//technical error
        $ERRORS->Add('Error, the website failed to verify your account balance.');
    }
}
unset($BalanceError);
$ERRORS->Check('/index.php?page=purchase_gold');
####################################################################
## The actual script begins here
//construct the characters handler
$chars = new server_Character();
//start logging
$logs->add('PSTORE_GOLD', 'Starting log session. Using currency: Gold Coins, Amount of Purchase: ' . $GoldAmount . ', selected realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($chars->setRealm($RealmId)) {
    //check if the character belongs to this account
    if ($chars->isMyCharacter(false, $character)) {
        //send the gold
        $sentGold = $command->sendMoney($character, $GoldAmount * 10000, 'In-Game Gold Delivery', $RealmId);
        //check if any of the actions have failed and log it
        if ($sentGold !== true) {
            $logs->update(false, 'The website failed to execute the send money command and returned: ' . $sentGold . '.', 'error');
            $ERRORS->Add("The website failed to deliver your purchase. Please contact the administration.");
        } else {
            //charge for the purchase
            $Charge = $finance->Charge("In-Game Gold", CA_SOURCE_TYPE_PURCHASE);
            if ($Charge === true) {
                //update the log
                $logs->update(false, 'The user has been charged for his purchase.', 'ok');
            } else {
                //update the log
                $logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');
Exemple #2
0
 private function ProcessItemReward($entry)
 {
     global $CORE;
     //Make sure we have a selected realm
     //It's set to realm 1 by default but
     //it might be needed later on
     if ($this->realm === false) {
         $this->errors[] = 'The realm id is missing.';
         return false;
     }
     //Make sure a character is selected
     if (!$this->character) {
         $this->errors[] = 'This code requires a character to be selected.';
         return false;
     }
     //load the sendmail class
     if (!$CORE->isLoaded_ServerModule('commands')) {
         $CORE->load_ServerModule('commands');
     }
     //prepare the sendmail class
     $command = new server_Commands();
     //check if the realm is online
     if ($command->CheckConnection($this->realm) !== true) {
         $this->errors[] = 'The realm is currently unavailable. Please try again in few minutes.';
         return false;
     }
     //load the characters handling class
     if (!$CORE->isLoaded_ServerModule('character')) {
         $CORE->load_ServerModule('character');
     }
     //construct the characters handler
     $chars = new server_Character();
     if (!$chars->setRealm($this->realm)) {
         $this->errors[] = 'The website failed to load realm database. Please contact the administration for more information.';
         return false;
     }
     //check if the character belongs to this account
     if (!$chars->isMyCharacter(false, $this->character, (int) $this->account)) {
         $this->errors[] = 'The selected character does not belong to this account.';
         return false;
     }
     //Send the item
     $sentMail = $command->sendItems($this->character, $entry, 'Promotion Code Reward', $this->realm);
     //make sure the mail was sent
     if ($sentMail !== true) {
         $this->errors[] = 'The website was unable to deliver your reward due to reason: ' . $sentMail;
         return false;
     }
     unset($chars, $command);
     return true;
 }
Exemple #3
0
$MD = new MapsData();
//setup the map points data class
$MP = new MapPoints();
//start logging
$logs->add('TELEPORTER', 'Starting log session. Teleporting player: ' . $charName . ', to point: ' . $pointId . ', selected realm: ' . $RealmId . '.', 'pending');
//connect to the database
if ($chars->setRealm($RealmId)) {
    ################################################
    ####   check if the character is valid    ######
    //get some character data
    $charData = $chars->getCharacterData(false, $charName, array('guid', 'level'));
    //find the map key by pointId
    $mapKey = $MD->ResolveMapByPoint($pointId);
    //get the map data
    $mapData = $MD->get($mapKey);
    if (!$chars->isMyCharacter(false, $charName)) {
        $ERRORS->Add('The selected character does not belong to this account.');
        //update the log
        $logs->update(false, 'The selected character belongs to another account.', 'error');
    } else {
        if ($mapData['reqLevel'] > $charData['level']) {
            $ERRORS->Add('The selected character does not meet the level requirement. The location requires a minimum of atleast ' . $charData['level'] . ' level.');
            //update the log
            $logs->update(false, 'The selected character does not meet the level requirement. The location requires a minimum of atleast ' . $charData['level'] . ' level.', 'error');
        } else {
            //get the coords
            if ($coords = $MP->get($pointId)) {
                //if the character is Online use SOAP to teleport using commands
                if ($chars->isCharacterOnline($charData['guid'])) {
                    //try teleporting using soap
                    $teleport = $command->Teleport($charName, $coords['x'], $coords['y'], $coords['z'], $coords['map'], $RealmId);