• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Modern AAC] Guild wars display

Glecko

Advanced OT User
Joined
Aug 21, 2007
Messages
1,015
Reaction score
240
Location
Spain
When getting elf's war system, I noticed that the .php file I got was for Gesior AAC. I tried everything to get a working php for Modern AAC.
I tried to convert it (does not work) and every file I found on the internet (otland and other pages) doesn't work neither. Does anybody have a working php file for this?

Thanks in advance!
Giving rep++ :D

I don't post my current code by now, since I don't know if it's still illegal to publish parts of the elf war system. If anybody could confirm I will post it.
 
Code:
<?php 
echo "<TABLE BORDER=2 style='border-color: #f8c300; border: collapse;' CELLPADDING=2 CELLSPACING=2 WIDTH=100%> 
<TR BGCOLOR=black><TD><B>Command</B></TD><TD><B>Action</B></TD></TR> 
<TR BGCOLOR=black><TD>/war invite,guild name,fraglimit </TD><TD>Send an invitation to start a war. 
Example: war invite,Black Ninjas,150</TD></TR> 
<TR BGCOLOR=black><TD>/war invite,guild name,fraglimit,money,time </TD><TD>Send an invitation to start a war. 
Example: war invite,Black Ninjas,150,10000,3 day's</TD></TR> 
<TR BGCOLOR=black><TD>/war Accept,guild name </TD><TD>Accept the invitation to start a war.</TD></TR> 
<TR BGCOLOR=black><TD>/war reject,guild name </TD><TD>Reject the invitation to start a war.</TD></TR> 
<TR BGCOLOR=black><TD>/war cancel,guild name</TD><TD>This will cancel the invitation to the guild Black Ninjas</TD></TR> 

<TR BGCOLOR=black><TD>/balance donate 1234</TD><TD>Command for founder of guilds for pay money</TD></TR> 
<TR BGCOLOR=black><TD>/balance pick 1234</TD><TD>Command for founder of guilds for payout money</TD></TR> 


</TABLE>"; 
echo  '<center><h1>Guild Wars</h1></center> 
<table width="100%" border="0" cellspacing="1" cellpadding="4"> 
<tr> 
<td bgcolor="" class="white" width="150"><b>Aggressor</b></td> 
<td bgcolor="" class="white"><b>Information</b></td> 
<td bgcolor="" class="white" width="150"><b>Enemy</b></td> 
</tr>'; 
echo " 
<script type=\"text/javascript\"><!-- 
function show_hide(flip) 
{ 
    var tmp = document.getElementById(flip); 
    if(tmp) 
        tmp.style.display = tmp.style.display == 'none' ? '' : 'none'; 
} 
--></script>"; 
require("config.php"); 
$ots = POT::getInstance(); 
$ots->connect(POT::DB_MYSQL, connection()); 
$SQL = $ots->getDBHandle(); 
$config['site']['vdarkborder']=''; 
$config['site']['darkborder']=''; 
$config['site']['lightborder']=''; 



