本文整理汇总了PHP中Armory::GetLoc方法的典型用法代码示例。如果您正苦于以下问题:PHP Armory::GetLoc方法的具体用法?PHP Armory::GetLoc怎么用?PHP Armory::GetLoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armory
的用法示例。
在下文中一共展示了Armory::GetLoc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetNpcInfo
/**
* Returns NPC info (infoType)
* @category Mangos class
* @access public
* @param int $npc
* @param string $infoType
* @return mixed
**/
public function GetNpcInfo($npc, $infoType)
{
$info = null;
switch ($infoType) {
case 'maxlevel':
$info = Armory::$wDB->selectCell("SELECT `maxlevel` FROM `creature_template` WHERE `entry`=%d", $npc);
break;
case 'minlevel':
$info = Armory::$wDB->selectCell("SELECT `minlevel` FROM `creature_template` WHERE `entry`=%d", $npc);
break;
case 'map':
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $npc);
if (!$mapID) {
$killCredit = Armory::$wDB->selectRow("SELECT `KillCredit1`, `KillCredit2` FROM `creature_template` WHERE `entry`=%d", $npc);
if ($killCredit['KillCredit1'] > 0) {
$kc_entry = $killCredit['KillCredit1'];
} elseif ($killCredit['KillCredit2'] > 0) {
$kc_entry = $killCredit['KillCredit2'];
} else {
$kc_entry = false;
}
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $kc_entry);
if (!$mapID) {
return false;
}
}
if ($info = Armory::$aDB->selectCell("SELECT `name_%s` FROM `ARMORYDBPREFIX_instance_template` WHERE `map`=%d", Armory::GetLocale(), $mapID)) {
return $info;
} else {
$info = Armory::$aDB->selectCell("SELECT `name_%s` FROM `ARMORYDBPREFIX_maps` WHERE `id`=%d", Armory::GetLocale(), $mapID);
}
break;
case 'areaUrl':
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $npc);
if (!$mapID) {
$killCredit = Armory::$wDB->selectRow("SELECT `KillCredit1`, `KillCredit2` FROM `creature_template` WHERE `entry`=%d", $npc);
if ($killCredit['KillCredit1'] > 0) {
$kc_entry = $killCredit['KillCredit1'];
} elseif ($killCredit['KillCredit2'] > 0) {
$kc_entry = $killCredit['KillCredit2'];
} else {
$kc_entry = false;
}
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $kc_entry);
if (!$mapID) {
return false;
}
}
if ($info = Armory::$aDB->selectCell("SELECT `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `map`=%d", $mapID)) {
$areaUrl = sprintf('source=dungeon&dungeon=%s&boss=all&difficulty=all', $info);
return $areaUrl;
}
break;
case 'mapID':
$info = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $npc);
break;
case 'rank':
return Armory::$wDB->selectCell("SELECT `rank` FROM `creature_template` WHERE `entry`=%d", $npc);
break;
case 'subname':
if (Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'en_us') {
return Armory::$wDB->selectCell("SELECT `subname` FROM `creature_template` WHERE `entry`=%d LIMIT 1", $npc);
} else {
$info = Armory::$wDB->selectCell("SELECT `subname_loc%d` FROM `locales_creature` WHERE `entry`=%d LIMIT 1", Armory::GetLoc(), $npc);
if (!$info) {
$killCredit = Armory::$wDB->selectRow("SELECT `KillCredit1`, `KillCredit2` FROM `creature_template` WHERE `entry`=%d", $npc);
$kc_entry = false;
if ($killCredit['KillCredit1'] > 0) {
$kc_entry = $killCredit['KillCredit1'];
} elseif ($killCredit['KillCredit2'] > 0) {
$kc_entry = $killCredit['KillCredit2'];
}
if ($kc_entry) {
$info = Armory::$wDB->selectCell("SELECT `subname_loc%d` FROM `locales_creature` WHERE `entry`=%d LIMIT 1", Armory::GetLoc(), $kc_entry);
}
if (!$info) {
$info = Armory::$wDB->selectCell("SELECT `subname_loc%d` FROM `locales_creature` WHERE `entry`=%d LIMIT 1", Armory::GetLoc(), $npc);
}
}
}
break;
case 'dungeonlevel':
$query = Armory::$wDB->selectRow("\n\t\t\t\tSELECT `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`\n\t\t\t\t\tFROM `creature_template`\n\t\t\t\t\t\tWHERE `entry`=%d AND `difficulty_entry_1` > 0 or `difficulty_entry_2` > 0 or `difficulty_entry_3` > 0", $npc);
if (!$query) {
// 10 Normal or 5 Normal
return 0;
}
if ($query['difficulty_entry_1'] > 0) {
// 25 Normal or 5 Heroic
return 1;
} elseif ($query['difficulty_entry_2'] > 0) {
// 10 Heroic
//.........这里部分代码省略.........
示例2: header
* This will automaticaly add missing realms to `armory_realm_data` table (if MySQL user have "INSERT" access to Armory database)
**/
$utils->CheckConfigRealmData();
// Check $_GET variable
$utils->CheckVariablesForPage();
}
/** Login **/
if (isset($_GET['login']) && $_GET['login'] == 1) {
header('Location: login.xml');
} elseif (isset($_GET['logout']) && $_GET['logout'] == 1) {
header('Location: login.xml?logoff');
}
/** Locale change **/
if (isset($_GET['locale'])) {
$tmp = strtolower($_GET['locale']);
$_SESSION['armoryLocaleId'] = $armory->GetLoc();
switch ($tmp) {
case 'ru_ru':
case 'ruru':
case 'ru':
$_SESSION['armoryLocale'] = 'ru_ru';
$_SESSION['armoryLocaleId'] = 8;
break;
case 'en_gb':
case 'engb':
case 'en':
$_SESSION['armoryLocale'] = 'en_gb';
$_SESSION['armoryLocaleId'] = 0;
break;
case 'es_es':
case 'es_mx':
示例3: header
$utils->UpdateVisitorsCount();
}
/** Login **/
if (isset($_GET['login']) && $_GET['login'] == 1) {
header('Location: login.xml');
exit;
} else {
if (isset($_GET['logout']) && $_GET['logout'] == 1) {
header('Location: login.xml?logoff');
exit;
}
}
/** Locale change **/
if (isset($_GET['locale'])) {
$tmp = strtolower($_GET['locale']);
$_SESSION['armoryLocaleId'] = Armory::GetLoc();
switch ($tmp) {
case 'zh_cn':
case 'zhcn':
case 'zh':
$_SESSION['armoryLocale'] = 'zh_cn';
$_SESSION['armoryLocaleId'] = 4;
break;
case 'ru_ru':
case 'ruru':
case 'ru':
$_SESSION['armoryLocale'] = 'ru_ru';
$_SESSION['armoryLocaleId'] = 8;
break;
case 'en_gb':
case 'engb':
示例4: GetCharacterFeed
/**
* Returns info about last character activity. Requires MaNGOS/Trinity core patch (tools/character_feed)!
* bool $full used only in character-feed.php
* @category Characters class
* @access public
* @param bool $full = false
* @return array
* @todo Some bosses kills/achievement gains are not shown or shown with wrong date
**/
public function GetCharacterFeed($full = false)
{
if (!$this->guid) {
Armory::Log()->writeError('%s : player guid not defined', __METHOD__);
return false;
}
if (!$this->feed_data) {
// Must be loaded from Character::BuildCharacter()
return false;
}
$limit = $full == true ? 50 : 10;
$currently_added = 0;
$i = 0;
$key = 0;
$feed_data = array();
// Strings
$feed_strings = Armory::$aDB->select("SELECT `id`, `string_%s` AS `string` FROM `ARMORYDBPREFIX_string` WHERE `id` IN (13, 14, 15, 16, 17, 18)", Armory::GetLocale());
if (!$feed_strings) {
Armory::Log()->writeError('%s : unable to load strings from armory_string (current locale: %s; locId: %d)', __METHOD__, Armory::GetLocale(), Armory::GetLoc());
return false;
}
$_strings = array();
foreach ($feed_strings as $str) {
$_strings[$str['id']] = $str['string'];
}
foreach ($this->feed_data as $event) {
if ($currently_added == $limit) {
break;
}
$event_date = $event['date'];
$event_type = $event['type'];
$event_data = $event['data'];
$date_string = date('d.m.Y', $event_date);
$feed_data[$i]['hard_date'] = $event_date;
$feed_data[$i]['hard_data'] = $event_data;
if (date('d.m.Y') == $date_string) {
$sort = 'today';
$diff = time() - $event_date;
if (Armory::GetLocale() == 'ru_ru') {
$periods = array('сек.', 'мин.', 'ч.');
$ago_str = 'назад';
} else {
$periods = array('seconds', 'minutes', 'hours');
$ago_str = 'ago';
}
$lengths = array(60, 60, 24);
for ($j = 0; $diff >= $lengths[$j]; $j++) {
$diff /= $lengths[$j];
}
$diff = round($diff);
$date_string = sprintf('%s %s %s', $diff, $periods[$j], $ago_str);
} elseif (date('d.m.Y', strtotime('yesterday')) == $date_string) {
$sort = 'yesterday';
} else {
$sort = 'earlier';
}
switch ($event_type) {
case TYPE_ACHIEVEMENT_FEED:
$send_data = array('achievement' => $event_data, 'date' => $event_date);
$achievement_info = $this->GetAchievementMgr()->GetAchievementInfo($send_data);
if (!$achievement_info || !isset($achievement_info['title']) || !$achievement_info['title'] || empty($achievement_info['title'])) {
// Wrong achievement ID or achievement not found in DB.
continue;
}
if (date('d/m/Y', $event_date) != $this->GetAchievementMgr()->GetAchievementDate($event['data'])) {
// Wrong achievement date, skip. Related to Vasago's issue.
continue;
}
if (!isset($achievement_info['points'])) {
$achievement_info['points'] = 0;
// Feat of Strength has no points.
}
$feed_data[$i]['event'] = array('type' => 'achievement', 'date' => $date_string, '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('<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&cn=%s" onMouseOver="setTipText(\'%s\')">%s</a>]', $_strings[14], urlencode($this->GetRealmName()), 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&cn=%s" onMouseOver="setTipText(\'%s\')">%s</a>] %s.', $_strings[13], urlencode($this->GetRealmName()), urlencode($this->name), $tooltip, $achievement_info['title'], $points_string);
}
$feed_data[$i]['tooltip'] = $tooltip;
break;
case TYPE_ITEM_FEED:
$item = Armory::$wDB->selectRow("SELECT `displayid`, `InventoryType`, `name`, `Quality` FROM `item_template` WHERE `entry`=%d LIMIT 1", $event_data);
if (!$item) {
continue;
//.........这里部分代码省略.........
示例5: PerformAdvancedItemsSearch
public function PerformAdvancedItemsSearch($count = false)
{
if ($this->itemSearchSkip == true) {
return false;
}
if ((!$this->get_array || !is_array($this->get_array)) && !$this->searchQuery) {
Armory::Log()->writeError('%s : start failed', __METHOD__);
return false;
}
if (!isset($this->get_array['source'])) {
Armory::Log()->writeError('%s : get_array[source] not defined', __METHOD__);
return false;
}
$allowedDungeon = false;
// Get item IDs first (if $this->searchQuery is defined)
$item_id_string = null;
if ($this->searchQuery) {
if (Armory::GetLoc() == 0) {
// No SQL injection - already escaped in search.php
$_item_ids = Armory::$wDB->select("SELECT `entry` FROM `item_template` WHERE `name` LIKE '%s'", '%' . $this->searchQuery . '%');
} else {
$_item_ids = Armory::$wDB->select("SELECT `entry` FROM `item_template` WHERE `name` LIKE '%s' OR `entry` IN (SELECT `entry` FROM `locales_item` WHERE `name_loc%d` LIKE '%s')", '%' . $this->searchQuery . '%', Armory::GetLoc(), '%' . $this->searchQuery . '%');
}
if (is_array($_item_ids)) {
$tmp_count_ids = count($_item_ids);
for ($i = 0; $i < $tmp_count_ids; $i++) {
if ($i) {
$item_id_string .= ', ' . $_item_ids[$i]['entry'];
} else {
$item_id_string .= $_item_ids[$i]['entry'];
}
}
unset($tmp_count_ids, $_item_ids);
}
}
switch ($this->get_array['source']) {
case 'all':
$global_sql_query = $this->HandleItemFilters($item_id_string);
break;
case 'quest':
$tmp_quest_query = "SELECT `item` FROM `ARMORYDBPREFIX_source` WHERE `source`='sourceType.questReward'";
if ($item_id_string != '') {
$tmp_quest_query .= sprintf(" AND `item` IN (%s)", $item_id_string);
}
$tmp_quest_query .= " ORDER BY `item` DESC LIMIT 200";
$_quest_items = Armory::$aDB->select($tmp_quest_query);
if (!$_quest_items) {
return false;
}
$quest_id_string = '';
$qCount = count($_quest_items);
for ($i = 0; $i < $qCount; $i++) {
if ($i) {
$quest_id_string .= ', ' . $_quest_items[$i]['item'];
} else {
$quest_id_string .= $_quest_items[$i]['item'];
}
}
unset($_quest_items, $qCount);
$global_sql_query = $this->HandleItemFilters($quest_id_string);
break;
case 'dungeon':
if (!isset($this->get_array['dungeon'])) {
$this->get_array['dungeon'] = 'all';
}
if (!isset($this->get_array['difficulty'])) {
$this->get_array['difficulty'] = 'all';
}
if (!isset($this->get_array['boss'])) {
$this->get_array['boss'] = 'all';
}
if (self::IsExtendedCost()) {
Armory::Log()->writeLog('%s : current ExtendedCost key: %s', __METHOD__, $this->get_array['dungeon']);
$item_extended_cost = Armory::$aDB->selectCell("SELECT `item` FROM `ARMORYDBPREFIX_item_sources` WHERE `key`='%s' LIMIT 1", $this->get_array['dungeon']);
if (!$item_extended_cost) {
Armory::Log()->writeError('%s : this->get_array[dungeon] is ExtendedCost key (%s) but data for this key is missed in `armory_item_sources`', __METHOD__, $this->get_array['dungeon']);
return false;
}
$extended_cost = Armory::$aDB->select("SELECT `id` FROM `ARMORYDBPREFIX_extended_cost` WHERE `item1`=%d OR `item2`=%d OR `item3`=%d OR `item4`=%d OR `item5`=%d", $item_extended_cost, $item_extended_cost, $item_extended_cost, $item_extended_cost, $item_extended_cost);
if (!$extended_cost) {
Armory::Log()->writeError('%s : this->get_array[dungeon] is ExtendedCost (key: %s, id: %d) but data for this id is missed in `armory_extended_cost`', __METHOD__, $this->get_array['dungeon'], $item_extended_cost);
return false;
}
$cost_ids = array();
foreach ($extended_cost as $cost) {
$cost_ids[] = $cost['id'];
}
$ex_cost_ids = null;
$mytmpcount = count($cost_ids);
for ($i = 0; $i < $mytmpcount; $i++) {
if ($i) {
$ex_cost_ids .= ', ' . $cost_ids[$i] . ', -' . $cost_ids[$i];
} else {
$ex_cost_ids .= $cost_ids[$i] . ', -' . $cost_ids[$i];
}
}
$global_sql_query = $this->HandleItemFilters($item_id_string, $ex_cost_ids);
} else {
$allowedDungeon = true;
$instance_data = Utils::GetDungeonData($this->get_array['dungeon']);
//.........这里部分代码省略.........
示例6: LoadStatisticsPage
/**
* Generates statistics page
* @category Achievements class
* @access public
* @param int $page_id
* @param int $faction
* @return array
**/
public function LoadStatisticsPage($page_id, $faction)
{
if (!$this->guid) {
Armory::Log()->writeError('%s : player guid not defined', __METHOD__);
return false;
}
$achievements_data = Armory::$aDB->select("\n SELECT `id`, `name_%s` AS `name`, `description_%s` AS `desc`, `categoryId`\n FROM `ARMORYDBPREFIX_achievement`\n WHERE `categoryId`=%d AND `factionFlag` IN (%d, -1)", Armory::GetLocale(), Armory::GetLocale(), $page_id, $faction);
if (!$achievements_data) {
Armory::Log()->writeError('%s : unable to get data for page_id %d, faction %d (current locale: %s, locId: %d)', __METHOD__, $page_id, $faction, Armory::GetLocale(), Armory::GetLoc());
return false;
}
$return_data = array();
$hide_id = array();
foreach ($achievements_data as $achievement) {
$this->achId = $achievement['id'];
$return_data[$this->achId] = $achievement;
$return_data[$this->achId]['quantity'] = self::GetCriteriaValue();
}
return $return_data;
}
示例7: AllowableClasses
/**
* Returns available classes string (if mask > 0)
* @category Items class
* @access public
* @param int $mask
* @return string
**/
public function AllowableClasses($mask)
{
$mask &= 0x5df;
// Return zero if for all class (or for none)
if ($mask == 0x5df || $mask == 0) {
return 0;
}
$classes = Armory::$aDB->select("SELECT `id`, `name_%s` AS `name` FROM `ARMORYDBPREFIX_classes`", Armory::GetLocale());
if (!is_array($classes)) {
Armory::Log()->writeError('%s : unable to find classes names for locale %s (%d)', __METHOD__, Armory::GetLocale(), Armory::GetLoc());
return false;
}
$classes_data = array();
foreach ($classes as $class_tmp) {
$classes_data[$class_tmp['id']] = $class_tmp['name'];
}
$i = 1;
$rMask = array();
while ($mask) {
if ($mask & 1) {
$rMask[$i] = $classes_data[$i];
}
$mask >>= 1;
$i++;
}
return $rMask;
}