mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Util/Game
* cleanup Util 2/2 * move game related functions and variables to new class: Game
This commit is contained in:
@@ -113,7 +113,7 @@ class EnchantmentPage extends GenericPage
|
||||
if ($_obj < 2) // [mana, health] are on [0, 1] respectively and are expected on [1, 2] ..
|
||||
$_obj++; // 0 is weaponDmg .. ehh .. i messed up somewhere
|
||||
|
||||
$this->effects[$i]['tip'] = [$_obj, Util::$itemMods[$_obj]];
|
||||
$this->effects[$i]['tip'] = [$_obj, Game::$itemMods[$_obj]];
|
||||
// DO NOT BREAK!
|
||||
case 2:
|
||||
case 6:
|
||||
|
||||
@@ -330,7 +330,7 @@ class ItemPage extends genericPage
|
||||
|
||||
// pageText
|
||||
$pageText = [];
|
||||
if ($this->pageText = Util::getPageText($this->subject->getField('pageTextId')))
|
||||
if ($this->pageText = Game::getPageText($this->subject->getField('pageTextId')))
|
||||
{
|
||||
$this->addJS('Book.js');
|
||||
$this->addCSS(['path' => 'Book.css']);
|
||||
@@ -346,7 +346,7 @@ class ItemPage extends genericPage
|
||||
BUTTON_EQUIP => in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]),
|
||||
BUTTON_UPGRADE => ($_cu ? ['class' => $_class, 'slot' => $_slot] : false),
|
||||
BUTTON_LINKS => array(
|
||||
'linkColor' => 'ff'.Util::$rarityColorStings[$this->subject->getField('quality')],
|
||||
'linkColor' => 'ff'.Game::$rarityColorStings[$this->subject->getField('quality')],
|
||||
'linkId' => 'item:'.$this->typeId.':0:0:0:0:0:0:0:0',
|
||||
'linkName' => $this->name,
|
||||
'type' => $this->type,
|
||||
@@ -879,7 +879,7 @@ class ItemPage extends genericPage
|
||||
foreach ($_ as $idx)
|
||||
$ids[] = $indirectSpells->getField('effect'.$idx.'TriggerSpell');
|
||||
|
||||
$ids = array_merge($ids, Util::getTaughtSpells($indirect));
|
||||
$ids = array_merge($ids, Game::getTaughtSpells($indirect));
|
||||
}
|
||||
|
||||
if ($ids)
|
||||
@@ -1087,7 +1087,7 @@ class ItemPage extends genericPage
|
||||
{
|
||||
$j = '';
|
||||
foreach ($onUse as $idx => $qty)
|
||||
$j .= ',"'.Util::$itemMods[$idx].'":'.$qty;
|
||||
$j .= ',"'.Game::$itemMods[$idx].'":'.$qty;
|
||||
|
||||
$xml->addChild('jsonUse')->addCData(substr($j, 1));
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ class NpcPage extends GenericPage
|
||||
{
|
||||
$skill = 0;
|
||||
$mask = 0x0;
|
||||
foreach (Util::$skillLineMask[-1] as $idx => $pair)
|
||||
foreach (Game::$skillLineMask[-1] as $idx => $pair)
|
||||
{
|
||||
if ($pair[0] != $_)
|
||||
continue;
|
||||
|
||||
@@ -194,7 +194,7 @@ class ObjectPage extends GenericPage
|
||||
/****************/
|
||||
|
||||
// pageText
|
||||
if ($this->pageText = Util::getPageText($next = $this->subject->getField('pageTextId')))
|
||||
if ($this->pageText = Game::getPageText($next = $this->subject->getField('pageTextId')))
|
||||
{
|
||||
$this->addCSS(['path' => 'Book.css']);
|
||||
$this->addJS('Book.js');
|
||||
|
||||
@@ -120,7 +120,7 @@ class PetPage extends GenericPage
|
||||
|
||||
// tab: spells
|
||||
$mask = 0x0;
|
||||
foreach (Util::$skillLineMask[-1] as $idx => $pair)
|
||||
foreach (Game::$skillLineMask[-1] as $idx => $pair)
|
||||
{
|
||||
if ($pair[0] == $this->typeId)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ class QuestPage extends GenericPage
|
||||
$_minLevel = $this->subject->getField('minLevel');
|
||||
$_flags = $this->subject->getField('flags');
|
||||
$_specialFlags = $this->subject->getField('specialFlags');
|
||||
$_side = Util::sideByRaceMask($this->subject->getField('reqRaceMask'));
|
||||
$_side = Game::sideByRaceMask($this->subject->getField('reqRaceMask'));
|
||||
|
||||
/***********/
|
||||
/* Infobox */
|
||||
@@ -269,7 +269,7 @@ class QuestPage extends GenericPage
|
||||
$n = Util::localizedString($_, 'name');
|
||||
array_unshift($chain, array(
|
||||
array(
|
||||
'side' => Util::sideByRaceMask($_['reqRaceMask']),
|
||||
'side' => Game::sideByRaceMask($_['reqRaceMask']),
|
||||
'typeStr' => Util::$typeStrings[TYPE_QUEST],
|
||||
'typeId' => $_['typeId'],
|
||||
'name' => mb_strlen($n) > 40 ? mb_substr($n, 0, 40).'…' : $n
|
||||
@@ -289,7 +289,7 @@ class QuestPage extends GenericPage
|
||||
$n = Util::localizedString($_, 'name');
|
||||
array_push($chain, array(
|
||||
array(
|
||||
'side' => Util::sideByRaceMask($_['reqRaceMask']),
|
||||
'side' => Game::sideByRaceMask($_['reqRaceMask']),
|
||||
'typeStr' => Util::$typeStrings[TYPE_QUEST],
|
||||
'typeId' => $_['typeId'],
|
||||
'name' => mb_strlen($n) > 40 ? mb_substr($n, 0, 40).'…' : $n,
|
||||
@@ -315,7 +315,7 @@ class QuestPage extends GenericPage
|
||||
{
|
||||
$n = $list->getField('name', true);
|
||||
$chain[] = array(array(
|
||||
'side' => Util::sideByRaceMask($list->getField('reqRaceMask')),
|
||||
'side' => Game::sideByRaceMask($list->getField('reqRaceMask')),
|
||||
'typeStr' => Util::$typeStrings[TYPE_QUEST],
|
||||
'typeId' => $id,
|
||||
'name' => mb_strlen($n) > 40 ? mb_substr($n, 0, 40).'…' : $n
|
||||
@@ -955,13 +955,13 @@ class QuestPage extends GenericPage
|
||||
$cnd = [];
|
||||
if ($_ = $this->subject->getField('reqMinRepFaction'))
|
||||
{
|
||||
$cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [CND_REPUTATION_RANK, $_, 1 << Util::getReputationLevelForPoints($this->subject->getField('reqMinRepValue'))];
|
||||
$cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [CND_REPUTATION_RANK, $_, 1 << Game::getReputationLevelForPoints($this->subject->getField('reqMinRepValue'))];
|
||||
$this->extendGlobalIds(TYPE_FACTION, $_);
|
||||
}
|
||||
|
||||
if ($_ = $this->subject->getField('reqMaxRepFaction'))
|
||||
{
|
||||
$cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [-CND_REPUTATION_RANK, $_, 1 << Util::getReputationLevelForPoints($this->subject->getField('reqMaxRepValue'))];
|
||||
$cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [-CND_REPUTATION_RANK, $_, 1 << Game::getReputationLevelForPoints($this->subject->getField('reqMaxRepValue'))];
|
||||
$this->extendGlobalIds(TYPE_FACTION, $_);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class QuestsPage extends GenericPage
|
||||
|
||||
public function __construct($pageCall, $pageParam)
|
||||
{
|
||||
$this->validCats = Util::$questClasses; // needs reviewing (not allowed to set this as default)
|
||||
$this->validCats = Game::$questClasses; // needs reviewing (not allowed to set this as default)
|
||||
|
||||
$this->filterObj = new QuestListFilter();
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
|
||||
@@ -190,7 +190,7 @@ class SkillPage extends GenericPage
|
||||
CFG_SQL_LIMIT_NONE
|
||||
);
|
||||
|
||||
foreach (Util::$skillLineMask as $line1 => $sets)
|
||||
foreach (Game::$skillLineMask as $line1 => $sets)
|
||||
foreach ($sets as $idx => $set)
|
||||
if ($set[1] == $this->typeId)
|
||||
{
|
||||
@@ -236,12 +236,12 @@ class SkillPage extends GenericPage
|
||||
if (in_array($this->cat, [-5, 6, 7, 8, 9, 11]))
|
||||
{
|
||||
$list = [];
|
||||
if (!empty(Util::$trainerTemplates[TYPE_SKILL][$this->typeId]))
|
||||
$list = DB::World()->selectCol('SELECT DISTINCT ID FROM npc_trainer WHERE SpellID IN (?a) AND ID < 200000', Util::$trainerTemplates[TYPE_SKILL][$this->typeId]);
|
||||
if (!empty(Game::$trainerTemplates[TYPE_SKILL][$this->typeId]))
|
||||
$list = DB::World()->selectCol('SELECT DISTINCT ID FROM npc_trainer WHERE SpellID IN (?a) AND ID < 200000', Game::$trainerTemplates[TYPE_SKILL][$this->typeId]);
|
||||
else
|
||||
{
|
||||
$mask = 0;
|
||||
foreach (Util::$skillLineMask[-3] as $idx => $pair)
|
||||
foreach (Game::$skillLineMask[-3] as $idx => $pair)
|
||||
if ($pair[1] == $this->typeId)
|
||||
$mask |= 1 << $idx;
|
||||
|
||||
|
||||
@@ -956,7 +956,7 @@ class SpellPage extends GenericPage
|
||||
}
|
||||
|
||||
// tab: teaches
|
||||
if ($ids = Util::getTaughtSpells($this->subject))
|
||||
if ($ids = Game::getTaughtSpells($this->subject))
|
||||
{
|
||||
$teaches = new SpellList(array(['id', $ids]));
|
||||
if (!$teaches->error)
|
||||
|
||||
@@ -131,7 +131,7 @@ class SpellsPage extends GenericPage
|
||||
$xCond = null;
|
||||
for ($i = -2; $i < 0; $i++)
|
||||
{
|
||||
foreach (Util::$skillLineMask[$i] as $idx => $pair)
|
||||
foreach (Game::$skillLineMask[$i] as $idx => $pair)
|
||||
{
|
||||
if ($pair[1] == $this->category[1])
|
||||
{
|
||||
|
||||
@@ -498,7 +498,7 @@ class ZonePage extends GenericPage
|
||||
{
|
||||
$tabData = ['quest', ['data' => array_values($questsLV)]];
|
||||
|
||||
foreach (Util::$questClasses as $parent => $children)
|
||||
foreach (Game::$questClasses as $parent => $children)
|
||||
{
|
||||
if (in_array($this->typeId, $children))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user