Exemple #1
0
 public function fullUpdate($guildName)
 {
     $char = new Characters($this->site);
     $members = $this->getMembers($guildName);
     foreach ($members as $member) {
         $char->getCharacter($member['name']);
     }
 }
 public function getMembersAsCharIDArray($groupID)
 {
     $members = TrackingGroupMembers::Model()->findAll('trackingGroupID=:groupID', array(':groupID' => $groupID));
     foreach ($members as $member) {
         $character = Characters::Model()->findByPk($member->characterID);
         $memberArray[] = $character->characterID;
     }
     return $memberArray;
 }
 public function getCharacters()
 {
     $groupMembers = TrackingGroupMembers::Model()->findAll('trackingGroupID=:trackingGroupID', array(':trackingGroupID' => Yii::app()->user->trackingGroupID));
     foreach ($groupMembers as $member) {
         $character = Characters::Model()->findByPk($member->characterID);
         $charArray[$character->characterID] = $character->characterName;
     }
     return $charArray;
 }
 public function index()
 {
     //Set keyword to proper format using Str::lower - it's the same as strtolower
     $keyword = Str::lower(Input::get('keyword'));
     //Use Query builder to look for the keyword in various category
     $data['comics'] = Comicbooks::where('book_name', 'LIKE', '%' . $keyword . '%')->select('book_name')->distinct()->get();
     $data['characters'] = Characters::where('character_name', 'LIKE', '%' . $keyword . '%')->select('character_name')->distinct()->get();
     $data['authors'] = Authors::where('author_name', 'LIKE', '%' . $keyword . '%')->select('author_name')->distinct()->get();
     $data['artists'] = Artists::where('artist_name', 'LIKE', '%' . $keyword . '%')->select('artist_name')->distinct()->get();
     $data['publishers'] = Publishers::where('publisher_name', 'LIKE', '%' . $keyword . '%')->select('publisher_name')->distinct()->get();
     $this->layout->content = View::make('search', $data);
 }
Exemple #5
0
 public function storeData($walletID)
 {
     $attributes = $this->apiAttributes();
     //Retrieve the XML dataset
     $orders = $this->getEVEData($walletID);
     $character = Characters::Model()->findByPk($walletID);
     Orders::Model()->deleteAll('charID=:charID', array(':charID' => $character->characterID));
     foreach ($orders->result->rowset->row as $row) {
         $exist = Orders::Model()->exists('orderID=:orderID', array(':orderID' => $row->attributes()->orderID));
         if (!$exist) {
             //echo "ORDERID: {$row->attributes()->orderID} <br>";
             $orderRow = new Orders();
             $orderRow->orderID = $row->attributes()->orderID;
             $orderRow->charID = $row->attributes()->charID;
             $orderRow->stationID = $row->attributes()->stationID;
             $orderRow->volEntered = $row->attributes()->volEntered;
             $orderRow->volRemaining = $row->attributes()->volRemaining;
             $orderRow->minVolume = $row->attributes()->minVolume;
             $orderRow->orderState = $row->attributes()->orderState;
             $orderRow->typeID = $row->attributes()->typeID;
             $orderRow->range = $row->attributes()->range;
             $orderRow->accountKey = $row->attributes()->accountKey;
             $orderRow->duration = $row->attributes()->duration;
             $orderRow->escrow = $row->attributes()->escrow;
             $orderRow->price = $row->attributes()->price;
             $orderRow->bid = $row->attributes()->bid;
             $orderRow->issued = $row->attributes()->issued;
             $orderRow->save();
             //print_r($orderRow->getErrors());
         } else {
             //echo "ORDERID: {$row->attributes()->orderID} <br>";
             $orderRow = Orders::Model()->findByPk($row->attributes()->orderID);
             $orderRow->orderID = $row->attributes()->orderID;
             $orderRow->charID = $row->attributes()->charID;
             $orderRow->stationID = $row->attributes()->stationID;
             $orderRow->volEntered = $row->attributes()->volEntered;
             $orderRow->volRemaining = $row->attributes()->volRemaining;
             $orderRow->minVolume = $row->attributes()->minVolume;
             $orderRow->orderState = $row->attributes()->orderState;
             $orderRow->typeID = $row->attributes()->typeID;
             $orderRow->range = $row->attributes()->range;
             $orderRow->accountKey = $row->attributes()->accountKey;
             $orderRow->duration = $row->attributes()->duration;
             $orderRow->escrow = $row->attributes()->escrow;
             $orderRow->price = $row->attributes()->price;
             $orderRow->bid = $row->attributes()->bid;
             $orderRow->issued = $row->attributes()->issued;
             $orderRow->save();
             //print_r($orderRow->getErrors());
         }
     }
 }
 public static function GetGuildData($GuildName)
 {
     $Statement = Guild::$CharConnection->prepare('SELECT g.*, count(gm.guid) guild_population FROM guild g LEFT JOIN guild_member gm ON g.guildid = gm.guildid WHERE g.name = :name');
     $Statement->bindParam(':name', $GuildName);
     $Statement->execute();
     $Result = $Statement->fetch(PDO::FETCH_ASSOC);
     if ($Result['name'] == $GuildName) {
         $Result['guild_side'] = Characters::GetSideByRaceID(Characters::GetCharacterByGUID($Result['leaderguid'])['race']);
         return $Result;
     } else {
         return false;
     }
 }
