Exemplo n.º 1
0
 public static function GetResetStatus($JSONP)
 {
     $WorldStates = [20001, 20002, 20003, 20006, 20007];
     $Response = [];
     $Statement = parent::$CharConnection->prepare('SELECT * from worldstates WHERE entry IN(20001, 20002, 20003, 20006, 20007);');
     $Statement->execute();
     $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
     if (Database::IsEmpty($Statement)) {
         foreach ($WorldStates as $ID) {
             $Response[] = [ArmoryAPI::GetWorldstateByID($ID) => '0'];
         }
     } else {
         foreach ($Result as $WS) {
             foreach ($WorldStates as $ID) {
                 if ($ID == $WS['entry']) {
                     $Response[] = [ArmoryAPI::GetWorldstateByID($ID) => $WS['value']];
                     break;
                 } else {
                     $Response[] = [ArmoryAPI::GetWorldstateByID($WS['entry']) => '0'];
                     break;
                 }
             }
         }
     }
     return parent::Encode($Response, $JSONP, "wsrt");
 }
 public static function GetSimpleSpell($SpellID, $JSONP)
 {
     $SpellInfo = Spells::SpellInfo($SpellID);
     if ($SpellInfo) {
         $SpellData = Text::RemapArray($SpellInfo, ['SpellID', 'Name', 'Description', 'icon'], ['id', 'name', 'description', 'icon']);
         parent::Encode($SpellData, $JSONP);
     } else {
         parent::GenerateResponse(404, true);
     }
 }
 public static function ItemClasses($JSONP)
 {
     $Result = Items::ItemSubClass(null, null, false, true);
     $JSONArray = [];
     foreach ($Result as $Key => $Value) {
         $ClassArray = [];
         $ClassArray['class'] = $Key;
         $ClassArray['name'] = Items::ItemClass($Key)['translation'];
         $ClassArray['subclasses'] = [];
         foreach ($Value as $SKey => $SValue) {
             $ClassArray['subclasses'][] = ['subclass' => $SValue['subclass'], "name" => $SValue['translation']];
         }
         $JSONArray[] = $ClassArray;
     }
     parent::Encode($JSONArray, $JSONP, 'classes');
 }
 public static function GetSimpleAchievement($AchievementID, $JSONP)
 {
     $Statement = parent::$DBConnection->prepare('SELECT a.id, a.faction as factionID, a.name_loc0 as title, a.description_loc0 as description, a.points, a.reward_loc0 as reward, LOWER(si.iconname) as icon FROM freedomcore_achievement a LEFT JOIN freedomcore_spellicons si ON a.icon = si.id WHERE a.id = :aid');
     $Statement->bindParam(':aid', $AchievementID);
     $Statement->execute();
     $Result = $Statement->fetch(PDO::FETCH_ASSOC);
     if ($Statement->rowCount() > 0) {
         $GetAchievementCriterias = AchievementAPI::GetAchievementCriteria($AchievementID);
         foreach ($GetAchievementCriterias as $Criteria) {
             $Result['criteria'][] = $Criteria;
         }
         return parent::Encode($Result, $JSONP);
     } else {
         return parent::GenerateResponse(404, true);
     }
 }
 public static function GetCharacters($Username, $Password, $JSONP)
 {
     $GameData = AccountAPI::GetUserBasicData($Username, $Password);
     if (isset($GameData['code'])) {
         return parent::Encode($GameData, $JSONP);
     } else {
         $Statement = parent::$CharConnection->prepare('SELECT name, race, class, gender, level, money FROM characters WHERE account = :accountid');
         $Statement->bindParam(":accountid", $GameData['id']);
         $Statement->execute();
         $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
         $ArrayIndex = 0;
         foreach ($Result as $Character) {
             $Result[$ArrayIndex]['race'] = Characters::GetRaceByID($Character['race']);
             $Result[$ArrayIndex]['class'] = Characters::GetClassByID($Character['class']);
             $Result[$ArrayIndex]['class'] = Characters::GetClassByID($Character['class']);
             $Result[$ArrayIndex]['money'] = Text::MoneyToCoins($Character['money']);
             $ArrayIndex++;
         }
         return parent::Encode($Result, $JSONP, "characters");
     }
 }
 public static function GetItemSet($SetID, $JSONP)
 {
     $Statement = parent::$DBConnection->prepare('SELECT * FROM freedomcore_itemset WHERE itemsetID = :setid');
     $Statement->bindParam(':setid', $SetID);
     $Statement->execute();
     $Result = $Statement->fetch(PDO::FETCH_ASSOC);
     if ($Statement->rowCount() > 0) {
         $FinalArray = [];
         $FinalArray['id'] = $Result['itemsetID'];
         $FinalArray['name'] = $Result['name_loc0'];
         $i = 8;
         while ($i > 0) {
             if ($Result['bonus' . $i] != 0) {
                 $FinalArray['setBonuses'][] = ['description' => Spells::SpellInfo($Result['spell' . $i])['Description'], 'threshold' => $Result['bonus' . $i]];
             }
             $i--;
         }
         $SetItems = [];
         for ($i = 1; $i <= 10; $i++) {
             if ($Result['item' . $i] != 0) {
                 $SetItems[] = $Result['item' . $i];
             }
         }
         $FinalArray['items'] = $SetItems;
         parent::Encode($FinalArray, $JSONP);
     } else {
         parent::GenerateResponse(404, true);
     }
 }