Example #1
0
        foreach ($BalanceError as $currency) {
            $ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins.");
        }
    } else {
        //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
Example #2
0
//load the character module
$CORE->load_ServerModule('character');
$CORE->load_ServerModule('commands');
$CORE->load_CoreModule('purchaseLog');
//prepare the log
$logs = new purchaseLog();
//prepare the commands class
$command = new server_Commands();
//prepare the character handler
$chars = new server_Character();
//setup the maps data class
$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 {
Example #3
0
        foreach ($BalanceError as $currency) {
            $ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins.");
        }
    } else {
        //technical error
        $ERRORS->Add('Error, the website failed to verify your account balance.');
    }
}
unset($BalanceError);
$ERRORS->Check('/index.php?page=factionchange');
####################################################################
## The actual script begins here
//construct the characters handler
$chars = new server_Character();
//start logging
$logs->add('PSTORE_FACTION', 'Starting log session, initial value of the required currency: ' . $accountGold . ' Gold, selected realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($chars->setRealm($RealmId)) {
    //check if the character belongs to this account
    if ($chars->isMyCharacter(false, $character)) {
        //level the character
        $FactionChange = $command->FactionChange($character, $RealmId);
        //check if the command was successfull
        if ($FactionChange === true) {
            //charge for the purchase
            $Charge = $finance->Charge("Faction Change", CA_SOURCE_TYPE_NONE);
            if ($Charge === true) {
                //update the log
                $logs->update(false, 'The faction change command has been executed and the user has been successfully charged for his purchase.', 'ok');
            } else {
                //update the log
Example #4
0
        //insufficient amount
        foreach ($BalanceError as $currency) {
            $ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins.");
        }
    } else {
        //technical error
        $ERRORS->Add('Error, the website failed to verify your account balance.');
    }
}
unset($BalanceError);
//Check for errors
$ERRORS->Check('/index.php?page=changedname');
############################################################
######## UPDATE THE ACCOUNT"S DISPLAY NAME #################
//start logging
$logs->add('CHANGE_DNAME', 'Starting log session for the Change Display Name service. Using currency: ' . $currency . '.', 'pending');
//Apply the new display name to the account
$update = $DB->prepare("UPDATE `account_data` SET `displayName` = :name WHERE `id` = :acc LIMIT 1;");
$update->bindParam(':name', $displayName, PDO::PARAM_STR);
$update->bindParam(':acc', $CURUSER->get('id'), PDO::PARAM_INT);
$update->execute();
//check if the account was affected
if ($update->rowCount() > 0) {
    //update the log
    $logs->update(false, 'The user\'s display name has been successfully changed.', 'pending');
    //charge for the purchase
    $Charge = $finance->Charge("Display name change", CA_SOURCE_TYPE_PURCHASE);
    if ($Charge === true) {
        //update the log
        $logs->update(false, 'The user has been charged for his purchase.', 'ok');
    } else {
Example #5
0
if ($CURUSER->getSocial($app) === $status) {
    //already set
    exit;
}
###############################################################
############### Update the Social Status ######################
//Im going to limit the status update to positive only because
//we are going to reward users who give us positives
if ($CURUSER->getSocial($app) === STATUS_POSITIVE) {
    exit;
}
$CORE->load_CoreModule('purchaseLog');
//prepare the log
$logs = new purchaseLog();
//start logging
$logs->add('SOCIAL_BUTTONS', 'Starting log session. Application: ' . $app . ', status variable: ' . $status . '.', 'pending');
//Update the user social button status
if ($CURUSER->setSocial($app, $status)) {
    //If the status was update reward the user
    //log successful status update
    $logs->update(false, 'The user status was update.', 'pending');
    //Load the most important module
    $CORE->load_CoreModule('accounts.finances');
    //Setup the finances class
    $finance = new AccountFinances();
    //Set the account id
    $finance->SetAccount($CURUSER->get('id'));
    //Set the currency to gold
    $finance->SetCurrency(CURRENCY_SILVER);
    //Set the amount we are Giving
    $finance->SetAmount($RewardAmount);
Example #6
0
if (!$charName) {
    $ERRORS->Add("Please select a character first.");
}
if (!$items) {
    $ERRORS->Add("There ware no items to send.");
}
$ERRORS->Check('/index.php?page=store');
####################################################################
## The actual script begins here
//construct the characters handler
$chars = new server_Character();
//get the account gold and silver
$accountGold = (int) $CURUSER->get('gold');
$accountSilver = (int) $CURUSER->get('silver');
//start logging
$logs->add('STORE', 'Starting log session, initial values: ' . $accountSilver . ' silver, ' . $accountGold . ' gold. To character: ' . $charName . ' in realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($chars->setRealm($RealmId)) {
    //check if the character belongs to this account
    if ($chars->isMyCharacter(false, $charName)) {
        //create error array
        $itemErrors = array();
        //create negative items string
        $itemsString = false;
        $charData = $chars->getCharacterData(false, $charName, 'guid');
        //Get the character GUID
        $characterGUID = $charData['guid'];
        unset($charData);
        //loop the item list
        foreach ($items as $index => $data) {
            //set the default hasMoney to false
Example #7
0
        foreach ($BalanceError as $currency) {
            $ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins.");
        }
    } else {
        //technical error
        $ERRORS->Add('Error, the website failed to verify your account balance.');
    }
}
unset($BalanceError);
$ERRORS->Check('/index.php?page=levels');
####################################################################
## The actual script begins here
//construct the characters handler
$chars = new server_Character();
//start logging
$logs->add('PSTORE_LEVEL', 'Starting log session. Leveling character: ' . $character . ' to level ' . $level['level'] . '. Using currency: ' . $level['priceCurrency'] . ', price value: ' . $level['price'] . ', selected realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($chars->setRealm($RealmId)) {
    //check if the character belongs to this account
    if ($chars->isMyCharacter(false, $character)) {
        //get the character name
        $charData = $chars->getCharacterData(false, $character, 'level');
        //check if the character is already higher level
        if ($charData['level'] < $level['level']) {
            //level the character
            $levelUp = $command->levelTo($character, $level['level'], $RealmId);
            //send the gold
            $sentGold = $command->sendMoney($character, $level['money'], 'Premium Store Delivery', $RealmId);
            //make the bags string
            $bagsString = "";
            for ($i = 0; $i < $level['bags']; $i++) {
Example #8
0
            $ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins.");
        }
    } else {
        //technical error
        $ERRORS->Add('Error, the website failed to verify your account balance.');
    }
}
unset($BalanceError);
//Check for errors
$ERRORS->Check('/index.php?page=boosts');
############################################################
######## UPDATE THE ACCOUNT"S DISPLAY NAME #################
//Get the time
$time = $CORE->getTime(true);
//start logging
$logs->add('BOOSTS', 'Starting log session for the Boost Purchase service. Using currency: ' . $currency . ' and duration: ' . $DurationId . ', selected realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($RealmDB = $CORE->RealmDatabaseConnection($RealmId)) {
    # Check if the boost is already active
    $res = $RealmDB->prepare("SELECT * FROM `player_boosts` WHERE `account_Id` = :acc AND `boosts` = :boost LIMIT 1;");
    $res->bindParam(':acc', $CURUSER->get('id'), PDO::PARAM_INT);
    $res->bindParam(':boost', $BoostId, PDO::PARAM_INT);
    $res->execute();
    if ($res->rowCount() > 0) {
        if ($time->getTimestamp() > (int) $arr['unsetdate']) {
            //already expired, remove from the database
            $delete = $RealmDB->prepare("DELETE FROM `player_boosts` WHERE `account_Id` = :acc AND `boosts` = :boost LIMIT 1;");
            $delete->bindParam(':acc', $CURUSER->get('id'), PDO::PARAM_INT);
            $delete->bindParam(':boost', $BoostId, PDO::PARAM_INT);
            $delete->execute();
        } else {