• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC SELLING VOCATIONS HELP!

kukas9

New Member
Joined
Oct 8, 2017
Messages
7
Reaction score
0
Hello everyone, anyone who can help or collaborate I thank you immensely, I am having difficulty implementing the vocation acquisition by the site, my server is from NTO, instead of using item that the person receives the vocation, or NPC that sells the vocation , I'm trying to do the site, so I'm having problems, in the 1st step is to do this addition of vocations manually using the adminsitrador panel, the 2nd is when I click on buy vocation he create another character with the vocation chosen, 2nd stage more I believe that the 1st depends on the 2nd step, thanks again for the help!
follows the image of the first difficulty I'm having and the code that I believe is right
Imgur

In the file "admin-add.html.twig" I added the following code:
Code:
<option value="Vocation">Vocation</option>
____________________
else if(value == 'vocation') {
			$('#extra').append('<input type="number" name="vocation" style="width: 120px;" min="1" placeholder="Vocation" required/>');
			$('#extra').append('<input type="number" name="item_count" style="width: 120px;" min="1" placeholder="Item Count" required/>');
			$('#extra').append('<br/><input type="number" name="looktype" style="width: 120px;" min="1" placeholder="LookType" required/>');
		}

Gifts.php
inside the "getOfferArray" function, within the "while" i insert:
Code:
elseif ($data['offer_type'] == 'vocation')
		{
			$offer_array['vocation'][$i_item]['id'] = $data['id'];
			$offer_array['vocation'][$i_item]['item_count'] = $data['count1'];
			$offer_array['vocation'][$i_item]['points'] = $data['points'];
			$offer_array['vocation'][$i_item]['description'] = $data['offer_description'];
			$offer_array['vocation'][$i_item]['name'] = $data['offer_name'];
			$offer_array['vocation'][$i_item]['vocation'] = $data['vocation'];
			$offer_array['vocation'][$i_item]['looktype'] = $data['looktype'];
			$i_item++;
		}

inside in "if ($ action == 'admin_add') {", i insert:

Code:
case 'vocation':
						
						$count1 = isset($_REQUEST['item_count']) ? $_REQUEST['item_count'] : null;
						$vocation = isset($_REQUEST['vocation']) ? $_REQUEST['vocation'] : null;
						$looktype = isset($_REQUEST['looktype']) ? $_REQUEST['looktype'] : null;
						 if(!$count1 || !is_numeric($count1)) {
							$error = 'Please fill all fields. Item Count is empty or its not a number.';
						} 
						else if(!$vocation || !is_numeric($vocation)) {
							$error = 'Please fill all fields. Vocation is empty or its not a number.';
						}
						else if(!$looktype || !is_numeric($looktype)) {
							$error = 'Please fill all fields. LookType is empty or its not a number.';
						}
						
						
						break;

And in "offer_list" i insert:
Code:
//show list of vocations offers
		else if($get_offerType == 'vocation' && isset($offer_list['vocation']) && count($offer_list['vocation']) > 0)
		{
			foreach($offer_list['vocation'] as $vocation)
			{
				echo '<tr bgcolor="'.$config['lightborder'].'">
				<td align="center">'.getItemImage($vocation['vocation']).'</td><td><b>'.$vocation['looktype'].'</b><br/>'.'</td><td><b>'.$vocation['name'].'</b><br/>'.$vocation['description'].'</td><td align="center">'.$vocation['points'].'</td><td align="center">';
				
				if(!$logged)
				{
					echo '<b>Login to buy</b>';
				}
				else
				{
					echo '<form action="?subtopic=gifts&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$vocation['vocation'].'"><input type="submit" value="Buy"><br><b>for '.$vocation['points'].' points</b></form>';
				}
				echo '</td></tr>';
			}
		}

And to finish, in "confirm_transaction", i insert:
Code:
elseif($buy_offer['type'] == 'vocation')
										{
											$query = 'INSERT INTO '.$db->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$db->quote($buy_player->getName()).', \'login\', \'give_item\', '.$db->quote($buy_offer['vocation']).', '.$db->quote($buy_offer['item_count']).', 0, 0, \'item\', '.$db->quote($buy_offer['name']).', \'\', \'1\');';
											$db->query($query);
											$save_transaction = 'INSERT INTO '.$db->tableName('z_shop_history').' (id, comunication_id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES (NULL, '.$db->lastInsertId().', '.$db->quote($buy_player->getName()).', '.$db->quote($buy_player_account->getId()).', '.$db->quote($buy_from).',  '.$db->quote($account_logged->getId()).', '.$db->quote($buy_offer['points']).', '.$db->quote($buy_offer['id']).', \'wait\', '.$db->quote(time()).', \'0\');';
											$db->query($save_transaction);
											$user_premium_points -= $buy_offer['points'];
											add_points($account_logged, -$buy_offer['points']);
											echo '<h2>You have bought this item!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br/>Now patiently wait in game MAX 3 minutes to receive this item!<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="?subtopic=gifts">GO TO MAIN SHOP SITE</a>';
										}

Well, I apologize for anything, I'm still learning and I do not know if I'm going right, who can give me a light, I thank you again
 
Vocation = Vocation ID in vocation.xml (example: 164: Madara)
Looktype= LooktypeID (example: 714)
I cant edit, it is giving error to edit, then I will correct here, where
Code:
$offer_array['vocation'][$i_item]['id'] = $data['id'];
            $offer_array['vocation'][$i_item]['item_count'] = $data['count1'];
            $offer_array['vocation'][$i_item]['points'] = $data['points'];
            $offer_array['vocation'][$i_item]['description'] = $data['offer_description'];
            $offer_array['vocation'][$i_item]['name'] = $data['offer_name'];
            $offer_array['vocation'][$i_item]['vocation'] = $data['vocation'];
            $offer_array['vocation'][$i_item]['looktype'] = $data['looktype'];
            $i_item++;
CHANGE
Code:
$offer_array['vocation'][$i_vocation]['id'] = $data['id'];
            $offer_array['vocation'][$i_vocation]['points'] = $data['points'];
            $offer_array['vocation'][$i_vocation]['description'] = $data['offer_description'];
            $offer_array['vocation'][$i_vocation]['name'] = $data['offer_name'];
            $offer_array['vocation'][$i_vocation]['vocation'] = $data['vocation'];
            $offer_array['vocation'][$i_vocation]['looktype'] = $data['looktype'];
            $i_vocation++;
 
Back
Top