Exemple #7
0
 static function send($pj, $msg)
 {
     $pj = Characters::get($pj);
     if (!$pj['success']) {
         return array('success' => false, 'msg' => $pj['msg']);
     } else {
         $pj = $pj['data'];
     }
     PDOSql::$pdobj = pdoConnect();
     $iduser = Sql::esc($pj['iduser']);
     $msg = Sql::esc(str_replace('{%NAME%}', $pj['name'], $msg));
     return Sql::insert("INSERT INTO notifications (iduser, msg, status) VALUES ('{$iduser}', '{$msg}', '0')");
 }
 public function getOrderTotal($characterID)
 {
     //Get the character information from the db
     $character = Characters::model()->findByPk($characterID);
     $criteria = new CDbCriteria();
     $criteria->condition = 'charID=:characterID AND orderState=0 AND bid=0';
     $criteria->params = array(':characterID' => $character->characterID);
     $orders = Orders::Model()->findAll($criteria);
     foreach ($orders as $order) {
         $orderTotal = $orderTotal + $order->price * $order->volRemaining;
     }
     return $orderTotal;
 }
 public function getCharacters()
 {
     //Grab the characters from the db
     $members = $this->getMembersAsArray(Yii::app()->user->trackingGroupID);
     $sqlarray = '(' . implode(',', $members) . ')';
     $characters = Characters::Model()->findAll('walletID IN ' . $sqlarray . '', array(':accountID' => $userid));
     foreach ($characters as $character) {
         $characterSheet = new APICharacterInfo();
         $characterAPI = $characterSheet->getEVEData($character['walletID']);
         $characterInfos[] = $characterAPI->result;
     }
     return $characterInfos;
 }
 public static function load($characterID, $className = __CLASS__)
 {
     if (!isset($characterID)) {
         return false;
     }
     $character = Characters::Model()->find('characterID = :characterID', array(':characterID' => $characterID));
     $sheetObject = new APICharacterSheet();
     $sheetObject->_charSheetXML = $sheetObject->getEVEData($character->walletID);
     if ($sheetObject->_charSheetXML != false) {
         return $sheetObject;
     } else {
         return false;
     }
 }
 public function storeData($walletID)
 {
     $attributes = $this->apiAttributes();
     //Retrieve the XML dataset
     $transactions = $this->getEVEData($walletID);
     $character = Characters::Model()->findByPk($walletID);
     if (!isset($transactions->error)) {
         $row = $transactions->result->rowset->row;
         for ($i = count($row) - 1; $i >= 0; $i--) {
             if ($character->limitUpdate) {
                 $orderTime = strtotime($row[$i]->attributes()->transactionDateTime);
                 $timeLimit = strtotime($character->limitDate);
             } else {
                 $orderTime = 1;
                 $timeLimit = 0;
             }
             $exist = Wallet::Model()->exists('transactionID=:transactionID', array(':transactionID' => $row[$i]->attributes()->transactionID));
             if ($exist == false && $orderTime > $timeLimit) {
                 if ($row[$i]->attributes()->transactionFor == "personal") {
                     $orderRow = new Wallet();
                     $orderRow->transactionDateTime = $row[$i]->attributes()->transactionDateTime;
                     $orderRow->transactionID = $row[$i]->attributes()->transactionID;
                     $orderRow->quantity = $row[$i]->attributes()->quantity;
                     $orderRow->typeName = $row[$i]->attributes()->typeName;
                     $orderRow->typeID = $row[$i]->attributes()->typeID;
                     $orderRow->price = $row[$i]->attributes()->price;
                     $orderRow->clientID = $row[$i]->attributes()->clientID;
                     $orderRow->clientName = $row[$i]->attributes()->clientName;
                     $orderRow->stationID = $row[$i]->attributes()->stationID;
                     $orderRow->stationName = $row[$i]->attributes()->stationName;
                     $orderRow->transactionType = $row[$i]->attributes()->transactionType;
                     $orderRow->characterID = $walletID;
                     $orderRow->personal = 0;
                     $lastPrice = $this->lastStockPrice($orderRow->typeID, $orderRow, $character->walletID);
                     if ($orderRow->transactionType == "buy") {
                         $this->addStock($orderRow);
                     }
                     if ($lastPrice == 0 || $orderRow->transactionType == "buy") {
                         $orderRow->profit = 0;
                     } else {
                         $orderRow->profit = $orderRow->quantity * $orderRow->price - $orderRow->quantity * $lastPrice;
                         $this->subtractStock($orderRow, $orderRow->quantity, $character->walletID);
                     }
                     $orderRow->save();
                     print_r($orderRow->getErrors());
                 }
             }
         }
     }
 }
 public static function PerformSearch($Query)
 {
     $FoundTotal = 0;
     $GuildsFound = 0;
     $CharactersFound = 0;
     $ArticlesFound = 0;
     $ItemsFound = 0;
     $GuildsArray = array();
     $CharactersArray = array();
     $ArticlesArray = array();
     $ItemsArray = array();
     $SearchForGuild = Search::SearchForGuild($Query);
     $SearchForCharacter = Search::SearchForCharacter($Query);
     $SearchForArticles = Search::SearchForArticles($Query);
     $SearchForItems = Search::SearchForItems($Query);
     if (!empty($SearchForGuild)) {
         $FoundTotal = $FoundTotal + count($SearchForGuild);
         $GuildsFound = count($SearchForGuild);
         foreach ($SearchForGuild as $Guild) {
             $GuildData = Characters::GetGuildData($Guild['name']);
             $GuildsArray[] = array('guid' => $GuildData['guildid'], 'name' => $GuildData['name'], 'side' => $GuildData['side']['name'], 'side_translation' => $GuildData['side']['translation'], 'BackgroundColor' => $GuildData['BackgroundColor'], 'BorderStyle' => $GuildData['BorderStyle'], 'BorderColor' => $GuildData['BorderColor'], 'EmblemStyle' => $GuildData['EmblemStyle'], 'EmblemColor' => $GuildData['EmblemColor']);
         }
     }
     if (!empty($SearchForCharacter)) {
         $FoundTotal = $FoundTotal + count($SearchForCharacter);
         $CharactersFound = count($SearchForCharacter);
         foreach ($SearchForCharacter as $Character) {
             $CharacterData = Characters::GetCharacterData($Character['name']);
             $CharactersArray[] = array('name' => $CharacterData['name'], 'class' => $CharacterData['class'], 'race' => $CharacterData['race'], 'gender' => $CharacterData['gender'], 'class_name' => $CharacterData['class_data']['translation'], 'race_name' => $CharacterData['race_data']['translation'], 'level' => $CharacterData['level'], 'online' => $CharacterData['online'], 'guild' => $CharacterData['guild_name'], 'side' => $CharacterData['side_id'], 'sidetranslation' => $CharacterData['side_translation']);
         }
     }
     if (!empty($SearchForArticles)) {
         $FoundTotal = $FoundTotal + count($SearchForArticles);
         $ArticlesFound = count($SearchForArticles);
         foreach ($SearchForArticles as $Article) {
             $ArticleData = News::GetArticle($Article['id']);
             $ArticlesArray[] = array('id' => $ArticleData['id'], 'miniature' => $ArticleData['post_miniature'], 'title' => $ArticleData['title'], 'comments' => $ArticleData['comments_count']);
         }
     }
     if (!empty($SearchForItems)) {
         $FoundTotal = $FoundTotal + count($SearchForItems);
         $ItemsFound = count($SearchForItems);
         foreach ($SearchForItems as $Item) {
             $ItemsArray[] = array('id' => $Item['entry'], 'name' => $Item['name'], 'Quality' => $Item['Quality'], 'ItemLevel' => $Item['ItemLevel'], 'RequiredLevel' => $Item['RequiredLevel'], 'Class' => $Item['class']['translation'], 'Subclass' => $Item['subclass']['translation'], 'icon' => $Item['icon']);
         }
     }
     $SearchResult = array('foundtotal' => $FoundTotal, 'guildsfound' => $GuildsFound, 'charactersfound' => $CharactersFound, 'articlesfound' => $ArticlesFound, 'itemsfound' => $ItemsFound, 'guilds' => $GuildsArray, 'characters' => $CharactersArray, 'articles' => $ArticlesArray, 'items' => $ItemsArray);
     return $SearchResult;
 }
 public function run($args)
 {
     $characters = Characters::model()->findAll();
     foreach ($characters as $character) {
         echo "Found character {$character->characterName}\n";
         $walletInterface = new APITransactions();
         $journalInterface = new APIJournal();
         $ordersInterface = new APIOrders();
         $assetsInterface = new APIAssetList();
         $sheetInterface = new APICharacterSheet();
         //Wallet
         if (!$walletInterface->getCacheExpiration($character->walletID) && $character->walletEnabled) {
             echo "Updating transactions...\n";
             $walletInterface->storeData($character->walletID);
         }
         //Journal
         if (!$journalInterface->getCacheExpiration($character->walletID) && $character->journalEnabled) {
             echo "Updating journal...\n";
             $journalInterface->storeData($character->walletID);
         }
         //Orders
         if (!$ordersInterface->getCacheExpiration($character->walletID) && $character->ordersEnabled) {
             echo "Updating orders...\n";
             $ordersInterface->storeData($character->walletID);
         }
         /*
                     //Assets
                     if(!($assetsInterface->getCacheExpiration($character->walletID)))
                     {
            echo "Updating assets...\n";
            $assetsInterface->storeData($character->walletID);
                     }
         */
         //Balance
         if (!$sheetInterface->getCacheExpiration($character->walletID) && $character->displayBalance) {
             echo "Updating balances...\n";
             $sheet = $sheetInterface->getEveData($character->walletID);
             $sheetBalance = $sheet->result->balance[0][0];
             $balance = (double) $sheetBalance;
             $balanceRow = new Balances();
             $balanceRow->characterID = $character->characterID;
             $balanceRow->balanceDateTime = $this->getEveTimeSql();
             $balanceRow->balance = $balance;
             $balanceRow->save();
         }
     }
 }