$count = 0; 
foreach($SQL->query('SELECT * FROM `guild_wars` WHERE `status` IN (1,4) OR ((`end` >= (UNIX_TIMESTAMP() - 604800) OR `end` = 0) AND `status` IN (0,5));') as $war) 
{ 
    $a = $ots->createObject('Guild'); 
    $a->load($war['guild_id']); 
    if(!$a->isLoaded()) 
        continue; 

    $e = $ots->createObject('Guild'); 
    $e->load($war['enemy_id']); 
    if(!$e->isLoaded()) 
        continue; 

    //$alogo = $a->getCustomField('logo_gfx_name'); 
    //if(empty($alogo) || !file_exists('guilds/' . $alogo)) 
        $alogo = 'default.gif'; 

    //$elogo = $e->getCustomField('logo_gfx_name'); 
    //if(empty($elogo) || !file_exists('guilds/' . $elogo)) 
        $elogo = 'default.gif'; 

    $count++; 
    echo "<tr style=\"background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\"> 
<td align=\"center\"><a href=\"/index.php/guilds/view/".$a->getId()."\"><img src=\"/public/guild_logos/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$a->getName()."</a></td>;
<td class=\"white\" align=\"center\">"; 
    switch($war['status']) 
    { 
        case 0: 
        { 
            echo "<b>Pending acceptation</b><br />Invited on " . date("M d Y, H:i:s", $war['begin']) . " for " . ($war['end'] > 0 ? (($war['end'] - $war['begin']) / 86400) : "unspecified") . " days. The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment.")."<br />Will expire in three days."; 
            break; 
        } 

        case 3: 
        { 
            echo "<s>Canceled invitation</s><br />Sent invite on " . date("M d Y, H:i:s", $war['begin']) . ", canceled on " . date("M d Y, H:i:s", $war['end']) . "."; 
            break; 
        } 

        case 2: 
        { 
            echo "Rejected invitation<br />Invited on " . date("M d Y, H:i:s", $war['begin']) . ", rejected on " . date("M d Y, H:i:s", $war['end']) . "."; 
            break; 
        } 

        case 1: 
        { 
            echo "<font size=\"12\"><span style=\"color: red;\">" . $war['guild_kills'] . "</span> : <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span></font><br /><br /><span style=\"color: darkred; font-weight: bold;\">On a brutal war</span><br />Began on " . date("M d Y, H:i:s", $war['begin']) . ($war['end'] > 0 ? ", will end up at " . date("M d Y, H:i:s", $war['end']) : "") . ".<br />The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment."); 
            break; 
        } 

        case 4: 
       

        case 5: 
        { 
            echo "<i>Ended</i><br />Began on " . date("M d Y, H:i:s", $war['begin']) . ", ended on " . date("M d Y, H:i:s", $war['end']) . ". Frag statistics: <span style=\"color: red;\">" . $war['guild_kills'] . "</span> to <span style=\"color: lime;\">" . $war['enemy_kills'] . "</span>."; 
            break; 
        } 

        default: 
        { 
            echo "Unknown, please contact with gamemaster."; 
            break; 
        } 
    } 

    echo "<br /><br /><a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\">&raquo; Details &laquo;</a></td> 
<td align=\"center\"><a href=\"/index.php/guilds/view/".$e->getId()."\"><img src=\"/public/guild_logos/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$e->getName()."</a></td> 
</tr> 
<tr id=\"war-details:" . $war['id'] . "\" style=\"display: none; background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\"> 
<td colspan=\"3\">"; 
    if(in_array($war['status'], array(1,4,5))) 
    { 
        $deaths = $SQL->query('SELECT `pd`.`id`, `pd`.`date`, `gk`.`guild_id` AS `enemy`, `p`.`name`, `pd`.`level` 
FROM `guild_kills` gk 
    LEFT JOIN `player_deaths` pd ON `gk`.`death_id` = `pd`.`id` 
    LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` 
WHERE `gk`.`war_id` = ' . $war['id'] . ' AND `p`.`deleted` = 0 
    ORDER BY `pd`.`date` DESC')->fetchAll(); 
        if(!empty($deaths)) 
        { 
            foreach($deaths as $death) 
            { 
                $killers = $SQL->query('SELECT `p`.`name` AS `player_name`, `p`.`deleted` AS `player_exists`, `k`.`war` AS `is_war` 
FROM `killers` k 
    LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` 
    LEFT JOIN `players` p ON `p`.`id` = `pk`.`player_id` 
WHERE `k`.`death_id` = ' . $death['id'] . ' 
    ORDER BY `k`.`final_hit` DESC, `k`.`id` ASC')->fetchAll(); 
                $count = count($killers); $i = 0; 

                $others = false; 
                echo date("j M Y, H:i", $death['date']) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "lime") . ";\">+</span> 
<a href=\"localhost//index.php/character/view/" . urlencode($death['name']) . "\"><b>".$death['name']."</b></a> "; 
                foreach($killers as $killer) 
                { 
                    $i++; 
                    if($killer['is_war'] != 0) 
                    { 
                        if($i == 1) 
                            echo "killed at level <b>".$death['level']."</b> by "; 
                        else if($i == $count && $others == false) 
                            echo " and by "; 
                        else 
                            echo ", "; 

                        if($killer['player_exists'] == 0) 
                            echo "<a href=\"injecotr.zapto.org//index.php/character/view/".urlencode($killer['player_name'])."\">"; 

                        echo $killer['player_name']; 
                        if($killer['player_exists'] == 0) 
                            echo "</a>"; 
                    } 
                    else 
                        $others = true; 

                    if($i == $count) 
                    { 
                        if($others == true) 
                            echo " and few others"; 

                        echo ".<br />"; 
                    } 
                } 
            } 
        } 
        else 
            echo "<center>There were no frags on this war so far.</center>"; 
    } 
    else 
        echo "<center>This war did not began yet.</center>"; 

    echo "</td> 
