public static function GetCategories()
 {
     $Categories = Achievements::GetRootCategories();
     $Index = 0;
     foreach ($Categories as $Category) {
         $Categories[$Index]['achievements_in_category'] = 0;
         $Categories[$Index]['points_for_category'] = 0;
         $SubCategories = Achievements::GetSubCategories($Category['id']);
         $CategoryData = Achievements::GetDataForCategory($Category['id']);
         $Categories[$Index]['achievements_in_category'] = $Categories[$Index]['achievements_in_category'] + $CategoryData['amount'];
         $Categories[$Index]['points_for_category'] = $Categories[$Index]['points_for_category'] + $CategoryData['maxscore'];
         if (!empty($SubCategories)) {
             $Categories[$Index]['subcategories'] = $SubCategories;
             $InnerIndex = 0;
             foreach ($SubCategories as $SubCategory) {
                 $SubSubCategories = Achievements::GetSubCategories($SubCategory['id']);
                 $SubCategoryData = Achievements::GetDataForCategory($SubCategory['id']);
                 $Categories[$Index]['achievements_in_category'] = $Categories[$Index]['achievements_in_category'] + $SubCategoryData['amount'];
                 $Categories[$Index]['points_for_category'] = $Categories[$Index]['points_for_category'] + $SubCategoryData['maxscore'];
                 if (!empty($LastCategories)) {
                     $Categories[$Index]['subcategories'][$InnerIndex]['lastcategory'] = $LastCategories;
                 }
                 $InnerIndex++;
             }
         }
         $Index++;
     }
     //unset($Categories[0]); // we dont need stats.... yet....
     return $Categories;
 }
 /**
  * Get a list of the completed achievements by the guild
  * @param String $sort Define what the list should be sorted by: timestamp|id|name
  * @param String $sortFlag Can be asc|desc
  */
 public function getAchievements($sort = FALSE, $sortFlag = 'asc')
 {
     $achievements['achievementsCompleted'] = $this->characterData['achievements']['achievementsCompleted'];
     $achievements['achievementsCompletedTimestamp'] = $this->characterData['achievements']['achievementsCompletedTimestamp'];
     $id_list = '';
     for ($i = 0; $i < count($achievements['achievementsCompleted']); $i++) {
         // Build the new array to return
         $achievement[$i]['id'] = $achievements['achievementsCompleted'][$i];
         $achievement[$i]['timestamp'] = $achievements['achievementsCompletedTimestamp'][$i];
         $achievement[$i]['url'] = $GLOBALS['wowarmory']['urls']['achievement'] . "=" . $achievements['achievementsCompleted'][$i];
         $achievement[$i]['url'] .= "&who=" . $this->name . "&when=" . $achievement[$i]['timestamp'];
         $id_list .= $achievement[$i]['id'] . ',';
     }
     $id_list = substr($id_list, 0, -1);
     $achievementdata = new Achievements($id_list, 'character', $this->region);
     $id_list = null;
     for ($i = 0; $i < count($achievements['achievementsCompleted']); $i++) {
         $achievement[$i]['name'] = $achievementdata->getAchievement($achievement[$i]['id'], 'title');
     }
     $achievements = null;
     $achievementdata = null;
     if ($sort) {
         return $this->sortAchievements($achievement, $sort, $sortFlag);
     }
     return $achievement;
 }
