Ir para conteúdo
  • Cadastre-se

Posts Recomendados

refiz dnv, e agora volta ao primeiro erro, quando clico no item que quero comprar com os points, em vez dele ir para a tela de selecionar o char, ela fica branca, por favor, uma boa alma poderia me ajudar?


alguem me ajuda por favor


up

Editado por demoniacs (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 weeks later...

Deu quase certo só nao entregou o item :(

e as fotos dos items no site nao aparece...

uso tfs 1.0 , global 10.76

se alguem puder ajudar eu agradeço

Link para o post
Compartilhar em outros sites

Para quem estiver com esse erro use esse shopguild.php por que o Natanael Beckman, posto o negocio cheio de bug.

 

 

 

Shopguild.php

 

<?php
if(!defined('INITIALIZED'))
exit;
 
if($config['site']['shopguild_system'])
{
if($logged)
{
$user_guild_points = $account_logged->getCustomField('guild_points');
}
else
{
$user_guild_points = 'Login first';
}
function getItemByID($id)
{
$id = (int) $id;
$SQL = $GLOBALS['SQL'];
$data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch();
if($data['offer_type'] == 'item')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif($data['offer_type'] == 'mount')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif($data['offer_type'] == 'addon')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif($data['offer_type'] == 'container')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
return $offer;
}
 
function getOfferArray()
{
$offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shopguild_offer').';');
$i_item = 0;
$i_mount = 0;
$i_addon = 0;
$i_container = 0;
while($data = $offer_list->fetch())
{
if($data['offer_type'] == 'item')
{
$offer_array['item'][$i_item]['id'] = $data['id'];
$offer_array['item'][$i_item]['item_id'] = $data['itemid1'];
$offer_array['item'][$i_item]['item_count'] = $data['count1'];
$offer_array['item'][$i_item]['points'] = $data['points'];
$offer_array['item'][$i_item]['description'] = $data['offer_description'];
$offer_array['item'][$i_item]['name'] = $data['offer_name'];
$i_item++;
}
elseif($data['offer_type'] == 'mount')
{
$offer_array['mount'][$i_mount]['id'] = $data['id'];
$offer_array['mount'][$i_mount]['container_id'] = $data['itemid1'];
$offer_array['mount'][$i_mount]['container_count'] = $data['count1'];
$offer_array['mount'][$i_mount]['item_id'] = $data['itemid1'];
$offer_array['mount'][$i_mount]['item_count'] = $data['count2'];
$offer_array['mount'][$i_mount]['points'] = $data['points'];
$offer_array['mount'][$i_mount]['description'] = $data['offer_description'];
$offer_array['mount'][$i_mount]['name'] = $data['offer_name'];
$i_mount++;
}
elseif($data['offer_type'] == 'addon')
{
$offer_array['addon'][$i_addon]['id'] = $data['id'];
$offer_array['addon'][$i_addon]['container_id'] = $data['itemid1'];
$offer_array['addon'][$i_addon]['container_count'] = $data['count1'];
$offer_array['addon'][$i_addon]['item_id'] = $data['itemid1'];
$offer_array['addon'][$i_addon]['item_count'] = $data['count2'];
$offer_array['addon'][$i_addon]['points'] = $data['points'];
$offer_array['addon'][$i_addon]['description'] = $data['offer_description'];
$offer_array['addon'][$i_addon]['name'] = $data['offer_name'];
$i_addon++;
}
elseif($data['offer_type'] == 'container')
{
$offer_array['container'][$i_container]['id'] = $data['id'];
$offer_array['container'][$i_container]['container_id'] = $data['itemid1'];
$offer_array['container'][$i_container]['container_count'] = $data['count1'];
$offer_array['container'][$i_container]['item_id'] = $data['itemid2'];
$offer_array['container'][$i_container]['item_count'] = $data['count2'];
$offer_array['container'][$i_container]['points'] = $data['points'];
$offer_array['container'][$i_container]['description'] = $data['offer_description'];
$offer_array['container'][$i_container]['name'] = $data['offer_name'];
$i_container++;
}
}
return $offer_array;
}
if(($action == '') or ($action == 'item') or ($action == 'mount') or ($action == 'addon') or ($action == 'container'))
{
unset($_SESSION['viewed_confirmation_page']);
$offer_list = getOfferArray();
 
if(empty($action))
{
if(count($offer_list['item']) > 0)
$action = 'item';
elseif(count($offer_list['mount']) > 0)
$action = 'mount';
elseif(count($offer_list['addon']) > 0)
$action = 'addon';
elseif(count($offer_list['container']) > 0)
$action = 'container';
}
 
function selectcolor($value)
{
if($GLOBALS['action'] == $value)
return '#505050; color: #FFFFFF';
else
return '#303030; color: #aaaaaa';
}
 
if((count($offer_list['item']) > 0) or (count($offer_list['mount']) > 0) or (count($offer_list['addon']) > 0) or (count($offer_list['container']) > 0))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white colspan="2"><B>Choose a categorie: </B>';
if(count($offer_list['item']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=item" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('item').';">Items</a>';
if(count($offer_list['mount']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=mount" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('mount').';">Mounts</a>';
if(count($offer_list['addon']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=addon" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('addon').';">Addons</a>';
if(count($offer_list['container']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=container" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('container').';">Container</a>';
$main_content .= '</TD></TR></TD></TR></table><table BORDER=0 CELLPaDDING="4" CELLSPaCING="1" style="width:100%;font-weight:bold;text-align:center;"><tr style="background:#505050;"><td colspan="3" style="height:px;"></td></tr></table>';
}
 
//show list of items offers
if((count($offer_list['item']) > 0) and ($action == 'item'))
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['item'] as $item)
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$item['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $item['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($item['name']).'</b> ('.$item['points'].' points)<br />'.htmlspecialchars($item['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="itemform_'.$item['id'].'"><input type=hidden" name="buy_id" value="'.$item['id].'"><div class="navibutton"><a href="" onClick="itemform_'.$item['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//show list of mount offers
if((count($offer_list['mount']) > 0) and ($action == 'mount'))
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['mount'] as $mount)
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$mount['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $mount['id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($mount['name']).'</b> ('.$mount['points'].' points)<br />'.htmlspecialchars($mount['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="itemform_'.$mount['id'].'"><input type=hidden" name="buy_id" value="'.$mount['id].'"><div class="navibutton"><a href="" onClick="itemform_'.$mount['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//show list of addon offers
if((count($offer_list['addon']) > 0) and ($action == 'addon'))
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['addon'] as $addon)
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$addon['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $addon['id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($addon['name']).'</b> ('.$addon['points'].' points)<br />'.htmlspecialchars($addon['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="itemform_'.$addon['id'].'"><input type=hidden" name="buy_id" value="'.$addon['id].'"><div class="navibutton"><a href="" onClick="itemform_'.$addon['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//show list of containers offers
if((count($offer_list['container']) > 0) and ($action == 'container'))
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['container'] as $container)
{
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$container['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $container['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($container['name']).'</b> ('.$container['points'].' points)<br />'.htmlspecialchars($container['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="contform_'.$container['id'].'"><input type=hidden" name="buy_id" value="'.$container['id].'"><div class="navibutton"><a href="" onClick="contform_'.$container['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//Finish container
if((count($offer_list['item']) > 0) or (count($offer_list['mount']) > 0) or (count($offer_list['addon']) > 0) or (count($offer_list['container']) > 0))
{
$main_content .= '<table BORDER=0 CELLPaDDING="4" CELLSPaCING="1" style="width:100%;font-weight:bold;text-align:center;">
<tr style="background:#505050;">
<td colspan="3" style="height:px;"></td>
</tr>
</table>';
}
}
if($action == 'select_player')
{
unset($_SESSION['viewed_confirmation_page']);
if(!$logged) {
$errormessage .= 'Please login first.';
}
else
{
$buy_id = (int) $_REQUEST['buy_id'];
if(empty($buy_id))
{
$errormessage .= 'Please <a href="?subtopic=shopguild">select item</a> first.';
}
else
{
$buy_offer = getItemByID($buy_id);
if(isset($buy_offer['id'])) //item exist in database
{
if($user_guild_points >= $buy_offer['points'])
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Selected Offer</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width=100"><b>Name:</b></td><td width="550">'.htmlspecialchars($buy_offer['name]).'</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width=100"><b>Description:</b></td><td width="550">'.htmlspecialchars($buy_offer['description]).'</td></tr>
</table><br />
<form action="?subtopic=shopguild&action=confirm_transaction" method="POST"><input type="hidden" name="buy_id" value="'.$buy_id.'">
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Give item to player from your account</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
$players_from_logged_acc = $account_logged->getPlayersList();
if(count($players_from_logged_acc) > 0)
{
foreach($players_from_logged_acc as $player)
{
$main_content .= '<option>'.htmlspecialchars($player->getName()).'</option>';
}
}
else
{
$main_content .= 'You don\'t have any character on your account.';
}
$main_content .= '</select>&nbsp;<input type="submit" value="Give"></td></tr>
</table>
</form><br /><form action="?subtopic=shopguild&action=confirm_transaction" method="POST"><input type="hidden" name="buy_id" value="'.$buy_id.'">
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Give item to other player</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width="110"><b>To player:</b></td><td width="550"><input type="text" name="buy_name"> - name of player</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width="110"><b>From:</b></td><td width="550"><input type="text" name="buy_from">&nbsp;<input type="submit" value="Give"> - your nick, \'empty\' = Anonymous</td></tr>
</table><br />
</form>';
 
}
else
{
$errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_guild_points.'</b> guild points. Please <a href="?subtopic=shopguild">select other item</a> or buy guild points.';
}
}
else
{
$errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="?subtopic=shopguild">select item</a> again.';
}
}
}
if(!empty($errormessage))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
</table>';
}
}
elseif($action == 'confirm_transaction')
{
if(!$logged)
{
$errormessage .= 'Please login first.';
}
else
{
$buy_id = (int) $_POST['buy_id'];
$buy_name = trim($_POST['buy_name']);
$buy_from = trim($_POST['buy_from']);
if(empty($buy_from))
{
$buy_from = 'Anonymous';
}
if(empty($buy_id))
{
$errormessage .= 'Please <a href="?subtopic=shopguild">select item</a> first.';
}
else
{
if(!check_name($buy_from))
{
$errormessage .= 'Invalid nick ("from player") format. Please <a href="?subtopic=shopguild&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
}
else
{
$buy_offer = getItemByID($buy_id);
if(isset($buy_offer['id'])) //item exist in database
{
if($user_guild_points >= $buy_offer['points'])
{
if(check_name($buy_name))
{
$buy_player = new Player();
$buy_player->find($buy_name);
if($buy_player->isLoaded())
{
$buy_player_account = $buy_player->getAccount();
if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes')
{
if($buy_offer['type'] == 'item')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Item added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
elseif($buy_offer['type'] == 'mount')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Mount added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
elseif($buy_offer['type'] == 'addon')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Addon added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
elseif($buy_offer['type'] == 'container')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote($buy_offer['container_id']).', '.$SQL->quote($buy_offer['container_count']).', '.$SQL->quote('container').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Container of items added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this container with items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
}
else
{
$set_session = TRUE;
$_SESSION['viewed_confirmation_page'] = 'yes';
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="3" class="white"><b>Confirm Transaction</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width=100"><b>Name:</b></td><td width="550" colspan="2">'. htmlspecialchars($buy_offer['name]).'</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width=100"><b>Description:</b></td><td width="550" colspan="2">'. htmlspecialchars($buy_offer['description]).'</td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width=100"><b>Cost:</b></td><td width="550" colspan="2"><b>'. htmlspecialchars($buy_offer['points]).' guild points</b> from your account</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>For Player:</b></td><td width="550" colspan="2"><font color="red">'.htmlspecialchars($buy_player->getName()).'</font></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width="100"><b>From:</b></td><td width="550" colspan="2"><font color="red">'.htmlspecialchars($buy_from).'</font></td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td colspan="3"></td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>Transaction?</b></td><td width="275" align="left">
<form action="?subtopic=shopguild&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.htmlspecialchars($buy_from).'"><input type="hidden" name="buy_name" value="'.htmlspecialchars($buy_name).'"><input type="submit" value="Accept"></form></td>
<td align="right"><form action="?subtopic=shopguild" method="POST"><input type="submit" value="Cancel"></form></td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td colspan="3"></td></tr>
</table> 
';
}
}
else
{
$errormessage .= 'Player with name <b>'.htmlspecialchars($buy_name).'</b> doesn\'t exist. Please <a href="?subtopic=shopguild&action=select_player&buy_id='.$buy_id.'">select other name</a>.';
}
}
else
{
$errormessage .= 'Invalid name format. Please <a href="?subtopic=shopguild&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
}
}
else
{
$errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_guild_points.'</b> guild points. Please <a href="?subtopic=shopguild">select other item</a> or buy guild points.';
}
}
else
{
$errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="?subtopic=shopguild">select item</a> again.';
}
}
}
}
if(!empty($errormessage))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
</table>';
}
if(!$set_session)
{
unset($_SESSION['viewed_confirmation_page']);
}
}
elseif($action == 'show_history')
{
if(!$logged)
{
$errormessage .= 'Please login first.';
}
else
{
$items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
if(is_object($items_history_received))
{
foreach($items_history_received as $item_received)
{
if($account_logged->getId() == $item_received['to_account'])
$char_color = 'green';
else
$char_color = 'red';
$items_received_text .= '<tr bgcolor="'.$config['site']['lightborder'].'"><td><font color='.$char_color.'">'.htmlspecialchars($item_received['to_name]).'</font></td><td>';
if($account_logged->getId() == $item_received['from_account'])
$items_received_text .= '<i>Your account</i>';
else
$items_received_text .= htmlspecialchars($item_received['from_nick']);
$items_received_text .= '</td><td>'.htmlspecialchars($item_received['offer_id']).'</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
if($item_received['trans_real'] > 0)
$items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
else
$items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
$items_received_text .= '</tr>';
}
}
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'"></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><center><B>Transactions History</B></center></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'"></TD></TR>
</table><br>';
 
if(!empty($items_received_text))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white colspan="5"><B>Item Transactions</B></TD></TR>
<tr bgcolor="'.$config['site']['darkborder'].'"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Bought on page</b></td><td><b>Received on OTS</b></td></tr>
'.$items_received_text.'
</table><br />';
}
if(empty($items_received_text))
$errormessage .= 'You did not buy/receive any item.';
}
if(!empty($errormessage))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
</table>';
}
}
$main_content .= '<br><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>guild points</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b><font color="green">You have guild points: </font></b>'.$user_guild_points.'</TD></TR>
</table>';
}
else
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=center CLASS=white ><B>Shop Information</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><center>Shop is currently closed. [to admin: edit it in \'config/config.php\']</TD></TR>
</table>';

Link para o post
Compartilhar em outros sites
  • 3 weeks later...
  • 1 month later...

Esse sistema esta funcionando corretamente até a parte de entregar itens, não entrega item algum. E o shopguild admin não abri. Mas o resto é perfeito. 

Alguem sabe como arrumar isso?

Editado por acesso123 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 months later...

Arruma o shopguild.php que está no tutorial, acho que se confundiu e colocou o shopguild.lua hahah, se quiser, ta ai o shopguild.php:

<?php
if(!defined('INITIALIZED'))
exit;
 
if($config['site']['shopguild_system'])
{
if($logged)
{
$user_guild_points = $account_logged->getCustomField('guild_points');
}
else
{
$user_guild_points = 'Login first';
}
function getItemByID($id)
{
$id = (int) $id;
$SQL = $GLOBALS['SQL'];
$data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch();
if($data['offer_type'] == 'item')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif($data['offer_type'] == 'mount')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif($data['offer_type'] == 'addon')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif($data['offer_type'] == 'container')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
return $offer;
}
 
function getOfferArray()
{
$offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shopguild_offer').';');
$i_item = 0;
$i_mount = 0;
$i_addon = 0;
$i_container = 0;
while($data = $offer_list->fetch())
{
if($data['offer_type'] == 'item')
{
$offer_array['item'][$i_item]['id'] = $data['id'];
$offer_array['item'][$i_item]['item_id'] = $data['itemid1'];
$offer_array['item'][$i_item]['item_count'] = $data['count1'];
$offer_array['item'][$i_item]['points'] = $data['points'];
$offer_array['item'][$i_item]['description'] = $data['offer_description'];
$offer_array['item'][$i_item]['name'] = $data['offer_name'];
$i_item++;
}
elseif($data['offer_type'] == 'mount')
{
$offer_array['mount'][$i_mount]['id'] = $data['id'];
$offer_array['mount'][$i_mount]['container_id'] = $data['itemid1'];
$offer_array['mount'][$i_mount]['container_count'] = $data['count1'];
$offer_array['mount'][$i_mount]['item_id'] = $data['itemid1'];
$offer_array['mount'][$i_mount]['item_count'] = $data['count2'];
$offer_array['mount'][$i_mount]['points'] = $data['points'];
$offer_array['mount'][$i_mount]['description'] = $data['offer_description'];
$offer_array['mount'][$i_mount]['name'] = $data['offer_name'];
$i_mount++;
}
elseif($data['offer_type'] == 'addon')
{
$offer_array['addon'][$i_addon]['id'] = $data['id'];
$offer_array['addon'][$i_addon]['container_id'] = $data['itemid1'];
$offer_array['addon'][$i_addon]['container_count'] = $data['count1'];
$offer_array['addon'][$i_addon]['item_id'] = $data['itemid1'];
$offer_array['addon'][$i_addon]['item_count'] = $data['count2'];
$offer_array['addon'][$i_addon]['points'] = $data['points'];
$offer_array['addon'][$i_addon]['description'] = $data['offer_description'];
$offer_array['addon'][$i_addon]['name'] = $data['offer_name'];
$i_addon++;
}
elseif($data['offer_type'] == 'container')
{
$offer_array['container'][$i_container]['id'] = $data['id'];
$offer_array['container'][$i_container]['container_id'] = $data['itemid1'];
$offer_array['container'][$i_container]['container_count'] = $data['count1'];
$offer_array['container'][$i_container]['item_id'] = $data['itemid2'];
$offer_array['container'][$i_container]['item_count'] = $data['count2'];
$offer_array['container'][$i_container]['points'] = $data['points'];
$offer_array['container'][$i_container]['description'] = $data['offer_description'];
$offer_array['container'][$i_container]['name'] = $data['offer_name'];
$i_container++;
}
}
return $offer_array;
}
if(($action == '') or ($action == 'item') or ($action == 'mount') or ($action == 'addon') or ($action == 'container'))
{
unset($_SESSION['viewed_confirmation_page']);
$offer_list = getOfferArray();
 
if(empty($action))
{
if(count($offer_list['item']) > 0)
$action = 'item';
elseif(count($offer_list['mount']) > 0)
$action = 'mount';
elseif(count($offer_list['addon']) > 0)
$action = 'addon';
elseif(count($offer_list['container']) > 0)
$action = 'container';
}
 
function selectcolor($value)
{
if($GLOBALS['action'] == $value)
return '#505050; color: #FFFFFF';
else
return '#303030; color: #aaaaaa';
}
 
if((count($offer_list['item']) > 0) or (count($offer_list['mount']) > 0) or (count($offer_list['addon']) > 0) or (count($offer_list['container']) > 0))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white colspan="2"><B>Choose a categorie: </B>';
if(count($offer_list['item']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=item" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('item').';">Items</a>';
if(count($offer_list['mount']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=mount" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('mount').';">Mounts</a>';
if(count($offer_list['addon']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=addon" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('addon').';">Addons</a>';
if(count($offer_list['container']) > 0) $main_content .= '<a href="?subtopic=shopguild&action=container" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('container').';">Container</a>';
$main_content .= '</TD></TR></TD></TR></table><table BORDER=0 CELLPaDDING="4" CELLSPaCING="1" style="width:100%;font-weight:bold;text-align:center;"><tr style="background:#505050;"><td colspan="3" style="height:px;"></td></tr></table>';
}
 
//show list of items offers
if((count($offer_list['item']) > 0) and ($action == 'item'))
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['item'] as $item)
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$item['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $item['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($item['name']).'</b> ('.$item['points'].' points)<br />'.htmlspecialchars($item['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="itemform_'.$item['id'].'"><input type=hidden" name="buy_id" value="'.$item['id].'"><div class="navibutton"><a href="" onClick="itemform_'.$item['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//show list of mount offers
if((count($offer_list['mount']) > 0) and ($action == 'mount'))
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['mount'] as $mount)
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$mount['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $mount['id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($mount['name']).'</b> ('.$mount['points'].' points)<br />'.htmlspecialchars($mount['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="itemform_'.$mount['id'].'"><input type=hidden" name="buy_id" value="'.$mount['id].'"><div class="navibutton"><a href="" onClick="itemform_'.$mount['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//show list of addon offers
if((count($offer_list['addon']) > 0) and ($action == 'addon'))
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['addon'] as $addon)
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$addon['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $addon['id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($addon['name']).'</b> ('.$addon['points'].' points)<br />'.htmlspecialchars($addon['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="itemform_'.$addon['id'].'"><input type=hidden" name="buy_id" value="'.$addon['id].'"><div class="navibutton"><a href="" onClick="itemform_'.$addon['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//show list of containers offers
if((count($offer_list['container']) > 0) and ($action == 'container'))
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
foreach($offer_list['container'] as $container)
{
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$container['points'].'</b></td><td align=center"><img src="' . $config['site]['item_images_url'] . $container['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($container['name']).'</b> ('.$container['points'].' points)<br />'.htmlspecialchars($container['description']).'</td><td align="center">';
if(!$logged)
{
$main_content .= '<b>Login to buy</b>';
}
else
{
$main_content .= '<form action="?subtopic=shopguild&action=select_player" method="POST" name="contform_'.$container['id'].'"><input type=hidden" name="buy_id" value="'.$container['id].'"><div class="navibutton"><a href="" onClick="contform_'.$container['id'].'.submit();return false;">BUY</a></div></form>';
}
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
//Finish container
if((count($offer_list['item']) > 0) or (count($offer_list['mount']) > 0) or (count($offer_list['addon']) > 0) or (count($offer_list['container']) > 0))
{
$main_content .= '<table BORDER=0 CELLPaDDING="4" CELLSPaCING="1" style="width:100%;font-weight:bold;text-align:center;">
<tr style="background:#505050;">
<td colspan="3" style="height:px;"></td>
</tr>
</table>';
}
}
if($action == 'select_player')
{
unset($_SESSION['viewed_confirmation_page']);
if(!$logged) {
$errormessage .= 'Please login first.';
}
else
{
$buy_id = (int) $_REQUEST['buy_id'];
if(empty($buy_id))
{
$errormessage .= 'Please <a href="?subtopic=shopguild">select item</a> first.';
}
else
{
$buy_offer = getItemByID($buy_id);
if(isset($buy_offer['id'])) //item exist in database
{
if($user_guild_points >= $buy_offer['points'])
{
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Selected Offer</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width=100"><b>Name:</b></td><td width="550">'.htmlspecialchars($buy_offer['name]).'</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width=100"><b>Description:</b></td><td width="550">'.htmlspecialchars($buy_offer['description]).'</td></tr>
</table><br />
<form action="?subtopic=shopguild&action=confirm_transaction" method="POST"><input type="hidden" name="buy_id" value="'.$buy_id.'">
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Give item to player from your account</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
$players_from_logged_acc = $account_logged->getPlayersList();
if(count($players_from_logged_acc) > 0)
{
foreach($players_from_logged_acc as $player)
{
$main_content .= '<option>'.htmlspecialchars($player->getName()).'</option>';
}
}
else
{
$main_content .= 'You don\'t have any character on your account.';
}
$main_content .= '</select>&nbsp;<input type="submit" value="Give"></td></tr>
</table>
</form><br /><form action="?subtopic=shopguild&action=confirm_transaction" method="POST"><input type="hidden" name="buy_id" value="'.$buy_id.'">
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Give item to other player</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width="110"><b>To player:</b></td><td width="550"><input type="text" name="buy_name"> - name of player</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width="110"><b>From:</b></td><td width="550"><input type="text" name="buy_from">&nbsp;<input type="submit" value="Give"> - your nick, \'empty\' = Anonymous</td></tr>
</table><br />
</form>';
 
}
else
{
$errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_guild_points.'</b> guild points. Please <a href="?subtopic=shopguild">select other item</a> or buy guild points.';
}
}
else
{
$errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="?subtopic=shopguild">select item</a> again.';
}
}
}
if(!empty($errormessage))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
</table>';
}
}
elseif($action == 'confirm_transaction')
{
if(!$logged)
{
$errormessage .= 'Please login first.';
}
else
{
$buy_id = (int) $_POST['buy_id'];
$buy_name = trim($_POST['buy_name']);
$buy_from = trim($_POST['buy_from']);
if(empty($buy_from))
{
$buy_from = 'Anonymous';
}
if(empty($buy_id))
{
$errormessage .= 'Please <a href="?subtopic=shopguild">select item</a> first.';
}
else
{
if(!check_name($buy_from))
{
$errormessage .= 'Invalid nick ("from player") format. Please <a href="?subtopic=shopguild&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
}
else
{
$buy_offer = getItemByID($buy_id);
if(isset($buy_offer['id'])) //item exist in database
{
if($user_guild_points >= $buy_offer['points'])
{
if(check_name($buy_name))
{
$buy_player = new Player();
$buy_player->find($buy_name);
if($buy_player->isLoaded())
{
$buy_player_account = $buy_player->getAccount();
if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes')
{
if($buy_offer['type'] == 'item')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Item added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
elseif($buy_offer['type'] == 'mount')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Mount added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
elseif($buy_offer['type'] == 'addon')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Addon added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
elseif($buy_offer['type'] == 'container')
{
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_guildcomunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote($buy_offer['container_id']).', '.$SQL->quote($buy_offer['container_count']).', '.$SQL->quote('container').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shopguild_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
$SQL->query($save_transaction);
$account_logged->setCustomField('guild_points', $user_guild_points-$buy_offer['points']);
$user_guild_points = $user_guild_points - $buy_offer['points'];
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Container of items added!</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this container with items after relog) for <b>'.$buy_offer['points'].' guild points</b> from your account.<br />Now you have <b>'.$user_guild_points.' guild points</b>.<br /><a href="?subtopic=shopguild">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
}
}
else
{
$set_session = TRUE;
$_SESSION['viewed_confirmation_page'] = 'yes';
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="3" class="white"><b>Confirm Transaction</b></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width=100"><b>Name:</b></td><td width="550" colspan="2">'. htmlspecialchars($buy_offer['name]).'</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width=100"><b>Description:</b></td><td width="550" colspan="2">'. htmlspecialchars($buy_offer['description]).'</td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width=100"><b>Cost:</b></td><td width="550" colspan="2"><b>'. htmlspecialchars($buy_offer['points]).' guild points</b> from your account</td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>For Player:</b></td><td width="550" colspan="2"><font color="red">'.htmlspecialchars($buy_player->getName()).'</font></td></tr>
<tr bgcolor="'.$config['site']['lightborder'].'"><td width="100"><b>From:</b></td><td width="550" colspan="2"><font color="red">'.htmlspecialchars($buy_from).'</font></td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td colspan="3"></td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>Transaction?</b></td><td width="275" align="left">
<form action="?subtopic=shopguild&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.htmlspecialchars($buy_from).'"><input type="hidden" name="buy_name" value="'.htmlspecialchars($buy_name).'"><input type="submit" value="Accept"></form></td>
<td align="right"><form action="?subtopic=shopguild" method="POST"><input type="submit" value="Cancel"></form></td></tr>
<tr bgcolor="'.$config['site']['darkborder'].'"><td colspan="3"></td></tr>
</table> 
';
}
}
else
{
$errormessage .= 'Player with name <b>'.htmlspecialchars($buy_name).'</b> doesn\'t exist. Please <a href="?subtopic=shopguild&action=select_player&buy_id='.$buy_id.'">select other name</a>.';
}
}
else
{
$errormessage .= 'Invalid name format. Please <a href="?subtopic=shopguild&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
}
}
else
{
$errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_guild_points.'</b> guild points. Please <a href="?subtopic=shopguild">select other item</a> or buy guild points.';
}
}
else
{
$errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="?subtopic=shopguild">select item</a> again.';
}
}
}
}
if(!empty($errormessage))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
</table>';
}
if(!$set_session)
{
unset($_SESSION['viewed_confirmation_page']);
}
}
elseif($action == 'show_history')
{
if(!$logged)
{
$errormessage .= 'Please login first.';
}
else
{
$items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
if(is_object($items_history_received))
{
foreach($items_history_received as $item_received)
{
if($account_logged->getId() == $item_received['to_account'])
$char_color = 'green';
else
$char_color = 'red';
$items_received_text .= '<tr bgcolor="'.$config['site']['lightborder'].'"><td><font color='.$char_color.'">'.htmlspecialchars($item_received['to_name]).'</font></td><td>';
if($account_logged->getId() == $item_received['from_account'])
$items_received_text .= '<i>Your account</i>';
else
$items_received_text .= htmlspecialchars($item_received['from_nick']);
$items_received_text .= '</td><td>'.htmlspecialchars($item_received['offer_id']).'</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
if($item_received['trans_real'] > 0)
$items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
else
$items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
$items_received_text .= '</tr>';
}
}
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'"></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><center><B>Transactions History</B></center></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'"></TD></TR>
</table><br>';
 
if(!empty($items_received_text))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white colspan="5"><B>Item Transactions</B></TD></TR>
<tr bgcolor="'.$config['site']['darkborder'].'"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Bought on page</b></td><td><b>Received on OTS</b></td></tr>
'.$items_received_text.'
</table><br />';
}
if(empty($items_received_text))
$errormessage .= 'You did not buy/receive any item.';
}
if(!empty($errormessage))
{
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
</table>';
}
}
$main_content .= '<br><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>guild points</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b><font color="green">You have guild points: </font></b>'.$user_guild_points.'</TD></TR>
</table>';
}
else
$main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=center CLASS=white ><B>Shop Information</B></TD></TR>
<TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><center>Shop is currently closed. [to admin: edit it in \'config/config.php\']</TD></TR>
</table>';

Reputado pelo ótimo tutorial. :)

 

-- EDIT --

 

Cara, não ta enviando os items pros players... No site eu compro o item, ele remove os pontos só que não chega no player  :hum:

Editado por VitorNM (veja o histórico de edições)

nbeTETb.png?1

 

Link para o post
Compartilhar em outros sites
  • 2 months later...

[Warning - Event::checkScript] Can not load script: scripts/guildpoints.lua
data/talkactions/scripts/guildpoints.lua:7: unexpected symbol near '}'
 

 

da esse erro no distro

Link para o post
Compartilhar em outros sites
  • 2 months later...

Desculpem reviver o tópico mais estou com problemas com o script.

Reparei que existem divergencias na parte do globalevents tentei arrumar porem o item nao esta sendo entregue, apenas fica parado na database aguardando ser enviado.

Tentei utilizar a versão que adiciona a players Offline porem nao sei se a versão do meu TFS pode estar influenciando mais esta dando erros.

 

Alguem pode me axiliar?

Link para o post
Compartilhar em outros sites
  • 5 months later...

Não consigo fazer funcionar nem fudendo, as tabalas da database a maioria não pega, e quando eu instalo no gesior, ele não coloca itens no shop guild, alguém pode ajudar?

Link para o post
Compartilhar em outros sites
Em 04/08/2014 ás 15:03, Natanael Beckman disse:

Shop Guild TFS 1.0

Bom, vamos ao sistema:

Em talkactions.xml, adicione a tag abaixo:


      <talkaction words="!guildpoints" separator=" " script="guildpoints.lua"/>
Na pasta talkactions/scripts faça um .lua com o nome guildpoints e dentro dele adicione os coder abaixo:

local config = {
        executeInterval = 24,
        minimumLevel = 80,
        membersNeeded = 10,
        minimumDifferentIps = 6,
        pointAmount = 9
}

local function getValidAccounts(guild)
        local resultId = db.storeQuery('SELECT a.`id` FROM `accounts` a, `guild_membership` m, `players` p WHERE m.`guild_id` = ' ..guild:getId() .. ' AND p.`id` = m.`player_id` AND p.`level` > ' ..  config.minimumLevel .. ' and a.`id` = p.`account_id` AND a.`guild_points_stats` = 0 GROUP BY a.`id`;')
        if resultId == false then
                return {}
        end

        local accounts = {}
        repeat
                table.insert(accounts, result.getDataInt(resultId, 'id'))
        until not result.next(resultId)
        result.free(resultId)

        return accounts
end

function onSay(cid, words, param)
        local player = Player(cid)
        local guild = player:getGuild()
        if not guild or player:getGuildLevel() ~= GUILDLEVEL_LEADER then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only guild leader can request points.')
                return false
        end

        local resultId = db.storeQuery('SELECT `last_execute_points` FROM `guilds` WHERE id = ' .. guild:getId())
        if resultId == false then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendCancelMessage('Error while running database query.')
                return false
        end

        local lastExecution = result.getDataInt(resultId, 'last_execute_points')
        result.free(resultId)
        if lastExecution >= os.time() then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'The command can only be run once every ' ..config.executeInterval .. ' hours.')
                return false
        end

        local members = guild:getMembersOnline()
        for i = #members, 1, -1 do
                if members[i]:getLevel() < config.minimumLevel then
                        table.remove(members, i)
                end
        end

        if #members < config.membersNeeded then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only ' .. #members .. ' guild members online, you need ' ..config.membersNeeded .. ' guild members with level ' .. config.minimumLevel .. ' or higher.')
                return false
        end

        local ipDictionary, ipCount = {}, 0
        for i = 1, #members do
                local ip = members[i]:getIp()
                if not ipDictionary[ip] then
                        ipDictionary[ip] = true
                        ipCount = ipCount + 1
                end
        end

        if ipCount < config.minimumDifferentIps then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only ' .. ipCount .. ' members are valid, you need ' ..config.minimumDifferentIps .. ' players with different ip addresses.')
                return false
        end

        local validAccounts = getValidAccounts(guild)
        db.query('UPDATE `guilds` SET `last_execute_points` = ' .. (os.time() + config.executeInterval * 3600) .. ' WHERE `guilds`.`id` = ' .. guild:getId() .. ';')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, #validAccounts .. ' guild members received points.')
        if #validAccounts > 0 then
                db.query('UPDATE `accounts` SET `guild_points` = `guild_points` + ' .. config.pointAmount .. ', `guild_points_stats` = ' .. os.time() .. ' WHERE `id` IN (' .. table.concat(validAccounts, ',') .. ');')
                for i = 1, #members do
                        local member = members[i]
                        if isInArray(validAccounts, member:getAccountId()) then
                                member:sendTextMessage(MESSAGE_INFO_DESCR, 'You received ' .. config.pointAmount .. ' guild points.')
                        end
                end
        end
        return false
end

No coder acima bem no inicio tem as linhas seguintes para configurar:

executeInterval = 24, ( Intervalo para execução do comando, ae está de 24 em 24hrs)
membersNeeded = 10, (Quantos players é preciso está online para poder executar o comando.)
minimumDifferentIps = 6, (Quantos IPS diferentes são necessários para executar o comando no exemplo ae tem 6.)
minimumLevel = 80, (Aqui adicione o level minimo, é necessário que todos os player da guild tenha o level pedido para o lider executar o comando.)
pointAmount = 9, (Aqui é a quantidade de pontos para adicionar em cada player da guild.)

 

Em data/globalevents/scripts crie um arquivo chamado shopguild.lua e adicione o code a seguir:


-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 18
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.storeQuery("SELECT * FROM z_ots_guildcomunication")
    if(result_plr ~= false) then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
            if(cid) then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local received_item = 0
                local full_weight = 0
                if(add_item_type == 'container') then
                    container_weight = getItemWeight(container_id, 1)
                    if(isItemRune(itemtogive_id)) then
                        items_weight = container_count * getItemWeight(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    if(isItemRune(itemtogive_id)) then
                        full_weight = getItemWeight(itemtogive_id, 1)
                    else
                        full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    end
                end
                local free_cap = getPlayerFreeCap(cid)
                if(full_weight <= free_cap) then
                    if(add_item_type == 'container') then
                        local new_container = doCreateItemEx(container_id, 1)
                        local iter = 0
                        while(iter ~= container_count) do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
                    end
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '..SQL_interval ..' seconds to get it.')
                end
            end
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
end

Em data/globalevents/globalevents.xml adicione a seguinte tag:


<globalevent name="shopguild" interval="300" event="script" value="shopguild.lua"/>

Certo, a parte do servidor é esta, ta feita, vamos adicionar a database o coder a seguir:


                  ALTER TABLE `accounts` ADD `guild_points` INTEGER(11) NOT NULL DEFAULT 0;

                  ALTER TABLE `accounts` ADD `guild_points_stats` INT NOT NULL DEFAULT '0';

                  ALTER TABLE `guilds` ADD `last_execute_points` INT NOT NULL DEFAULT '0';

                  CREATE TABLE `z_shopguild_offer` (
                        `id` int(11) NOT NULL auto_increment,
                        `points` int(11) NOT NULL default '0',
                        `itemid1` int(11) NOT NULL default '0',
                        `count1` int(11) NOT NULL default '0',
                        `itemid2` int(11) NOT NULL default '0',
                        `count2` int(11) NOT NULL default '0',
                        `offer_type` varchar(255) default NULL,
                        `offer_description` text NOT NULL,
                        `offer_name` varchar(255) NOT NULL,
                        `pid` INT(11) NOT NULL DEFAULT '0',
                  PRIMARY KEY (`id`))

                  CREATE TABLE `z_shopguild_history_item` (
                        `id` int(11) NOT NULL auto_increment,
                        `to_name` varchar(255) NOT NULL default '0',
                        `to_account` int(11) NOT NULL default '0',
                        `from_nick` varchar(255) NOT NULL,
                        `from_account` int(11) NOT NULL default '0',
                        `price` int(11) NOT NULL default '0',
                        `offer_id` int(11) NOT NULL default '0',
                        `trans_state` varchar(255) NOT NULL,
                        `trans_start` int(11) NOT NULL default '0',
                        `trans_real` int(11) NOT NULL default '0',
                  PRIMARY KEY (`id`))

                  CREATE TABLE `z_shopguild_history_pacc` (
                        `id` int(11) NOT NULL auto_increment,
                        `to_name` varchar(255) NOT NULL default '0',
                        `to_account` int(11) NOT NULL default '0',
                        `from_nick` varchar(255) NOT NULL,
                        `from_account` int(11) NOT NULL default '0',
                        `price` int(11) NOT NULL default '0',
                        `pacc_days` int(11) NOT NULL default '0',
                        `trans_state` varchar(255) NOT NULL,
                        `trans_start` int(11) NOT NULL default '0',
                        `trans_real` int(11) NOT NULL default '0',
                  PRIMARY KEY (`id`)) 

                  CREATE TABLE IF NOT EXISTS `z_ots_guildcomunication` (
                        `id` int(11) NOT NULL AUTO_INCREMENT,
                        `name` varchar(255) NOT NULL,
                        `type` varchar(255) NOT NULL,
                        `action` varchar(255) NOT NULL,
                        `param1` varchar(255) NOT NULL,
                        `param2` varchar(255) NOT NULL,
                        `param3` varchar(255) NOT NULL,
                        `param4` varchar(255) NOT NULL,
                        `param5` varchar(255) NOT NULL,
                        `param6` varchar(255) NOT NULL,
                        `param7` varchar(255) NOT NULL,
                        `delete_it` int(2) NOT NULL DEFAULT '1',
                        PRIMARY KEY (`id`)
                  ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=13107;

Olha estamos quase finalizando tudo, só precisamos terminar a parte de web.
O meu GuildShop eu copiei meu shopsystem.php e fiz umas modificações, simples você pode fazer o mesmo é menos trabalhoso.
Copie o shopsystem.php renomeie para shopguild.php, após abra-o e modifique como manda a seguir:

shop_system para shopguild_system
premium_points para guild_points

premium points para guild points
z_shop_offer para z_shopguild_offer
shopsystem para shopguild
z_shop_history_pacc para z_shopguild_history_pacc
z_shop_history_item para z_shopguild_history_item

z_ots_comunication para z_ots_guildcomunication

 

Ou utilize este já pronto:

shopguild.php

 

shopguildadmin.php está no link abaixo, basta fazer o mesmo procedimento:

shopguildadmin.php

 

Em index.php add:


case "shopguild";
   $topic = "Shop Guild";
   $subtopic = "shopguild";
   include("shopguild.php");
break;
case "shopguildadmin";
   $topic = "ShopGuild Admin";
   $subtopic = "shopguildadmin";
   include("shopguildadmin.php");
break;

Vá em config.php adicione:


$config['site']['shopguild_system'] = 1;
$config['site']['access_adminguild_panel'] = 9;

Vá em layouts.php adicione abaixo de buypoints:


                                <a href='?subtopic=shopguild'>
                                        <div id='submenu_shopguild' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)'onMouseOut='MouseOutSubmenuItem(this)'>
                                                <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
                                                <div id='ActiveSubmenuItemIcon_shopguild' class='ActiveSubmenuItemIcon'style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
                                                <div class='SubmenuitemLabel'>Shop Guild</div>
                                                <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
                                        </div>
                                </a>

Em layouts.php add depois do shopadmin:


if($group_id_of_acc_logged >= $config['site']['access_adminguild_panel'])
  echo "<a href='?subtopic=shopadmin'>
                                   <div id='submenu_shopguildadmin' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)'onMouseOut='MouseOutSubmenuItem(this)'>
                                          <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
                                          <div id='ActiveSubmenuItemIcon_shopguildadmin' class='ActiveSubmenuItemIcon'style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
                                          <div class='SubmenuitemLabel'><font color=red>! ShopGuild Admin !</font></div>
                                         <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
                                   </div>
                            </a>";

Em shopsystem.php procure por:


       elseif($action == 'show_history') {
                if(!$logged) {
                        $main_content .= 'Please login first.';
                } else{
                        $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
                        if(is_object($items_history_received)) {
                                foreach($items_history_received as $item_received) {
                                        if($account_logged->getId() == $item_received['to_account'])
                                                $char_color = 'green';
                                        else
                                                $char_color = 'red';
                                                $items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>';
                                        if($account_logged->getId() == $item_received['from_account'])
                                                $items_received_text .= '<i>Your account</i>';
                                        else
                                                $items_received_text .= $item_received['from_nick'];
                                               
                                                $items_received_text .= '</td><td>'.$item_received['offer_id'].'</td><td>'.$item_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
                                       
                                       
                                       
                                       
                                        if($item_received['trans_real'] > 0)
                                                $items_received_text .= '<td>'.date("j F Y, H:i:s",$item_received['trans_real']).'</td>';
                                        else
                                                $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
                                                $items_received_text .= '</tr>';
                                }
                        }
                        $paccs_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
                        if(is_object($paccs_history_received)) {
                                foreach($paccs_history_received as $pacc_received) {
                                        if($account_logged->getId() == $pacc_received['to_account'])
                                                $char_color = 'green';
                                        else
                                                $char_color = 'red';
                                                $paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>';
                                        if($account_logged->getId() == $pacc_received['from_account'])
                                                $paccs_received_text .= '<i>Your account</i>';
                                        else
                                                $paccs_received_text .= $pacc_received['from_nick'];
                                                $paccs_received_text .= '</td><td>'.$pacc_received['pacc_days'].' days</td><td>'.$pacc_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $pacc_received['trans_real']).'</td></tr>';
                                }
                        }
                        $main_content .= '<center><h1>Transactions History</h1></center>';
                        if(!empty($items_received_text))
                                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="6"><font color="white" size="4"><b>&nbsp;Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Cost</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />';
                        if(!empty($paccs_received_text))
                                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b>&nbsp;Pacc Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccs_received_text.'</table><br />';
                        if(empty($paccs_received_text) && empty($items_received_text))
                                $main_content .= 'You did not buy/receive any items or PACC.';
                }
        }

Troque por:


        elseif($action == 'show_history') {
                if(!$logged) {
                        $main_content .= 'Please login first.';
                } else{
                        $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
                        if(is_object($items_history_received)) {
                                foreach($items_history_received as $item_received) {
                                        if($account_logged->getId() == $item_received['to_account'])
                                                $char_color = 'green';
                                        else
                                                $char_color = 'red';
                                                $items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>';
                                        if($account_logged->getId() == $item_received['from_account'])
                                                $items_received_text .= '<i>Your account</i>';
                                        else
                                                $items_received_text .= $item_received['from_nick'];
                                               
                                                $items_received_text .= '</td><td>'.$item_received['offer_id'].'</td><td>'.$item_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
                                       
                                       
                                       
                                       
                                        if($item_received['trans_real'] > 0)
                                                $items_received_text .= '<td>'.date("j F Y, H:i:s",$item_received['trans_real']).'</td>';
                                        else
                                                $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
                                                $items_received_text .= '</tr>';
                                }
                        }
                        $itemsguild_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
                        if(is_object($itemsguild_history_received)) {
                                foreach($itemsguild_history_received as $itemguild_received) {
                                        if($account_logged->getId() == $itemguild_received['to_account'])
                                                $char_color = 'green';
                                        else
                                                $char_color = 'red';
                                                $itemsguild_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$itemguild_received['to_name'].'</font></td><td>';
                                        if($account_logged->getId() == $itemguild_received['from_account'])
                                                $itemsguild_received_text .= '<i>Your account</i>';
                                        else
                                                $itemsguild_received_text .= $itemguild_received['from_nick'];
                                               
                                                $itemsguild_received_text .= '</td><td>'.$itemguild_received['offer_id'].'</td><td>'.$itemguild_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $itemguild_received['trans_start']).'</td>';
                                       
                                       
                                       
                                       
                                        if($itemguild_received['trans_real'] > 0)
                                                $itemsguild_received_text .= '<td>'.date("j F Y, H:i:s",$itemguild_received['trans_real']).'</td>';
                                        else
                                                $itemsguild_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
                                                $itemsguild_received_text .= '</tr>';
                                }
                        }
                        $paccs_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
                        if(is_object($paccs_history_received)) {
                                foreach($paccs_history_received as $pacc_received) {
                                        if($account_logged->getId() == $pacc_received['to_account'])
                                                $char_color = 'green';
                                        else
                                                $char_color = 'red';
                                                $paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>';
                                        if($account_logged->getId() == $pacc_received['from_account'])
                                                $paccs_received_text .= '<i>Your account</i>';
                                        else
                                                $paccs_received_text .= $pacc_received['from_nick'];
                                                $paccs_received_text .= '</td><td>'.$pacc_received['pacc_days'].' days</td><td>'.$pacc_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $pacc_received['trans_real']).'</td></tr>';
                                }
                        }
                        $paccsguild_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
                        if(is_object($paccsguild_history_received)) {
                                foreach($paccsguild_history_received as $paccguild_received) {
                                        if($account_logged->getId() == $paccguild_received['to_account'])
                                                $char_color = 'green';
                                        else
                                                $char_color = 'red';
                                                $paccsguild_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$paccguild_received['to_name'].'</font></td><td>';
                                        if($account_logged->getId() == $paccguild_received['from_account'])
                                                $paccsguild_received_text .= '<i>Your account</i>';
                                        else
                                                $paccsguild_received_text .= $paccguild_received['from_nick'];
                                                $paccsguild_received_text .= '</td><td>'.$paccguild_received['pacc_days'].' days</td><td>'.$paccguild_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $paccguild_received['trans_real']).'</td></tr>';
                                }
                        }
                        $main_content .= '<center><h1>Transactions History</h1></center>';
                        if(!empty($items_received_text))
                                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="6"><font color="white" size="4"><b>&nbsp;ShopServer Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Cost</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />';
                        if(!empty($itemsguild_received_text))
                                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="6"><font color="white" size="4"><b>&nbsp;ShopGuild Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Cost</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$itemsguild_received_text.'</table><br />';
                        if(!empty($paccs_received_text))
                                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b>&nbsp;ShopServer VIP Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccs_received_text.'</table><br />';
                        if(!empty($paccsguild_received_text))
                                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b>&nbsp;ShopGuild VIP Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccsguild_received_text.'</table><br />';
                        if(empty($paccs_received_text) && empty($items_received_text))
                                $main_content .= 'You did not buy/receive any items or PACC.';
                        if(empty($paccsguild_received_text) && empty($itemsguild_received_text))
                                $main_content .= 'You did not buy/receive any items or PACC.';
                }
        }

Finalmente terminamos!
Bom todo esse processo é feito só para facilitar tudo pra você e o player e pra diferenciar o Shop System do Shop Guild, porque um sustenta as despesas do server e o outro atrai player, porque pra ter player é preciso ter player.

Galera acredito que não esteja faltando nada, espero que gostem e tudo que eu poder fazer para nossas melhoras estarei postando, me desculpem meu erros de português mais o que importa aqui é o script está correto, abraços!


Créditos:
Natanael Beckman

 

Não proíbo ninguém de copia o tópico só peço que onde você adicione os créditos mencionados.

 

Funciona em TFS 1.2?

Link para o post
Compartilhar em outros sites
  • 3 years later...

Eu tenho um problema em

 

stack traceback:
 data/talkactions/scripts/guildpoints.lua:25: in function <data/talkactions/scripts/guildpoints.lua:24>

 

Eu apreciaria se você pudesse me ajudar :)

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo