Guest User

Untitled

a guest
Apr 20th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 154.16 KB | None | 0 0
  1. <?php
  2. if(!defined('INITIALIZED'))
  3. exit;
  4.  
  5. # Sistema de venda de personagens
  6.  
  7. $trade_errors = array();
  8.  
  9. if ($action == "") {
  10. $main_content .= '
  11. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  12. <h3>Bem vindo ao nosso Shopping de Personagens<br><small style="font-weight: normal; font-size: 11px;">Aqui você poderá comprar ou vender personagens por coins.</small><br><small style="font-weight: normal; font-size: 11px;"><b>OBS.</b> Para a sua <b><font color="green">segurança e anonimato</font></b>, ao completar a compra, o <i><b>antigo nome do personagem comprado será deletado de todas as listas vips</b></i> dos players do servidor.</small></h3>';
  13.  
  14. $main_content .= '
  15. <div class="SmallBox">
  16. <div class="MessageContainer">
  17. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);"></div>
  18. <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  19. <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  20. <div class="Message">
  21. <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);"></div>
  22. <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);"></div>
  23. <table class="HintBox">
  24. <tbody>
  25. <tr>
  26. <td><i><small>Se você quiser vender ou comprar algum personagem faça login em sua conta.<br>Regras para vender:<br><ul><li>O personagem não pode estar online no game.</li><li>O personagem não pode pertencer a nenhuma guild.</li><li>A conta do personagem não pode estar banida.</li><li>O personagem deve ter no mínimo <strong>level '.$trade_config['levelToSell'].'</strong>.</li>
  27. <li>Você deverá pagar uma taxa de <strong>'.$trade_config['taxPercent'].'</strong>% em cima do valor negociado.</li></ul>
  28. <br>Regras para comprar:<br>
  29. <ul><li>Você deve pagar uma taxa no valor de <strong>'.$trade_config['buy_tax'].' coins</strong> para criar uma oferta de compra.</li></ul>
  30. </small></i></td>
  31. </tr>
  32. </tbody>
  33. </table>
  34. </div>
  35. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);"></div>
  36. <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  37. <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  38. </div>
  39. </div><br>';
  40.  
  41. $main_content .= '
  42. <div class="TableContainer">
  43. <div class="CaptionContainer">
  44. <div class="CaptionInnerContainer">
  45. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  46. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  47. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  48. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  49. <div class="Text">Opções</div>
  50. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  51. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  52. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  53. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  54. </div>
  55. </div>
  56. <table class="Table3" cellpadding="0" cellspacing="0">
  57. <tbody>
  58. <tr>
  59. <td>
  60. <div class="InnerTableContainer">
  61. <table style="width:100%;">
  62. <tr>
  63. <td>
  64. <div class="TableShadowContainerRightTop" >
  65. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  66. </div>
  67. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  68. <div class="TableContentContainer" >
  69. <table class="TableContent" width="100%">
  70. <tr>
  71. <td width="25%" style="border: none; text-align: center;">
  72. <strong><small>Crie uma oferta de compra de um personagem.</small></strong><br><br>
  73. <center>
  74. <form action="?subtopic=tradecharacter&action=buycharacter" method="post">
  75. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);"></div><input class="ButtonText" name="Buy Character" alt="Buy Character" src="'.$layout_name.'/images/buttons/_sbutton_buycharacter.gif" type="image"></div></div>
  76. </form>
  77. </center>
  78. </td>
  79. <td width="25%" style="border: none; text-align: center;">
  80. <strong><small>Coloque a venda um personagem seu.</small></strong><br><br>
  81. <center>
  82. <form action="?subtopic=tradecharacter&action=sellcharacter" method="post">
  83. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);"></div><input class="ButtonText" name="Sell Character" alt="Sell Character" src="'.$layout_name.'/images/buttons/_sbutton_sellcharacter.gif" type="image"></div></div>
  84. </form>
  85. </center>
  86. </td>
  87. <td width="25%" style="border: none; text-align: center;">
  88. <strong><small>Lista de personagens a venda no servidor</small></strong><br><br>
  89. <center>
  90. <form action="?subtopic=tradecharacter&action=listsell" method="post">
  91. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);"></div><input class="ButtonText" name="Sale List" alt="Sale List" src="'.$layout_name.'/images/buttons/_sbutton_salelist.gif" type="image"></div></div>
  92. </form>
  93. </center>
  94. </td>
  95. <td width="25%" style="border: none; text-align: center;">
  96. <strong><small>Lista de ofertas de compra de personagens</small></strong><br><br>
  97. <center>
  98. <form action="?subtopic=tradecharacter&action=listbuy" method="post">
  99. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);"></div><input class="ButtonText" name="Buy List" alt="Buy List" src="'.$layout_name.'/images/buttons/_sbutton_buylist.gif" type="image"></div></div>
  100. </form>
  101. </center>
  102. </td>
  103. </tr>
  104. </table>
  105. </div>
  106. </div>
  107. <div class="TableShadowContainer" >
  108. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  109. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  110. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  111. </div>
  112. </div>
  113. </td>
  114. </tr>
  115. </table>
  116. </div>
  117. </td>
  118. </tr>
  119. </table>
  120. </div><br>
  121. <small style="float: right;">Sistema desenvolvido por <strong><a style="color: #5A2800; text-decoration: none;" href="https://www.facebook.com/FelipeeMonteiro" target="_blank">Felipe Monteiro</a></strong>.</small>
  122. <div style="clear: both;"></div>';
  123.  
  124. }
  125.  
  126. if ($action == "buyoffert") {
  127. if ($logged) {
  128.  
  129. // Check if a form has been sent
  130. $website = new Website();
  131. $postedToken = filter_input(INPUT_POST, 'token');
  132. if(!empty($postedToken)){
  133. if($website->isTokenValid($postedToken)){
  134. // Process form
  135. $vocation = (int) $_POST['vocation'];
  136. $minLevel = (int) $_POST['minLevel'];
  137. $maxnLevel = (int) $_POST['maxLevel'];
  138. $minMagic = (int) $_POST['magicMin'];
  139. $maxMagic = (int) $_POST['magicMax'];
  140. $minClub = (int) $_POST['clubMin'];
  141. $maxClub = (int) $_POST['clubMax'];
  142. $minSword = (int) $_POST['swordMin'];
  143. $maxSword = (int) $_POST['swordMax'];
  144. $minAxe = (int) $_POST['axeMin'];
  145. $maxAxe = (int) $_POST['axeMax'];
  146. $minDist = (int) $_POST['distMin'];
  147. $maxDist = (int) $_POST['distMax'];
  148. $minShield = (int) $_POST['shieldMin'];
  149. $maxShield = (int) $_POST['shieldMax'];
  150. $quests = $_POST['quests'];
  151. $price = (int) $_POST['price'];
  152.  
  153. function isValidValues ($min, $max, $required = false) {
  154. $response = array();
  155. $response['status'] = true;
  156.  
  157. if ($required) {
  158. if ($min == 0 || $max == 0) {
  159. $response['message'] = "É necessário informar valores de minimo e máximo para o level do seu personagem";
  160. $response['status'] = false;
  161. }
  162. }
  163.  
  164. if ($min > $max || $max < $min) {
  165. $response['message'] = "Valores de minimo devem ser menores que valores de máximo e vice-versa.";
  166. $response['status'] = false;
  167. } elseif ($min == $max) {
  168. $response['message'] = "Valores de minimo e máximo não podem ser iguais.";
  169. $response['status'] = false;
  170. }
  171.  
  172. return $response;
  173. }
  174.  
  175. $trade_errors = array();
  176.  
  177. if ($account_logged->getPremiumPoints() < ($price + $trade_config['buy_tax'])) {
  178. $trade_errors[] = "Você precisa não possui os coins necessários para criar essa oferta.";
  179. }
  180.  
  181. if ($account_logged->getPremiumPoints() < $trade_config['buy_tax']) {
  182. $trade_errors[] = "Você precisa ter ao menos " . $trade_config['buy_tax'] . " coins para criar essa oferta.";
  183. }
  184.  
  185. if ($vocation == 0) {
  186. $trade_errors[] = "É necessário informar a vocação que deseja para o seu personagem.";
  187. }
  188.  
  189. $character_level = isValidValues($minLevel, $maxnLevel, true);
  190. if (!$character_level['status']) {
  191. $trade_errors[] = $character_level['message'];
  192. }
  193.  
  194. if ($minMagic > 0 && $maxMagic > 0) {
  195. $character_magic = isValidValues($minMagic, $maxMagic);
  196. if (!$character_magic['status']) {
  197. $trade_errors[] = $character_magic['message'];
  198. }
  199. }
  200.  
  201. if ($minClub > 0 && $maxClub > 0) {
  202. $character_club = isValidValues($minClub, $maxClub);
  203. if (!$character_club['status']) {
  204. $trade_errors[] = $character_club['message'];
  205. }
  206. }
  207.  
  208. if ($minSword > 0 && $maxSword > 0) {
  209. $character_sword = isValidValues($minSword, $maxSword);
  210. if (!$character_sword['status']) {
  211. $trade_errors[] = $character_sword['message'];
  212. }
  213. }
  214.  
  215. if ($minAxe > 0 && $maxAxe > 0) {
  216. $character_axe = isValidValues($minAxe, $maxAxe);
  217. if (!$character_axe['status']) {
  218. $trade_errors[] = $character_axe['message'];
  219. }
  220. }
  221.  
  222. if ($minDist > 0 && $maxDist > 0) {
  223. $character_dist = isValidValues($minDist, $maxDist);
  224. if (!$character_dist['status']) {
  225. $trade_errors[] = $character_dist['message'];
  226. }
  227. }
  228.  
  229. if ($minShield > 0 && $maxShield > 0) {
  230. $character_shield = isValidValues($minShield, $maxShield);
  231. if (!$character_shield['status']) {
  232. $trade_errors[] = $character_shield['message'];
  233. }
  234. }
  235.  
  236. if (empty($price) || !is_int($price)) {
  237. $trade_errors[] = "Coloque um valor válido para o preço que deseja pagar pelo personagem.";
  238. }
  239.  
  240. if ($price == 0) {
  241. $trade_errors[] = "O preço deve ser maior que 0.";
  242. }
  243.  
  244. if (empty($trade_errors)) {
  245.  
  246. $offer_array = array();
  247.  
  248. $offer_array['buyer_account'] = $account_logged->getID();
  249. $offer_array['player_vocation'] = $vocation;
  250. $offer_array['player_level'] = $minLevel . "," . $maxnLevel;
  251.  
  252. if ($minMagic > 0 && $maxMagic > 0) {
  253. $offer_array['player_skill_magic'] = $minMagic . "," . $maxMagic;
  254. }
  255.  
  256. if ($minClub > 0 && $maxClub > 0) {
  257. $offer_array['player_skill_club'] = $minClub . "," . $maxClub;
  258. }
  259.  
  260. if ($minSword > 0 && $maxSword > 0) {
  261. $offer_array['player_skill_sword'] = $minSword . "," . $maxSword;
  262. }
  263.  
  264. if ($minAxe > 0 && $maxAxe > 0) {
  265. $offer_array['player_skill_axe'] = $minAxe . "," . $maxAxe;
  266. }
  267.  
  268. if ($minDist > 0 && $maxDist > 0) {
  269. $offer_array['player_skill_dist'] = $minDist . "," . $maxDist;
  270. }
  271.  
  272. if ($minShield > 0 && $maxShield > 0) {
  273. $offer_array['player_skill_shield'] = $minShield . "," . $maxShield;
  274. }
  275.  
  276. if (count($quests) > 0) {
  277. $req_quests = "";
  278. foreach ($quests as $q) {
  279. $req_quests .= $q . ",";
  280. }
  281. $req_quests = substr($req_quests, 0, -1);
  282. $offer_array['player_quests'] = $req_quests;
  283. }
  284.  
  285. $offer_array['player_price'] = $price;
  286.  
  287. ksort($offer_array);
  288.  
  289. $fieldNames = implode('`, `', array_keys($offer_array));
  290. $fieldValues = ':' . implode(', :', array_keys($offer_array));
  291.  
  292. $sth = $SQL->prepare("INSERT INTO `player_buying` (`$fieldNames`) VALUES ($fieldValues)");
  293.  
  294. foreach ($offer_array as $key => $value) {
  295. $sth->bindValue(":$key", $value);
  296. }
  297.  
  298. $account_logged->setPremiumPoints($account_logged->getPremiumPoints() - ($price + $trade_config['buy_tax']));
  299. $account_logged->save();
  300.  
  301. $sth->execute();
  302. $main_content .= '
  303. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  304. <div class="TableContainer">
  305. <div class="CaptionContainer">
  306. <div class="CaptionInnerContainer">
  307. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  308. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  309. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  310. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  311. <div class="Text">Criar Oferta de Compra de Personagem</div>
  312. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  313. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  314. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  315. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  316. </div>
  317. </div>
  318. <table class="Table5" cellpadding="0" cellspacing="0">
  319. <tbody>
  320. <tr>
  321. <td>
  322. <div class="InnerTableContainer">
  323. <table style="width: 100%;">
  324. <tbody>
  325. <tr>
  326. <td>
  327. <div class="InnerTableContainer">
  328. <p>Abaixo as especificações que você selecionou para sua oferta.</p>
  329. <p>A vocação escolhida é: <strong>'.htmlspecialchars(Website::getVocationName($vocation)).'</strong>, e abaixo as caracteristicas escolhidas.</p>
  330. <ul>';
  331. if ($minMagic > 0 && $maxMagic > 0) {
  332. $main_content .= '<li>Sill Magic Level minimo de <strong>' . $minMagic . '</strong> e máximo de <strong>' . $maxMagic . '</strong></li>';
  333. }
  334.  
  335. if ($minClub > 0 && $maxClub > 0) {
  336. $main_content .= '<li>Sill Club minimo de <strong>' . $minClub . '</strong> e máximo de <strong>' . $maxClub . '</strong></li>';
  337. }
  338.  
  339. if ($minSword > 0 && $maxSword > 0) {
  340. $main_content .= '<li>Sill Sword minimo de <strong>' . $minSword . '</strong> e máximo de <strong>' . $maxSword . '</strong></li>';
  341. }
  342.  
  343. if ($minAxe > 0 && $maxAxe > 0) {
  344. $main_content .= '<li>Sill Axe minimo de <strong>' . $minAxe . '</strong> e máximo de <strong>' . $maxAxe . '</strong></li>';
  345. }
  346.  
  347. if ($minDist > 0 && $maxDist > 0) {
  348. $main_content .= '<li>Sill Distance minimo de <strong>' . $minDist . '</strong> e máximo de <strong>' . $maxDist . '</strong></li>';
  349. }
  350.  
  351. if ($minShield > 0 && $maxShield > 0) {
  352. $main_content .= '<li>Sill Shield minimo de <strong>' . $minShield . '</strong> e máximo de <strong>' . $maxShield . '</strong></li>';
  353. }
  354. $main_content .= '
  355. </ul>';
  356.  
  357. if (count($quests) > 0) {
  358. $main_content .= '<p>Você também selecionou as seguintes quests como requisitos para o seu novo personagem:</p>';
  359. $main_content .= '<ul>';
  360. foreach ($quests as $q) {
  361. $main_content .= '<li>' . $trade_config['quests'][$q]['name'] . '</li>';
  362. }
  363. $main_content .= '</ul>';
  364. }
  365.  
  366. $main_content .= '<p>Todas essas caracteristicas você selecionou o valor a ser pago será de <strong>'.$price.' coins</strong>.</p>';
  367. $main_content .= '
  368. </div>
  369. </td>
  370. </tr>
  371. </tbody>
  372. </table>
  373. </div>
  374. </td>
  375. </tr>
  376. </tbody>
  377. </table>
  378. </div><br>
  379. <center>
  380. <table border="0" cellpadding="0" cellspacing="10" style="margin-bottom: 15px">
  381. <tbody><tr>
  382. <td style="border: 0px none;">
  383. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  384. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  385. <a href="?subtopic=tradecharacter"><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></a></div></div></td></tr></tbody>
  386. </table>
  387. </center>';
  388. } else {
  389. $main_content .= '
  390. <div class="SmallBox" >
  391. <div class="MessageContainer" >
  392. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>
  393. <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  394. <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  395. <div class="ErrorMessage" >
  396. <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>
  397. <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>
  398. <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div>
  399. <b>The Following Errors Have Occurred:</b><br>';
  400. foreach($trade_errors as $error)
  401. $main_content .= $error . '<br>';
  402. $main_content .= '
  403. </div>
  404. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>
  405. <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  406. <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  407. </div>
  408. </div><br>
  409. <center>
  410. <table border="0" cellpadding="0" cellspacing="10" style="margin-bottom: 15px">
  411. <tbody><tr>
  412. <td style="border: 0px none;">
  413. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  414. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  415. <a href="?subtopic=tradecharacter"><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_login.gif" type="image"></a></div></div></td></tr></tbody>
  416. </table>
  417. </center>';
  418. }
  419. } else{
  420. // Do something about the error
  421. $main_content .= '
  422. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  423. <div class="TableContainer">
  424. <div class="CaptionContainer">
  425. <div class="CaptionInnerContainer">
  426. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  427. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  428. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  429. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  430. <div class="Text">Error</div>
  431. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  432. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  433. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  434. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  435. </div>
  436. </div>
  437. <table class="Table5" cellpadding="0" cellspacing="0">
  438. <tbody>
  439. <tr>
  440. <td>
  441. <div class="InnerTableContainer">
  442. <table style="width: 100%;">
  443. <tbody>
  444. <tr>
  445. <td>
  446. <div class="InnerTableContainer">
  447. <p><center>Você já criou uma oferta de compra.</center></p>
  448. </div>
  449. </td>
  450. </tr>
  451. </tbody>
  452. </table>
  453. </div>
  454. </td>
  455. </tr>
  456. </tbody>
  457. </table>
  458. </div><br>
  459. <center>
  460. <table border="0" cellpadding="0" cellspacing="10" style="margin-bottom: 15px">
  461. <tbody><tr><td style="border: 0px none;">
  462. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  463. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  464. <a href="?subtopic=tradecharacter"><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></a></div></div></td></tr></tbody>
  465. </table>
  466. </center>';
  467. }
  468. }
  469. } else {
  470. $main_content .= '
  471. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  472. <div class="TableContainer">
  473. <div class="CaptionContainer">
  474. <div class="CaptionInnerContainer">
  475. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  476. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  477. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  478. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  479. <div class="Text">Error</div>
  480. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  481. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  482. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  483. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  484. </div>
  485. </div>
  486. <table class="Table5" cellpadding="0" cellspacing="0">
  487. <tbody>
  488. <tr>
  489. <td>
  490. <div class="InnerTableContainer">
  491. <table style="width: 100%;">
  492. <tbody>
  493. <tr>
  494. <td>
  495. <div class="InnerTableContainer">
  496. <p><center>You are not logged in.</center></p>
  497. </div>
  498. </td>
  499. </tr>
  500. </tbody>
  501. </table>
  502. </div>
  503. </td>
  504. </tr>
  505. </tbody>
  506. </table>
  507. </div><br>
  508. <center>
  509. <table border="0" cellpadding="0" cellspacing="10" style="margin-bottom: 15px">
  510. <tbody><tr><td style="border: 0px none;">
  511. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  512. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  513. <a href="?subtopic=tradecharacter"><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></a></div></div></td>
  514. <td style="border: 0px none;">
  515. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  516. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  517. <a href="?subtopic=accountmanagement"><input class="ButtonText" name="Login" alt="Login" src="'.$layout_name.'/images/buttons/_sbutton_login.gif" type="image"></a></div></div></td></tr></tbody>
  518. </table>
  519. </center>';
  520. }
  521. }
  522.  
  523. if ($action == "buycharacter") {
  524. $website = new Website();
  525. if ($logged) {
  526. $main_content .= '<p>Aqui você pode criar uma oferta de compra de um personagem especificando as caracteristicas que você deseja que o personagem possua. Exemplo: skills, level, vocação e até mesmos quais quests você quer que possua. Crie logo sua oferta e comece logo a jogar.</p>
  527. <p><strong>Obs.:</strong> Os skills serão observados pelo sistema levando em consideração a vocação escolhida, isto é, se a vocação selecionada for um mage (Master Sorcerer ou Elder Druid), o sistema levará em consideração apenas o skill de <strong>Magic Level</strong> e o skill de <strong>Shielding</strong>, no caso dos knights os skills de <strong>Club</strong>, <strong>Sword</strong> e <strong>Axe</strong> serão levados em conta, portanto selecione o de sua preferência para que o sistema possa abranger mais vendedores.</p>
  528. <p>Skills onde o valor de mínimo ou máximo são 0 serão ignorados pelo sistema.</p>
  529. <p style="color: green;">A taxa para criação dessa oferta é de <strong>'.$trade_config['buy_tax'].' coins</strong> que serão debitados de você juntamente com o valor colocado na oferta para compra.</p>';
  530.  
  531. $main_content .= '
  532. <div class="TableContainer">
  533. <div class="CaptionContainer">
  534. <div class="CaptionInnerContainer">
  535. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  536. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  537. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  538. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  539. <div class="Text">Criar Oferta de Compra</div>
  540. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  541. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  542. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  543. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  544. </div>
  545. </div>
  546. <form method="post" action="?subtopic=tradecharacter&action=buyoffert">
  547. <table class="Table3" cellpadding="0" cellspacing="0">
  548. <tbody>
  549. <tr>
  550. <td>
  551. <div class="InnerTableContainer">
  552. <table style="width:100%;">
  553. <tr>
  554. <td>
  555. <div class="TableShadowContainerRightTop" >
  556. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  557. </div>
  558. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  559. <div class="TableContentContainer" >
  560. <table class="TableContent" width="100%">
  561. <tr style="background-color:#D4C0A1;">
  562. <td width="20%"><strong>Vocação</strong></td>
  563. <td>
  564. <select name="vocation">
  565. <option value="0">Selecione uma vocação</option>
  566. <option value="5">Master Sorcerer</option>
  567. <option value="6">Elder Druid</option>
  568. <option value="7">Royal Paladin</option>
  569. <option value="8">Elite Knight</option>
  570. </select>
  571. </td>
  572. </tr>
  573. <tr style="background-color: #F1E0C6;">
  574. <td><strong>Level</strong></td>
  575. <td>Min: <input type="number" name="minLevel" value="0" style="width: 70px"> Max: <input type="number" name="maxLevel" value="0" style="width: 70px"></td>
  576. </tr>
  577. <tr style="background-color:#D4C0A1;">
  578. <td><strong>Magic Level Skill</strong></td>
  579. <td>Min: <input type="number" name="magicMin" value="0" style="width: 70px"> Max: <input type="number" name="magicMax" value="0" style="width: 70px"></td>
  580. </tr>
  581. <tr style="background-color:#F1E0C6;">
  582. <td><strong>Club Skill</strong></td>
  583. <td>Min: <input type="number" name="clubMin" value="0" style="width: 70px"> Max: <input type="number" name="clubMax" value="0" style="width: 70px"></td>
  584. </tr>
  585. <tr style="background-color:#D4C0A1;">
  586. <td><strong>Sword Skill</strong></td>
  587. <td>Min: <input type="number" name="swordMin" value="0" style="width: 70px"> Max: <input type="number" name="swordMax" value="0" style="width: 70px"></td>
  588. </tr>
  589. <tr style="background-color:#F1E0C6;">
  590. <td><strong>Axe Skill</strong></td>
  591. <td>Min: <input type="number" name="axeMin" value="0" style="width: 70px"> Max: <input type="number" name="axeMax" value="0" style="width: 70px"></td>
  592. </tr>
  593. <tr style="background-color:#D4C0A1;">
  594. <td><strong>Distance Skill</strong></td>
  595. <td>Min: <input type="number" name="distMin" value="0" style="width: 70px"> Max: <input type="number" name="distMax" value="0" style="width: 70px"></td>
  596. </tr>
  597. <tr style="background-color:#F1E0C6;">
  598. <td><strong>Shield Skill</strong></td>
  599. <td>Min: <input type="number" name="shieldMin" value="0" style="width: 70px"> Max: <input type="number" name="shieldMax" value="0" style="width: 70px"></td>
  600. </tr>
  601. <tr style="background-color:#D4C0A1;">
  602. <td><strong>Quests Feitas</strong></td>
  603. <td style="padding: 5px;">';
  604.  
  605. foreach ($trade_config['quests'] as $i => $v) {
  606. $main_content .= '<span style="border: 1px solid #5A2800; border-radius: 5px; margin-left: 10px; margin-bottom: 5px; display: inline-block; padding: 2px;"><input type="checkbox" name="quests[]" value="'.$i.'"><label for="'.$i.'">' . $v['name']. '</label></span>';
  607. }
  608.  
  609. $main_content .= '<br><small>*Selecione todas as quests que deseja que seu futuro personagem já as tenha completado.</small>';
  610. $main_content .= '
  611. </td>
  612. </tr>
  613. <tr style="background-color:#F1E0C6;">
  614. <td><strong>Valor</strong></td>
  615. <td><input type="number" name="price" value="0" style="width: 70px"></td>
  616. </tr>
  617. </table>
  618. </div>
  619. </div>
  620. <div class="TableShadowContainer" >
  621. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  622. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  623. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  624. </div>
  625. </div>
  626. </td>
  627. </tr>
  628. </table>
  629. </div>
  630. </td>
  631. </tr>
  632. </table>
  633. </div><br>
  634. <center>
  635. <table>
  636. <tr>
  637. <td>';
  638. $token = $website->getToken();
  639. $main_content .= '
  640. <input type="hidden" name="token" value="'.$token.'">
  641. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);"></div><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_createoffert.gif" type="image"></div></div>
  642. </form>
  643.  
  644. </td>
  645. <td>
  646.  
  647. <form action="?subtopic=tradecharacter" method="post">
  648. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></div></div>
  649. </form>
  650.  
  651. </td>
  652. </tr>
  653. </table>
  654. </center>';
  655. } else {
  656. $main_content .= '
  657. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  658. <div class="TableContainer">
  659. <div class="CaptionContainer">
  660. <div class="CaptionInnerContainer">
  661. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  662. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  663. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  664. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  665. <div class="Text">Error</div>
  666. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  667. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  668. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  669. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  670. </div>
  671. </div>
  672. <table class="Table5" cellpadding="0" cellspacing="0">
  673. <tbody>
  674. <tr>
  675. <td>
  676. <div class="InnerTableContainer">
  677. <table style="width: 100%;">
  678. <tbody>
  679. <tr>
  680. <td>
  681. <div class="InnerTableContainer">
  682. <p><center>You are not logged in.</center></p>
  683. </div>
  684. </td>
  685. </tr>
  686. </tbody>
  687. </table>
  688. </div>
  689. </td>
  690. </tr>
  691. </tbody>
  692. </table>
  693. </div><br>
  694. <center>
  695. <table border="0" cellpadding="0" cellspacing="10" style="margin-bottom: 15px">
  696. <tbody><tr><td style="border: 0px none;">
  697. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  698. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  699. <a href="?subtopic=tradecharacter"><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></a></div></div></td>
  700. <td style="border: 0px none;">
  701. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  702. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  703. <a href="?subtopic=accountmanagement"><input class="ButtonText" name="Login" alt="Login" src="'.$layout_name.'/images/buttons/_sbutton_login.gif" type="image"></a></div></div></td></tr></tbody>
  704. </table>
  705. </center>';
  706. }
  707. }
  708.  
  709. if ($action == "sellcharacter") {
  710. if ($logged) {
  711. $account_players = array();
  712. $p_count = 0;
  713.  
  714. foreach($account_logged->getPlayers() as $player) {
  715. if ($player->getLevel() >= $trade_config['levelToSell']) {
  716. $p_count++;
  717. $account_players[$p_count]['name'] = $player->getName();
  718. }
  719. }
  720.  
  721. if (count($account_players) > 0 && !$account_logged->isBanned()) {
  722. $main_content .= '
  723. <p>Abaixo está a lista de personagens que você tem e podem ser vendidos.</p>';
  724. $main_content .= '
  725. <div class="TableContainer">
  726. <div class="CaptionContainer">
  727. <div class="CaptionInnerContainer">
  728. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  729. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  730. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  731. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  732. <div class="Text">Vender Personagens</div>
  733. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  734. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  735. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  736. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  737. </div>
  738. </div>
  739. <form method="post" action="?subtopic=tradecharacter&action=sell">
  740. <table class="Table3" cellpadding="0" cellspacing="0">
  741. <tbody>
  742. <tr>
  743. <td>
  744. <div class="InnerTableContainer">
  745. <table style="width:100%;">
  746. <tr>
  747. <td>
  748. <div class="TableShadowContainerRightTop" >
  749. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  750. </div>
  751. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  752. <div class="TableContentContainer" >
  753. <table class="TableContent" width="100%">
  754. <tr style="background-color:#D4C0A1;">
  755. <td width="35%"><strong>Selecione o personagem para vender</strong></td>
  756. <td>
  757. <select name="selling">';
  758. for ($i = 0; $i <= count($account_players); $i++) {
  759. if (!empty($account_players[$i]['name']))
  760. $main_content .= '
  761. <option value="'.htmlspecialchars($account_players[$i]['name']).'">'.htmlspecialchars($account_players[$i]['name']).'</option>';
  762. }
  763. $main_content .= '
  764. </select>
  765. </td>
  766. </tr>
  767. </table>
  768. </div>
  769. </div>
  770. <div class="TableShadowContainer" >
  771. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  772. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  773. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  774. </div>
  775. </div>
  776. </td>
  777. </tr>
  778. </table>
  779. <table>
  780. <tr>
  781. <td>
  782. <center>
  783. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);"></div><input class="ButtonText" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" type="image"></div></div>
  784. </center>
  785. </td>
  786. </tr>
  787. </table>
  788. </form>
  789. </div>
  790. </td>
  791. </tr>
  792. </table>
  793. </div><br>
  794. <center>
  795. <table>
  796. <tr>
  797. <td>
  798.  
  799. <form action="?subtopic=tradecharacter" method="post">
  800. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></div></div>
  801. </form>
  802.  
  803. </td>
  804. </tr>
  805. </table>
  806. </center>';
  807. }
  808. } else {
  809. $main_content .= '
  810. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  811. <div class="TableContainer">
  812. <div class="CaptionContainer">
  813. <div class="CaptionInnerContainer">
  814. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  815. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  816. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  817. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  818. <div class="Text">Error</div>
  819. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  820. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  821. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  822. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  823. </div>
  824. </div>
  825. <table class="Table5" cellpadding="0" cellspacing="0">
  826. <tbody>
  827. <tr>
  828. <td>
  829. <div class="InnerTableContainer">
  830. <table style="width: 100%;">
  831. <tbody>
  832. <tr>
  833. <td>
  834. <div class="InnerTableContainer">
  835. <p><center>You are not logged in.</center></p>
  836. </div>
  837. </td>
  838. </tr>
  839. </tbody>
  840. </table>
  841. </div>
  842. </td>
  843. </tr>
  844. </tbody>
  845. </table>
  846. </div><br>
  847. <center>
  848. <table border="0" cellpadding="0" cellspacing="10" style="margin-bottom: 15px">
  849. <tbody><tr><td style="border: 0px none;">
  850. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  851. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  852. <a href="?subtopic=tradecharacter"><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></a></div></div></td>
  853. <td style="border: 0px none;">
  854. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  855. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  856. <a href="?subtopic=accountmanagement"><input class="ButtonText" name="Login" alt="Login" src="'.$layout_name.'/images/buttons/_sbutton_login.gif" type="image"></a></div></div></td></tr></tbody>
  857. </table>
  858. </center>';
  859. }
  860. }
  861.  
  862. if ($action == "sellaction") {
  863. if ($logged) {
  864. $offerId = (int) $_REQUEST['offer'];
  865. if (isset($offerId)) {
  866. $get_offer = $SQL->query("SELECT * FROM `player_buying` WHERE `id` = " . $offerId)->fetch();
  867.  
  868. if (isset($get_offer[0])) {
  869. $main_content .= '
  870. <p>Escolha um personagem seu que tenha as caracteristicas do personagem requerido na oferta e clique em Submit.</p>
  871. <div class="TableContainer">
  872. <div class="CaptionContainer">
  873. <div class="CaptionInnerContainer">
  874. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  875. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  876. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  877. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  878. <div class="Text">Escolher Personagem</div>
  879. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  880. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  881. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  882. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  883. </div>
  884. </div>
  885. <form id="formSellAction" method="post" action="?subtopic=tradecharacter&action=sellaction">
  886. <input type="hidden" name="offerId" value="'.(int) $offerId.'">
  887. <table class="Table3" cellpadding="0" cellspacing="0">
  888. <tbody>
  889. <tr>
  890. <td>
  891. <div class="InnerTableContainer">
  892. <table style="width:100%;">
  893. <tr>
  894. <td>
  895. <div class="TableShadowContainerRightTop" >
  896. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  897. </div>
  898. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  899. <div class="TableContentContainer" >
  900. <table class="TableContent" width="100%">
  901. <tr style="background-color:#D4C0A1;">
  902. <td width="35%"><strong>Selecione o personagem para vender</strong></td>
  903. <td>
  904. <select name="sellchar">';
  905.  
  906. $main_content .= '<option value="0">Selecione o personagem</option>';
  907. foreach ($account_logged->getPlayers() as $player) {
  908. $main_content .= '<option value="'.$player->getID().'">'.$player->getName().'</option>';
  909. }
  910. $main_content .= '
  911. </select>
  912. </td>
  913. </tr>
  914. </table>
  915. </div>
  916. </div>
  917. <div class="TableShadowContainer" >
  918. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  919. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  920. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  921. </div>
  922. </div>
  923. </td>
  924. </tr>
  925. </table>
  926. </div>
  927. </td>
  928. </tr>
  929. </table>
  930. </div><br>
  931. <p>Abaixo as caracteristicas requeridas pelo comprador. Se seu personagem possuir essas caracteristicas sua venda será concretizada, avalie bem todas as caracteristicas e também o valor a ser pago, e então clique em Submit.</p>
  932. <div class="TableContainer">
  933. <div class="CaptionContainer">
  934. <div class="CaptionInnerContainer">
  935. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  936. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  937. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  938. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  939. <div class="Text">Oferta de compra</div>
  940. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  941. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  942. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  943. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  944. </div>
  945. </div>
  946. <table class="Table3" cellpadding="0" cellspacing="0">
  947. <tbody>
  948. <tr>
  949. <td>
  950. <div class="InnerTableContainer">
  951. <table style="width:100%;">
  952. <tr>
  953. <td>
  954. <div class="TableShadowContainerRightTop" >
  955. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  956. </div>
  957. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  958. <div class="TableContentContainer" >
  959. <table class="TableContent" width="100%">
  960. <tr style="background-color:#D4C0A1;">
  961. <td width="20%"><strong>Vocação</strong></td>
  962. <td>'.Website::getVocationName($get_offer['player_vocation']).'</td>
  963. </tr>
  964. <tr bgcolor="#F1E0C6">
  965. <td><strong>Level:</strong></td>
  966. <td>Entre: '.explode(",", $get_offer['player_level'])[0].' e '.explode(",", $get_offer['player_level'])[1].'</td>
  967. </tr>
  968. <tr bgcolor="#D4C0A1">
  969. <td><strong>Skills:</strong></td>
  970. <td>
  971. <ul>';
  972. if ($get_offer['player_skill_magic'] > 0) {
  973. $main_content .= '<li>Skill de Magic Level entre '.explode(",", $get_offer['player_skill_magic'])[0].' e '.explode(",", $get_offer['player_skill_magic'])[1].'</li>';
  974. }
  975.  
  976. if ($get_offer['player_skill_club'] > 0) {
  977. $main_content .= '<li>Skill de Club entre '.explode(",", $get_offer['player_skill_club'])[0].' e '.explode(",", $get_offer['player_skill_club'])[1].'</li>';
  978. }
  979.  
  980. if ($get_offer['player_skill_sword'] > 0) {
  981. $main_content .= '<li>Skill de Sword entre '.explode(",", $get_offer['player_skill_sword'])[0].' e '.explode(",", $get_offer['player_skill_sword'])[1].'</li>';
  982. }
  983.  
  984. if ($get_offer['player_skill_axe'] > 0) {
  985. $main_content .= '<li>Skill de Axe entre '.explode(",", $get_offer['player_skill_axe'])[0].' e '.explode(",", $get_offer['player_skill_axe'])[1].'</li>';
  986. }
  987.  
  988. if ($get_offer['player_skill_dist'] > 0) {
  989. $main_content .= '<li>Skill de Distance entre '.explode(",", $get_offer['player_skill_dist'])[0].' e '.explode(",", $get_offer['player_skill_dist'])[1].'</li>';
  990. }
  991.  
  992. if ($get_offer['player_skill_shield'] > 0) {
  993. $main_content .= '<li>Skill de Shield entre '.explode(",", $get_offer['player_skill_shield'])[0].' e '.explode(",", $get_offer['player_skill_shield'])[1].'</li>';
  994. }
  995. $main_content .= '
  996. </ul>
  997. </td>';
  998.  
  999. if ($get_offer['player_quests'] > 0) {
  1000. $main_content .= '
  1001. <tr bgcolor="#F1E0C6">
  1002. <td><strong>Quests Feitas:</strong></td>
  1003. <td>
  1004. <ul>';
  1005. $quests = explode(",", $get_offer['player_quests']);
  1006. foreach ($quests as $quest) {
  1007. $main_content .= '
  1008. <li>'.$trade_config['quests'][$quest]['name'].'</li>';
  1009. }
  1010. $main_content . '
  1011. </ul>
  1012. </td>
  1013. </tr>';
  1014. }
  1015. $main_content .= '
  1016. </tr>
  1017. <tr'.((count($get_offer['player_quests']) > 0) ? ' bgcolor="#D4C0A1"' : ' bgcolor="#F1E0C6"').'>
  1018. <td><strong>Valor:</strong></td>]
  1019. <td>'.$get_offer['player_price'].' coins</td>
  1020. </tr>
  1021. </table>
  1022. </div>
  1023. </div>
  1024. <div class="TableShadowContainer" >
  1025. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  1026. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  1027. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  1028. </div>
  1029. </div>
  1030. </td>
  1031. </tr>
  1032. </table>
  1033. </div>
  1034. </td>
  1035. </tr>
  1036. </table>
  1037. </div><br>
  1038. <center>
  1039. <table>
  1040. <tr>
  1041. <td>
  1042. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over_green.gif);"></div><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" type="image"></div></div>
  1043. </td>
  1044. </form>
  1045. <td>
  1046. <form action="?subtopic=tradecharacter" method="post">
  1047. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></div></div>
  1048. </form>
  1049. </td>
  1050. </tr>
  1051. </table>
  1052. </center>';
  1053. } else {
  1054. header("location: ?subtopic=tradecharacter");
  1055. }
  1056. } else {
  1057. header("location: ?subtopic=tradecharacter");
  1058. }
  1059. } else {
  1060. $main_content .= '
  1061. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  1062. <div class="TableContainer">
  1063. <div class="CaptionContainer">
  1064. <div class="CaptionInnerContainer">
  1065. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1066. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1067. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  1068. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  1069. <div class="Text">Error</div>
  1070. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  1071. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  1072. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1073. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1074. </div>
  1075. </div>
  1076. <table class="Table5" cellpadding="0" cellspacing="0">
  1077. <tbody>
  1078. <tr>
  1079. <td>
  1080. <div class="InnerTableContainer">
  1081. <table style="width: 100%;">
  1082. <tbody>
  1083. <tr>
  1084. <td>
  1085. <div class="InnerTableContainer">
  1086. <p><center>You are not logged in.</center></p>
  1087. </div>
  1088. </td>
  1089. </tr>
  1090. </tbody>
  1091. </table>
  1092. </div>
  1093. </td>
  1094. </tr>
  1095. </tbody>
  1096. </table>
  1097. </div><br>
  1098. <center>
  1099. <table border="0" cellpadding="0" cellspacing="10" style="margin-bottom: 15px">
  1100. <tbody><tr><td style="border: 0px none;">
  1101. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  1102. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  1103. <a href="?subtopic=tradecharacter"><input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image"></a></div></div></td>
  1104. <td style="border: 0px none;">
  1105. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  1106. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  1107. <a href="?subtopic=accountmanagement"><input class="ButtonText" name="Login" alt="Login" src="'.$layout_name.'/images/buttons/_sbutton_login.gif" type="image"></a></div></div></td></tr></tbody>
  1108. </table>
  1109. </center>';
  1110. }
  1111. }
  1112.  
  1113. if ($action == "listbuy") {
  1114. $website = new Website();
  1115. $vocationName = '';
  1116. if (isset($_REQUEST['voc']))
  1117. $vocationName = strip_tags(trim($_REQUEST['voc']));
  1118.  
  1119. $max_links = 5;
  1120. $links_laterais = ceil($max_links / 2);
  1121.  
  1122. if (isset($_REQUEST['page']))
  1123. $page = (int) $_REQUEST['page'];
  1124. else
  1125. $page = (int) 1;
  1126.  
  1127. $start = $page - 1;
  1128. $start = $trade_config['results_per_page'] * $start;
  1129.  
  1130. $start2 = $page - $links_laterais;
  1131. $limit = $page + $links_laterais;
  1132.  
  1133. if ($vocationName == '') {
  1134. $whereVoc = '';
  1135. } elseif ($vocationName == "sorcerer") {
  1136. $whereVoc = " WHERE `player_vocation` IN(1,5) ";
  1137. } elseif ($vocationName == "druid") {
  1138. $whereVoc = " WHERE `player_vocation` IN(2,6) ";
  1139. } elseif ($vocationName == "paladin") {
  1140. $whereVoc = " WHERE `player_vocation` IN(3,7) ";
  1141. } elseif ($vocationName == "knight") {
  1142. $whereVoc = " WHERE `player_vocation` IN(4,8) ";
  1143. }
  1144.  
  1145. $all_buy_characters = $SQL->query("SELECT * FROM `player_buying`")->fetchAll();
  1146. $buy_characters = $SQL->query("SELECT * FROM `player_buying` ". $whereVoc ." ORDER BY `player_level` DESC LIMIT ".$start.", " . $trade_config['results_per_page'])->fetchAll();
  1147. $offers_count = $SQL->query("SELECT COUNT(`id`) AS `offers_count` FROM `player_buying` ". $whereVoc)->fetchAll();
  1148. $main_content .= '<p>Abaixo está uma lista de ofertas de compra de personagens. Se você possuir um personagem com as caracteristicas requeridas abaixo poderá vende-lo.</p>';
  1149.  
  1150. $pgs = ceil($offers_count[0]['offers_count'] / $trade_config['results_per_page']);
  1151.  
  1152. $main_content .= '
  1153. <style>
  1154. /* pagination style */
  1155. .pagin {
  1156. padding: 2px 0;
  1157. margin: 0;
  1158. font-family: "Verdana", sans-serif;
  1159. font-size: 7pt;
  1160. font-weight: bold;
  1161. }
  1162. .pagination > a {
  1163. text-decoration: none !important;
  1164. }
  1165. .pagination {
  1166. float: left;
  1167. left: 0;
  1168. margin-bottom: 10px;
  1169. }
  1170. .pagin * {
  1171. padding: 2px 6px;
  1172. margin: 0;
  1173. }
  1174. .pagin a {
  1175. border: solid 1px #666666;
  1176. background-color: #F1E0C6;
  1177. color: #000;
  1178. text-decoration: none;
  1179. }
  1180. .pagin a:hover, .pagin a:active {
  1181. border: solid 1px #CC0000;
  1182. background-color: white;
  1183. color: #CC0000;
  1184. text-decoration: none;
  1185. }
  1186. .pagin span {
  1187. cursor: default;
  1188. border: solid 1px #808080;
  1189. background-color: #D4C0A1;
  1190. color: #000;
  1191. }
  1192. .pagin span.current {
  1193. border: solid 1px #666666;
  1194. background-color: #666666;
  1195. color: white;
  1196. }
  1197. </style>';
  1198.  
  1199. # Paginação do conteúdo
  1200. if ($offers_count[0]['offers_count'] > $trade_config['results_per_page']) {
  1201. $main_content .= '
  1202. <div class="pagination">
  1203. <div class="pagin">';
  1204. if ($page > ($pgs / 2))
  1205. $main_content .= '<a href="?subtopic=tradecharacter&action=listbuy&page=1'.((isset($_REQUEST['voc'])) ? '&voc='.$WvocationA : '').'">« </a>';
  1206. else
  1207. $main_content .= '<span>« </span>';
  1208.  
  1209. for ($i = $start2; $i <= $limit; $i++) {
  1210. if ($i == $page)
  1211. $main_content .= " <strong>" . $i . "</strong>";
  1212. elseif ($i >= 1 && $i <= $pgs)
  1213. $main_content .= ' <a href="?subtopic=tradecharacter&action=listbuy&page='.$i.((isset($_REQUEST['voc'])) ? '&voc='.$WvocationA : '').'">' . $i . '</a>';
  1214. }
  1215.  
  1216. if ($page < ($pgs / 2))
  1217. $main_content .= ' <a href="?subtopic=tradecharacter&action=listbuy&page='.$pgs.((isset($_REQUEST['voc'])) ? '&voc='.$WvocationA : '').'"> »</a>';
  1218. else
  1219. $main_content .= ' <span> »</span>';
  1220. $main_content .= '
  1221. </div>
  1222. </div>
  1223. <div style="clear: both;"></div>';
  1224. }
  1225.  
  1226. $main_content .= '
  1227. <style>
  1228. .buycharactersbox a, .buycharactersbox a:hover {
  1229. color: #FFF;
  1230. }
  1231. </style>
  1232. <div class="TableContainer">
  1233. <div class="CaptionContainer">
  1234. <div class="CaptionInnerContainer">
  1235. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1236. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1237. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  1238. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  1239. <div class="Text buycharactersbox">
  1240. <span>Comprar Personagens</span>';
  1241.  
  1242. if (isset($all_buy_characters[0]))
  1243. $main_content .= '
  1244. <br><small style="font-weight: normal; font-size: 11px;"><strong>Filter by vocation:</strong> '.(($vocationName == "") ? 'All' : '<a href="?subtopic=tradecharacter" alt="All vocations">All</a>').' | '.(($vocationName == "sorcerer") ? 'Sorcerer' : '<a href="?subtopic=tradecharacter&voc=sorcerer" alt="Sorcerer">Sorcerer</a>').' | '.(($vocationName == "druid") ? 'Druid' : '<a href="?subtopic=tradecharacter&voc=druid" alt="Druid">Druid</a>').' | '.(($vocationName == "paladin") ? 'Paladin' : '<a href="?subtopic=tradecharacter&voc=paladin" alt="Paladin">Paladin</a>').' | '.(($vocationName == "knight") ? 'Knight' : '<a href="?subtopic=tradecharacter&voc=knight" alt="Knight">Knight</a>').'</small>';
  1245.  
  1246. $main_content .= '
  1247. </div>
  1248. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  1249. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  1250. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1251. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1252. </div>
  1253. </div>
  1254. <table class="Table3" cellpadding="0" cellspacing="0">
  1255. <tbody>
  1256. <tr>
  1257. <td>
  1258. <div class="InnerTableContainer">
  1259. <table style="width:100%;">
  1260. <tr>
  1261. <td>
  1262. <div class="TableShadowContainerRightTop" >
  1263. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  1264. </div>
  1265. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  1266. <div class="TableContentContainer" >
  1267. <table class="TableContent" width="100%">
  1268. <tr style="background-color:#D4C0A1;">
  1269. <td><strong>Descrição</strong></td>
  1270. <td width="15%" align="center"><strong>Custo</strong></td>
  1271. <td width="22%"></td>
  1272. </tr>';
  1273. if (isset($all_buy_characters[0])) {
  1274. if (isset($buy_characters[0])) {
  1275. # lista de personagens a venda
  1276.  
  1277. foreach($buy_characters as $char) {
  1278. $playerLevel = explode(",", $char['player_level']);
  1279. $bgcolor = (($number++ % 2 == 1) ? '#D4C0A1' : '#F1E0C6');
  1280. $main_content .= '
  1281. <tr style="background-color:'.$bgcolor.';">
  1282. <td valign="top">
  1283. <p style="font-size: 11px;">Vocação: <strong>'.$website->getVocationName($char['player_vocation']).'</strong><br>
  1284. Level: <strong>min: '.$playerLevel[0].'</strong> - <strong>max: '.$playerLevel[1].'</strong>';
  1285. if ($char['player_skill_magic'] > 0 || $char['player_skill_club'] > 0 || $char['player_skill_sword'] > 0 || $char['player_skill_axe'] > 0 || $char['player_skill_dist'] > 0 || $char['player_skill_shield'] > 0) {
  1286. $main_content .= '
  1287. <br>Skills: ';
  1288. if ($char['player_skill_magic'] > 0)
  1289. $main_content .= '<span style="display: inline-block; background: #5f4d41; color: white; border-radius: 5px; padding:2px; margin-left:5px; margin-bottom: 5px;">ML '.explode(",", $char['player_skill_magic'])[0].' ~ '.explode(",", $char['player_skill_magic'])[1].'</span> ';
  1290.  
  1291. if ($char['player_skill_club'] > 0)
  1292. $main_content .= '<span style="display: inline-block; background: #5f4d41; color: white; border-radius: 5px; padding:2px; margin-left:5px; margin-bottom: 5px;">Club '.explode(",", $char['player_skill_club'])[0].' ~ '.explode(",", $char['player_skill_club'])[1].'</span> ';
  1293.  
  1294. if ($char['player_skill_sword'] > 0)
  1295. $main_content .= '<span style="display: inline-block; background: #5f4d41; color: white; border-radius: 5px; padding:2px; margin-left:5px; margin-bottom: 5px;">Sword '.explode(",", $char['player_skill_sword'])[0].' ~ '.explode(",", $char['player_skill_sword'])[1].'</span> ';
  1296.  
  1297. if ($char['player_skill_axe'] > 0)
  1298. $main_content .= '<span style="display: inline-block; background: #5f4d41; color: white; border-radius: 5px; padding:2px; margin-left:5px; margin-bottom: 5px;">Axe '.explode(",", $char['player_skill_axe'])[0].' ~ '.explode(",", $char['player_skill_axe'])[1].'</span> ';
  1299.  
  1300. if ($char['player_skill_dist'] > 0)
  1301. $main_content .= '<span style="display: inline-block; background: #5f4d41; color: white; border-radius: 5px; padding:2px; margin-left:5px; margin-bottom: 5px;">Distance '.explode(",", $char['player_skill_dist'])[0].' ~ '.explode(",", $char['player_skill_dist'])[1].'</span> ';
  1302.  
  1303. if ($char['player_skill_shield'] > 0)
  1304. $main_content .= '<span style="display: inline-block; background: #5f4d41; color: white; border-radius: 5px; padding:2px; margin-left:5px; margin-bottom: 5px;">Shield '.explode(",", $char['player_skill_shield'])[0].' ~ '.explode(",", $char['player_skill_shield'])[1].'</span> ';
  1305. }
  1306. $main_content .= '
  1307. </p>
  1308. </td>
  1309. <td align="center">'.$char['player_price'].' coins</td>
  1310. <td valign="middle" align="center">';
  1311. if ($logged && $char['buyer_account'] == $account_logged->getID()) {
  1312. $main_content .= '
  1313. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_red.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_red_over.gif);" ></div><input class="ButtonText" id="cancelsellaction" data-id="'.$char['id'].'" type="image" name="Cancel Sale" alt="Cancel Sale" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" ></div></div>';
  1314. } else {
  1315. $main_content .= '
  1316. <form action="?subtopic=tradecharacter&action=sellaction&offer='.$char['id'].'" method="post" style="margin: 0; padding: 0;">
  1317. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);" ></div><input class="ButtonText" type="image" name="Buy Character" alt="Buy Character" src="'.$layout_name.'/images/buttons/detalhe.png" ></div></div>
  1318. </form>';
  1319. }
  1320. $main_content .= '
  1321. </td>
  1322. </tr>';
  1323.  
  1324. }
  1325.  
  1326. } else {
  1327. $main_content .= '
  1328. <tr style="background-color:#F1E0C6;"><td colspan="4">No characters of vocation ' . $vocationName . ' for sale.</td></tr>';
  1329. }
  1330. } else {
  1331. $main_content .= '
  1332. <tr style="background-color:#F1E0C6;"><td colspan="4">Não há personagens para comprar.</td></tr>';
  1333. }
  1334.  
  1335. $main_content .= '
  1336. </table>
  1337. </div>
  1338. </div>
  1339. <div class="TableShadowContainer" >
  1340. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  1341. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  1342. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  1343. </div>
  1344. </div>
  1345. </td>
  1346. </tr>
  1347. </table>
  1348. </div>
  1349. </td>
  1350. </tr>
  1351. </tbody>
  1352. </table>
  1353. </div><br>
  1354. <center>
  1355. <form action="?subtopic=tradecharacter" method="post">
  1356. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Buy Character" alt="Buy Character" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  1357. </form>
  1358. </center>';
  1359. $main_content .= '
  1360. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">';
  1361. }
  1362.  
  1363. if ($action == "listsell") {
  1364. $WvocationA = '';
  1365. if (isset($_REQUEST['voc']))
  1366. $WvocationA = strip_tags(trim($_REQUEST['voc']));
  1367. //$WvocationA = preg_replace("/[^a-zA-Z0-9]/", "", $vocation);
  1368.  
  1369. $max_links = 5;
  1370. $links_laterais = ceil($max_links / 2);
  1371.  
  1372. if (isset($_REQUEST['page']))
  1373. $page = (int) $_REQUEST['page'];
  1374. else
  1375. $page = (int) 1;
  1376.  
  1377. $start = $page - 1;
  1378. $start = $trade_config['results_per_page'] * $start;
  1379.  
  1380. $start2 = $page - $links_laterais;
  1381. $limit = $page + $links_laterais;
  1382.  
  1383. if ($WvocationA == '') {
  1384. $WhereA = '';
  1385. } elseif ($WvocationA == "sorcerer") {
  1386. $WhereA = " WHERE `player_vocation` IN(1,5) ";
  1387. } elseif ($WvocationA == "druid") {
  1388. $WhereA = " WHERE `player_vocation` IN(2,6) ";
  1389. } elseif ($WvocationA == "paladin") {
  1390. $WhereA = " WHERE `player_vocation` IN(3,7) ";
  1391. } elseif ($WvocationA == "knight") {
  1392. $WhereA = " WHERE `player_vocation` IN(4,8) ";
  1393. }
  1394.  
  1395. $Aall_sold_characters_ZZ = $SQL->query("SELECT * FROM `player_selling`")->fetchAll();
  1396. $Asold_characters_ZZ = $SQL->query("SELECT * FROM `player_selling` ". $WhereA ." ORDER BY `player_level` DESC LIMIT ".$start.", " . $trade_config['results_per_page'])->fetchAll();
  1397. $offers_count = $SQL->query("SELECT COUNT(`player_id`) AS `offers_count` FROM `player_selling` ". $WhereA ." ORDER BY `player_level` DESC")->fetchAll();
  1398. $main_content .= '<p>Abaixo está uma lista dos personagens disponíveis para comprar.</p>';
  1399.  
  1400. $pgs = ceil($offers_count[0]['offers_count'] / $trade_config['results_per_page']);
  1401.  
  1402. $main_content .= '
  1403. <style>
  1404. /* pagination style */
  1405. .pagin {
  1406. padding: 2px 0;
  1407. margin: 0;
  1408. font-family: "Verdana", sans-serif;
  1409. font-size: 7pt;
  1410. font-weight: bold;
  1411. }
  1412. .pagination > a {
  1413. text-decoration: none !important;
  1414. }
  1415. .pagination {
  1416. float: left;
  1417. left: 0;
  1418. margin-bottom: 10px;
  1419. }
  1420. .pagin * {
  1421. padding: 2px 6px;
  1422. margin: 0;
  1423. }
  1424. .pagin a {
  1425. border: solid 1px #666666;
  1426. background-color: #F1E0C6;
  1427. color: #000;
  1428. text-decoration: none;
  1429. }
  1430. .pagin a:hover, .pagin a:active {
  1431. border: solid 1px #CC0000;
  1432. background-color: white;
  1433. color: #CC0000;
  1434. text-decoration: none;
  1435. }
  1436. .pagin span {
  1437. cursor: default;
  1438. border: solid 1px #808080;
  1439. background-color: #D4C0A1;
  1440. color: #000;
  1441. }
  1442. .pagin span.current {
  1443. border: solid 1px #666666;
  1444. background-color: #666666;
  1445. color: white;
  1446. }
  1447. </style>';
  1448.  
  1449. # Paginação do conteúdo
  1450. if ($offers_count[0]['offers_count'] > $trade_config['results_per_page']) {
  1451. $main_content .= '
  1452. <div class="pagination">
  1453. <div class="pagin">';
  1454. if ($page > ($pgs / 2))
  1455. $main_content .= '<a href="?subtopic=tradecharacter&action=listsell&page=1'.((isset($_REQUEST['voc'])) ? '&voc='.$WvocationA : '').'">« </a>';
  1456. else
  1457. $main_content .= '<span>« </span>';
  1458.  
  1459. for ($i = $start2; $i <= $limit; $i++) {
  1460. if ($i == $page)
  1461. $main_content .= " <strong>" . $i . "</strong>";
  1462. elseif ($i >= 1 && $i <= $pgs)
  1463. $main_content .= ' <a href="?subtopic=tradecharacter&action=listsell&page='.$i.((isset($_REQUEST['voc'])) ? '&voc='.$WvocationA : '').'">' . $i . '</a>';
  1464. }
  1465.  
  1466. if ($page < ($pgs / 2))
  1467. $main_content .= ' <a href="?subtopic=tradecharacter&action=listsell&page='.$pgs.((isset($_REQUEST['voc'])) ? '&voc='.$WvocationA : '').'"> »</a>';
  1468. else
  1469. $main_content .= ' <span> »</span>';
  1470. $main_content .= '
  1471. </div>
  1472. </div>
  1473. <div style="clear: both;"></div>';
  1474. }
  1475.  
  1476. $main_content .= '
  1477. <style>
  1478. .buycharactersbox a, .buycharactersbox a:hover {
  1479. color: #FFF;
  1480. }
  1481. </style>';
  1482. $main_content .= '
  1483. <div class="TableContainer">
  1484. <div class="CaptionContainer">
  1485. <div class="CaptionInnerContainer">
  1486. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1487. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1488. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  1489. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  1490. <div class="Text buycharactersbox">
  1491. <span>Comprar Personagens</span>';
  1492.  
  1493. if (isset($Aall_sold_characters_ZZ[0]))
  1494. $main_content .= '
  1495. <br><small style="font-weight: normal; font-size: 11px;"><strong>Filter by vocation:</strong> '.(($WvocationA == "") ? 'All' : '<a href="?subtopic=tradecharacter" alt="All vocations">All</a>').' | '.(($WvocationA == "sorcerer") ? 'Sorcerer' : '<a href="?subtopic=tradecharacter&voc=sorcerer" alt="Sorcerer">Sorcerer</a>').' | '.(($WvocationA == "druid") ? 'Druid' : '<a href="?subtopic=tradecharacter&voc=druid" alt="Druid">Druid</a>').' | '.(($WvocationA == "paladin") ? 'Paladin' : '<a href="?subtopic=tradecharacter&voc=paladin" alt="Paladin">Paladin</a>').' | '.(($WvocationA == "knight") ? 'Knight' : '<a href="?subtopic=tradecharacter&voc=knight" alt="Knight">Knight</a>').'</small>';
  1496.  
  1497. $main_content .= '
  1498. </div>
  1499. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  1500. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  1501. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1502. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1503. </div>
  1504. </div>
  1505. <table class="Table3" cellpadding="0" cellspacing="0">
  1506. <tbody>
  1507. <tr>
  1508. <td>
  1509. <div class="InnerTableContainer">
  1510. <table style="width:100%;">
  1511. <tr>
  1512. <td>
  1513. <div class="TableShadowContainerRightTop" >
  1514. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  1515. </div>
  1516. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  1517. <div class="TableContentContainer" >
  1518. <table class="TableContent" width="100%">
  1519. <tr style="background-color:#D4C0A1;">
  1520. <td width="5%"></td>
  1521. <td><strong>Personagem</strong></td>
  1522. <td width="12%" align="center"><strong>Custo</strong></td>
  1523. <td width="22%"></td>
  1524. </tr>';
  1525. if (isset($Aall_sold_characters_ZZ[0])) {
  1526. if (isset($Asold_characters_ZZ[0])) {
  1527. # lista de personagens a venda
  1528.  
  1529. foreach($Asold_characters_ZZ as $char) {
  1530.  
  1531. $player = new Player();
  1532. $player->load($char['player_id']);
  1533.  
  1534. if ($player->isLoaded()) {
  1535. $bgcolor = (($number++ % 2 == 1) ? '#D4C0A1' : '#F1E0C6');
  1536. $main_content .= '
  1537. <tr style="background-color:'.$bgcolor.';">
  1538. <td width="10%" height="25px" style="position: relative;">';
  1539. if ($player->getSkull()) {
  1540. if ($player->getSkull() == 4) {
  1541. $main_content .= '<img src="images/Red_Skull.gif" width="11px" height="11px" alt="" style="position: absolute; top:0; right: 15px;">';
  1542. } elseif ($player->getSkull() == 5) {
  1543. $main_content .= '<img src="images/Black_Skull.gif" width="11px" height="11px" alt="" style="position: absolute; top:0; right: 15px;">';
  1544. }
  1545. }
  1546. $main_content .= '
  1547. <img src="' . $config['site']['outfit_images_url'] . '?id='.$player->getLookType().'&addons='.$player->getLookAddons().'&head='.$player->getLookHead().'&body='.$player->getLookBody().'&legs='.$player->getLookLegs().'&feet='.$player->getLookFeet().'" style="position: absolute; top: -30px; left: -15px;" />
  1548.  
  1549.  
  1550. </td>
  1551. <td><a href="?subtopic=characters&name='.urlencode(htmlspecialchars($player->getName())).'">'.htmlspecialchars($player->getName()).'</a><br><small>'.htmlspecialchars($vocation_name[$player->getVocation()]).' - Level '.$player->getLevel().'</small></td>
  1552. <td align="center">'.$char['price'].' coins</td>
  1553. <td valign="middle" align="center">';
  1554.  
  1555. if ($char['player_account'] == $account_logged->getID()) {
  1556. $main_content .= '
  1557. <input type="hidden" name="buying" value="'.$player->getID().'">
  1558. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_red.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_red_over.gif);" ></div><input class="ButtonText" id="cancelsale" data-id="'.$char['player_id'].'" type="image" name="Cancel Sale" alt="Cancel Sale" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" ></div></div>';
  1559. } else {
  1560. $main_content .= '
  1561. <form action="?subtopic=tradecharacter&action=buy" method="post" style="margin: 0; padding: 0;">
  1562. <input type="hidden" name="buying" value="'.$player->getID().'">
  1563. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);" ></div><input class="ButtonText" type="image" name="Buy Character" alt="Buy Character" src="'.$layout_name.'/images/buttons/detalhe.png" ></div></div>
  1564. </form>';
  1565. }
  1566.  
  1567. $main_content .= '
  1568. </td>
  1569. </tr>';
  1570. }
  1571. }
  1572.  
  1573. } else {
  1574. $main_content .= '
  1575. <tr style="background-color:#F1E0C6;"><td colspan="4">No characters of vocation ' . $WvocationA . ' for sale.</td></tr>';
  1576. }
  1577. } else {
  1578. $main_content .= '
  1579. <tr style="background-color:#F1E0C6;"><td colspan="4">Não há personagens para comprar.</td></tr>';
  1580. }
  1581.  
  1582. $main_content .= '
  1583. </table>
  1584. </div>
  1585. </div>
  1586. <div class="TableShadowContainer" >
  1587. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  1588. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  1589. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  1590. </div>
  1591. </div>
  1592. </td>
  1593. </tr>
  1594. </table>
  1595. </div>
  1596. </td>
  1597. </tr>
  1598. </tbody>
  1599. </table>
  1600. </div><br>
  1601. <center>
  1602. <form action="?subtopic=tradecharacter" method="post">
  1603. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Buy Character" alt="Buy Character" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  1604. </form>
  1605. </center>';
  1606. $main_content .= '
  1607. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">';
  1608. }
  1609.  
  1610. if ($action == "buy") {
  1611. if ($logged) {
  1612. if (isset($_REQUEST['buying'])) {
  1613. $AplayerId_Z = (int) $_REQUEST['buying'];
  1614.  
  1615. $Aselling_ZZ = $SQL->query("SELECT * FROM `player_selling` WHERE `player_id` = " . $AplayerId_Z)->fetch();
  1616. if (!isset($Aselling_ZZ[0])) {
  1617. $trade_errors[] = "This character is not for sale.";
  1618. }
  1619.  
  1620. if (empty($trade_errors)) {
  1621. $character = new Player();
  1622. $character->load($AplayerId_Z);
  1623.  
  1624. if (!$character->isLoaded()) {
  1625. $trade_errors[] = "The character entered is invalid.";
  1626. }
  1627. }
  1628.  
  1629. if (empty($trade_errors)) {
  1630. $main_content .= '
  1631. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  1632. <center><table><tr><td><img src="'.$layout_name.'/images/content/headline-bracer-left.gif" /></td><td style="text-align:center;vertical-align:middle;horizontal-align:center;font-size:17px;font-weight:bold;" >Character: '.htmlspecialchars($character->getName()).'<br/></td><td><img src="'.$layout_name.'/images/content/headline-bracer-right.gif" /></td></tr></table><br/></center>
  1633. <p>Below are information about the purchase of the character and also some specifications of the character.</p>';
  1634.  
  1635. $main_content .= '
  1636. <div class="SmallBox">
  1637. <div class="MessageContainer">
  1638. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);"></div>
  1639. <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  1640. <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  1641. <div class="Message">
  1642. <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);"></div>
  1643. <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);"></div>
  1644. <table class="HintBox">
  1645. <tbody>
  1646. <tr>
  1647. <td><i><small>When you buy this character, it will automatically go to the account used at the moment of purchase. All items in the backpack or inside the depot and/or inbox will be available to the buyer. If the character owns a house, it will also be available for use by the new owner.<br><br>When purchasing the character you must choose a new name for it.</small></i></td>
  1648. </tr>
  1649. </tbody>
  1650. </table>
  1651. </div>
  1652. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);"></div>
  1653. <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  1654. <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  1655. </div>
  1656. </div><br>';
  1657.  
  1658. $main_content .= '
  1659. <div class="TableContainer">
  1660. <div class="CaptionContainer" >
  1661. <div class="CaptionInnerContainer" >
  1662. <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  1663. <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  1664. <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>
  1665. <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  1666. <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  1667. <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>
  1668. <div class="Text" >Informations</div>
  1669. <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>
  1670. <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)></span>
  1671. <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  1672. <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  1673. </div>
  1674. </div>
  1675. <table class="Table3" cellpadding="0" cellspacing="0">
  1676. <tbody>
  1677. <tr>
  1678. <td>
  1679. <div class="InnerTableContainer">
  1680. <table style="width:100%;">
  1681. <tr>
  1682. <td>
  1683. <div class="TableShadowContainerRightTop" >
  1684. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  1685. </div>
  1686. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  1687. <div class="TableContentContainer" >
  1688. <table class="TableContent" width="100%">
  1689. <tr bgcolor="#D4C0A1">
  1690. <td><strong>New Name:</strong></td>
  1691. <td><input style="width: 100%; height: 28px; padding: 5px;" type="text" name="new-name" id="new-name" placeholder="Type a new name for your new character"></td>
  1692. </tr>
  1693. </table>
  1694. </div>
  1695. </div>
  1696. <div class="TableShadowContainer" >
  1697. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  1698. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  1699. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  1700. </div>
  1701. </div>
  1702. </td>
  1703. </tr>
  1704. <tr>
  1705. <td>
  1706. <div class="TableShadowContainerRightTop" >
  1707. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  1708. </div>
  1709. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);">
  1710. <div class="TableContentContainer">
  1711. <table class="TableContent" width="100%">
  1712. <tr bgcolor="#505050">
  1713. <tr align="center">
  1714. <td><strong>Character:</strong></td>
  1715. <td><strong>Inventory:</strong></td>
  1716. <td><strong>Addons:</strong></td>
  1717. <td><strong>Mounts:</strong></td>
  1718. </tr>
  1719. <tr bgcolor="#F1E0C6">
  1720. <TD WIDTH=20%><center>
  1721.  
  1722.  
  1723.  
  1724. <img src="' . $config['site']['outfit_images_url'] . '?id='.$character->getLookType().'&addons='.$character->getLookAddons().'&head='.$character->getLookHead().'&body='.$character->getLookBody().'&legs='.$character->getLookLegs().'&feet='.$character->getLookFeet().'&mount=0" /><br>
  1725. <small><a href="?subtopic=characters&name='.urlencode($character->getName()).'">'.htmlspecialchars($character->getName()).'</a></small><br><small>(' . htmlspecialchars(Website::getVocationName($character->getVocation())) . ')</small><br><br>
  1726. <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=1><tr bgcolor="#505050">
  1727. <tr bgcolor="#D4C0A1">
  1728. <td><font size="1"><strong>Level:</strong></font></td>
  1729. <td WIDTH=30%><font size="1">'.$character->getLevel().'</font></td>
  1730. </tr>
  1731. <tr bgcolor="#F1E0C6">
  1732. <td><font size="1"><b>Magic Level:</b></font></td>
  1733. <td WIDTH=30%><font size="1">'.$character->getMagLevel().'</font></td>
  1734. </tr>
  1735. <tr bgcolor="#D4C0A1">
  1736. <td><font size="1"><b>Fist:</b></font></td>
  1737. <td WIDTH=30%><font size="1">'.$character->getSkill(0).'</font></td>
  1738. </tr>
  1739. <tr bgcolor="#F1E0C6">
  1740. <td><font size="1"><b>Club:</b></font></td>
  1741. <td WIDTH=30%><font size="1">'.$character->getSkill(1).'</font></td>
  1742. </tr>
  1743. <tr bgcolor="#D4C0A1">
  1744. <td><font size="1"><b>Sword:</b></font></td>
  1745. <td WIDTH=30%><font size="1">'.$character->getSkill(2).'</font></td>
  1746. </tr>
  1747. <tr bgcolor="#F1E0C6">
  1748. <td><font size="1"><b>Axe:</b></font></td>
  1749. <td WIDTH=30%><font size="1">'.$character->getSkill(3).'</font></td>
  1750. </tr>
  1751. <tr bgcolor="#D4C0A1">
  1752. <td><font size="1"><b>Distance:</b></font></td>
  1753. <td WIDTH=30%><font size="1">'.$character->getSkill(4).'</font></td>
  1754. </tr>
  1755. <tr bgcolor="#F1E0C6">
  1756. <td><font size="1"><b>Shielding:</b></font></td>
  1757. <td WIDTH=30%><font size="1">'.$character->getSkill(5).'</font></td>
  1758. </tr>
  1759. <tr bgcolor="#D4C0A1">
  1760. <td><font size="1"><b>Fishing:</b></font></td>
  1761. <td WIDTH=30%><font size="1">'.$character->getSkill(6).'</font></td>
  1762. </tr>
  1763. <tr bgcolor="#F1E0C6">
  1764. <td><font size="1"><b>Balance:</b></font></td>
  1765. <td WIDTH=70%><font size="1">'.$character->getBalance().'</font></td>
  1766. </tr>
  1767. </table>
  1768. </center>
  1769. </td>
  1770. <td align=center width=23%>
  1771. <table with=100% style="border: solid 1px #888888;" CELLSPACING="1">
  1772. <TR>';
  1773. //equipment shower
  1774. $number_of_items = 1;
  1775. $main_content .= '<td align=center><table with=100% style="border: solid 1px #888888;" CELLSPACING="1"><TR>';
  1776.  
  1777. $list = array('2','1','3','6','4','5','9','7','10','8');
  1778.  
  1779. foreach ($list as $pid => $name) {
  1780. $AtopZ = $SQL->query('SELECT * FROM player_items WHERE player_id = '.$character->getID().' AND pid = '.$list[$pid].';')->fetch();
  1781. if($AtopZ['itemtype'] == false) {
  1782. if($list[$pid] == '8') {
  1783. $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$character->getSoul().'</td>';
  1784. }
  1785. if(is_int($number_of_items / 3)){
  1786. $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD></tr><tr>';
  1787. } else {
  1788. $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD>';
  1789. }
  1790. $number_of_items++;
  1791. } else {
  1792. if($list[$pid] == '8') {
  1793. $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$character->getSoul().'</td>';
  1794. }
  1795. if(is_int($number_of_items / 3))
  1796. $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$AtopZ['itemtype'].'.gif" width="45"/></TD></tr><tr>';
  1797. else
  1798. $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$AtopZ['itemtype'].'.gif" width="45"/></TD>';
  1799. $number_of_items++;
  1800. }
  1801. if($list[$pid] == '8') {
  1802. $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Cap:<br/>'.$character->getCap().'</td>';
  1803. }
  1804. }
  1805. $main_content .= '</tr></TABLE></td>';
  1806. $main_content .= '
  1807. </font>
  1808. </TD>
  1809. </tr>
  1810. </table><br>
  1811. <table with=100% style="border: solid 1px #888888;" CELLSPACING="1">';
  1812.  
  1813. # Main backpack items
  1814. $characterItems = $character->getItems();
  1815.  
  1816. $mainBackpack = $characterItems->getSlot(Item::SLOT_BACKPACK);
  1817. if ($mainBackpack) {
  1818.  
  1819. $bpSid = $mainBackpack->getSID();
  1820. $bpItems = $characterItems->getItem($bpSid); // get items inside container
  1821.  
  1822. $bpItemsCount = count($bpItems);
  1823.  
  1824. if ($bpItemsCount <= 4)
  1825. $colSpan = $bpItemsCount;
  1826. else
  1827. $colSpan = 4;
  1828.  
  1829. $main_content .= '
  1830. <tr>
  1831. <td style="background-color: #D4C0A1; text-align: center;" colspan="'.$colSpan.'"><strong>Main Backpack</strong></td>
  1832. </tr>';
  1833.  
  1834. if ($bpItemsCount > 0) {
  1835. $bp_items = 1;
  1836.  
  1837. $main_content .= '<tr>';
  1838.  
  1839. foreach($bpItems as $item) {
  1840. if (is_int($bp_items / 4)) {
  1841. $main_content .= '
  1842. <td style="background-color: #D4C0A1; text-align: center;"><img src="images/items/'. $item->getID() .'.gif" /><div style="position: absolute; margin-top: -13px;">' . $item->getCount() . '</div></td>
  1843. </tr><tr>';
  1844. } else {
  1845. $main_content .= '
  1846. <td style="background-color: #D4C0A1; text-align: center;"><img src="images/items/'. $item->getID() .'.gif" /><div style="position: absolute; margin-top: -13px;">' . $item->getCount() . '</div></td>';
  1847. }
  1848. $bp_items++;
  1849. }
  1850. } else {
  1851. $main_content .= '
  1852. <tr bgcolor="#F1E0C6">
  1853. <td>Empty</td>
  1854. </tr>';
  1855. }
  1856. }
  1857.  
  1858.  
  1859. $main_content .= '
  1860. </table>
  1861. <TD WIDTH=30% valign="top">';
  1862.  
  1863. # Show outfits
  1864. define('PSTRG_RESERVED_RANGE_START', 10000000);
  1865. define('PSTRG_OUTFITS_RANGE_START', PSTRG_RESERVED_RANGE_START + 1000);
  1866. define('PSTRG_OUTFITS_RANGE_SIZE', 500);
  1867. define('PSTRG_MOUNTS_RANGE_START', PSTRG_RESERVED_RANGE_START + 2001);
  1868. define('PSTRG_MOUNTS_RANGE_SIZE', 10);
  1869. define('PSTRG_MOUNTS_CURRENTMOUNT', PSTRG_MOUNTS_RANGE_START + 10);
  1870.  
  1871. $outfits = [];
  1872.  
  1873. for($key = PSTRG_OUTFITS_RANGE_START; $key < PSTRG_OUTFITS_RANGE_START + PSTRG_OUTFITS_RANGE_SIZE; $key++) {
  1874. $value = $character->getStorage($key);
  1875. if ($value !== null) {
  1876. $outfitType = ($value & 0xFFFF0000) >> 16;
  1877. $outfitAddonToImageGenerator = ($value & 0x0000FFFF);
  1878. $main_content .= '
  1879. <img src="' . $config['site']['outfit_images_url'] . '?id='.$outfitType.'&addons='.$outfitAddonToImageGenerator.'&head='.$character->getLookHead().'&body='.$character->getLookBody().'&legs='.$character->getLookLegs().'&feet='.$character->getLookFeet().'&mount=0" width="45" valign="top" />';
  1880. }
  1881. }
  1882.  
  1883. $main_content .= '
  1884. </TD>
  1885. <TD WIDTH=30% valign="top">';
  1886.  
  1887. $dataPath = $config['site']['serverPath'].'data/';
  1888. $xml = simplexml_load_string(file_get_contents($dataPath . 'XML/mounts.xml'), 'SimpleXMLElement', LIBXML_NOCDATA);
  1889. $array = json_decode(json_encode((array)$xml), TRUE);
  1890.  
  1891. for($mountId = 1; $mountId <= count($array['mount']); $mountId++) {
  1892. $tmpMountId = $mountId - 1;
  1893. $key = PSTRG_MOUNTS_RANGE_START + ($tmpMountId / 31);
  1894. $value = $character->getStorage($key);
  1895.  
  1896. if ($value !== null) {
  1897. $hasMount = ((1 << ($tmpMountId % 31)) & $value);
  1898. if ($hasMount) {
  1899. $clientIdMount = $array['mount'][$tmpMountId]['@attributes']['clientid'];
  1900. $mountName = $array['mount'][$tmpMountId]['@attributes']['name'];
  1901.  
  1902. $main_content .= '<img src="outfits/outfitsAnim1152mgnocopy/'.$clientIdMount.'/1_1_1_3.png" style="height: auto; width: 40px" valign="top" title="'.$mountName.'" />';
  1903. }
  1904. }
  1905. }
  1906.  
  1907. $main_content .= '
  1908. </TR> </TD>
  1909. </table>
  1910. </div>
  1911. </div>
  1912. <div class="TableShadowContainer" >
  1913. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  1914. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  1915. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  1916. </div>
  1917. </div>
  1918. </td>
  1919. </tr>
  1920. <tr>
  1921. <td>
  1922. <div class="TableShadowContainerRightTop" >
  1923. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  1924. </div>
  1925. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  1926. <div class="TableContentContainer" >
  1927. <table class="TableContent" width="100%">
  1928. <tr bgcolor="#D4C0A1">
  1929. <td><strong>Depot Items</strong></td>
  1930. </tr>
  1931. <tr bgcolor="#F1E0C6">
  1932. <td>';
  1933. # Depot Items
  1934.  
  1935. $AdepotItemsZ = $SQL->query("SELECT `itemtype`, `count` FROM `player_depotitems` WHERE `player_id` = " . $character->getID())->fetchAll();
  1936.  
  1937. if (isset($AdepotItemsZ[0])) {
  1938. foreach($AdepotItemsZ as $dpItem) {
  1939. $main_content .= '
  1940. <span style="display: inline-block; box-sizing: border-box; padding: 3px; margin-bottom: 1px; margin-right: 1px; background: #D4C0A1; text-align: center;"><img src="images/items/'. $dpItem['itemtype'] .'.gif" /><div style="position: absolute; margin-top: -13px;">' . $dpItem['count'] . '</div></span>';
  1941. }
  1942. }
  1943.  
  1944. $main_content .= '
  1945. </td>
  1946. </tr>
  1947. </table>
  1948. </div>
  1949. </div>
  1950. <div class="TableShadowContainer" >
  1951. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  1952. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  1953. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  1954. </div>
  1955. </div>
  1956. </td>
  1957. </tr>
  1958. <tr>
  1959. <td>
  1960. <div class="TableShadowContainerRightTop" >
  1961. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  1962. </div>
  1963. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  1964. <div class="TableContentContainer" >
  1965. <table class="TableContent" width="100%">
  1966. <tr bgcolor="#D4C0A1">
  1967. <td><strong>Character Price:</strong></td>
  1968. <td>'.$Aselling_ZZ['price'].' coins</td>
  1969. </tr>
  1970. </table>
  1971. </div>
  1972. </div>
  1973. <div class="TableShadowContainer" >
  1974. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  1975. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  1976. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  1977. </div>
  1978. </div>
  1979. </td>
  1980. </tr>
  1981. <tr>
  1982. <td align="center">
  1983. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);" ></div><input id="buychar" class="ButtonText" type="image" name="Buy Character" alt="Buy Character" src="'.$layout_name.'/images/buttons/comprar_char.gif" ></div></div>
  1984.  
  1985. <input type="hidden" name="buyCharId" id="buyCharId" value="'.$character->getID().'">
  1986. <input type="hidden" name="buyerId" id="buyerId" value="'.$account_logged->getID().'">
  1987. </td>
  1988. </tr>
  1989. </table>
  1990. </div>
  1991. </td>
  1992. </tr>
  1993. </tbody>
  1994. </table>
  1995. </div><br>
  1996. <center>
  1997. <table border="0" cellspacing="0" cellpadding="0" >
  1998. <form action="?subtopic=tradecharacter" method="post" >
  1999. <tr>
  2000. <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  2001. </td>
  2002. </tr>
  2003. </form>
  2004. </table>
  2005. </center>';
  2006. } else {
  2007. $main_content .= '
  2008. <div class="SmallBox" >
  2009. <div class="MessageContainer" >
  2010. <div class="BoxFrameHorizontal" style="background-image:url(./layouts/tibiacom/images/content/box-frame-horizontal.gif);" /></div>
  2011. <div class="BoxFrameEdgeLeftTop" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2012. <div class="BoxFrameEdgeRightTop" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2013. <div class="ErrorMessage" >
  2014. <div class="BoxFrameVerticalLeft" style="background-image:url(./layouts/tibiacom/images/content/box-frame-vertical.gif);" /></div>
  2015. <div class="BoxFrameVerticalRight" style="background-image:url(./layouts/tibiacom/images/content/box-frame-vertical.gif);" /></div>
  2016. <div class="AttentionSign" style="background-image:url(./layouts/tibiacom/images/content/attentionsign.gif);" /></div>
  2017. <b>The Following Errors Have Occurred:</b>';
  2018. foreach($trade_errors as $error)
  2019. $main_content.= '<li>'. htmlspecialchars($error);
  2020. $main_content .= '
  2021. </div>
  2022. <div class="BoxFrameHorizontal" style="background-image:url(./layouts/tibiacom/images/content/box-frame-horizontal.gif);" /></div>
  2023. <div class="BoxFrameEdgeRightBottom" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2024. <div class="BoxFrameEdgeLeftBottom" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2025. </div>
  2026. </div><br>
  2027. <center>
  2028. <table border="0" cellspacing="0" cellpadding="0" >
  2029. <form action="?subtopic=tradecharacter" method="post" >
  2030. <tr>
  2031. <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  2032. </td>
  2033. </tr>
  2034. </form>
  2035. </table>
  2036. </center>';
  2037. }
  2038.  
  2039. } else {
  2040. header("location: ?subtopic=tradecharacter");
  2041. }
  2042. } else {
  2043. $main_content .= '
  2044. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  2045. <div class="TableContainer">
  2046. <div class="CaptionContainer">
  2047. <div class="CaptionInnerContainer">
  2048. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2049. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2050. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  2051. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  2052. <div class="Text">Error</div>
  2053. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  2054. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  2055. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2056. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2057. </div>
  2058. </div>
  2059. <table class="Table5" cellpadding="0" cellspacing="0">
  2060. <tbody>
  2061. <tr>
  2062. <td>
  2063. <div class="InnerTableContainer">
  2064. <table style="width: 100%;">
  2065. <tbody>
  2066. <tr>
  2067. <td>
  2068. <div class="InnerTableContainer">
  2069. <p><center>You are not logged in.</center></p>
  2070. </div>
  2071. </td>
  2072. </tr>
  2073. </tbody>
  2074. </table>
  2075. </div>
  2076. </td>
  2077. </tr>
  2078. </tbody>
  2079. </table>
  2080. </div><br>
  2081. <center>
  2082. <table border="0" cellpadding="0" cellspacing="0" style="margin-bottom: 15px">
  2083. <tbody><tr><td style="border: 0px none;">
  2084. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  2085. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  2086. <a href="?subtopic=accountmanagement"><input class="ButtonText" name="Login" alt="Login" src="'.$layout_name.'/images/buttons/_sbutton_login.gif" type="image"></a></div></div></td></tr></tbody>
  2087. </table>
  2088. </center>';
  2089. }
  2090.  
  2091. }
  2092.  
  2093. if ($action == "sell") {
  2094. if ($logged) {
  2095. if (isset($_REQUEST['selling'])) {
  2096. $name = trim(strip_tags($_REQUEST['selling']));
  2097.  
  2098. if ($account_logged->isBanned())
  2099. $trade_errors[] = "You can not sell your character. Your account was banned.";
  2100.  
  2101. $character = new Player();
  2102. $character->loadByName($name);
  2103.  
  2104. if (!$character->isLoaded())
  2105. $trade_errors[] = "The character entered is invalid or does not exist.";
  2106.  
  2107. if ($character->isDeleted())
  2108. $trade_errors[] = "Your character was deleted.";
  2109.  
  2110.  
  2111. $house = $SQL->query( 'SELECT `houses`.`id`, `houses`.`name`, `houses`.`town_id`, `houses`.`paid` FROM `houses` WHERE `houses`.`owner` = '.$character->getId().';' )->fetch();
  2112. if (!empty($house))
  2113. $trade_errors[] = "Your character can not be sold because you own a house.";
  2114.  
  2115. if ($character->getGroupID() > 1)
  2116. $trade_errors[] = "Your character is Tutor, you need to leave the tutor position.";
  2117.  
  2118. if($character->hasGuild())
  2119. $trade_errors[] = "You can not sell a char that is in Guild.";
  2120.  
  2121. if ($character->isOnline())
  2122. $trade_errors[] = "The informed character is online, to sell a character is necessary that it's logged out.";
  2123.  
  2124. if ($character->getAccount()->getID() != $account_logged->getID())
  2125. $trade_errors[] = "This character does not belong to your account.";
  2126.  
  2127. if (empty($trade_errors)) {
  2128. $main_content .= '
  2129. <center><table><tr><td><img src="'.$layout_name.'/images/content/headline-bracer-left.gif" /></td><td style="text-align:center;vertical-align:middle;horizontal-align:center;font-size:17px;font-weight:bold;" >Character: '.htmlspecialchars($character->getName()).'<br/></td><td><img src="'.$layout_name.'/images/content/headline-bracer-right.gif" /></td></tr></table><br/></center>
  2130. <p>Below is some information about your sale and your character.</p>';
  2131.  
  2132. $main_content .= '
  2133. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  2134. <div class="SmallBox">
  2135. <div class="MessageContainer">
  2136. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);"></div>
  2137. <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  2138. <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  2139. <div class="Message">
  2140. <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);"></div>
  2141. <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);"></div>
  2142. <table class="HintBox">
  2143. <tbody>
  2144. <tr>
  2145. <td><i><small>The character selling system <strong>has a '.$trade_config['taxPercent'].'% charge on the sale value</strong>, so just put your character up for sale if you really want to sell it. Once put up for sale you can cancel, however the service fee will not be returned.</small></i></td>
  2146. </tr>
  2147. </tbody>
  2148. </table>
  2149. </div>
  2150. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);"></div>
  2151. <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  2152. <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></div>
  2153. </div>
  2154. </div><br>';
  2155.  
  2156. $main_content .= '
  2157. <div class="TableContainer">
  2158. <div class="CaptionContainer" >
  2159. <div class="CaptionInnerContainer" >
  2160. <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  2161. <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  2162. <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>
  2163. <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  2164. <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2165. <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>
  2166. <div class="Text" >Character Info</div>
  2167. <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>
  2168. <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)></span>
  2169. <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  2170. <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>
  2171. </div>
  2172. </div>
  2173. <table class="Table3" cellpadding="0" cellspacing="0">
  2174. <tbody>
  2175. <tr>
  2176. <td>
  2177. <div class="InnerTableContainer" >
  2178. <table style="width:100%;" >
  2179. <tr>
  2180. <td>
  2181. <div class="TableShadowContainerRightTop" >
  2182. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  2183. </div>
  2184. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  2185. <div class="TableContentContainer" >
  2186. <table class="TableContent" width="100%">
  2187. <tr bgcolor="#D4C0A1">
  2188. <td><strong>Character</strong></td>
  2189. <td><strong><center>Inventory</center></strong></td>
  2190.  
  2191. </tr>
  2192. <tr bgcolor="#F1E0C6">
  2193. <TD WIDTH=33%>
  2194. <center>
  2195.  
  2196.  
  2197.  
  2198. <img src="' . $config['site']['outfit_images_url'] . '?id='.$character->getLookType().'&addons='.$character->getLookAddons().'&head='.$character->getLookHead().'&body='.$character->getLookBody().'&legs='.$character->getLookLegs().'&feet='.$character->getLookFeet().'&mount=0" /><br>
  2199. <A HREF="?subtopic=characters&name='.urlencode($character->getName()).'">'.$character->getName().'</A><br>
  2200. <font size="1">(' . htmlspecialchars(Website::getVocationName($character->getVocation())) . ')</font><br><br>
  2201. <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=1>
  2202. <tr bgcolor="#505050">
  2203. <tr bgcolor="#D4C0A1">
  2204. <td><font size="1"><b>Level:</b></font></td>
  2205. <td WIDTH=70%><font size="1">'.$character->getLevel().'</font></td>
  2206. </tr>
  2207. <tr bgcolor="#F1E0C6">
  2208. <td><font size="1"><b>Magic Level:</b></font></td>
  2209. <td WIDTH=70%><font size="1">'.$character->getMagLevel().'</font></td>
  2210. </tr>
  2211. <tr bgcolor="#D4C0A1">
  2212. <td><font size="1"><b>Fist:</b></font></td>
  2213. <td WIDTH=70%><font size="1">'.$character->getSkill(0).'</font></td>
  2214. </tr>
  2215. <tr bgcolor="#F1E0C6">
  2216. <td><font size="1"><b>Club:</b></font></td>
  2217. <td WIDTH=70%><font size="1">'.$character->getSkill(1).'</font></td>
  2218. </tr>
  2219. <tr bgcolor="#D4C0A1">
  2220. <td><font size="1"><b>Sword:</b></font></td>
  2221. <td WIDTH=70%><font size="1">'.$character->getSkill(2).'</font></td>
  2222. </tr>
  2223. <tr bgcolor="#F1E0C6">
  2224. <td><font size="1"><b>Axe:</b></font></td>
  2225. <td WIDTH=70%><font size="1">'.$character->getSkill(3).'</font></td>
  2226. </tr>
  2227. <tr bgcolor="#D4C0A1">
  2228. <td><font size="1"><b>Distance:</b></font></td>
  2229. <td WIDTH=70%><font size="1">'.$character->getSkill(4).'</font></td>
  2230. </tr>
  2231. <tr bgcolor="#F1E0C6">
  2232. <td><font size="1"><b>Shielding:</b></font></td>
  2233. <td WIDTH=70%><font size="1">'.$character->getSkill(5).'</font></td>
  2234. </tr>
  2235. <tr bgcolor="#D4C0A1">
  2236. <td><font size="1"><b>Fishing:</b></font></td>
  2237. <td WIDTH=70%><font size="1">'.$character->getSkill(6).'</font></td>
  2238. </tr>
  2239. <tr bgcolor="#F1E0C6">
  2240. <td><font size="1"><b>Balance:</b></font></td>
  2241. <td WIDTH=70%><font size="1">'.$character->getBalance().'</font></td>
  2242. </tr>
  2243. </table>
  2244. </center>
  2245. </td>';
  2246. //equipment shower by ballack13
  2247. $number_of_items = 1;
  2248. $main_content .= '<td align=center><table with=100% style="border: solid 1px #888888;" CELLSPACING="1"><TR>';
  2249. $list = array('2','1','3','6','4','5','9','7','10','8');
  2250. foreach ($list as $pid => $name) {
  2251. $AtopZ = $SQL->query('SELECT * FROM player_items WHERE player_id = '.$character->getId().' AND pid = '.$list[$pid].';')->fetch();
  2252. if($AtopZ['itemtype'] == NULL) {
  2253. if($list[$pid] == '8') {
  2254. $main_content .= '<td></td>';
  2255. }
  2256. if(is_int($number_of_items / 3)) {
  2257. $main_content .= '<TD style="background-color:#d4c0a1; text-align: center;"><img src="images/items/'.$list[$pid].'.gif" width="44" higth="44"/></TD></tr><tr>';
  2258. } else {
  2259. $main_content .= '<TD style="background-color: #d4c0a1; text-align: center;"><img src="images/items/'.$list[$pid].'.gif" width="44" higth="44"/></TD>';
  2260. }
  2261. $number_of_items++;
  2262. } else {
  2263. if($list[$pid] == '8') {
  2264. $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$character->getSoul().'</td>';
  2265. }
  2266. if(is_int($number_of_items / 3))
  2267. $main_content .= '<TD style="background-color: #d4c0a1; text-align: center;"><img src="images/items/'.$AtopZ['itemtype'].'.gif" width="44" higth="44"/></TD></tr><tr>';
  2268. else
  2269. $main_content .= '<TD style="background-color: #d4c0a1; text-align: center;"><img src="images/items/'.$AtopZ['itemtype'].'.gif" width="44" higth="44"/></TD>';
  2270. $number_of_items++;
  2271. }
  2272. if($list[$pid] == '8') {
  2273. $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Cap:<br/>'.$character->getCap().'</td>';
  2274. }
  2275. }
  2276. $main_content .= '</tr></TABLE></td>';
  2277.  
  2278.  
  2279.  
  2280. $main_content .= '
  2281. </font>
  2282. </TD>
  2283. </tr>
  2284. </table>
  2285. </div>
  2286. </div>
  2287. <div class="TableShadowContainer" >
  2288. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  2289. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  2290. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  2291. </div>
  2292. </div>
  2293. </td>
  2294. </tr>
  2295. <tr>
  2296. <td>
  2297. <div class="TableShadowContainerRightTop" >
  2298. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  2299. </div>
  2300. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  2301. <div class="TableContentContainer" >
  2302. <table class="TableContent" width="100%">
  2303. <tr bgcolor="#D4C0A1">
  2304. <td><strong>Character Price:</strong></td>
  2305. <td><input type="number" name="charPrice" id="charPrice" placeholder="Min.: '.$trade_config['minPrice'].' - Max.: '.$trade_config['maxPrice'].'"></td>
  2306. </tr>
  2307. </table>
  2308. </div>
  2309. </div>
  2310. <div class="TableShadowContainer" >
  2311. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  2312. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  2313. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  2314. </div>
  2315. </div>
  2316. </td>
  2317. </tr>
  2318. <tr>
  2319. <td align="center">
  2320. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);" ></div><input id="sellchar" class="ButtonText" type="image" name="Continue" alt="Continue" src="'.$layout_name.'/images/buttons/_sbutton_continue.gif" ></div></div>
  2321.  
  2322. <input type="hidden" name="sellCharId" id="sellCharId" value="'.$character->getID().'">
  2323. <input type="hidden" name="sellerId" id="sellerId" value="'.$account_logged->getID().'">
  2324. </td>
  2325. </tr>
  2326. </table>
  2327. </div>
  2328. </td>
  2329. </tr>
  2330. </tbody>
  2331. </table>
  2332. </div><br>
  2333. <center>
  2334. <table border="0" cellspacing="0" cellpadding="0">
  2335. <form action="?subtopic=tradecharacter" method="post">
  2336. <tr>
  2337. <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  2338. </td>
  2339. </tr>
  2340. </form>
  2341. </table>
  2342. </center>';
  2343. } else {
  2344. $main_content .= '
  2345. <div class="SmallBox" >
  2346. <div class="MessageContainer" >
  2347. <div class="BoxFrameHorizontal" style="background-image:url(./layouts/tibiacom/images/content/box-frame-horizontal.gif);" /></div>
  2348. <div class="BoxFrameEdgeLeftTop" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2349. <div class="BoxFrameEdgeRightTop" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2350. <div class="ErrorMessage" >
  2351. <div class="BoxFrameVerticalLeft" style="background-image:url(./layouts/tibiacom/images/content/box-frame-vertical.gif);" /></div>
  2352. <div class="BoxFrameVerticalRight" style="background-image:url(./layouts/tibiacom/images/content/box-frame-vertical.gif);" /></div>
  2353. <div class="AttentionSign" style="background-image:url(./layouts/tibiacom/images/content/attentionsign.gif);" /></div>
  2354. <b>The Following Errors Have Occurred:</b>';
  2355. foreach($trade_errors as $error)
  2356. $main_content.= '<li>'. htmlspecialchars($error);
  2357. $main_content .= '
  2358. </div>
  2359. <div class="BoxFrameHorizontal" style="background-image:url(./layouts/tibiacom/images/content/box-frame-horizontal.gif);" /></div>
  2360. <div class="BoxFrameEdgeRightBottom" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2361. <div class="BoxFrameEdgeLeftBottom" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2362. </div>
  2363. </div><br>
  2364. <center>
  2365. <table border="0" cellspacing="0" cellpadding="0" >
  2366. <form action="?subtopic=tradecharacter" method="post" >
  2367. <tr>
  2368. <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  2369. </td>
  2370. </tr>
  2371. </form>
  2372. </table>
  2373. </center>';
  2374. }
  2375. } else {
  2376. if ($account_logged->isBanned())
  2377. $trade_errors[] = "You can not sell your character. Your account was banned.";
  2378.  
  2379. $account_players = array();
  2380. $p_count = 0;
  2381.  
  2382. foreach($account_logged->getPlayers() as $player) {
  2383. if ($player->getLevel() >= $trade_config['levelToSell']) {
  2384. $p_count++;
  2385. $account_players[$p_count]['name'] = $player->getName();
  2386. }
  2387. }
  2388.  
  2389. if (count($account_players) == 0)
  2390. $trade_errors[] = "You don't have any characters on your account to sell.";
  2391.  
  2392. if (empty($trade_errors)) {
  2393. $main_content .= '
  2394. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  2395. <p>Choose the character you want to sell to proceed with your sale.</p>
  2396. <div class="TableContainer">
  2397. <div class="CaptionContainer">
  2398. <div class="CaptionInnerContainer">
  2399. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2400. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2401. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  2402. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  2403. <div class="Text">Choose Character</div>
  2404. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  2405. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  2406. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2407. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2408. </div>
  2409. </div>
  2410. <form method="post" action="?subtopic=tradecharacter&action=sell">
  2411. <table class="Table3" cellpadding="0" cellspacing="0">
  2412. <tbody>
  2413. <tr>
  2414. <td>
  2415. <div class="InnerTableContainer">
  2416. <table style="width:100%;">
  2417. <tr>
  2418. <td>
  2419. <div class="TableShadowContainerRightTop" >
  2420. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div>
  2421. </div>
  2422. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" >
  2423. <div class="TableContentContainer" >
  2424. <table class="TableContent" width="100%">
  2425. <tr style="background-color:#D4C0A1;">
  2426. <td width="30%"><strong>Selecione o personagem</strong></td>
  2427. <td>
  2428. <select name="selling">';
  2429. for ($i = 0; $i <= count($account_players); $i++) {
  2430. if (!empty($account_players[$i]['name']))
  2431. $main_content .= '
  2432. <option value="'.htmlspecialchars($account_players[$i]['name']).'">'.htmlspecialchars($account_players[$i]['name']).'</option>';
  2433. }
  2434. $main_content .= '
  2435. </select>
  2436. </td>
  2437. </tr>
  2438. </table>
  2439. </div>
  2440. </div>
  2441. <div class="TableShadowContainer" >
  2442. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >
  2443. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>
  2444. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>
  2445. </div>
  2446. </div>
  2447. </td>
  2448. </tr>
  2449. </table>
  2450. <table>
  2451. <tr>
  2452. <td>
  2453. <center>
  2454. <input name="selectedcharacter" value="" type="hidden">
  2455. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green.gif)"><div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_green_over.gif);"></div><input class="ButtonText" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" type="image"></div></div>
  2456. </center>
  2457. </td>
  2458. </tr>
  2459. </table>
  2460. </form>
  2461. </div>
  2462. </td>
  2463. </tr>
  2464. </table>
  2465. </div><br>
  2466. <center>
  2467. <table border="0" cellspacing="0" cellpadding="0" >
  2468. <form action="?subtopic=tradecharacter" method="post" >
  2469. <tr>
  2470. <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  2471. </td>
  2472. </tr>
  2473. </form>
  2474. </table>
  2475. </center>';
  2476. } else {
  2477. $main_content .= '
  2478. <div class="SmallBox" >
  2479. <div class="MessageContainer" >
  2480. <div class="BoxFrameHorizontal" style="background-image:url(./layouts/tibiacom/images/content/box-frame-horizontal.gif);" /></div>
  2481. <div class="BoxFrameEdgeLeftTop" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2482. <div class="BoxFrameEdgeRightTop" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2483. <div class="ErrorMessage" >
  2484. <div class="BoxFrameVerticalLeft" style="background-image:url(./layouts/tibiacom/images/content/box-frame-vertical.gif);" /></div>
  2485. <div class="BoxFrameVerticalRight" style="background-image:url(./layouts/tibiacom/images/content/box-frame-vertical.gif);" /></div>
  2486. <div class="AttentionSign" style="background-image:url(./layouts/tibiacom/images/content/attentionsign.gif);" /></div>
  2487. <b>The Following Errors Have Occurred:</b>';
  2488. foreach($trade_errors as $error)
  2489. $main_content.= '<li>'. htmlspecialchars($error);
  2490. $main_content .= '
  2491. </div>
  2492. <div class="BoxFrameHorizontal" style="background-image:url(./layouts/tibiacom/images/content/box-frame-horizontal.gif);" /></div>
  2493. <div class="BoxFrameEdgeRightBottom" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2494. <div class="BoxFrameEdgeLeftBottom" style="background-image:url(./layouts/tibiacom/images/content/box-frame-edge.gif);" /></div>
  2495. </div>
  2496. </div><br>
  2497. <center>
  2498. <table border="0" cellspacing="0" cellpadding="0" >
  2499. <form action="?subtopic=tradecharacter" method="post" >
  2500. <tr>
  2501. <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div>
  2502. </td>
  2503. </tr>
  2504. </form>
  2505. </table>
  2506. </center>';
  2507. }
  2508. }
  2509. } else {
  2510. $main_content .= '
  2511. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">
  2512. <div class="TableContainer">
  2513. <div class="CaptionContainer">
  2514. <div class="CaptionInnerContainer">
  2515. <span class="CaptionEdgeLeftTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2516. <span class="CaptionEdgeRightTop" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2517. <span class="CaptionBorderTop" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  2518. <span class="CaptionVerticalLeft" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  2519. <div class="Text">Error</div>
  2520. <span class="CaptionVerticalRight" style="background-image: url('.$layout_name.'/images/content/box-frame-vertical.gif);"></span>
  2521. <span class="CaptionBorderBottom" style="background-image: url('.$layout_name.'/images/content/table-headline-border.gif);"></span>
  2522. <span class="CaptionEdgeLeftBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2523. <span class="CaptionEdgeRightBottom" style="background-image: url('.$layout_name.'/images/content/box-frame-edge.gif);"></span>
  2524. </div>
  2525. </div>
  2526. <table class="Table5" cellpadding="0" cellspacing="0">
  2527. <tbody>
  2528. <tr>
  2529. <td>
  2530. <div class="InnerTableContainer">
  2531. <table style="width: 100%;">
  2532. <tbody>
  2533. <tr>
  2534. <td>
  2535. <div class="InnerTableContainer">
  2536. <p><center>You are not logged in.</center></p>
  2537. </div>
  2538. </td>
  2539. </tr>
  2540. </tbody>
  2541. </table>
  2542. </div>
  2543. </td>
  2544. </tr>
  2545. </tbody>
  2546. </table>
  2547. </div><br>
  2548. <center>
  2549. <table border="0" cellpadding="0" cellspacing="0" style="margin-bottom: 15px">
  2550. <tbody><tr><td style="border: 0px none;">
  2551. <div class="BigButton" style="background-image: url('.$layout_name.'/images/buttons/sbutton.gif);">
  2552. <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
  2553. <a href="?subtopic=accountmanagement"><input class="ButtonText" name="Login" alt="Login" src="'.$layout_name.'/images/buttons/_sbutton_login.gif" type="image"></a></div></div></td></tr></tbody>
  2554. </table>
  2555. </center>';
  2556. }
  2557.  
  2558. $main_content .= '
  2559. <img id="ContentBoxHeadline" class="Title" src="images/head/buychar.png" alt="Contentbox headline">';
  2560. }
  2561.  
  2562. $main_content .= '
  2563. <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  2564. <script>
  2565. $(document).ready(function() {
  2566. $(\'#cancelsale\').on(\'click\', function(e) {
  2567. e.preventDefault();
  2568. console.log("merda");
  2569. var charID = $(this).attr(\'data-id\');
  2570.  
  2571. swal({
  2572. title: "Are you sure you want cancel this sale?",
  2573. text: "By canceling this sale you will not receive back the fee charged to sell your character.",
  2574. icon: "warning",
  2575. buttons: ["No", "Yes, cancel sale!"]
  2576. })
  2577. .then((willCancel) => {
  2578. if (willCancel) {
  2579. $.ajax({
  2580. url: \'ajax.php\',
  2581. type: \'POST\',
  2582. data: {
  2583. action: "cancel-sale",
  2584. character: charID
  2585. },
  2586. dataType: "json",
  2587. success: function(data) {
  2588. if (data.status == "success") {
  2589. setTimeout(function() {
  2590. window.location.href = "?subtopic=tradecharacter&action=listsell";
  2591. }, 2000);
  2592.  
  2593. swal("The sale of your character has been successfully canceled!", {
  2594. icon: "success",
  2595. });
  2596. } else {
  2597. swal({
  2598. title: \'Error\',
  2599. text: data.message,
  2600. icon: \'error\'
  2601. });
  2602. }
  2603. }
  2604. });
  2605. }
  2606. });
  2607. });
  2608.  
  2609. $("#cancelsellaction").click(function(e) {
  2610. e.preventDefault();
  2611.  
  2612. var offerId = $(this).attr(\'data-id\');
  2613.  
  2614. swal({
  2615. title: "Cancelar Oferta",
  2616. text: "Deseja realmente cancelar essa oferta? O valor cobrado pela taxa de criação não será devolvido.",
  2617. icon: "warning",
  2618. buttons: ["Não", "Sim, cancelar!"]
  2619. })
  2620. .then((willCancel) => {
  2621. if (willCancel) {
  2622. $.ajax({
  2623. url: \'ajax.php\',
  2624. type: \'POST\',
  2625. data: {
  2626. action: "cancelSellAction",
  2627. offer: offerId
  2628. },
  2629. dataType: "json",
  2630. success: function(data) {
  2631. if (data.status) {
  2632. setTimeout(function() {
  2633. window.location.href = "?subtopic=tradecharacter";
  2634. }, 2000);
  2635.  
  2636. swal("Sua oferta de compra foi cancelada com sucesso!", {
  2637. icon: "success",
  2638. });
  2639. } else {
  2640. swal({
  2641. title: \'Error\',
  2642. text: data.message,
  2643. icon: \'error\'
  2644. });
  2645. }
  2646. }
  2647. });
  2648. }
  2649. });
  2650. });
  2651.  
  2652. $("#formSellAction").submit(function(e) {
  2653. e.preventDefault();
  2654.  
  2655. var formData = $(this).serializeArray();
  2656.  
  2657. swal({
  2658. title: "Deseja realmente vender seu personagem?",
  2659. text: "Processaremos sua requisição, se for aceita, esse personagem será vendido ao comprador.",
  2660. icon: "warning",
  2661. buttons: ["Cancelar", "Sim, vender!"]
  2662. }).then((sellIt) => {
  2663. if (sellIt) {
  2664. $.ajax({
  2665. url: "ajax.php",
  2666. type: "POST",
  2667. data : {action: "sellOffer", dataForm: formData},
  2668. dataType: "json",
  2669. success: function(res) {
  2670. console.log(res.infos);
  2671. if (res.status) {
  2672.  
  2673. setTimeout(function() {
  2674. window.location.href = "?subtopic=tradecharacter";
  2675. }, 2000);
  2676.  
  2677. swal("Você venceu seu personagem com sucesso!", {
  2678. icon: "success",
  2679. });
  2680. } else {
  2681. swal({
  2682. title: "Error",
  2683. text: res.message,
  2684. icon: "error"
  2685. });
  2686. }
  2687. }
  2688. });
  2689. }
  2690. });
  2691. //console.log(formData);
  2692. });
  2693.  
  2694. $(\'#buychar\').click(function(e) {
  2695. e.preventDefault();
  2696.  
  2697. var charID = $(\'#buyCharId\').val();
  2698. var buyerID = $(\'#buyerId\').val();
  2699. var newName = $(\'#new-name\').val();
  2700.  
  2701. swal({
  2702. title: "Are you sure you want to buy this character?",
  2703. text: "The value of this character will be deducted directly from your account, and it will become yours.",
  2704. icon: "warning",
  2705. buttons: ["Cancel", "Yes, buy!"]
  2706. })
  2707. .then((willBuy) => {
  2708. if (willBuy) {
  2709. $.ajax({
  2710. url: \'ajax.php\',
  2711. type: \'POST\',
  2712. data: {
  2713. action: "buy-char",
  2714. character: charID,
  2715. name: newName,
  2716. newaccount: buyerID
  2717. },
  2718. dataType: "json",
  2719. success: function(data) {
  2720. if (data.status == "success") {
  2721. setTimeout(function() {
  2722. window.location.href = "?subtopic=tradecharacter";
  2723. }, 2000);
  2724.  
  2725. swal("You have successfully purchased this character!", {
  2726. icon: "success",
  2727. });
  2728. } else {
  2729. swal({
  2730. title: \'Error\',
  2731. text: data.message,
  2732. icon: \'error\'
  2733. });
  2734. }
  2735. }
  2736. });
  2737. }
  2738. });
  2739. });
  2740.  
  2741. $(\'#sellchar\').click(function(e) {
  2742. e.preventDefault();
  2743.  
  2744. var charID = $(\'#sellCharId\').val();
  2745. var sellerID = $(\'#sellerId\').val();
  2746. var charPrice = $(\'#charPrice\').val();
  2747.  
  2748. swal({
  2749. title: "Are you sure you want to sell this character?",
  2750. text: "You will be charged a fee on the sale value, and if you cancel the sale this value will not be refunded.",
  2751. icon: "warning",
  2752. buttons: ["Cancel", "Yes, sell!"]
  2753. })
  2754. .then((willSell) => {
  2755. if (willSell) {
  2756.  
  2757. swal("Please type your Recovery Key to sell this character:", {
  2758. content: "input",
  2759. })
  2760. .then((rk) => {
  2761. //swal(`You typed: ${value}`);
  2762.  
  2763. $.ajax({
  2764. url: \'ajax.php\',
  2765. type: \'POST\',
  2766. data: {
  2767. action: "sell-char",
  2768. character: charID,
  2769. oldaccount: sellerID,
  2770. price: charPrice,
  2771. recoveryKey: rk
  2772. },
  2773. dataType: "json",
  2774. success: function(data) {
  2775. if (data.status == "success") {
  2776. setTimeout(function() {
  2777. window.location.href = "?subtopic=tradecharacter";
  2778. }, 2000);
  2779.  
  2780. swal("Your character was put up for sale successfully.", {
  2781. icon: "success",
  2782. });
  2783. } else {
  2784. swal({
  2785. title: \'Error\',
  2786. text: data.message,
  2787. icon: \'error\'
  2788. });
  2789. }
  2790. }
  2791. });
  2792. });
  2793. }
  2794. });
  2795. });
  2796. });
  2797. </script>';
Add Comment
Please, Sign In to add comment