Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 17th, 2012  |  syntax: None  |  size: 11.72 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. $main_content = "<h1 align=\"center\">Guild Wars</h1>
  3. <script type=\"text/javascript\"><!--
  4. function show_hide(flip)
  5. {
  6.         var tmp = document.getElementById(flip);
  7.         if(tmp)
  8.                 tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
  9. }
  10. --></script>
  11.  
  12. <a onclick=\"show_hide('information'); return false;\" style=\"cursor: pointer;\"><h1><center>&raquo; Click to se the commands &laquo;<center></h1></a>
  13. <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"information\" style=\"display: none;\";>
  14. <tr align=\"center\"><b>You must send this commands in GUILD CHAT.</tr>
  15. <tr style=\"background: #512e0b;\"><td align=\"center\" class=\"white\"><b>Command</b></td><td colspan=\"2\" align=\"center\" class=\"white\"><b>Description</b></td></tr>
  16. <tr style=\"background: #F1E0C6;\"><td><b>/war invite, guild name, fraglimit</b></td><td>Sends an invitation to start the war. Example: <font color=red><BR>/war invite, Chickens, 150<BR></font><B>(Invite a guild to war with 150 frags count.)</B></td></tr>
  17. <tr style=\"background: #D4C0A1;\"><td><b>/war invite, guild name, fraglimit, money</b></td><td>Send the invitation to start the war. Example: <font color=red><BR>/war invite, Chickens, 150, 10000</font><br><B> (Invite a guild to war with 150 frags count and payment of 10000 gold coins <- you need donate to guild to use it.)<B></td></tr>
  18. <tr style=\"background: #F1E0C6;\"><td><b>/war accept, guild name</b></td><td>Accepts the invitation to start a war. Example: <font color=red><BR>/war accept, Chickens</font><BR><B>(Accept the war against guild \"Chickens\".)</b></td></tr>
  19.  
  20. <tr style=\"background: #D4C0A1;\"><td><b>/war reject, guild name</b></td><td>Rejects the invitation to start a war. Example: <font color=red><BR>/war reject, Chickens</font><BR><B>(Reject a invitation to war from Chickens.)</B></td></tr>
  21. <tr style=\"background: #F1E0C6;\"><td><b>/war cancel, guild name</b></td><td>Cancels the invitation. Example: <font color=red><BR>/war cancel, Chickens</font><br><b>(Cancel my guild invitation to war with Chickens.)</b></td></tr>
  22. <tr style=\"background: #D4C0A1;\"><td><b>/balance</b></td><td>See the guild balance - balance of money.</td></tr>
  23. <tr style=\"background: #F1E0C6;\"><td><b>/balance donate value</b></td><td>Deposits money on the guild's bank account. All players can donate. Example: <font color=red><BR>/balance donate 100000 </font><BR><B>(You will donate 100k to your guild balance.)</B></td></tr>
  24. <tr style=\"background: #D4C0A1;\"><td><b>/balance pick value</b></td><td>Withdraws money from the guild's bank account. Can be used only by the guild leader. Example: <font color=red><BR>/balance pick 100000 </font><BR><B>(You will withdraw 100k from your guild balance.)</B></td></tr>
  25. </table>
  26.  
  27. <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">
  28. <tr>
  29. <td style=\"background: #512e0b\" class=\"white\" width=\"150\"><b>Aggressor</b></td>
  30.  
  31. <td style=\"background: #512e0b\" class=\"white\"><b>Information</b></td>
  32. <td style=\"background: #512e0b\" class=\"white\" width=\"150\"><b>Enemy</b></td>
  33. </tr><tr style=\"background: #F1E0C6;\">";
  34.  
  35. $count = 0;
  36. 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)
  37. {
  38.         $a = $ots->createObject('Guild');
  39.         $a->load($war['guild_id']);
  40.         if(!$a->isLoaded())
  41.                 continue;
  42.  
  43.         $e = $ots->createObject('Guild');
  44.         $e->load($war['enemy_id']);
  45.         if(!$e->isLoaded())
  46.                 continue;
  47.  
  48.         $alogo = $a->getCustomField('logo_gfx_name');
  49.         if(empty($alogo) || !file_exists('guilds/' . $alogo))
  50.                 $alogo = 'default_logo.gif';
  51.  
  52.         $elogo = $e->getCustomField('logo_gfx_name');
  53.         if(empty($elogo) || !file_exists('guilds/' . $elogo))
  54.                 $elogo = 'default_logo.gif';
  55.  
  56.         $count++;
  57.         $main_content .= "<tr style=\"background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\">
  58. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$a->getId()."\"><img src=\"guilds/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$a->getName()."</a></td>
  59. <td align=\"center\">";
  60.         switch($war['status'])
  61.         {
  62.                 case 0:
  63.                 {
  64.                         $main_content .= "<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.";
  65.                         break;
  66.                 }
  67.  
  68.                 case 3:
  69.                 {
  70.                         $main_content .= "<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']) . ".";
  71.                         break;
  72.                 }
  73.  
  74.                 case 2:
  75.                 {
  76.                         $main_content .= "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']) . ".";
  77.                         break;
  78.                 }
  79.  
  80.                 case 1:
  81.                 {
  82.                         $main_content .= "<font size=\"6\"><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.");
  83.                         break;
  84.                 }
  85.  
  86.                 case 4:
  87.                 {
  88.                         $main_content .= "<font size=\"6\"><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.");
  89.                         break;
  90.                 }
  91.  
  92.                 case 5:
  93.                 {
  94.                         $main_content .= "<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>.";
  95.                         break;
  96.                 }
  97.  
  98.                 default:
  99.                 {
  100.                         $main_content .= "Unknown, please contact with gamemaster.";
  101.                         break;
  102.                 }
  103.         }
  104.  
  105.         $main_content .= "<br /><br /><a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\">&raquo; Details &laquo;</a></td>
  106. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$e->getId()."\"><img src=\"guilds/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$e->getName()."</a></td>
  107. </tr>
  108. <tr id=\"war-details:" . $war['id'] . "\" style=\"display: none; background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\">
  109. <td colspan=\"3\">";
  110.         if(in_array($war['status'], array(1,4,5)))
  111.         {
  112.                 $deaths = $SQL->query('SELECT `pd`.`id`, `pd`.`date`, `gk`.`guild_id` AS `enemy`, `p`.`name`, `pd`.`level`
  113. FROM `guild_kills` gk
  114.         LEFT JOIN `player_deaths` pd ON `gk`.`death_id` = `pd`.`id`
  115.         LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id`
  116. WHERE `gk`.`war_id` = ' . $war['id'] . ' AND `p`.`deleted` = 0
  117.         ORDER BY `pd`.`date` DESC')->fetchAll();
  118.                 if(!empty($deaths))
  119.                 {
  120.                         foreach($deaths as $death)
  121.                         {
  122.                                 $killers = $SQL->query('SELECT `p`.`name` AS `player_name`, `p`.`deleted` AS `player_exists`, `k`.`war` AS `is_war`
  123. FROM `killers` k
  124.         LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
  125.         LEFT JOIN `players` p ON `p`.`id` = `pk`.`player_id`
  126. WHERE `k`.`death_id` = ' . $death['id'] . '
  127.         ORDER BY `k`.`final_hit` DESC, `k`.`id` ASC')->fetchAll();
  128.                                 $count = count($killers); $i = 0;
  129.  
  130.                                 $others = false;
  131.                                 $main_content .= date("j M Y, H:i", $death['date']) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "lime") . ";\">+</span>
  132. <a href=\"index.php?subtopic=characters&name=" . urlencode($death['name']) . "\"><b>".$death['name']."</b></a> ";
  133.                                 foreach($killers as $killer)
  134.                                 {
  135.                                         $i++;
  136.                                         if($killer['is_war'] != 0)
  137.                                         {
  138.                                                 if($i == 1)
  139.                                                         $main_content .= "killed at level <b>".$death['level']."</b> by ";
  140.                                                 else if($i == $count && $others == false)
  141.                                                         $main_content .= " and by ";
  142.                                                 else
  143.                                                         $main_content .= ", ";
  144.  
  145.                                                 if($killer['player_exists'] == 0)
  146.                                                         $main_content .= "<a href=\"index.php?subtopic=characters&name=".urlencode($killer['player_name'])."\">";
  147.  
  148.                                                 $main_content .= $killer['player_name'];
  149.                                                 if($killer['player_exists'] == 0)
  150.                                                         $main_content .= "</a>";
  151.                                         }
  152.                                         else
  153.                                                 $others = true;
  154.  
  155.                                         if($i == $count)
  156.                                         {
  157.                                                 if($others == true)
  158.                                                         $main_content .= " and few others";
  159.  
  160.                                                 $main_content .= ".<br />";
  161.                                         }
  162.                                 }
  163.                         }
  164.                 }
  165.                 else
  166.                         $main_content .= "<center>There were no frags on this war so far.</center>";
  167.         }
  168.         else
  169.                 $main_content .= "<center>This war did not began yet.</center>";
  170.  
  171.         $main_content .= "</td>
  172. </tr>";
  173. }
  174.  
  175. if($count == 0)
  176.         $main_content .= "<tr style=\"background: ".$config['site']['darkborder'].";\">
  177. <td colspan=\"3\">Currently there are no active wars.</td>
  178. </tr>";
  179.  
  180. $main_content .= "</table>";
  181. $main_content .= '<div align="right"><small><b>Customized by: <a href="http://www.xtibia.com/forum/user/240289-walef-xavier">Walef Xavier</a></b></small></div><br />';
  182.  
  183. ?>