Exemplo n.º 1
0
<?php

namespace Functions\Character;

/**
 * Check to see if a name already exists
 */
$Get = null;
if (property_exists($ARequest, 'Data')) {
    $Get = $ARequest->Data;
} else {
    $Get = new \stdClass();
}
if (property_exists($Get, 'Name')) {
    $Character = new \Entities\Character();
    $Character->Name = $Get->Name;
    $Race = new \Entities\Race();
    if ($Character->Verify($Race)) {
        if (!$Database->Characters->CheckName($Character)) {
            $Response->Set('Result', \Protocol\Response::ER_SUCCESS);
        } else {
            $Response->Set('Result', \Protocol\Response::ER_ALREADYEXISTS);
        }
    } else {
        $Response->Set('Result', \Protocol\Response::ER_BADDATA);
    }
} else {
    $Response->Set('Result', \Protocol\Response::ER_MALFORMED);
}
Exemplo n.º 2
0
if (property_exists($Get, 'Gender') && property_exists($Get, 'Pin') && property_exists($Get, 'Name') && property_exists($Get, 'RaceId') && property_exists($Get, 'Strength') && property_exists($Get, 'Dexterity') && property_exists($Get, 'Intelligence') && property_exists($Get, 'Wisdom') && property_exists($Get, 'Vitality')) {
    $ACharacter = new \Entities\Character();
    $ACharacter->AccountId = $_SESSION['AccountId'];
    $ACharacter->Gender = $Get->Gender;
    $ACharacter->Pin = $Get->Pin;
    $ACharacter->Name = $Get->Name;
    $ACharacter->RaceId = $Get->RaceId;
    $ACharacter->RacialStrength = $Get->Strength;
    $ACharacter->RacialDexterity = $Get->Dexterity;
    $ACharacter->RacialIntelligence = $Get->Intelligence;
    $ACharacter->RacialWisdom = $Get->Wisdom;
    $ACharacter->RacialVitality = $Get->Vitality;
    $ARace = new \Entities\Race();
    $ARace->RaceId = $ACharacter->RaceId;
    if ($Database->Races->LoadById($ARace)) {
        if ($ACharacter->Verify($ARace)) {
            $ACharacter->MapId = $ARace->HomeMapId;
            $ACharacter->PositionX = $ARace->HomePositionX;
            $ACharacter->PositionY = $ARace->HomePositionY;
            $ACharacter->Strength = $ARace->Strength + $ACharacter->RacialStrength;
            $ACharacter->Dexterity = $ARace->Dexterity + $ACharacter->RacialDexterity;
            $ACharacter->Intelligence = $ARace->Intelligence + $ACharacter->RacialIntelligence;
            $ACharacter->Wisdom = $ARace->Wisdom + $ACharacter->RacialWisdom;
            $ACharacter->Vitality = $ARace->Vitality + $ACharacter->RacialVitality;
            $ACharacter->Health = $ACharacter->Vitality;
            $ACharacter->Gold = STARTING_GOLD;
            $ACharacter->AlignGood = $ARace->AlignGood;
            $ACharacter->AlignOrder = $ARace->AlignOrder;
            $Database->startTransaction();
            $Success = false;
            if ($Database->Characters->Insert($ACharacter)) {