</tr>"; 
} 

if($count == 0) 
    echo "<tr style=\"background: ".$config['site']['darkborder'].";\"> 
<td colspan=\"3\">Currently there are no active wars.</td> 
</tr>"; 

echo "</table>"; 
?>
 
PHP:
<style type="text/css">
font.details_wars {
color: #004294;
}
font.details_wars:hover {
color: #0063DC;
}
</style>
        <div class='message'>
        <div class='title'>Guild Wars</div>
        <div class='content'>
<?PHP
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
echo "
<table cellpadding=\"4\" cellspacing=\"1\" width=\"100%\">
<tr bgcolor=\"#505050\"><td class=\"white\" colspan=\"5\"><b><font color=\"white\">&nbsp;In-game Commands</font></b></td></tr>

<tr><td><table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">
<tr bgcolor=\"#f1e0c6\"><td><b>&nbsp;<font color=\"black\">Command</font></b></td><td><b>&nbsp;<font color=\"black\">Action</font></b></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>&nbsp;<font color=\"black\">/war invite,guild name,fraglimit </font></td><td>&nbsp;<font color=\"black\">Send an invitation to start a war.
Example: war invite,Black Ninjas,150</font></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>&nbsp;<font color=\"black\">/war invite,guild name,fraglimit,money,time </font></td><td>&nbsp;<font color=\"black\">Send an invitation to start a war.
Example: war invite,Black Ninjas,150,10000,3 day's</font></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>&nbsp;<font color=\"black\">/war accept,guild name </font></td><td>&nbsp;<font color=\"black\">Accept the invitation to start a war.</font></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>&nbsp;<font color=\"black\">/war reject,guild name </font></td><td>&nbsp;<font color=\"black\">Reject the invitation to start a war.</font></td></tr>

<tr bgcolor=\"#f1e0c6\"><td>&nbsp;<font color=\"black\">/war cancel,guild name</font></td><td>&nbsp;<font color=\"black\">This will cancel the invitation to the guild Black Ninjas</font></td></tr>

</table></td></tr></table>
<br />
<div align='center'>
<font color='red'>*Guild War commands must be written in your guild channel in order for them to work</font>
	<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=90%> 
		<TR> 
			<TD align='center'><img src='".WEBSITE."/public/images/green.gif' width='10px' height='10px'/> Guild Members | 
			<img src='".WEBSITE."/public/images/red.gif' width='10px' height='10px'/> Guild Enemies | 
			<img src='".WEBSITE."/public/images/blue.gif' width='10px' height='10px'/> Allies or other active wars</TD> 
		</TR> 
	</TABLE> 
