예제 #1
0
 /**
  * Account API Currency Convertor Functionality
  * @param $Arguments
  * @return array|mixed
  */
 protected function getCurrencyConvert($Arguments)
 {
     if (count($Arguments) > 3) {
         return json_decode(parent::generateResponse('Too many arguments', 400), true);
     }
     $From = $Arguments[0];
     $To = $Arguments[1];
     $Amount = $Arguments[2];
     $Converter = new CurrencyConverter($From, $To);
     return ['result' => $Converter->toForeign($Amount)];
 }
 protected function getAppearance($Arguments)
 {
     if (count($Arguments) > 1) {
         return json_decode(parent::generateResponse('Too many arguments', 400), true);
     } elseif (count($Arguments) == 0) {
         return json_decode(parent::generateResponse('Not enough arguments', 400), true);
     }
     $CharacterName = ucfirst(strtolower($Arguments[0]));
     $CharData = $this->setTable('characters')->addArguments('name, class, race, gender, level, logout_time, playerBytes, playerBytes2, totalKills')->addColumn('name')->addParameter([':charname', $CharacterName])->build()->single();
     $PlayerBytes = $CharData['playerBytes'];
     $PlayerBytes2 = $CharData['playerBytes2'];
     unset($CharData['playerBytes']);
     unset($CharData['playerBytes2']);
     $Appearance = ['faceVariation' => ($PlayerBytes >> 8) % 256, 'skinColor' => $PlayerBytes % 256, 'hairVariation' => ($PlayerBytes >> 16) % 256, 'hairColor' => ($PlayerBytes >> 24) % 256, 'featureVariation' => $PlayerBytes2 % 256];
     $CharData['faction'] = $this->sideByRaceID($CharData['race']);
     $CharData['appearance'] = $Appearance;
     $CharData['totalHonorableKills'] = $CharData['totalKills'];
     unset($CharData['totalKills']);
     return $CharData;
 }