Exemple #14
0
 public function getCacheExpiration($characterID)
 {
     //Get the API model attributes
     $attributes = $this->apiAttributes();
     //Get the character information from the db
     $character = Characters::model()->findByPk($characterID);
     //Create the full cacheID and check the cache
     $fullCacheID = $attributes['cacheID'] . $character->getAttribute($attributes['primaryID']);
     $expire = Yii::app()->cache->expiration($fullCacheID);
     if (empty($expire)) {
         return 0;
     } else {
         $timeLeft = $expire - time();
         if ($timeLeft <= 0) {
             return 0;
         } else {
             return $timeLeft;
         }
     }
     /*
     if (empty($data))
     {
     	return 0;
     }
     else
     {
     	$EVExml = new SimpleXMLElement($data);
     	$remain = strtotime($EVExml->cachedUntil) - strtotime("+5 hour") + 5 + $attributes['cacheOffset'];
     	
     	if ($EVExml->error)
     	{
     		echo "ERROR: $EVExml->error CHARACTER: $characterID <br>";
     	}
     	
     	if ($remain <= 0)
     	{
     		return 0;
     	}
     	else
     	{
     		return $remain;
     	}
     }
     */
 }
 public function actionUpdateCharacter($id)
 {
     $model = Characters::Model()->find('characterID=:characterID', array(':characterID' => $id));
     // Generate the accounts dropdown list
     $accounts = Accounts::Model()->findAll();
     foreach ($accounts as $account) {
         $accountsArray[$account->accountID] = $account->fullName;
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'characters-updateCharacter-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['Characters'])) {
         $model->attributes = $_POST['Characters'];
         if ($model->validate()) {
             $model->save();
             $this->redirect(array('index'));
         }
     }
     $this->render('updateCharacter', array('model' => $model, 'accountsArray' => $accountsArray));
 }
Exemple #16
0
 public function getBrowse($category)
 {
     //Get browse category
     $category_filtered = strtoupper(trim($category));
     //Page Title
     $data['title'] = $category_filtered;
     //Switch to get appropriate data, redirect to error if options aren't listed
     switch ($category_filtered) {
         case 'SERIES':
             $data['comics'] = Comicbooks::orderBy('book_name', 'asc')->get();
             break;
         case 'AUTHORS':
             $data['comics'] = Authors::select('author_name')->orderBy('author_name', 'asc')->distinct()->get();
             break;
         case 'ARTISTS':
             $data['comics'] = Artists::select('artist_name')->orderBy('artist_name', 'asc')->distinct()->get();
             break;
         case 'CHARACTERS':
             $data['comics'] = Characters::select('character_name')->orderBy('character_name', 'asc')->distinct()->get();
             break;
         case 'PUBLISHERS':
             $data['comics'] = Publishers::select('publisher_name')->orderBy('publisher_name', 'asc')->distinct()->get();
             break;
         case 'GENRES':
             $data['comics'] = Genres::orderBy('genre_name', 'asc')->get();
             break;
         case 'YEARS':
             //This needed to be a raw query because of the date
             $data['comics'] = Comicissues::select(DB::raw('year(published_date) as year'))->orderBy('published_date', 'asc')->distinct()->get();
             break;
         default:
             return Redirect::to('error');
             break;
     }
     $this->layout->content = View::make('browse', $data);
 }
Exemple #17
0
 public function storeData($walletID)
 {
     $attributes = $this->apiAttributes();
     $character = Characters::Model()->findByPk($walletID);
     //Retrieve the XML dataset
     $journal = $this->getEVEData($walletID);
     if (!isset($journal->error)) {
         foreach ($journal->result->rowset->row as $row) {
             if ($character->limitUpdate) {
                 $orderTime = strtotime($row->attributes()->date);
                 $timeLimit = strtotime($character->limitDate);
             } else {
                 $orderTime = 1;
                 $timeLimit = 0;
             }
             $exist = Journal::Model()->exists('refID=:refID', array(':refID' => $row->attributes()->refID));
             if (!$exist && $orderTime > $timeLimit) {
                 $orderRow = new Journal();
                 $orderRow->date = $row->attributes()->date;
                 $orderRow->refID = $row->attributes()->refID;
                 $orderRow->refTypeID = $row->attributes()->refTypeID;
                 $orderRow->ownerName1 = $row->attributes()->ownerName1;
                 $orderRow->ownerID1 = $row->attributes()->ownerID1;
                 $orderRow->ownerName2 = $row->attributes()->ownerName2;
                 $orderRow->ownerID2 = $row->attributes()->ownerID2;
                 $orderRow->argName1 = $row->attributes()->argName1;
                 $orderRow->argID1 = $row->attributes()->argID1;
                 $orderRow->amount = $row->attributes()->amount;
                 $orderRow->balance = $row->attributes()->balance;
                 $orderRow->reason = $row->attributes()->reason;
                 $orderRow->characterID = $walletID;
                 $orderRow->save();
             }
         }
     }
 }