</div>
<br />
<script type=\"text/javascript\"><!--
function show_hide(flip)
{
	var tmp = document.getElementById(flip);
	if(tmp)
		tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
}
--></script>
<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">
<tr>
<td style=\"background: #505050\" width=\"150\"><font color=\"white\"><b><center>Aggressor</center></b></font></td>
<td style=\"background: #505050\"><font color=\"white\"><b><center>Information</center></b></font></td>
<td style=\"background: #505050\" width=\"150\"><font color=\"white\"><b><center>Enemy</center></b></font></td>
</tr>";
$counting = 0;
foreach($SQL->query('SELECT * FROM `guild_wars` WHERE `status` IN (1,4) OR ((`end` >= (UNIX_TIMESTAMP() - 604800) OR `end` = 0) AND `status` IN (0,5));') as $war)
{
	$counting++;
	$a = $ots->createObject('Guild');
	$a->load($war['guild_id']);
	if(!$a->isLoaded())
		continue;
		
	$e = $ots->createObject('Guild');
	$e->load($war['enemy_id']);
	if(!$e->isLoaded())
		continue;
		
	$alogo = $a->getCustomField('id');
	if(empty($alogo) || !file_exists('../../public/guild_logos/' . $alogo))
		$alogo = 'default.gif';
		
	$elogo = $e->getCustomField('id');
	if(empty($elogo) || !file_exists('../../public/guild_logos/' . $elogo))
		$elogo = 'default.gif';
	
	echo "<tr style=\"background: " . (is_int($counting / 2) ? '#D4C0A1' : '#F1E0C6') . ";color:black;\">
<td align=\"center\"><center><a href=\"".WEBSITE."/index.php/guilds/view/".$a->getId()."\"><img src=\"".$config['website']."/public/guild_logos/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br /><font class=\"details_wars\">".$a->getName()."</center></font></a></td>
<td align=\"center\">";

$date_begin = $war['begin'] - (5 * 60 * 60);
$date_end = $war['end'] - (5 * 60 * 60);

	switch($war['status'])
	{
		case 0:
		{
			echo "<center><b>Pending acceptation</b><br />Invited on " . date("M d Y, H:i:s", $date_begin) . " for " . ($date_end > 0 ? (($date_end - $date_begin) / 86400) : "unspecified") . " days. The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment.")."<br />Will expire in three days.</center>";
			break;
		}
 
		case 3:
		{
			echo "<center><s>Canceled invitation</s><br />Sent invite on " . date("M d Y, H:i:s", $date_begin) . ", canceled on " . date("M d Y, H:i:s", $date_end) . ".</center>";
			break;
		}
 
		case 2:
		{
			echo "<center>Rejected invitation<br />Invited on " . date("M d Y, H:i:s", $date_begin) . ", rejected on " . date("M d Y, H:i:s", $date_end) . ".</center>";
			break;
		}

		case 1:
		{
			echo "<center><br /><font size=\"5\"><span style=\"color: red;\">" . $war['guild_kills'] . " </span> : <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span></font><br /><br /><span style=\"color: darkred; font-weight: bold;\">On a brutal war</span><br />Began on " . date("M d Y, H:i:s", $date_begin) . ($date_end > 0 ? ", will end up at " . date("M d Y, H:i:s", $date_end) : "") . ".<br />The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment.</center>");
			break;
		}
 
		case 4:
		{
			echo "<center><font size=\"5\"><span style=\"color: red;\">" . $war['guild_kills'] . " </span> : <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span></font><br /><br /><span style=\"color: darkred;\">Pending end</span><br />Began on " . date("M d Y, H:i:s", $war['begin']) . ", signed armstice on " . date("M d Y, H:i:s", $war['end']) . ".<br />Will expire after reaching " . $war['frags'] . " frags. ".($war['payment'] > 0 ? "The payment is set to " . $war['payment'] . " bronze coins." : "There's no payment set.</center>");
			break;
		}
 
		case 5:
		{
			echo "<center><i>Ended</i><br />Began on " . date("M d Y, H:i:s", $date_begin) . ", ended on " . date("M d Y, H:i:s", $date_end) . ". Frag statistics: <span style=\"color: red;\">" . $war['guild_kills'] . " </span> to <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span>.</center>";
			break;
		}
 
		default:
		{
			echo "<center>Unknown, please contact with gamemaster.</center>";
			break;
		}
	}
 
	echo "<br /><br /><a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\"><font class=\"details_wars\"><center>&raquo; Details &laquo;</center></font></a></td>
