PageRenderTime 27ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/upload/wars.php

http://gesior-aac.googlecode.com/
PHP | 221 lines | 213 code | 8 blank | 0 comment | 7 complexity | 73b4b8a689f858b5a1631b5cdc4acb20 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1
  1. <?php
  2. $main_content .= '<center><h1>Guild Wars</h1></center>
  3. <FONT SIZE=2 COLOR=#DF0101>
  4. * <b>/war invite,guild name,fraglimit</b> :
  5. <FONT SIZE=1 COLOR=green>
  6. Send an invitation to start a war.<br>
  7. <u>Example</u>: /war invite,Black Ninjas,150
  8. </FONT><br>
  9. * <b>/war accept,guild name</b> :
  10. <FONT SIZE=1 COLOR=green>
  11. Accept the invitation to start a war.
  12. </FONT><br>
  13. * <b>/war reject,guild name</b> :
  14. <FONT SIZE=1 COLOR=green>
  15. Reject the invitation to start a war.
  16. </FONT><br>
  17. * <b>/war cancel,guild name</b> :
  18. <FONT SIZE=1 COLOR=green>
  19. This will cancel the invitation to the guild "Black Ninjas"
  20. </FONT><br>
  21. </FONT>
  22. <br>
  23. <FONT SIZE=2 COLOR=#8A0808>
  24. Those commands can only be executed by guild leaders.<br><br>
  25. <table border="1"><tr border="1"><td border="1"><h3>Remember:</h3>
  26. <ul>
  27. <li><h5>This war system is just like real Tibia\'s. During the war, the killing of a war opponent will always be a justified kill. However, attacking a war ponent will result in a protection zone block. If the attacked character hits back, he will also receive a protection zone block even though he did not initiate the act.<h5></li>
  28. <li><h5>Characters that are currently in war will be marked with special icons. This allows an easy identification of friendly and opposing characters, as well as characters who are involved in other ongoing wars you are not part of. <h5></li>
  29. </ul></td></tr></table>
  30. </FONT> <br><br>
  31. <table width="100%" border="0" cellspacing="1" cellpadding="4">
  32. <TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=3 CLASS=white><B>Active Wars</B></TD></TR>
  33. <TR BGCOLOR='.$config['site']['vdarkborder'].'>
  34. <td class="vdarkborder" class="white" width="150"><b>Aggressor</b></td>
  35. <td class="vdarkborder" class="white"><b>Information</b></td>
  36. <td class="vdarkborder" class="white" width="150"><b>Enemy</b></td>
  37. </tr>';
  38. $count = 0;
  39. foreach($SQL->query('SELECT * FROM `guild_wars` WHERE (`end` >= (UNIX_TIMESTAMP() - 604800) OR `end` = 0) AND `status` IN (1,4);') as $war) /* 0,5 */
  40. {
  41. $a = $ots->createObject('Guild');
  42. $a->load($war['guild_id']);
  43. if(!$a->isLoaded())
  44. continue;
  45. $e = $ots->createObject('Guild');
  46. $e->load($war['enemy_id']);
  47. if(!$e->isLoaded())
  48. continue;
  49. $alogo = $a->getCustomField('logo_gfx_name');
  50. if(empty($alogo) || !file_exists('images/guilds/' . $alogo))
  51. $alogo = 'default_logo.gif';
  52. $elogo = $e->getCustomField('logo_gfx_name');
  53. if(empty($elogo) || !file_exists('images/guilds/' . $elogo))
  54. $elogo = 'default_logo.gif';
  55. $count++;
  56. if(is_int($count / 2))
  57. $bgcolor = $config['site']['darkborder'];
  58. else
  59. $bgcolor = $config['site']['lightborder'];
  60. $main_content .= "<tr style=\"background: ".$bgcolor.";\">
  61. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$a->getId()."\"><img src=\"images/guilds/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$a->getName()."</a></td>
  62. <td class=\"white\" align=\"center\"><font color=\"#3D3D3D\">";
  63. switch($war['status'])
  64. {
  65. case 1:
  66. {
  67. $main_content .= "<span style=\"color: red;\"><font size=\"12\">" . $war['guild_kills'] . " : " . $war['enemy_kills'] . "</font><br /><br /><b>On a brutal war</b></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'] . " gold coins." : "without any payment.");
  68. break;
  69. }
  70. case 4:
  71. {
  72. $main_content .= "<span style=\"color: red;\"><font size=\"12\">" . $war['guild_kills'] . " : " . $war['enemy_kills'] . "</font><br /><br />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'] . " gold coins." : "There's no payment set.");
  73. break;
  74. }
  75. default:
  76. {
  77. $main_content .= "Unknown, please contact with gamemaster.";
  78. break;
  79. }
  80. }
  81. $main_content .= "</font></td>
  82. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$e->getId()."\"><img src=\"images/guilds/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$e->getName()."</a></td>
  83. </tr>";
  84. }
  85. if($count == 0)
  86. $main_content .= "<tr style=\"background: ".$config['site']['darkborder'].";\">
  87. <td colspan=\"3\">Currently there are no active wars.</td>
  88. </tr>";
  89. $main_content .= '</table><br><br><table width="100%" border="0" cellspacing="1" cellpadding="4"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=3 CLASS=white><B>Pending declarations</B></TD></TR><TR BGCOLOR='.$config['site']['vdarkborder'].'>
  90. <td class="vdarkborder" class="white" width="150"><b>Aggressor</b></td>
  91. <td class="vdarkborder" class="white"><b>Information</b></td>
  92. <td class="vdarkborder" class="white" width="150"><b>Enemy</b></td>
  93. </tr>';
  94. $count = 0;
  95. foreach($SQL->query('SELECT * FROM `guild_wars` WHERE (`end` >= (UNIX_TIMESTAMP() - 604800) OR `end` = 0) AND `status` IN (0);') as $war) /* 0,5 */
  96. {
  97. $a = $ots->createObject('Guild');
  98. $a->load($war['guild_id']);
  99. if(!$a->isLoaded())
  100. continue;
  101. $e = $ots->createObject('Guild');
  102. $e->load($war['enemy_id']);
  103. if(!$e->isLoaded())
  104. continue;
  105. $alogo = $a->getCustomField('logo_gfx_name');
  106. if(empty($alogo) || !file_exists('images/guilds/' . $alogo))
  107. $alogo = 'default_logo.gif';
  108. $elogo = $e->getCustomField('logo_gfx_name');
  109. if(empty($elogo) || !file_exists('images/guilds/' . $elogo))
  110. $elogo = 'default_logo.gif';
  111. $count++;
  112. if(is_int($count / 2))
  113. $bgcolor = $config['site']['darkborder'];
  114. else
  115. $bgcolor = $config['site']['lightborder'];
  116. $main_content .= "<tr style=\"background: ".$bgcolor.";\">
  117. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$a->getId()."\"><img src=\"images/guilds/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$a->getName()."</a></td>
  118. <td class=\"white\" align=\"center\"><font color=\"#3D3D3D\">";
  119. switch($war['status'])
  120. {
  121. case 0:
  122. {
  123. $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'] . " gold coins." : "without any payment.")."<br />Will expire in two days.";
  124. break;
  125. }
  126. default:
  127. {
  128. $main_content .= "Unknown, please contact with gamemaster.";
  129. break;
  130. }
  131. }
  132. $main_content .= "</font></td>
  133. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$e->getId()."\"><img src=\"images/guilds/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$e->getName()."</a></td>
  134. </tr>";
  135. }
  136. if($count == 0)
  137. $main_content .= "<tr style=\"background: ".$config['site']['darkborder'].";\">
  138. <td colspan=\"3\">Currently there are no under declaration of war.</td>
  139. </tr>";
  140. $main_content .= '</table><br><br><table width="100%" border="0" cellspacing="1" cellpadding="4"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=3 CLASS=white><B>Finished Wars</B></TD></TR><TR BGCOLOR='.$config['site']['vdarkborder'].'>
  141. <td class="vdarkborder" class="white" width="150"><b>Aggressor</b></td>
  142. <td class="vdarkborder" class="white"><b>Information</b></td>
  143. <td class="vdarkborder" class="white" width="150"><b>Enemy</b></td>
  144. </tr>';
  145. $count = 0;
  146. foreach($SQL->query('SELECT * FROM `guild_wars` WHERE `status` IN (5);') as $war) /* 0,5 */
  147. {
  148. $a = $ots->createObject('Guild');
  149. $a->load($war['guild_id']);
  150. if(!$a->isLoaded())
  151. continue;
  152. $e = $ots->createObject('Guild');
  153. $e->load($war['enemy_id']);
  154. if(!$e->isLoaded())
  155. continue;
  156. $alogo = $a->getCustomField('logo_gfx_name');
  157. if(empty($alogo) || !file_exists('images/guilds/' . $alogo))
  158. $alogo = 'default_logo.gif';
  159. $elogo = $e->getCustomField('logo_gfx_name');
  160. if(empty($elogo) || !file_exists('images/guilds/' . $elogo))
  161. $elogo = 'default_logo.gif';
  162. $count++;
  163. if(is_int($count / 2))
  164. $bgcolor = $config['site']['darkborder'];
  165. else
  166. $bgcolor = $config['site']['lightborder'];
  167. $main_content .= "<tr style=\"background: ".$bgcolor.";\">
  168. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$a->getId()."\"><img src=\"images/guilds/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$a->getName()."</a></td>
  169. <td class=\"white\" align=\"center\"><font color=\"#3D3D3D\">";
  170. switch($war['status'])
  171. {
  172. case 5:
  173. {
  174. $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: " . $war['guild_kills'] . " to " . $war['enemy_kills'] . ".";
  175. break;
  176. }
  177. default:
  178. {
  179. $main_content .= "Unknown, please contact with gamemaster.";
  180. break;
  181. }
  182. }
  183. $main_content .= "</font></td>
  184. <td align=\"center\"><a href=\"?subtopic=guilds&action=show&guild=".$e->getId()."\"><img src=\"images/guilds/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br />".$e->getName()."</a></td>
  185. </tr>";
  186. }
  187. if($count == 0)
  188. $main_content .= "<tr style=\"background: ".$config['site']['darkborder'].";\">
  189. <td colspan=\"3\">Currently there are no finished wars.</td>
  190. </tr>";
  191. $main_content .= "</table>";
  192. ?>