Exemple #18
0
    $xml->XMLWriter()->endElement();
    //page
    echo $xml->StopXML();
    exit;
}
$xml->XMLWriter()->startElement('itemTooltips');
$xml->XMLWriter()->startElement('itemTooltip');
/** ITEM TOOLTIP DATA GENERATED IN Items::ItemTooltip(int $itemID, XMLWriter $xml, Characters $characters)**/
$items->ItemTooltip($itemID, $xml, $characters);
$xml->XMLWriter()->endElement();
//itemTooltip
if ($utils->IsItemComparisonAllowed()) {
    $primaryCharacter = $utils->GetActiveCharacter();
    if (isset($primaryCharacter['name'])) {
        if ($primaryCharacter['name'] != $characters->GetName() || $primaryCharacter['name'] == $characters->GetName() && $primaryCharacter['realm_id'] != $characters->GetRealmID()) {
            $newChar = new Characters($armory);
            $newChar->BuildCharacter($primaryCharacter['name'], $primaryCharacter['realm_id']);
            if ($newChar->CheckPlayer()) {
                $itemSlot = $items->GetItemSlotId($itemID);
                if (is_array($itemSlot)) {
                    if (is_array($itemSlot['slotname'])) {
                        foreach ($itemSlot['slotname'] as $sId) {
                            $compItemID = $newChar->GetCharacterEquip($sId);
                            if ($compItemID > 0) {
                                $xml->XMLWriter()->startElement('comparisonTooltips');
                                $xml->XMLWriter()->startElement('itemTooltip');
                                $items->ItemTooltip($compItemID, $xml, $newChar, false, true);
                                $xml->XMLWriter()->endElement();
                                //itemTooltip
                                $xml->XMLWriter()->endElement();
                                //comparisonTooltips
Exemple #19
0
 function DisplayCharacterModel()
 {
     $CharacterData = Characters::GetCharacterData($_REQUEST['datatype']);
     $Inventory = Characters::GetGearForCharacter($CharacterData['guid']);
     ModelViewer::Initialize(450, 450);
     ModelViewer::SetCharacterData($CharacterData['race_data']['name'], $CharacterData['gender']);
     foreach ($Inventory as $Item) {
         if (isset($Item['data'])) {
             ModelViewer::EquipItem($Item['slot'], $Item['data']['displayid']);
         }
     }
     echo ModelViewer::GetCharacterHtml();
 }
 /**
  * Update a comicbook series
  * PUT /content/{title}
  *
  * @param  int  $title
  * @return Response
  */
 public function update($title)
 {
     //Set rules
     $rules = array('book_name' => 'required|min:1', 'publisher_name' => 'required|min:1', 'book_description' => 'max:2000', 'genres' => 'min:1', 'characters' => 'min:1');
     //Validate
     $validator = Validator::make(Input::all(), $rules);
     //Instance of Comicbook model
     $comic = new Comicbooks();
     $book_id = $comic->series($title)->select('comicdb_books.id')->first();
     //If the comicbook series exists
     if (!is_null($book_id)) {
         //If validation passes
         if ($validator->passes()) {
             //Instance of Publisher model
             $publishers = new Publishers();
             //Set variables
             $book_name = strtolower(Input::get('book_name'));
             $publisher = strtolower(Input::get('publisher_name'));
             //If publisher already exists, get the id of that publisher from the comicdb_publishers table
             $publisherExists = $publishers->where('publisher_name', $publisher)->select('id')->first();
             if (isset($publisherExists->id)) {
                 $publisher_id = $publisherExists->id;
             } else {
                 $publisher_id = $publishers->insertGetId(array('publisher_name' => $publisher));
             }
             //Update comic series
             $update_comic = $comic->findOrFail($book_id->id);
             $update_comic->book_name = $book_name;
             $update_comic->book_description = Input::get('book_description');
             $update_comic->publisher_id_FK = $publisher_id;
             $update_comic->save();
             //Delete then reinsert all the values because that way is easier.
             DB::table('comicdb_genrebook')->where('book_id_FK', $update_comic->id)->delete();
             foreach (Input::get('genres') as $key => $genre) {
                 DB::table('comicdb_genrebook')->insert(array('book_id_FK' => $update_comic->id, 'genre_id_FK' => $genre));
             }
             //Add issue character information into the comicdb_character table and keys into the comicdb_characterbook table
             DB::table('comicdb_characterbook')->where('book_id_FK', $update_comic->id)->delete();
             foreach (Input::get('characters') as $key => $character) {
                 $character_id = Characters::insertGetId(array('character_name' => $character));
                 DB::table('comicdb_characterbook')->insert(array('book_id_FK' => $update_comic->id, 'character_id_FK' => $character_id));
             }
             return Redirect::to('browse')->with('postMsg', 'The book has been updated!');
         } else {
             return Redirect::to('content.series.edit')->with('postMsg', 'Whoops! Looks like you got some errors.')->withErrors($validator)->withInput();
         }
     } else {
         return Redirect::to('content.series.edit')->with('postMsg', 'That book does not exist!');
     }
 }
 public static function prepareBoostData($Character)
 {
     $ClassItems = Classes::getBoostClassData($Character['class']);
     $CharacterItems = [];
     $DataArray['Main'] = Characters::generateCharacterLevelUP($Character['guid']);
     foreach ($ClassItems as $CI) {
         foreach ($CI as $Key => $Value) {
             if ($Key == $_REQUEST['specialization']) {
                 $CharacterItems[] = $Value;
             }
         }
     }
     $CharacterItems = call_user_func_array('array_merge', $CharacterItems);
     if ($Character['level'] >= 60) {
         $BoostProfessions = Classes::getBoostProfessions($Character['guid']);
         $DataArray['Skills'] = Characters::generateCharacterSkillsSQL($Character['guid'], $BoostProfessions);
     }
     if (self::getBoostSpells($Character['class'])) {
         $DataArray['Spells'] = Characters::generateCharacterSpellsSQL($Character['guid'], self::getBoostSpells($Character['class']));
     }
     $DataArray['ItemInstance'] = Items::generateItemInstanceSQL($Character['guid'], $CharacterItems);
     $DataArray['CharacterInv'] = Characters::generateCharacterInventorySQL($Character['guid'], $CharacterItems);
     return $DataArray;
 }
Exemple #22
0
 /**
  * 软件兑换金币
  *
  * @param unknown $user_id
  */
 public function software_to_gold($user_id, $software_id)
 {
     try {
         $con_characters = Yii::app()->db_characters;
         $trans_characters = $con_characters->beginTransaction();
         $table_name = sprintf('software_%02s', dechex($user_id % 256));
         $ret = $con_characters->createCommand()->select('id')->from($table_name)->where('software_id=:ID AND status=1')->bindParam(':ID', $software_id, PDO::PARAM_INT, 11)->order('id DESC')->queryRow();
         if ($ret) {
             return -2;
         } else {
             //查询软件推荐
             $software_info = Common::model()->getSoftware($software_id);
             if (!$software_info) {
                 return -3;
             }
             //获取用户基本信息
             $player = Characters::model()->getCharactersInfo($user_id);
             //金币购买体力
             $param['gold'] = (int) $player['gold'] + (int) $software_info[0]['gold'];
             //更新 加金币
             Characters::model()->updateCharacters($user_id, $param);
             //解锁女神 加金币日志
             $gold_params = array('user_id' => $user_id, 'type' => 10, 'value' => $software_info[0]['gold'], 'gold' => $param['gold'], 'create_ts' => date("Y-m-d H:i:s"));
             Gold::model()->createGold($user_id, $gold_params);
             //软件换金币记录
             $p = array('user_id' => $user_id, 'software_id' => $software_id, 'gold' => $software_info[0]['gold'], 'status' => 1);
             $con_characters->createCommand()->insert($table_name, $p);
             //提交事务
             $trans_characters->commit();
             //获取角色信息
             $info = Characters::model()->getCharactersInfo($user_id);
             $return['log']['gold'] = $software_info[0]['gold'];
             $return['log']['gold_after'] = $param['gold'];
             $return['result'] = array('point' => (int) $info['point'], 'exp' => (int) $info['exp'], 'vit' => (int) $info['vit'], 'vit_time' => (int) $info['vit_time'], 'level' => (int) $info['level'], 'gold' => (int) $info['gold'], 'flowers' => (int) $info['flowers']);
         }
     } catch (Exception $e) {
         error_log($e);
         $trans_characters->rollback();
         return -1;
     }
     return $return;
 }
 /**
  * 关注女神
  *
  * @param string $user_id
  * @param string $token
  * @param int    $goddess_id
  * @param int    $follow            1:关注  0:取消关注  2:用户取消关注
  *
  *
  */
 public function actionFollowGoddess()
 {
     // 参数检查
     if (!isset($_REQUEST['user_id']) || !isset($_REQUEST['token']) || !isset($_REQUEST['goddess_id']) || !isset($_REQUEST['follow'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $now = date("Y-m-d H:i:s");
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     $goddess_id = trim(Yii::app()->request->getParam('goddess_id'));
     $follow = trim(Yii::app()->request->getParam('follow'));
     if (!is_numeric($goddess_id) || !is_numeric($follow)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     if ($follow != 0 && $follow != 1 && $follow != 2) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     if (!is_numeric($user_id)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     //用户不存在 返回错误
     if ($user_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     //验证token
     if (!Token::model()->verifyToken($user_id, $token, $GLOBALS['__APPID'])) {
         //token 错误
         $this->_return('MSG_ERR_TOKEN');
     }
     //查询是否有此女神
     if (!Goddess::model()->isExitsGoddess($goddess_id)) {
         $this->_return('MSG_ERR_NO_EXIST_GODDESS');
     }
     //如果已经相同 则成功
     $rw = Follow::model()->getFollowRow($user_id, $goddess_id);
     if (isset($rw['followed']) && $follow == $rw['followed']) {
         $this->_return('MSG_SUCCESS');
     }
     //用户关注赞+1,女神照片赞+1,女神赞总数+1
     $characters_transaction = Yii::app()->db_characters->beginTransaction();
     $heroine_transaction = Yii::app()->db_heroine->beginTransaction();
     try {
         //关注女神
         Characters::model()->followGoddess($user_id, $goddess_id, $follow);
         $followerCount = Goddess::model()->getFollowerCount($goddess_id);
         if ($follow == 1) {
             $followerCount = $followerCount + 1;
             $arr = array('follower_count' => $followerCount);
             if ($rw['followed'] != 2) {
                 //关注魅力值+10
                 $glamorousCount = Goddess::model()->getGlamorousCount($goddess_id);
                 $glamorousCount = $glamorousCount + Yii::app()->params['follow_glamorous'];
                 $arr = array('follower_count' => $followerCount, 'glamorous' => $glamorousCount);
                 //关注加好感值
                 $liking = $rw['liking'] + (int) Yii::app()->params['follow_liking'];
                 Follow::model()->updateFollowRow($user_id, $goddess_id, array('liking' => $liking));
                 //关注加经验
                 //获取用户基本信息
                 $player = Characters::model()->getCharactersInfo($user_id);
                 //获取等级信息
                 $liking = Liking::model()->getLikingRow($player['level']);
                 //加经验值
                 $params = array('exp' => $player['exp'] + (int) Yii::app()->params['follow_exp']);
                 //加经验更新等级
                 $lv = Level::model()->exp2Level($params['exp']);
                 if (!empty($lv) && strcmp($lv, $player['level']) != 0) {
                     $param['level'] = $lv;
                 }
                 Characters::model()->updateCharacters($user_id, $params);
             }
         }
         if ($follow == 0) {
             $followerCount = max($followerCount - 1, 0);
             $arr = array('follower_count' => $followerCount);
         }
         //增加关注度
         Goddess::model()->updateHeroineInfo($goddess_id, $arr);
         $characters_transaction->commit();
         $heroine_transaction->commit();
         //关注女神
         Log::model()->_goddess_log($user_id, $goddess_id, 'DS_FOLLOW', date('Y-m-d H:i:s'), '');
     } catch (Exception $e) {
         error_log($e);
         $characters_transaction->rollback();
         $heroine_transaction->rollback();
         $this->_return('MSG_ERR_UNKOWN');
     }
     $this->_return('MSG_SUCCESS');
 }
 public function getTotalBalance()
 {
     $group = $this->getDefaultTrackingGroup(Yii::app()->user->trackingGroupID);
     $groupMembers = $this->getTrackingGroupMembers($group->trackingGroupID);
     foreach ($groupMembers as $member) {
         $character = Characters::Model()->findByPk($member->characterID);
         if ($character->displayBalance) {
             $criteria = new CDbCriteria();
             $criteria->condition = 'characterID = :characterID';
             $criteria->order = 'balanceDateTime DESC';
             $criteria->params = array(':characterID' => $character->characterID);
             $balanceRow = Balances::Model()->find($criteria);
             $balance = $balance + $balanceRow->balance;
         }
     }
     return $balance;
 }
 /**
  * Performs Authorization Based on Username and Password
  *
  * @param $Username
  * @param $Password
  *
  * @return bool
  */
 public static function Authorize($Username, $Password)
 {
     $StringToHash = $Username . ':' . $Password;
     $HashedPassword = Account::HashPassword('sha1', $StringToHash);
     $Statement = Account::$DBConnection->prepare('SELECT id, username, access_level, pinned_character FROM users WHERE username = :user AND password = :hashedpassword');
     $Statement->bindParam('user', $Username);
     $Statement->bindParam('hashedpassword', $HashedPassword);
     $Statement->execute();
     $Result = $Statement->fetch(PDO::FETCH_ASSOC);
     if (!is_null($Result['username'])) {
         if ($Result['pinned_character'] == null || Text::IsNull($Result['pinned_character'])) {
             $CharID = Characters::PickRandomChar($Result['id']);
             if ($CharID != false) {
                 Account::PinCharacter($Result['username'], $CharID);
             }
         }
         $_SESSION['access_role'] = $Result['access_level'];
         return true;
         // Successfull Athorization
     } else {
         return false;
     }
 }
 public function storeData($walletID)
 {
     $attributes = $this->apiAttributes();
     //Retrieve the XML dataset
     $industryJobs = $this->getEVEData($walletID);
     $character = Characters::Model()->findByPk($walletID);
     if (!isset($industryJobs->error)) {
         foreach ($industryJobs->result->rowset->row as $row) {
             //if ($row->attributes()->installerID == $character->characterID)
             //{
             $exist = IndustryJobs::Model()->exists('jobID=:jobID', array(':jobID' => $row->attributes()->jobID));
             // If this job doesn't exist yet, create a new one and populate it
             if (!$exist) {
                 $jobRow = new IndustryJobs();
                 $jobRow->jobID = $row->attributes()->jobID;
                 $jobRow->assemblyLineID = $row->attributes()->assemblyLineID;
                 $jobRow->containerID = $row->attributes()->containerID;
                 $jobRow->installedItemID = $row->attributes()->installedItemID;
                 $jobRow->installedItemLocationID = $row->attributes()->installedItemLocationID;
                 $jobRow->installedItemQuantity = $row->attributes()->installedItemQuantity;
                 $jobRow->installedItemProductivityLevel = $row->attributes()->installedItemProductivityLevel;
                 $jobRow->installedItemMaterialLevel = $row->attributes()->installedItemMaterialLevel;
                 $jobRow->installedItemLicensedProductionRunsRemaining = $row->attributes()->installedItemLicensedProductionRunsRemaining;
                 $jobRow->outputLocationID = $row->attributes()->outputLocationID;
                 $jobRow->installerID = $row->attributes()->installerID;
                 $jobRow->runs = $row->attributes()->runs;
                 $jobRow->licensedProductionRuns = $row->attributes()->licensedProductionRuns;
                 $jobRow->installedInSolarSystemID = $row->attributes()->installedInSolarSystemID;
                 $jobRow->containerLocationID = $row->attributes()->containerLocationID;
                 $jobRow->materialMultiplier = $row->attributes()->materialMultiplier;
                 $jobRow->charMaterialMultiplier = $row->attributes()->charMaterialMultiplier;
                 $jobRow->timeMultiplier = $row->attributes()->timeMultiplier;
                 $jobRow->charTimeMultiplier = $row->attributes()->charTimeMultiplier;
                 $jobRow->installedItemTypeID = $row->attributes()->installedItemTypeID;
                 $jobRow->outputTypeID = $row->attributes()->outputTypeID;
                 $jobRow->containerTypeID = $row->attributes()->containerTypeID;
                 $jobRow->installedItemCopy = $row->attributes()->installedItemCopy;
                 $jobRow->completed = $row->attributes()->completed;
                 $jobRow->completedSuccessfully = $row->attributes()->completedSuccessfully;
                 $jobRow->installedItemFlag = $row->attributes()->installedItemFlag;
                 $jobRow->activityID = $row->attributes()->activityID;
                 $jobRow->completedStatus = $row->attributes()->completedStatus;
                 $jobRow->installTime = $row->attributes()->installTime;
                 $jobRow->outputFlag = $row->attributes()->outputFlag;
                 $jobRow->beginProductionTime = $row->attributes()->beginProductionTime;
                 $jobRow->endProductionTime = $row->attributes()->endProductionTime;
                 $jobRow->pauseProductionTime = $row->attributes()->pauseProductionTime;
                 $jobRow->save();
                 print_r($jobRow->getErrors());
             } else {
                 // Retrieve the job
                 $jobRow = IndustryJobs::Model()->findByPk($row->attributes()->jobID);
                 // Do we need to move this job to assets?
                 if ($jobRow->completed == 0 && $row->attributes()->completed == 1) {
                     //Get the typeID details
                     $typeID = Invtypes::Model()->findByPk($row->attributes()->outputTypeID);
                     //Create a new asset
                     $asset = new Assets();
                     $asset->characterID = $character->characterID;
                     $asset->locationID = $row->attributes()->installedItemLocationID;
                     $asset->typeID = $row->attributes()->outputTypeID;
                     $asset->quantity = $row->attributes()->runs;
                     $asset->flag = 4;
                     $asset->singleton = 0;
                     $asset->containerID = 0;
                     $asset->locationName = $this->getLocationName($row->attributes()->installedItemLocationID);
                     $asset->typeName = $typeID->typeName;
                     $asset->groupID = $typeID->groupID;
                     $asset->save();
                 }
                 // Update the job row with the new data from CCP
                 $jobRow->jobID = $row->attributes()->jobID;
                 $jobRow->assemblyLineID = $row->attributes()->assemblyLineID;
                 $jobRow->containerID = $row->attributes()->containerID;
                 $jobRow->installedItemID = $row->attributes()->installedItemID;
                 $jobRow->installedItemLocationID = $row->attributes()->installedItemLocationID;
                 $jobRow->installedItemQuantity = $row->attributes()->installedItemQuantity;
                 $jobRow->installedItemProductivityLevel = $row->attributes()->installedItemProductivityLevel;
                 $jobRow->installedItemMaterialLevel = $row->attributes()->installedItemMaterialLevel;
                 $jobRow->installedItemLicensedProductionRunsRemaining = $row->attributes()->installedItemLicensedProductionRunsRemaining;
                 $jobRow->outputLocationID = $row->attributes()->outputLocationID;
                 $jobRow->installerID = $row->attributes()->installerID;
                 $jobRow->runs = $row->attributes()->runs;
                 $jobRow->licensedProductionRuns = $row->attributes()->licensedProductionRuns;
                 $jobRow->installedInSolarSystemID = $row->attributes()->installedInSolarSystemID;
                 $jobRow->containerLocationID = $row->attributes()->containerLocationID;
                 $jobRow->materialMultiplier = $row->attributes()->materialMultiplier;
                 $jobRow->charMaterialMultiplier = $row->attributes()->charMaterialMultiplier;
                 $jobRow->timeMultiplier = $row->attributes()->timeMultiplier;
                 $jobRow->charTimeMultiplier = $row->attributes()->charTimeMultiplier;
                 $jobRow->installedItemTypeID = $row->attributes()->installedItemTypeID;
                 $jobRow->outputTypeID = $row->attributes()->outputTypeID;
                 $jobRow->containerTypeID = $row->attributes()->containerTypeID;
                 $jobRow->installedItemCopy = $row->attributes()->installedItemCopy;
                 $jobRow->completed = $row->attributes()->completed;
                 $jobRow->completedSuccessfully = $row->attributes()->completedSuccessfully;
                 $jobRow->installedItemFlag = $row->attributes()->installedItemFlag;
                 $jobRow->activityID = $row->attributes()->activityID;
                 $jobRow->completedStatus = $row->attributes()->completedStatus;
                 $jobRow->installTime = $row->attributes()->installTime;
                 $jobRow->outputFlag = $row->attributes()->outputFlag;
                 $jobRow->beginProductionTime = $row->attributes()->beginProductionTime;
                 $jobRow->endProductionTime = $row->attributes()->endProductionTime;
                 $jobRow->pauseProductionTime = $row->attributes()->pauseProductionTime;
                 $jobRow->save();
             }
             //}
         }
     }
 }
Exemple #27
0
 /**
  * Returns array with guild members list.
  * @category Guilds class
  * @access   public
  * @return   array
  **/
 public function BuildGuildList()
 {
     if (!$this->guildId) {
         Armory::Log()->writeError('%s : guildId not defined', __METHOD__);
         return false;
     }
     $memberListTmp = Armory::$cDB->select("\n        SELECT\n        `characters`.`guid`,\n        `characters`.`name`,\n        `characters`.`class` AS `classId`,\n        `characters`.`race` AS `raceId`,\n        `characters`.`gender` AS `genderId`,\n        `characters`.`level`,\n        `guild_member`.`rank`\n        FROM `characters` AS `characters`\n        LEFT JOIN `guild_member` AS `guild_member` ON `guild_member`.`guid`=`characters`.`guid` AND `guild_member`.`guildid`=%d\n        LEFT JOIN `guild` AS `guild` ON `guild`.`guildid`=%d\n        WHERE `guild`.`guildid`=%d AND `characters`.`level`>=%d AND `guild_member`.`guid`=`characters`.`guid`", $this->guildId, $this->guildId, $this->guildId, Armory::$armoryconfig['minlevel']);
     $countMembers = count($memberListTmp);
     for ($i = 0; $i < $countMembers; $i++) {
         $pl = new Characters();
         $pl->SetOptions(LOAD_NOTHING);
         $pl->SetOptions(array('load_achievements' => true));
         $pl->BuildCharacter($memberListTmp[$i]['name'], Armory::$currentRealmInfo['id'], false);
         $memberListTmp[$i]['achPoints'] = $pl->GetAchievementMgr()->GetAchievementPoints();
         $memberListTmp[$i]['url'] = sprintf('r=%s&cn=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($memberListTmp[$i]['name']), urlencode($this->guildName));
         unset($pl);
     }
     return $memberListTmp;
 }
 public static function GetTopicData($TopicID)
 {
     $Statement = Forums::$DBConnection->prepare('SELECT fc.*, f.forum_name, f.forum_type, ft.topic FROM forum_comments fc, forums f, forum_topics ft WHERE ft.forum_id = fc.forum_id AND fc.forum_id = f.forum_id AND topic_id = :topicid');
     $Statement->bindParam(':topicid', $TopicID);
     $Statement->execute();
     $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
     $ArrayIndex = 0;
     foreach ($Result as $Topic) {
         $Result[$ArrayIndex]['forum_type_name'] = Forums::GetForumTypeTranslated($Topic['forum_id']);
         $Result[$ArrayIndex]['forum_name'] = Forums::$TM->GetConfigVars($Topic['forum_name']);
         $ArrayIndex++;
     }
     $ArrayIndex = 0;
     $TopicData = array('type' => array('id' => $Result[0]['forum_type'], 'name' => $Result[0]['forum_type_name']), 'category' => array('id' => $Result[0]['forum_id'], 'name' => $Result[0]['forum_name']), 'topic' => array('id' => $Result[0]['topic_id'], 'name' => $Result[0]['topic']), 'replies' => array());
     foreach ($Result as $Reply) {
         $CharacterData = Characters::GetShortProfileInfo($Reply['posted_by']);
         $Result[$ArrayIndex]['class'] = $CharacterData['class'];
         $Result[$ArrayIndex]['race'] = $CharacterData['race'];
         $Result[$ArrayIndex]['class_name'] = $CharacterData['class_name'];
         $Result[$ArrayIndex]['race_name'] = $CharacterData['race_name'];
         $Result[$ArrayIndex]['gender'] = $CharacterData['gender'];
         $Result[$ArrayIndex]['level'] = $CharacterData['level'];
         $Result[$ArrayIndex]['apoints'] = $CharacterData['apoints'];
         $Result[$ArrayIndex]['post_message'] = Forums::ParseBBCode($Reply['post_message']);
         $ArrayIndex++;
     }
     $TopicData['replies'] = String::MassUnset($Result, array('forum_type', 'forum_type_name', 'forum_id', 'forum_name', 'topic', 'topic_id'));
     return $TopicData;
 }
Exemple #29
0
<?php

//Acquire skill in training
$characterTable = Characters::Model()->find('characterID=:characterID', array(':characterID' => $data->characterID));
$skillAPI = new APISkillInTraining();
$skills = $skillAPI->getEVEData($characterTable->walletID);
?>
<div style="width: 100%;" class="characterstats">
	<h1 class="header1"><B><?php 
echo $data->characterName;
?>
</B></h1>
	
	<table>
	<tr>
	<td>
	
	<div style="width: 150px; height: 150px; margin-right: 2px;">
		<img src="http://image.eveonline.com/Character/<?php 
echo $data->characterID;
?>
_200.jpg" height="150" width="150">
	</div>
	
	<div style="margin-top: 0px; margin-bottom: 0px; width: 150px;" class="affiliationstats">
		<div style="width: 200px;">
			<img src="http://image.eveonline.com/Corporation/<?php 
echo $data->corporationID;
?>
_32.png" style="float:left; margin-right:2px;">
			<div style="margin-left: 0px;">
 public static function GetCharacterProfessions($CharacterGuid)
 {
     $Statement = Characters::$CharConnection->prepare('SELECT * FROM character_skills WHERE guid = :guid');
     $Statement->bindParam(':guid', $CharacterGuid);
     $Statement->execute();
     $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
     $Index = 0;
     $CharacterProfessions = array();
     foreach ($Result as $Profession) {
         $ProfessionData = Characters::GetProfessionData($Profession['skill']);
         if ($ProfessionData != false) {
             $CharacterProfessions[] = array('id' => $Profession['skill'], 'name' => $ProfessionData['name'], 'primary' => $ProfessionData['primary'], 'translation' => $ProfessionData['translation'], 'current' => $Profession['value'], 'max' => $Profession['max'], 'title' => Characters::ProfessionTitle($Profession['max']));
         }
     }
     return $CharacterProfessions;
 }