<td align=\"center\"><center><a href=\"".WEBSITE."/index.php/guilds/view/".$e->getId()."\"><img src=\"".$config['website']."/public/guild_logos/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br /><font class=\"details_wars\">".$e->getName()."</center>	</font></a></td>
</tr>
<tr id=\"war-details:" . $war['id'] . "\" style=\"display: none; background: " . (is_int($counting / 2) ? '#D4C0A1' : '#F1E0C6') . ";color:black;\">
<td colspan=\"3\">";
	if(in_array($war['status'], array(1,4,5))) {
		$deaths = $SQL->query('SELECT `pd`.`id`, `pd`.`date`, `gk`.`guild_id` AS `enemy`, `p`.`name`, `pd`.`level`
FROM `guild_kills` gk
	LEFT JOIN `player_deaths` pd ON `gk`.`death_id` = `pd`.`id`
	LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id`
WHERE `gk`.`war_id` = ' . $war['id'] . ' AND `p`.`deleted` = 0
	ORDER BY `pd`.`date` DESC')->fetchAll();
		if(!empty($deaths)) {
			foreach($deaths as $death) {
				$killers = $SQL->query('SELECT `p`.`name` AS `player_name`, `p`.`deleted` AS `player_exists`, `k`.`war` AS `is_war`
FROM `killers` k
	LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
	LEFT JOIN `players` p ON `p`.`id` = `pk`.`player_id`
WHERE `k`.`death_id` = ' . $death['id'] . '
	ORDER BY `k`.`final_hit` DESC, `k`.`id` ASC')->fetchAll();
				
				$i = 0;
				$count = count($killers); 
				
				$others = false;
				$deathdate = $death['date'] - (5 * 60 * 60);
				echo date("j M Y, H:i", $deathdate) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "green") . ";\"><font size=3>+</font></span>
<a href=\"".WEBSITE."/index.php/character/view/".$death['name']. "\"><b><font class=\"details_wars\">".$death['name']."</font></b></a> ";
				foreach($killers as $killer) {
					$i++;
					if($killer['is_war'] != 0) {
						if($i == 1)
							echo "killed at level <b>".$death['level']."</b> by ";
						else if($i == $count && $others == false)
							echo " and by ";
						else
							echo ", ";
 
						if($killer['player_exists'] == 0)
							echo "<a href=\"".WEBSITE."/index.php/character/view/".$killer['player_name']."\">";
 
						echo '<font class="details_wars">'.$killer['player_name'].'</font>';
						if($killer['player_exists'] == 0)
							echo "</a>";
					}
					else
						$others = true;
 
					if($i == $count) {
						if($others == true)
							echo " and few others";
 
						echo ".<br />";
					}
				}
			}
		}
		else
			echo "<center>There were no frags on this war so far.</center>";
	}
	else
		echo "<center>This war did not began yet.</center>";
 
	echo "</td>
</tr>";
}

if($counting == 0) {
	echo "<tr style=\"background: #D4C0A1;\">
<td colspan=\"3\" style=\"color:black;\"><center>No active wars.</center></td>
</tr>";
 }
echo "</table>";
?>
</div></div>
 
PHP:
<style type="text/css">
font.details_wars {
color: #004294;
}
font.details_wars:hover {
color: #0063DC;
}
</style>
        <div class='message'>
        <div class='title'>Guild Wars</div>
        <div class='content'>
<?PHP
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
echo "
<table cellpadding=\"4\" cellspacing=\"1\" width=\"100%\">
<tr bgcolor=\"#505050\"><td class=\"white\" colspan=\"5\"><b><font color=\"white\">*In-game Commands</font></b></td></tr>

<tr><td><table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">
<tr bgcolor=\"#f1e0c6\"><td><b>*<font color=\"black\">Command</font></b></td><td><b>*<font color=\"black\">Action</font></b></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>*<font color=\"black\">/war invite,guild name,fraglimit </font></td><td>*<font color=\"black\">Send an invitation to start a war.
Example: war invite,Black Ninjas,150</font></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>*<font color=\"black\">/war invite,guild name,fraglimit,money,time </font></td><td>*<font color=\"black\">Send an invitation to start a war.
Example: war invite,Black Ninjas,150,10000,3 day's</font></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>*<font color=\"black\">/war accept,guild name </font></td><td>*<font color=\"black\">Accept the invitation to start a war.</font></td></tr>
<tr bgcolor=\"#f1e0c6\"><td>*<font color=\"black\">/war reject,guild name </font></td><td>*<font color=\"black\">Reject the invitation to start a war.</font></td></tr>

<tr bgcolor=\"#f1e0c6\"><td>*<font color=\"black\">/war cancel,guild name</font></td><td>*<font color=\"black\">This will cancel the invitation to the guild Black Ninjas</font></td></tr>

</table></td></tr></table>
<br />
<div align='center'>
<font color='red'>*Guild War commands must be written in your guild channel in order for them to work</font>
	<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=90%> 
		<TR> 
			<TD align='center'><img src='".WEBSITE."/public/images/green.gif' width='10px' height='10px'/> Guild Members | 
			<img src='".WEBSITE."/public/images/red.gif' width='10px' height='10px'/> Guild Enemies | 
			<img src='".WEBSITE."/public/images/blue.gif' width='10px' height='10px'/> Allies or other active wars</TD> 
		</TR> 
	</TABLE> 
</div>
<br />
<script type=\"text/javascript\"><!--
function show_hide(flip)
{
	var tmp = document.getElementById(flip);
	if(tmp)
		tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
}
--></script>
<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">
<tr>
<td style=\"background: #505050\" width=\"150\"><font color=\"white\"><b><center>Aggressor</center></b></font></td>
<td style=\"background: #505050\"><font color=\"white\"><b><center>Information</center></b></font></td>
<td style=\"background: #505050\" width=\"150\"><font color=\"white\"><b><center>Enemy</center></b></font></td>
</tr>";
$counting = 0;
foreach($SQL->query('SELECT * FROM `guild_wars` WHERE `status` IN (1,4) OR ((`end` >= (UNIX_TIMESTAMP() - 604800) OR `end` = 0) AND `status` IN (0,5));') as $war)
{
	$counting++;
	$a = $ots->createObject('Guild');
	$a->load($war['guild_id']);
	if(!$a->isLoaded())
		continue;
		
	$e = $ots->createObject('Guild');
	$e->load($war['enemy_id']);
	if(!$e->isLoaded())
		continue;
		
	$alogo = $a->getCustomField('id');
	if(empty($alogo) || !file_exists('../../public/guild_logos/' . $alogo))
		$alogo = 'default.gif';
		
	$elogo = $e->getCustomField('id');
	if(empty($elogo) || !file_exists('../../public/guild_logos/' . $elogo))
		$elogo = 'default.gif';
	
	echo "<tr style=\"background: " . (is_int($counting / 2) ? '#D4C0A1' : '#F1E0C6') . ";color:black;\">
<td align=\"center\"><center><a href=\"".WEBSITE."/index.php/guilds/view/".$a->getId()."\"><img src=\"".$config['website']."/public/guild_logos/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br /><font class=\"details_wars\">".$a->getName()."</center></font></a></td>
<td align=\"center\">";

$date_begin = $war['begin'] - (5 * 60 * 60);
$date_end = $war['end'] - (5 * 60 * 60);

	switch($war['status'])
	{
		case 0:
		{
			echo "<center><b>Pending acceptation</b><br />Invited on " . date("M d Y, H:i:s", $date_begin) . " for " . ($date_end > 0 ? (($date_end - $date_begin) / 86400) : "unspecified") . " days. The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment.")."<br />Will expire in three days.</center>";
			break;
		}
 
		case 3:
		{
			echo "<center><s>Canceled invitation</s><br />Sent invite on " . date("M d Y, H:i:s", $date_begin) . ", canceled on " . date("M d Y, H:i:s", $date_end) . ".</center>";
			break;
		}
 
		case 2:
		{
			echo "<center>Rejected invitation<br />Invited on " . date("M d Y, H:i:s", $date_begin) . ", rejected on " . date("M d Y, H:i:s", $date_end) . ".</center>";
			break;
		}

		case 1:
		{
			echo "<center><br /><font size=\"5\"><span style=\"color: red;\">" . $war['guild_kills'] . " </span> : <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span></font><br /><br /><span style=\"color: darkred; font-weight: bold;\">On a brutal war</span><br />Began on " . date("M d Y, H:i:s", $date_begin) . ($date_end > 0 ? ", will end up at " . date("M d Y, H:i:s", $date_end) : "") . ".<br />The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment.</center>");
			break;
		}
 
		case 4:
		{
			echo "<center><font size=\"5\"><span style=\"color: red;\">" . $war['guild_kills'] . " </span> : <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span></font><br /><br /><span style=\"color: darkred;\">Pending end</span><br />Began on " . date("M d Y, H:i:s", $war['begin']) . ", signed armstice on " . date("M d Y, H:i:s", $war['end']) . ".<br />Will expire after reaching " . $war['frags'] . " frags. ".($war['payment'] > 0 ? "The payment is set to " . $war['payment'] . " bronze coins." : "There's no payment set.</center>");
			break;
		}
 
		case 5:
		{
			echo "<center><i>Ended</i><br />Began on " . date("M d Y, H:i:s", $date_begin) . ", ended on " . date("M d Y, H:i:s", $date_end) . ". Frag statistics: <span style=\"color: red;\">" . $war['guild_kills'] . " </span> to <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span>.</center>";
			break;
		}
 
		default:
		{
			echo "<center>Unknown, please contact with gamemaster.</center>";
			break;
		}
	}
 
	echo "<br /><br /><a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\"><font class=\"details_wars\"><center>» Details «</center></font></a></td>
<td align=\"center\"><center><a href=\"".WEBSITE."/index.php/guilds/view/".$e->getId()."\"><img src=\"".$config['website']."/public/guild_logos/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br /><font class=\"details_wars\">".$e->getName()."</center>	</font></a></td>
</tr>
<tr id=\"war-details:" . $war['id'] . "\" style=\"display: none; background: " . (is_int($counting / 2) ? '#D4C0A1' : '#F1E0C6') . ";color:black;\">
<td colspan=\"3\">";
	if(in_array($war['status'], array(1,4,5))) {
		$deaths = $SQL->query('SELECT `pd`.`id`, `pd`.`date`, `gk`.`guild_id` AS `enemy`, `p`.`name`, `pd`.`level`
FROM `guild_kills` gk
	LEFT JOIN `player_deaths` pd ON `gk`.`death_id` = `pd`.`id`
	LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id`
WHERE `gk`.`war_id` = ' . $war['id'] . ' AND `p`.`deleted` = 0
	ORDER BY `pd`.`date` DESC')->fetchAll();
		if(!empty($deaths)) {
			foreach($deaths as $death) {
				$killers = $SQL->query('SELECT `p`.`name` AS `player_name`, `p`.`deleted` AS `player_exists`, `k`.`war` AS `is_war`
FROM `killers` k
	LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
	LEFT JOIN `players` p ON `p`.`id` = `pk`.`player_id`
WHERE `k`.`death_id` = ' . $death['id'] . '
	ORDER BY `k`.`final_hit` DESC, `k`.`id` ASC')->fetchAll();
				
				$i = 0;
				$count = count($killers); 
				
				$others = false;
				$deathdate = $death['date'] - (5 * 60 * 60);
				echo date("j M Y, H:i", $deathdate) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "green") . ";\"><font size=3>+</font></span>
<a href=\"".WEBSITE."/index.php/character/view/".$death['name']. "\"><b><font class=\"details_wars\">".$death['name']."</font></b></a> ";
				foreach($killers as $killer) {
					$i++;
					if($killer['is_war'] != 0) {
						if($i == 1)
							echo "killed at level <b>".$death['level']."</b> by ";
						else if($i == $count && $others == false)
							echo " and by ";
						else
							echo ", ";
 
						if($killer['player_exists'] == 0)
							echo "<a href=\"".WEBSITE."/index.php/character/view/".$killer['player_name']."\">";
 
						echo '<font class="details_wars">'.$killer['player_name'].'</font>';
						if($killer['player_exists'] == 0)
							echo "</a>";
					}
					else
						$others = true;
 
					if($i == $count) {
						if($others == true)
							echo " and few others";
 
						echo ".<br />";
					}
				}
			}
		}
		else
			echo "<center>There were no frags on this war so far.</center>";
	}
	else
		echo "<center>This war did not began yet.</center>";
 
	echo "</td>
</tr>";
}

if($counting == 0) {
	echo "<tr style=\"background: #D4C0A1;\">
<td colspan=\"3\" style=\"color:black;\"><center>No active wars.</center></td>
</tr>";
 }
echo "</table>";
?>
</div></div>


Seriously, that didn't work either. :p
It's the millionth script I try and none works, does one of you guys know for sure these codes work for Modern AAC 266 (tested and so on)
 
Back
Top