示例#3
0
 /**
  * Returns array with all characters.
  * @category Utils class
  * @access   public
  * @return   array
  **/
 public function GetAllCharacters()
 {
     if (!isset($_SESSION['accountId'])) {
         return false;
     }
     $results = array();
     foreach (Armory::$realmData as $realm_info) {
         $db = new Armory::$dbClass($realm_info['host_characters'], $realm_info['user_characters'], $realm_info['pass_characters'], $realm_info['port_characters'], $realm_info['name_characters'], $realm_info['charset_characters']);
         if (!$db) {
             continue;
         }
         $chars_data = $db->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`.`guildid` AS `guildId`,\n            `guild`.`name` AS `guild`\n            FROM `characters` AS `characters`\n            LEFT JOIN `guild_member` AS `guild_member` ON `guild_member`.`guid`=`characters`.`guid`\n            LEFT JOIN `guild` AS `guild` ON `guild`.`guildid`=`guild_member`.`guildId`\n            WHERE `characters`.`account`=%d", $_SESSION['accountId']);
         if (!$chars_data) {
             Armory::Log()->writeLog('%s : no characters found for account %d in `%s` database', __METHOD__, $_SESSION['accountId'], $realm_info['name_characters']);
             continue;
         }
         foreach ($chars_data as $realm) {
             $realm['account'] = strtoupper($_SESSION['username']);
             $realm['factionId'] = self::GetFactionId($realm['raceId']);
             $realm['realm'] = $realm_info['name'];
             $realm['relevance'] = 100;
             if ($realm['level'] < Armory::$armoryconfig['minlevel']) {
                 $realm['relevance'] = 0;
             } elseif ($realm['level'] >= Armory::$armoryconfig['minlevel'] && $realm['level'] <= 79) {
                 $realm['relevance'] = $realm['level'];
             } elseif ($realm['level'] == MAX_PLAYER_LEVEL) {
                 $realm['relevance'] = 100;
             } else {
                 $realm['relevance'] = 0;
                 // Unknown
             }
             $realm['url'] = sprintf('r=%s&cn=%s', urlencode($realm['realm']), urlencode($realm['name']));
             $realm['selected'] = Armory::$aDB->selectCell("SELECT `selected` FROM `ARMORYDBPREFIX_login_characters` WHERE `account`=%d AND `guid`=%d AND `realm_id`=%d LIMIT 1", $_SESSION['accountId'], $realm['guid'], $realm_info['id']);
             if ($realm['selected'] > 2) {
                 $realm['selected'] = 2;
             } elseif ($realm['selected'] == 0) {
                 unset($realm['selected']);
             }
             $ach = new Achievements();
             $ach->InitAchievements($realm['guid'], $db);
             $realm['achPoints'] = $ach->CalculateAchievementPoints();
             unset($realm['guid'], $ach);
             // Do not show GUID in XML results
             $results[] = $realm;
         }
     }
     if (is_array($results)) {
         return $results;
     }
     Armory::Log()->writeLog('%s : unable to find any character for account %d', __METHOD__, $_SESSION['accountId']);
     return false;
 }
示例#4
0
 $Smarty->assign('Character', $CharacterData);
 $Smarty->assign('SelectedCategory', $_REQUEST['lastcategory']);
 switch ($_REQUEST['lastcategory']) {
     case 'achievement':
         if (Text::IsNull($_REQUEST['datatype'])) {
             Manager::LoadExtension('Achievements', $ClassConstructor);
             $Smarty->assign('AStatus', Achievements::GetAchievementsStats());
             $Smarty->assign('Categories', Achievements::GetCategories());
             $Smarty->assign('CompletedAchievements', Characters::GetCompletedAchievements($CharacterData['guid']));
             $Smarty->assign('Page', Page::Info('community', array('bodycss' => 'achievement_page', 'pagetitle' => $Smarty->GetConfigVars('Profile_Character_Achievements') . ' - ' . $Smarty->GetConfigVars('Menu_Community') . ' - ')));
             $Smarty->display('pages/character_achievements');
         } else {
             ob_end_flush();
             Manager::LoadExtension('Achievements', $ClassConstructor);
             $AllCategorues = Achievements::GetCategories();
             $AInCat = Achievements::GetAchievementsInCategory($_REQUEST['datatype']);
             $CompletedAchievements = Characters::GetCompletedAchievements($CharacterData['guid']);
             $WorkingWith = $AllCategorues[Text::MASearch($AllCategorues, 'id', $_REQUEST['datatype'])];
             $CA = array();
             foreach ($CompletedAchievements as $Achievement) {
                 if ($Achievement['category'] == $WorkingWith['id']) {
                     $CA[] = $Achievement['achievement'];
                 }
             }
             foreach ($AInCat as $Key => $Value) {
                 foreach ($CA as $CompA) {
                     if ($Value['id'] == $CompA) {
                         unset($AInCat[$Key]);
                     }
                 }
             }
示例#5
0
 /**
  * Parse achievement data, does it using regex, Faster
  *
  * @param $characterId - the character id
  * @param $all - all achievements or summary?
  * @return Achievement - an achievement object
  */
 private function advancedAchievementsParse($id, $all)
 {
     // If legacy or not.
     $isLegacy = false;
     // get kinds
     $kinds = $this->getAchievementKinds();
     // New character object
     $achievement = new Achievements();
     // loop through kinds
     foreach ($kinds as $kind => $type) {
         // Skip if this is the legacy kind and character is not legacy
         if ($kind == 13 && !$isLegacy) {
             continue;
         }
         // Generate url
         $url = $this->urlGen('achievementsKind', ['{id}' => $id, '{kind}' => $kind]);
         $rawHtml = $this->trim($this->curl($url), '<!-- #main -->', '<!-- //#main -->');
         $html = html_entity_decode(preg_replace(array('#\\s\\s+#s', '#[\\n\\t]#s'), '', $rawHtml), ENT_QUOTES);
         $achievementMatch = array();
         preg_match('#class="txt_yellow">(?<pointsCurrent>\\d+)</strong>.*?(?<legacy>(?<=.)legacy|\\#main)#', $html, $achievementMatch);
         $achievement->pointsCurrent = array_key_exists('pointsCurrent', $achievementMatch) && $achievementMatch['pointsCurrent'] > 0 ? $achievementMatch['pointsCurrent'] : null;
         $achievement->legacy = array_key_exists('legacy', $achievementMatch) && $achievementMatch['legacy'] == "legacy" ? true : false;
         $isLegacy = $achievement->legacy;
         # Achievments
         $regExp = "#<li><div class=\"(?<achieved>.*?)\">.*?" . $this->getRegExp('image', 'icon') . ".*?achievement_name.*?>(?<name>.*?)</span>(?<dateHTML>.*?)achievement_point.*?>(?<points>[\\d]+)</div>.*?<a.*?href=\"/lodestone/character/[\\d]+/achievement/detail/(?<id>[\\d]+)/\".*?</li>#";
         $achievmentMatches = array();
         preg_match_all($regExp, $html, $achievmentMatches, PREG_SET_ORDER);
         foreach ($achievmentMatches as $mkey => $match) {
             $obtained = $match['achieved'] == "already" ? true : false;
             if ($match['achieved'] == "already") {
                 preg_match('#ldst_strftime\\(([\\d\\.]+),#', $match['dateHTML'], $dateMatch);
                 $time = filter_var($dateMatch[1], FILTER_SANITIZE_NUMBER_INT);
             } else {
                 $time = null;
             }
             $points = filter_var($match['points'], FILTER_SANITIZE_NUMBER_INT);
             $achievement->list[$match['id']] = ['id' => $match['id'], 'icon' => $match['icon'], 'iconTimestanp' => $match['iconTimestamp'], 'name' => $match['name'], 'time' => $time, 'obtained' => $obtained, 'points' => $match['points'], 'kind' => $type, 'kind_id' => $kind];
             // prevent php notices
             if (!isset($achievement->kinds[$type])) {
                 $achievement->kinds[$type] = 0;
             }
             if (!isset($achievement->kindsTotal[$type])) {
                 $achievement->kindsTotal[$type] = 0;
             }
             // Increment kinds
             $achievement->kindsTotal[$type] = $achievement->kindsTotal[$type] + $points;
             if ($obtained) {
                 $achievement->kinds[$type] = $achievement->kinds[$type] + $points;
                 $achievement->countCurrent = $achievement->countCurrent + 1;
             }
             // Increment overall total
             $achievement->pointsTotal = $achievement->pointsTotal + $points;
             $achievement->countTotal = $achievement->countTotal + 1;
             if ($kind == 13) {
                 $achievement->legacyPointsTotal += $points;
                 if ($obtained) {
                     $achievement->legacyPoints += $points;
                 }
             }
         }
     }
     // Dust up
     $achievement->clean();
     // return
     return $achievement;
 }
示例#6
0
 $Smarty->assign('Character', $CharacterData);
 $Smarty->assign('SelectedCategory', $_REQUEST['lastcategory']);
 switch ($_REQUEST['lastcategory']) {
     case 'achievement':
         if (String::IsNull($_REQUEST['datatype'])) {
             Manager::LoadExtension('Achievements', $ClassConstructor);
             $Smarty->assign('AStatus', Achievements::GetAchievementsStats());
             $Smarty->assign('Categories', Achievements::GetCategories());
             $Smarty->assign('CompletedAchievements', Characters::GetCompletedAchievements($CharacterData['guid']));
             $Smarty->assign('Page', Page::Info('community', array('bodycss' => 'achievement_page', 'pagetitle' => $Smarty->GetConfigVars('Profile_Character_Achievements') . ' - ' . $Smarty->GetConfigVars('Menu_Community') . ' - ')));
             $Smarty->display('pages/character_achievements');
         } else {
             ob_flush();
             Manager::LoadExtension('Achievements', $ClassConstructor);
             $Smarty->assign('IncompleteAchievements', Achievements::GetAchievementsInCategory($_REQUEST['datatype']));
             $Smarty->assign('Categories', Achievements::GetCategories());
             $Smarty->assign('CompletedAchievements', Characters::GetCompletedAchievements($CharacterData['guid']));
             $Smarty->assign('Category', $_REQUEST['datatype']);
             $Smarty->display('blocks/achievements_category');
         }
         break;
     case 'reputation':
         $Smarty->assign('Reputations', Characters::GetReputation($CharacterData['guid']));
         $Smarty->assign('Page', Page::Info('community', array('bodycss' => 'reputation_page', 'pagetitle' => $Smarty->GetConfigVars('Profile_Character_Reputation') . ' - ' . $Smarty->GetConfigVars('Menu_Community') . ' - ')));
         $Smarty->display('pages/character_reputation');
         break;
     case 'profession':
         $Professions = Characters::GetCharacterProfessions($CharacterData['guid']);
         if (String::IsNull($_REQUEST['datatype'])) {
             if (empty($Professions)) {
                 $Smarty->assign('Page', Page::Info('community', array('bodycss' => 'professions_page', 'pagetitle' => $Smarty->GetConfigVars('Profile_Character_Professions') . ' - ' . $Smarty->GetConfigVars('Menu_Community') . ' - ')));
示例#7
0
 /**
  * Returns array with guild members list. If $gm == true, returns his/her data only.
  * @category Guilds class
  * @example Guilds::buildGuildList(false)
  * @return array
  **/
 public function BuildGuildList()
 {
     if (!$this->guildId) {
         $this->Log()->writeError('%s : guildId not defined', __METHOD__);
         return false;
     }
     $memberListTmp = $this->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`=?\n        LEFT JOIN `guild` AS `guild` ON `guild`.`guildid`=?\n        WHERE `guild`.`guildid`=? AND `characters`.`level`>=? AND `guild_member`.`guid`=`characters`.`guid`", $this->guildId, $this->guildId, $this->guildId, $this->armoryconfig['minlevel']);
     $countMembers = count($memberListTmp);
     for ($i = 0; $i < $countMembers; $i++) {
         $memberListTmp[$i]['achPoints'] = Achievements::calculateAchievementPoints($memberListTmp[$i]['guid']);
         $memberListTmp[$i]['url'] = sprintf('r=%s&cn=%s&gn=%s', urlencode($this->currentRealmInfo['name']), urlencode($memberListTmp[$i]['name']), urlencode($this->guildName));
     }
     return $memberListTmp;
 }
示例#8
0
 public function parseAchievementsByCategory($cID, $ID = null)
 {
     if (!$ID) {
         $ID = $this->getID();
     }
     if (!$ID) {
         echo "error: No ID Set.";
     } else {
         if (!$cID) {
             echo "No catagory id set.";
         } else {
             // Get the source
             $this->getSource($this->URL['character']['profile'] . $ID . $this->URL['character']['achievement'] . $cID . '/');
             // Create a new character object
             $Achievements = new Achievements();
             // Get Achievements
             $Public = $Achievements->checkIfPublic($this->findAll('area_inner_tc', 20));
             if ($Public) {
                 // Get Achievements
                 $Achievements->addCategory($cID);
                 $Achievements->set($this->findAll('achievement_area_body', NULL, 'bt_more', false));
                 // Append character to array
                 return $Achievements;
             } else {
                 return false;
             }
             // Append character to array
             $this->Achievements[$cID] = $Achievements;
             return $Achievements;
         }
     }
 }
示例#9
0
 /**
  * Returns info about last character activity. Requires MaNGOS core patch (tools/character_feed)!
  * $full used only in character-feed.php
  * @category Characters class
  * @example Characters::GetCharacterFeed()
  * @return array
  **/
 public function GetCharacterFeed($full = false)
 {
     if (!$this->guid) {
         $this->Log()->writeError('%s : player guid not defined', __METHOD__);
         return false;
     }
     if ($full) {
         $data = $this->db->select("SELECT * FROM `character_feed_log` WHERE `guid`=? ORDER BY `date` DESC LIMIT 50", $this->guid);
     } else {
         $data = $this->db->select("SELECT * FROM `character_feed_log` WHERE `guid`=? ORDER BY `date` DESC LIMIT 10", $this->guid);
     }
     if (!$data) {
         $this->Log()->writeLog('%s : feed data for player %d (%s) not found!', __METHOD__, $this->guid, $this->name);
         return false;
     }
     $feed_data = array();
     $i = 0;
     // Strings
     $feed_strings = $this->aDB->select("SELECT `id`, `string_" . $this->_locale . "` AS `string` FROM `armory_string` WHERE `id` IN (13, 14, 15, 16, 17, 18)");
     if (!$feed_strings) {
         $this->Log()->writeError('%s : unable to load strings from armory_string (current locale: %s; locId: %d)', __METHOD__, $this->_locale, $this->_loc);
         return false;
     }
     $_strings = array();
     foreach ($feed_strings as $str) {
         $_strings[$str['id']] = $str['string'];
     }
     foreach ($data as $event) {
         $event_date = strtotime($event['date']);
         if (date('d.m.Y') == date('d.m.Y', $event_date)) {
             $sort = 'today';
         } elseif (date('d.m.Y', $event_date) == date('d.m.Y', strtotime('yesterday'))) {
             $sort = 'yesterday';
         } else {
             $sort = 'earlier';
         }
         switch ($event['type']) {
             case TYPE_ACHIEVEMENT_FEED:
                 $send_data = array('achievement' => $event['data'], 'date' => $event_date);
                 $achievement_info = Achievements::GetAchievementInfo($send_data);
                 if (!isset($achievement_info['title']) || !$achievement_info['title'] || empty($achievement_info['title'])) {
                     continue;
                 }
                 if (!isset($achievement_info['points'])) {
                     $achievement_info['points'] = 0;
                 }
                 $feed_data[$i]['event'] = array('type' => 'achievement', 'date' => date('d.m.Y', $event_date), 'time' => date('H:i:s', $event_date), 'id' => $event['data'], 'points' => $achievement_info['points'], 'sort' => $sort);
                 $achievement_info['desc'] = str_replace("'", "\\'", $achievement_info['desc']);
                 $achievement_info['title'] = str_replace("'", "\\'", $achievement_info['title']);
                 $tooltip = sprintf('&lt;div class=\\&quot;myTable\\&quot;\\&gt;&lt;img src=\\&quot;wow-icons/_images/51x51/%s.jpg\\&quot; align=\\&quot;left\\&quot; class=\\&quot;ach_tooltip\\&quot; /\\&gt;&lt;strong style=\\&quot;color: #fff;\\&quot;\\&gt;%s (%d)&lt;/strong\\&gt;&lt;br /\\&gt;%s', $achievement_info['icon'], $achievement_info['title'], $achievement_info['points'], $achievement_info['desc']);
                 //$tooltip = sprintf('<div class="myTable"><img src="wow-icons/_images/51x51/%s.jpg" align="left" class="ach_tooltip" /><strong style="color: #fff;">%s (%d)</strong><br />%s', $achievement_info['icon'], $achievement_info['title'], $achievement_info['points'], $achievement_info['desc']);
                 if ($achievement_info['categoryId'] == 81) {
                     // Feats of strenght
                     $feed_data[$i]['title'] = sprintf('%s [%s].', $_strings[14], $achievement_info['title']);
                     $feed_data[$i]['desc'] = sprintf('%s [<a class="achievement staticTip" href="character-achievements.xml?r=%s&amp;cn=%s" onMouseOver="setTipText(\'%s\')">%s</a>]', $_strings[14], urlencode($this->currentRealmInfo['name']), urlencode($this->name), $tooltip, $achievement_info['title']);
                 } else {
                     $points_string = sprintf($_strings[18], $achievement_info['points']);
                     $feed_data[$i]['title'] = sprintf('%s [%s].', $_strings[13], $achievement_info['title']);
                     $feed_data[$i]['desc'] = sprintf('%s [<a class="achievement staticTip" href="character-achievements.xml?r=%s&amp;cn=%s" onMouseOver="setTipText(\'%s\')">%s</a>] %s.', $_strings[13], urlencode($this->currentRealmInfo['name']), urlencode($this->name), $tooltip, $achievement_info['title'], $points_string);
                 }
                 $feed_data[$i]['tooltip'] = $tooltip;
                 break;
             case TYPE_ITEM_FEED:
                 $item = $this->wDB->selectRow("SELECT `displayid`, `InventoryType`, `name`, `Quality` FROM `item_template` WHERE `entry`=? LIMIT 1", $event['data']);
                 if (!$item) {
                     continue;
                 }
                 $item_icon = $this->aDB->selectCell("SELECT `icon` FROM `armory_icons` WHERE `displayid`=?", $item['displayid']);
                 // Is item equipped?
                 $invenory_slots = array(1 => 'head', 2 => 'neck', 3 => 'shoulder', 4 => 'shirt', 5 => 'chest', 6 => 'belt', 7 => 'legs', 8 => 'boots', 9 => 'wrist', 10 => 'gloves', 11 => 'ring', 12 => 'trinket', 13 => 'mainhand', 14 => 'offhand', 15 => 'relic', 16 => 'back', 17 => 'mainhand', 18 => 'bag', 19 => 'tabard', 20 => 'chest', 21 => 'mainhand', 22 => 'offhand', 23 => 'relic', 26 => 'relic', 28 => 'relic');
                 $item_slot = -1;
                 if (isset($invenory_slots[$item['InventoryType']])) {
                     if ($item['InventoryType'] == 11) {
                         $rings = array('ring1', 'ring2');
                         foreach ($rings as $r_slot) {
                             $tmp_id = self::getCharacterEquip($r_slot);
                             if ($tmp_id == $event['data']) {
                                 $item_slot = $item['InventoryType'];
                             }
                         }
                     } elseif ($item['InventoryType'] == 12) {
                         $trinkets = array('trinket1', 'trinket2');
                         foreach ($trinkets as $t_slot) {
                             $tmp_id = self::getCharacterEquip($t_slot);
                             if ($tmp_id == $event['data']) {
                                 $item_slot = $item['InventoryType'];
                             }
                         }
                     } else {
                         $item_id = self::getCharacterEquip($invenory_slots[$item['InventoryType']]);
                         if ($item_id == $event['data']) {
                             $item_slot = $item['InventoryType'];
                         } else {
                             $item_slot = -1;
                         }
                     }
                 }
                 $feed_data[$i]['event'] = array('type' => 'loot', 'date' => date('d.m.Y', $event_date), 'time' => date('H:i:s', $event_date), 'icon' => $item_icon, 'id' => $event['data'], 'slot' => $item_slot, 'sort' => $sort);
                 if ($this->_locale != 'en_gb' && $this->_locale != 'en_us') {
                     $item['name'] = Items::getItemName($event['data']);
                 }
                 $feed_data[$i]['title'] = sprintf('%s [%s].', $_strings[15], $item['name']);
                 $feed_data[$i]['desc'] = sprintf('%s <a class="staticTip itemToolTip" id="i=%d" href="item-info.xml?i=%d"><span class="stats_rarity%d">[%s]</span></a>.', $_strings[15], $event['data'], $event['data'], $item['Quality'], $item['name']);
                 break;
             case TYPE_BOSS_FEED:
                 // Get criterias
                 $achievement_ids = array();
                 $criterias = $this->aDB->select("SELECT `referredAchievement` FROM `armory_achievement_criteria` WHERE `data`=?", $event['data']);
                 if (!$criterias) {
                     // Search for KillCredit
                     $kc_entry = 0;
                     $KillCredit = $this->wDB->selectRow("SELECT `KillCredit1`, `KillCredit2` FROM `creature_template` WHERE `entry`=?", $event['data']);
                     for ($i = 1; $i < 3; $i++) {
                         if ($KillCredit['KillCredit' . $i] > 0) {
                             $kc_entry = $KillCredit['KillCredit' . $i];
                         }
                     }
                     if ($kc_entry == 0) {
                         continue;
                     }
                     $criterias = $this->aDB->select("SELECT `referredAchievement` FROM `armory_achievement_criteria` WHERE `data`=?", $kc_entry);
                     if (!$criterias || !is_array($criterias)) {
                         continue;
                     }
                 }
                 foreach ($criterias as $crit) {
                     $achievement_ids[] = $crit['referredAchievement'];
                 }
                 if (!$achievement_ids || !is_array($achievement_ids)) {
                     continue;
                 }
                 $achievement = $this->aDB->selectRow("SELECT `id`, `name_" . $this->_locale . "` AS `name` FROM `armory_achievement` WHERE `id` IN (?a) AND `flags`=1", $achievement_ids);
                 if (!$achievement || !is_array($achievement)) {
                     continue;
                 }
                 $feed_data[$i]['event'] = array('type' => 'bosskill', 'date' => date('d.m.Y', $event_date), 'time' => date('H:i:s', $event_date), 'id' => $event['data'], 'points' => 0, 'sort' => $sort);
                 $feed_data[$i]['title'] = sprintf('%s [%s] %d %s', $_strings[16], $achievement['name'], $event['counter'], $_strings[17]);
                 $feed_data[$i]['desc'] = sprintf('%d %s.', $event['counter'], $achievement['name']);
                 break;
         }
         $i++;
     }
     return $feed_data;
 }
示例#10
0
//        rangeSelector: {
//            selected: 1
//        },
//
//        xAxis: {
//            maxZoom: 14 * 24 * 3600000 // fourteen days
//        },
$graph->series = $dataset['dataseries'];
//  $graph->clickThrough = true;
//  $graph->formatFunction = true;
//  $graph->formatFunctionPie = true;
$graphdata = $graph->toJSON(true);
$_dsep = DSEP;
$_tsep = TSEP;
$js .= "<script type=\"text/javascript\">\nvar chart;\n\t\t\t\$(document).ready(function() { \n\n    Highcharts.setOptions({\n        lang: {\n          decimalPoint: '{$_dsep}',\n          thousandsSep: '{$_tsep}'\n        }\n    });\n\n  chart = new Highcharts.Chart(\n{$graphdata}\n)\n\t\t\t});\n   </script>";
$ac = new Achievements($groupdetails['group_id']);
$actable = $ac->getAchievementsTable();
$testtablepos = $ac->getPositionTable();
// Start HTML output
print_header($js);
$back = get_back_page();
$topbar['leftnav'][0]['name'] = $back['name'];
$topbar['leftnav'][0]['url'] = $back['url'];
$topbar['title'] = "Graph!";
/* $topbar['rightnav'][0]['name'] = "Edit";
  $topbar['rightnav'][0]['url'] =  $_SERVER['PHP_SELF']. "?groupid=" . $groupdetails['group_id'] . "&mode=edit";
 */
print_topbar($topbar);
print_body_start();
//echo "Browser {$browser}, Platform {$platform}";
echo '<div id="graph_container" style="width: ' . $divSize['x'] . 'px; height: ' . $divSize['y'] . 'px; margin: 0 auto"></div>';
示例#11
0
<?php

require_once 'classes/achievements.php';
require_once 'classes/todo.php';
$achievement = new Achievements();
$todo = new Todo();
if (isset($_GET['action'])) {
    $data["goal_id"] = $_POST['goal_id'];
    $data["user_id"] = (int) $_SESSION['userid'];
    $data["comments"] = $_POST['comments'];
    $data["location"] = $_POST['location'];
    $data["date"] = time();
    $id = $achievement->add($data);
    $todo->remove($data["goal_id"], $_SESSION["userid"]);
    $msg = "Achievement Successfully Achieved!";
    echo "Achievement Successfully Achieved!";
    event::fire('USER_GOAL_COMPLETION');
}
示例#12
0
 /**
  * Returns array with guild members list. If $gm == true, returns his/her data only.
  * @category Guilds class
  * @example Guilds::buildGuildList(false)
  * @return array
  **/
 public function buildGuildList($gm = false)
 {
     if (!$this->guildId) {
         return false;
     }
     if ($gm == true) {
         $memberListTmp = $this->cDB->select("\n            SELECT `guid`, `name`, `race`, `class`, `gender`, `level`\n                FROM `characters` WHERE `guid` IN \n                (\n                    SELECT `guid`\n                    FROM `guild_member`\n                    WHERE `guildid`=? AND `rank`=0\n                ) LIMIT 1", $this->guildId);
     } else {
         $memberListTmp = $this->cDB->select("\n            SELECT\n            `characters`.`guid`,\n            `characters`.`name`,\n            `characters`.`class`,\n            `characters`.`race`,\n            `characters`.`gender`,\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`=?\n            LEFT JOIN `guild` AS `guild` ON `guild`.`guildid`=?\n            WHERE `guild`.`guildid`=? AND `characters`.`level`>=? AND `guild_member`.`guid`=`characters`.`guid` AND `guild_member`.`rank` <> 0\n            GROUP BY `guild_member`.`rank`", $this->guildId, $this->guildId, $this->guildId, $this->armoryconfig['minlevel']);
     }
     $i = 0;
     $countMembers = count($memberListTmp);
     for ($i = 0; $i < $countMembers; $i++) {
         $memberListTmp[$i]['ach_points'] = Achievements::calculateAchievementPoints($memberListTmp[$i]['guid']);
     }
     return $memberListTmp;
 }
示例#13
0
function submitWordList($user, $params)
{
    // check for achievements, win/loss, publish; return scores + words
    $matchID = getParam('m');
    $m = Store::get(Store::MATCH, $matchID);
    if (!$m) {
        // catch this
        trigger_error("ERROR: s Invalid mid ({$matchID}) user {$user}", E_USER_ERROR);
    }
    $words = getParam('w') ? getParam('w') : array();
    $participants = $m->getParticipants();
    if (array_key_exists($user, $participants)) {
        $m->updateParticipant($user, $words);
    } else {
        trigger_error("ERROR: s user {$user} not in match {$matchID}", E_USER_ERROR);
    }
    Store::set(Store::MATCH, $matchID, $m);
    $scores = $m->getScores();
    //TAG:SCORES
    if ($GLOBALS['on']['scores']) {
        publishScore($user, $scores[$user]);
    }
    //TAG:ACHIEVEMENTS
    if ($GLOBALS['on']['achievements']) {
        require_once 'Achievements.php';
        Achievements::grantAchievements($user, $scores[$user]);
    }
    restReturn($scores);
}