Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- $order = $_REQUEST['order'];
- if($order == 'name') {
- $orderby = 'name';
- }
- if($order == 'level') {
- $orderby = 'level';
- }
- if($order == 'vocation') {
- $orderby = 'vocation';
- }
- if(empty($orderby)) {
- $orderby = 'name';
- }
- $world_id = 0;
- $world_name = $config['server']['serverName'];
- if ($action == '') {
- if($logged)
- {
- $account_players = $account_logged->getPlayersList();
- $account_players->orderBy('name');
- $player_number_counter = 0;
- foreach($account_players as $account_player)
- {
- if ($account_player->getLevel() < $config['site']['charactertrade']['min_level'])
- continue;
- $player_number_counter++;
- if (is_int($player_number_counter / 2)) {
- $bgcolor = $config['site']['darkborder'];
- } else {
- $bgcolor = $config['site']['lightborder'];
- }
- $players_rows .= '
- <TR BGCOLOR=' . $bgcolor . '><form action="index.php?subtopic=charactertrade&action=sell_player" method="POST">
- <TD WIDTH=30%><center>' . $flag . '<A HREF="index.php?subtopic=characters&name=' . urlencode($account_player->getName()) . '">' . $account_player->getName() . '</A></center></TD>
- <TD WIDTH=10%><center>' . $account_player->getLevel() . '</center></TD>
- <TD WIDTH=15%><center>' . $vocation_name[0][$account_player->getPromotion()][$account_player->getVocation()] . '</center></TD>
- <TD WIDTH=20%><center><input required name="price" type=number min="'.$config['site']['charactertrade']['min_price'].'" max="'.$config['site']['charactertrade']['max_price'].'"></center></TD>
- <TD ><center><table border="0" cellpadding="0" cellspacing="0">
- <tbody><tr><td style="border: 0px none;"><br>
- <input type="hidden" name="player_id" value="'.$account_player->getId().'"><input type="submit" value="Vender"></a></td></tr></tbody></table><br></center></TD>
- </form></TR>';
- }
- if ($player_number_counter == 0) {
- //server status - server empty
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Jogadores</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>
- <b>➨ Como posso vender um personagem?</b><table><tr><td></td></tr></table>
- <b>1.</b> Para vender um personagem que não deseja mais usar, basta possuir em sua conta um personagem de <b>level 100 ou mais</b>.<table><tr><td></td></tr></table>
- <b>1.1.</b> Ao clicar em "<b>Vender</b>", o personagem será anunciado automaticamente para o mercado de jogadores.<table><tr><td></td></tr></table>
- <b>1.2.</b> Você receberá as <b>Elemental Coins</b> assim que alguém comprar o seu personagem.<br><br>
- <b>➨ Como comprar um personagem?</b><table><tr><td></td></tr></table>
- <b>2.</b> Você pode comprar um personagem facilmente, basta possuir em sua conta o número de <b>Elemental Coins</b> necessárias para comprá-lo.<table><tr><td></td></tr></table>
- <b>2.1.</b> Ao clicar em "<b>Comprar</b>" e posteriormente em "<b>Confirmar Compra</b>", o personagem escolhido será transferido para sua conta.<br><br>
- <b>➨ Como desistir da venda de um personagem?</b><table><tr><td></td></tr></table>
- <b>3.</b> Caso queira desistir da venda de algum personagem, basta clicar em "<b>Cancelar</b>" e o personagem será transferido para sua account.<br><br>
- <b>OBS.:</b> Nenhum personagem será anunciado/vendido por ausência. Essa ferramenta foi criada para negociações entre os próprios jogadores.
- </TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br>
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Vender Personagem</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Você não possui nenhum personagem para ser vendido.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div>';
- } else {
- //list of players
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Jogadores</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>
- <b>➨ Como posso vender um personagem?</b><table><tr><td></td></tr></table>
- <b>1.</b> Para vender um personagem que não deseja mais usar, basta possuir em sua conta um personagem de <b>level 80 ou mais</b>.<table><tr><td></td></tr></table>
- <b>1.1.</b> Ao clicar em "<b>Vender</b>", o personagem será anunciado automaticamente para o mercado de jogadores.<table><tr><td></td></tr></table>
- <b>1.2.</b> Você receberá as <b>Elemental Coins</b> assim que alguém comprar o seu personagem.<br><br>
- <b>➨ Como comprar um personagem?</b><table><tr><td></td></tr></table>
- <b>2.</b> Você pode comprar um personagem facilmente, basta possuir em sua conta o número de <b>Elemental Coins</b> necessárias para comprá-lo.<table><tr><td></td></tr></table>
- <b>2.1.</b> Ao clicar em "<b>Comprar</b>" e posteriormente em "<b>Confirmar Compra</b>", o personagem escolhido será transferido para sua conta.<br><br>
- <b>➨ Como desistir da venda de um personagem?</b><table><tr><td></td></tr></table>
- <b>3.</b> Caso queira desistir da venda de algum personagem, basta clicar em "<b>Cancelar</b>" e o personagem será transferido para sua account.<br><br>
- <b>OBS.:</b> Nenhum personagem será anunciado/vendido por ausência. Essa ferramenta foi criada para negociações entre os próprios jogadores.
- </TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br>
- <center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="10" bgcolor="#505050"><td colspan="5"><font color="white" size="3"><b> Vender Personagem</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="10" align="center"><b>Nome</b></td><td width="190" align="left"><b><center>Level</center></b></td><td width="190" align="left"><b><center>Vocação</center></b></td><td width="160" align="center"><b>Elemental Coins</b></td><td width="10" align="left"><b><center>Vender Personagem</center></b></td></tr>
- ' . $players_rows . '</TABLE>';
- }
- }
- else
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Jogadores</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>
- <b>➨ Como posso vender um personagem?</b><table><tr><td></td></tr></table>
- <b>1.</b> Para vender um personagem que não deseja mais usar, basta possuir em sua conta um personagem de <b>level 80 ou mais</b>.<table><tr><td></td></tr></table>
- <b>1.1.</b> Ao clicar em "<b>Vender</b>", o personagem será anunciado automaticamente para o mercado de jogadores.<table><tr><td></td></tr></table>
- <b>1.2.</b> Você receberá as <b>Elemental Coins</b> assim que alguém comprar o seu personagem.<br><br>
- <b>➨ Como comprar um personagem?</b><table><tr><td></td></tr></table>
- <b>2.</b> Você pode comprar um personagem facilmente, basta possuir em sua conta o número de <b>Elemental Coins</b> necessárias para comprá-lo.<table><tr><td></td></tr></table>
- <b>2.1.</b> Ao clicar em "<b>Comprar</b>" e posteriormente em "<b>Confirmar Compra</b>", o personagem escolhido será transferido para sua conta.<br><br>
- <b>➨ Como desistir da venda de um personagem?</b><table><tr><td></td></tr></table>
- <b>3.</b> Caso queira desistir da venda de algum personagem, basta clicar em "<b>Cancelar</b>" e o personagem será transferido para sua account.<br><br>
- <b>OBS.:</b> Nenhum personagem será anunciado/vendido por ausência. Essa ferramenta foi criada para negociações entre os próprios jogadores.
- </TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br>
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Vender Personagem</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>É necessário <A HREF="index.php?subtopic=accountmanagement">entrar</A> em sua conta para vender algum personagem.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div>
- ';
- }
- // clean
- $players_rows = '';
- $main_content .='<br>';
- $player_on_sale_data = $SQL->query('SELECT z_character_trade.*, players.name, players.world_id,players.promotion, players.vocation, players.level FROM z_character_trade LEFT JOIN players on players.id = z_character_trade.player_id ORDER BY players.level DESC');
- $number_of_players_on_sale = 0;
- foreach ($player_on_sale_data as $player) {
- $number_of_players_on_sale++;
- if (is_int($number_of_players_on_sale / 2)) {
- $bgcolor = $config['site']['darkborder'];
- } else {
- $bgcolor = $config['site']['lightborder'];
- }
- $players_rows .= '
- <TR BGCOLOR=' . $bgcolor . '>
- <TD WIDTH=30%><center>' . $flag . '<A HREF="index.php?subtopic=characters&name=' . urlencode($player['name']) . '">' . $player['name'] . '</A></center></TD>
- <TD WIDTH=10%><center>' . $player['level'] . '</center></TD>
- <TD WIDTH=15%><center>' . $vocation_name[$player['world_id']][$player['promotion']][$player['vocation']] . '</center></TD>
- <TD WIDTH=20%><center>' . $player['price'] . '</center></TD>
- '.($logged?'
- <TD><center><table border="0" cellpadding="0" cellspacing="0">
- <tbody><tr><td style="border: 0px none;"><br>
- <form action="index.php?subtopic=charactertrade&action=select_player" method="POST">
- <input type="hidden" name="player_id" value="'.$player['player_id'].'">
- <input type="submit" name="Cancelar" alt="Cancelar" value="'.($player['old_accountid'] == $account_logged->getId()?'Cancelar':'Comprar').'">
- </a></form></div></div></td></tr></tbody></table></center></TD>
- ' : '
- <TD><center><table border="0" cellpadding="0" cellspacing="0">
- <tbody><tr><td style="border: 0px none;">
- <a href="?subtopic=accountmanagement"><br>
- <input type="hidden" name="player_id" value="'.$player['player_id'].'">
- <input type="submit" value="Login">
- </a></div></div></td></tr></tbody></table><br></center></TD>') . '
- </TR>';
- }
- if ($number_of_players_on_sale == 0) {
- //server status - server empty
- $main_content .= '<div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Personagens a Venda</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Atualmente nenhum personagem está sendo vendido no mercado.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div>';
- } else {
- //list of players
- $main_content .= '
- <center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="10" bgcolor="#505050"><td colspan="5"><font color="white" size="3"><b> Personagens a Venda</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="10" align="center"><b>Nome</b></td><td width="190" align="left"><b><center>Level</center></b></td><td width="190" align="left"><b><center>Vocação</center></b></td><td width="160" align="center"><b>Elemental Coins</b></td><td width="10" align="left"><b><center>Comprar Personagem</center></b></td></tr>
- ' . $players_rows . '</TABLE>';
- }
- }
- else if ($action == 'select_player'){
- $player_id = $_POST['player_id'];
- $player_query = $SQL->query('SELECT z_character_trade.*, players.name, players.world_id,players.promotion, players.vocation, players.level FROM z_character_trade LEFT JOIN players on players.id = z_character_trade.player_id WHERE players.id = ' . $player_id);
- $player_data = $player_query->fetch();
- $player = new OTS_Player();
- $player->load($player_id);
- if (!$logged){
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>É necessário <A HREF="index.php?subtopic=accountmanagement">entrar</A> em sua conta para vender ou comprar algum personagem.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div>
- ';
- }
- else if($player_data == null || !$player->isLoaded()){
- $main_content .= '<div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Por favor, escolha outro personagem.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>';
- }
- else if ($account_logged->getId() == $player_data['old_accountid']){
- // remove trade
- $SQL->query('DELETE FROM z_character_trade WHERE player_id = ' . $player_id);
- // update player
- $player->setAccount($account_logged);
- $player->save();
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Você cancelou a venda de seu personagem, agora o mesmo voltou a fazer parte de sua account.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- }
- else
- {
- $main_content .= '
- <table border="1" cellpadding="3" cellspacing="1" width="746">
- <tr bgcolor="#505050"><td colspan="2"><font color="white" size="3"><b> Confirmar Compra</b></font></td></tr>
- <tr bgcolor="#D4C0A1"><td width="178"><b><center>Nome:</center></b></td><td width="472" colspan="2"> '.$player_data['name'].'</td></tr>
- <tr bgcolor="#F1E0C6"><td width="178"><b><center>Vocação:</center></b></td><td width="472" colspan="2"> '.$vocation_name[0][$player_data['promotion']][$player_data['vocation']].'</td></tr>
- <tr bgcolor="#D4C0A1"><td width="178"><b><center>Level:</center></b></td><td width="485" colspan="2"> '.$player_data['level'].'</td></tr>
- <tr bgcolor="#F1E0C6"><td width="178"><b><center>Elemental Coins:</center></b></td><td width="485" colspan="2"> '.$player_data['price'].'</td></tr>
- <form action="index.php?subtopic=charactertrade&action=confirm_transaction" method="POST"><input type="hidden" name="player_id" value="'.$player_data['player_id'].'">
- </table>
- <TABLE BORDER=0 WIDTH=100%>
- <TR><br>
- <TD ALIGN=center VALIGN=top>
- <INPUT TYPE="submit" value="Confirmar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
- </TD></form>
- <TD ALIGN=center>
- <FORM ACTION="index.php?subtopic=charactertrade" METHOD=post>
- <INPUT TYPE="submit" value="Cancelar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
- </FORM>
- </TD>
- </TR>
- </TABLE>
- ';
- }
- }
- else if ($action == 'sell_player'){
- $player_id = $_POST['player_id'];
- $price = $_POST['price'];
- $player = new OTS_Player();
- $player->load($player_id);
- if (!$logged)
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>É necessário <A HREF="index.php?subtopic=accountmanagement">entrar</A> em sua conta para vender ou comprar algum personagem.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div>
- ';
- }
- else if (!$player->isLoaded())
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Por favor, escolha outro personagem.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- }
- else if ($player->getAccount()->getId() != $account_logged->getId())
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Este personagem não pertence a você.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- }
- else if ($player->getLevel() < $config['site']['charactertrade']['min_level'])
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>O level mínimo para vender seu personagem é <b>'.$config['site']['charactertrade']['min_level'].'</b>.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- }
- else if ($price < $config['site']['charactertrade']['min_price'])
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>O preço mínimo para vender seu personagem é <b>'.$config['site']['charactertrade']['min_price'].' Elemental Coins</b>.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- }
- else if ($price > $config['site']['charactertrade']['max_price'])
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>O preço máximo para vender seu personagem é <b>'.$config['site']['charactertrade']['max_price'].' Elemental Coins</b>.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- }
- else if ($player->isOnline())
- {
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Seu personagem precisa está offline para ser vendido.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- }
- else
- {
- $temp_account = new OTS_Account();
- $temp_account->find($config['site']['charactertrade']['secret_account_name']);
- if (!$temp_account->isLoaded())
- {
- $main_content .= 'Administrator, secret account could not be found.';
- }else
- {
- $main_content .= '<div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD><b>'.$player->getName().'</b> foi adicionado ao mercado de personagens por <b>'.$price.' Elemental Coins</b>. Você tem a opção de removê-lo a qualquer momento.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>
- ';
- $player->setAccount($temp_account);
- $player->save();
- $SQL->query('INSERT INTO `z_character_trade`(`player_id`, `price`, `old_accountid`) VALUES ('.$player->getId().','.$price.','.$account_logged->getId().')');
- }
- }
- }
- else if ($action == 'confirm_transaction'){
- $player_id = $_POST['player_id'];
- $player_query = $SQL->query('SELECT z_character_trade.*, players.name, players.world_id,players.promotion, players.vocation, players.level FROM z_character_trade LEFT JOIN players on players.id = z_character_trade.player_id WHERE players.id = ' . $player_id);
- $player_data = $player_query->fetch();
- $player = new OTS_Player();
- $player->load($player_id);
- if (!$logged){
- $main_content .= '
- <div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>É necessário <A HREF="index.php?subtopic=accountmanagement">entrar</A> em sua conta para vender ou comprar algum personagem.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div>
- ';
- }
- else if($player_data == null || !$player->isLoaded()){
- $main_content .= '<div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
- <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <div class="Text">Mercado de Personagens</div>
- <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
- <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
- <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
- </div>
- </div>
- <table class="Table1" cellpadding="0" cellspacing="0">
- <tbody><TR BGCOLOR="'.$config['site']['darkborder'].'">
- <td>
- <div class="InnerTableContainer">
- <table style="width: 100%;"><tbody><tr><td>
- <TD>Por favor, escolha outro personagem.</TD>
- <tr><td></td></tr>
- </td>
- </tr>
- </td></tr> </tbody></table> </div>
- </td></tr></tbody></table></div><br><center>
- <td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
- <a href="javascript:void();" onclick=location.href="?subtopic=charactertrade"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
- <div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
- <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" type="image">
- </table></td></tr></tbody></table></center>';
- }
- else{
- $selling_price = $player_data['price'];
- $new_premiumpoints = $account_logged->getPremiumPoints() - $selling_price;
- $old_account = new OTS_Account($old_account);
- $old_account->load($player_data['old_accountid']);
- if (!$old_account->isLoaded() )
- {
- $main_content .='<br /><center><div class="error">Não foi possível encontrar essa conta. Entre em <a href="https://www.facebook.com/otavatarworld">contato</a> com o administrator.</div></center>';
- }else if ($account_logged->getPremiumPoints() < $selling_price)
- {
- $main_content .='<br /><center><div class="error">Você não possui <B>Elemental Coins</B> suficientes para comprar esse personagem. Por favor, <a href="index.php?subtopic=shopsystem">selecione outro personagem</a> ou <a href="index.php?subtopic=donate">compre mais Elemental Coins</a>.</div></center>';
- }
- else
- {
- // message
- $main_content .='<br /><center><div class="error">Você comprou o personagem <b>'.$player->getName().'</b> por <b>'.$selling_price.' Elemental Coins</b>. Acesse sua <a href="index.php?subtopic=accountmanagement">account</a> para ver seu mais novo personagem.</div></center>';
- // remove premium points from buyer
- $account_logged->setPremiumPoints($new_premiumpoints);
- $account_logged->save();
- // add premium points to seller
- $old_account->setPremiumPoints($old_account->getPremiumPoints() + $selling_price);
- $old_account->save();
- // remove trade
- $SQL->query('DELETE FROM z_character_trade WHERE player_id = ' . $player_id);
- // add log
- $SQL->query('INSERT INTO `z_character_trade_history`(`player_id`, `old accountid`, `new_accountid`) VALUES ('.$player_id.','.$old_account->getId().','.$account_logged->getId().')');
- // update player
- $player->setAccount($account_logged);
- $player->save();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement