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:
@@ -251,7 +251,7 @@ class AjaxProfile extends AjaxHandler
|
||||
{
|
||||
if (is_array($v))
|
||||
$mods[] = $v;
|
||||
else if ($str = @Util::$itemMods[$k])
|
||||
else if ($str = @Game::$itemMods[$k])
|
||||
$mods[$str] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
238
includes/game.php
Normal file
238
includes/game.php
Normal file
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
class Game
|
||||
{
|
||||
public static $resistanceFields = array(
|
||||
null, 'resHoly', 'resFire', 'resNature', 'resFrost', 'resShadow', 'resArcane'
|
||||
);
|
||||
|
||||
public static $rarityColorStings = array( // zero-indexed
|
||||
'9d9d9d', 'ffffff', '1eff00', '0070dd', 'a335ee', 'ff8000', 'e5cc80', 'e6cc80'
|
||||
);
|
||||
|
||||
private static $combatRatingToItemMod = array( // zero-indexed idx:CR; val:Mod
|
||||
null, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, null, null, null, 37, 44
|
||||
);
|
||||
|
||||
public static $lvlIndepRating = array( // rating doesn't scale with level
|
||||
ITEM_MOD_MANA, ITEM_MOD_HEALTH, ITEM_MOD_ATTACK_POWER, ITEM_MOD_MANA_REGENERATION, ITEM_MOD_SPELL_POWER,
|
||||
ITEM_MOD_HEALTH_REGEN, ITEM_MOD_SPELL_PENETRATION, ITEM_MOD_BLOCK_VALUE
|
||||
);
|
||||
|
||||
public static $questClasses = array( // taken from old aowow: 2 & 3 partially point to pointless mini-areas in front of dungeons
|
||||
-2 => [ 0],
|
||||
0 => [ 1, 3, 4, 8, 10, 11, 12, 25, 28, 33, 36, 38, 40, 41, 44, 45, 46, 47, 51, 85, 130, 139, 267, 279, 1497, 1519, 1537, 2257, 3430, 3433, 3487, 4080, 4298],
|
||||
1 => [ 14, 15, 16, 17, 141, 148, 215, 331, 357, 361, 400, 405, 406, 440, 490, 493, 618, 1216, 1377, 1637, 1638, 1657, 3524, 3525, 3557],
|
||||
/*todo*/ 2 => [ 133, 206, 209, 491, 717, 718, 719, 722, 796, 978, 1196, 1337, 1417, 1581, 1583, 1584, 1941, 2017, 2057, 2100, 2366, 2367, 2437, 2557, 3477, 3562, 3713, 3714, 3715, 3716, 3717, 3789, 3790, 3791, 3792, 3845, 3846, 3847, 3849, 3905, 4095, 4100, 4120, 4196, 4228, 4264, 4272, 4375, 4415, 4494, 4723],
|
||||
/*todo*/ 3 => [ 1977, 2159, 2562, 2677, 2717, 3428, 3429, 3456, 3606, 3805, 3836, 3840, 3842, 4273, 4500, 4722, 4812],
|
||||
4 => [ -372, -263, -262, -261, -162, -161, -141, -82, -81, -61],
|
||||
5 => [ -373, -371, -324, -304, -264, -201, -182, -181, -121, -101, -24],
|
||||
6 => [ -25, 2597, 3277, 3358, 3820, 4384, 4710],
|
||||
7 => [-1010, -368, -367, -365, -344, -241, -1],
|
||||
8 => [ 3483, 3518, 3519, 3520, 3521, 3522, 3523, 3679, 3703], // Skettis is no parent
|
||||
9 => [-1006, -1005, -1003, -1002, -1001, -376, -375, -374, -370, -369, -366, -364, -284, -41, -22], // 22: seasonal, 284: special => not in the actual menu
|
||||
10 => [ 65, 66, 67, 210, 394, 495, 3537, 3711, 4024, 4197, 4395, 4742] // Coldara is no parent
|
||||
);
|
||||
|
||||
/* why:
|
||||
Because petSkills (and ranged weapon skills) are the only ones with more than two skillLines attached. Because Left Joining ?_spell with ?_skillLineability causes more trouble than it has uses.
|
||||
Because this is more or less the only reaonable way to fit all that information into one database field, so..
|
||||
.. the indizes of this array are bits of skillLine2OrMask in ?_spell if skillLineId1 is negative
|
||||
*/
|
||||
public static $skillLineMask = array( // idx => [familyId, skillLineId]
|
||||
-1 => array( // Pets (Hunter)
|
||||
[ 1, 208], [ 2, 209], [ 3, 203], [ 4, 210], [ 5, 211], [ 6, 212], [ 7, 213], // Wolf, Cat, Spider, Bear, Boar, Crocolisk, Carrion Bird
|
||||
[ 8, 214], [ 9, 215], [11, 217], [12, 218], [20, 236], [21, 251], [24, 653], // Crab, Gorilla, Raptor, Tallstrider, Scorpid, Turtle, Bat
|
||||
[25, 654], [26, 655], [27, 656], [30, 763], [31, 767], [32, 766], [33, 765], // Hyena, Bird of Prey, Wind Serpent, Dragonhawk, Ravager, Warp Stalker, Sporebat
|
||||
[34, 764], [35, 768], [37, 775], [38, 780], [39, 781], [41, 783], [42, 784], // Nether Ray, Serpent, Moth, Chimaera, Devilsaur, Silithid, Worm
|
||||
[43, 786], [44, 785], [45, 787], [46, 788] // Rhino, Wasp, Core Hound, Spirit Beast
|
||||
),
|
||||
-2 => array( // Pets (Warlock)
|
||||
[15, 189], [16, 204], [17, 205], [19, 207], [23, 188], [29, 761] // Felhunter, Voidwalker, Succubus, Doomguard, Imp, Felguard
|
||||
),
|
||||
-3 => array( // Ranged Weapons
|
||||
[null, 45], [null, 46], [null, 226] // Bow, Gun, Crossbow
|
||||
)
|
||||
);
|
||||
|
||||
public static $trainerTemplates = array( // TYPE => Id => templateList
|
||||
TYPE_CLASS => array(
|
||||
1 => [-200001, -200002], // Warrior
|
||||
2 => [-200003, -200004, -200020, -200021], // Paladin
|
||||
3 => [-200013, -200014], // Hunter
|
||||
4 => [-200015, -200016], // Rogue
|
||||
5 => [-200011, -200012], // Priest
|
||||
6 => [-200019], // DK
|
||||
7 => [-200017, -200018], // Shaman (HighlevelAlly Id missing..?)
|
||||
8 => [-200007, -200008], // Mage
|
||||
9 => [-200009, -200010], // Warlock
|
||||
11 => [-200005, -200006] // Druid
|
||||
),
|
||||
TYPE_SKILL => array(
|
||||
171 => [-201001, -201002, -201003], // Alchemy
|
||||
164 => [-201004, -201005, -201006, -201007, -201008],// Blacksmithing
|
||||
333 => [-201009, -201010, -201011], // Enchanting
|
||||
202 => [-201012, -201013, -201014, -201015, -201016, -201017], // Engineering
|
||||
182 => [-201018, -201019, -201020], // Herbalism
|
||||
773 => [-201021, -201022, -201023], // Inscription
|
||||
755 => [-201024, -201025, -201026], // Jewelcrafting
|
||||
165 => [-201027, -201028, -201029, -201030, -201031, -201032], // Leatherworking
|
||||
186 => [-201033, -201034, -201035], // Mining
|
||||
393 => [-201036, -201037, -201038], // Skinning
|
||||
197 => [-201039, -201040, -201041, -201042], // Tailoring
|
||||
356 => [-202001, -202002, -202003], // Fishing
|
||||
185 => [-202004, -202005, -202006], // Cooking
|
||||
129 => [-202007, -202008, -202009], // First Aid
|
||||
762 => [-202010, -202011, -202012] // Riding
|
||||
)
|
||||
);
|
||||
|
||||
public static $sockets = array( // jsStyle Strings
|
||||
'meta', 'red', 'yellow', 'blue'
|
||||
);
|
||||
|
||||
public static $itemMods = array( // zero-indexed; "mastrtng": unused mastery; _[a-z] => taken mods..
|
||||
'dmg', 'mana', 'health', 'agi', 'str', 'int', 'spi',
|
||||
'sta', 'energy', 'rage', 'focus', 'runicpwr', 'defrtng', 'dodgertng',
|
||||
'parryrtng', 'blockrtng', 'mlehitrtng', 'rgdhitrtng', 'splhitrtng', 'mlecritstrkrtng', 'rgdcritstrkrtng',
|
||||
'splcritstrkrtng', '_mlehitrtng', '_rgdhitrtng', '_splhitrtng', '_mlecritstrkrtng', '_rgdcritstrkrtng', '_splcritstrkrtng',
|
||||
'mlehastertng', 'rgdhastertng', 'splhastertng', 'hitrtng', 'critstrkrtng', '_hitrtng', '_critstrkrtng',
|
||||
'resirtng', 'hastertng', 'exprtng', 'atkpwr', 'rgdatkpwr', 'feratkpwr', 'splheal',
|
||||
'spldmg', 'manargn', 'armorpenrtng', 'splpwr', 'healthrgn', 'splpen', 'block', // ITEM_MOD_BLOCK_VALUE
|
||||
'mastrtng', 'armor', 'firres', 'frores', 'holres', 'shares', 'natres',
|
||||
'arcres', 'firsplpwr', 'frosplpwr', 'holsplpwr', 'shasplpwr', 'natsplpwr', 'arcsplpwr'
|
||||
);
|
||||
|
||||
public static $class2SpellFamily = array(
|
||||
// null Warrior Paladin Hunter Rogue Priest DK Shaman Mage Warlock null Druid
|
||||
null, 4, 10, 9, 8, 6, 15, 11, 3, 5, null, 7
|
||||
);
|
||||
|
||||
public static function itemModByRatingMask($mask)
|
||||
{
|
||||
if (($mask & 0x1C000) == 0x1C000) // special case resilience
|
||||
return ITEM_MOD_RESILIENCE_RATING;
|
||||
|
||||
if (($mask & 0x00E0) == 0x00E0) // special case hit rating
|
||||
return ITEM_MOD_HIT_RATING;
|
||||
|
||||
for ($j = 0; $j < count(self::$combatRatingToItemMod); $j++)
|
||||
{
|
||||
if (!self::$combatRatingToItemMod[$j])
|
||||
continue;
|
||||
|
||||
if (!($mask & (1 << $j)))
|
||||
continue;
|
||||
|
||||
return self::$combatRatingToItemMod[$j];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function sideByRaceMask($race)
|
||||
{
|
||||
// Any
|
||||
if (!$race || ($race & RACE_MASK_ALL) == RACE_MASK_ALL)
|
||||
return SIDE_BOTH;
|
||||
|
||||
// Horde
|
||||
if ($race & RACE_MASK_HORDE && !($race & RACE_MASK_ALLIANCE))
|
||||
return SIDE_HORDE;
|
||||
|
||||
// Alliance
|
||||
if ($race & RACE_MASK_ALLIANCE && !($race & RACE_MASK_HORDE))
|
||||
return SIDE_ALLIANCE;
|
||||
|
||||
return SIDE_BOTH;
|
||||
}
|
||||
|
||||
public static function getReputationLevelForPoints($pts)
|
||||
{
|
||||
if ($pts >= 41999)
|
||||
return REP_EXALTED;
|
||||
else if ($pts >= 20999)
|
||||
return REP_REVERED;
|
||||
else if ($pts >= 8999)
|
||||
return REP_HONORED;
|
||||
else if ($pts >= 2999)
|
||||
return REP_FRIENDLY;
|
||||
else if ($pts >= 0)
|
||||
return REP_NEUTRAL;
|
||||
else if ($pts >= -3000)
|
||||
return REP_UNFRIENDLY;
|
||||
else if ($pts >= -6000)
|
||||
return REP_HOSTILE;
|
||||
else
|
||||
return REP_HATED;
|
||||
}
|
||||
|
||||
public static function getTaughtSpells(&$spell)
|
||||
{
|
||||
$extraIds = [-1]; // init with -1 to prevent empty-array errors
|
||||
$lookup = [-1];
|
||||
switch (gettype($spell))
|
||||
{
|
||||
case 'object':
|
||||
if (get_class($spell) != 'SpellList')
|
||||
return [];
|
||||
|
||||
$lookup[] = $spell->id;
|
||||
foreach ($spell->canTeachSpell() as $idx)
|
||||
$extraIds[] = $spell->getField('effect'.$idx.'TriggerSpell');
|
||||
|
||||
break;
|
||||
case 'integer':
|
||||
$lookup[] = $spell;
|
||||
break;
|
||||
case 'array':
|
||||
$lookup = $spell;
|
||||
break;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
// note: omits required spell and chance in skill_discovery_template
|
||||
$data = array_merge(
|
||||
DB::World()->selectCol('SELECT spellId FROM spell_learn_spell WHERE entry IN (?a)', $lookup),
|
||||
DB::World()->selectCol('SELECT spellId FROM skill_discovery_template WHERE reqSpell IN (?a)', $lookup),
|
||||
$extraIds
|
||||
);
|
||||
|
||||
// return list of integers, not strings
|
||||
array_walk($data, function (&$v, $k) {
|
||||
$v = intVal($v);
|
||||
});
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getPageText($ptId)
|
||||
{
|
||||
$pages = [];
|
||||
while ($ptId)
|
||||
{
|
||||
if ($row = DB::World()->selectRow('SELECT ptl.Text AS Text_loc?d, pt.* FROM page_text pt LEFT JOIN page_text_locale ptl ON pt.ID = ptl.ID AND locale = ? WHERE pt.ID = ?d', User::$localeId, User::$localeString, $ptId))
|
||||
{
|
||||
$ptId = $row['NextPageID'];
|
||||
$pages[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('Referenced PageTextId #'.$ptId.' is not in DB', E_USER_WARNING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $pages;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -13,7 +13,8 @@ mb_internal_encoding('UTF-8');
|
||||
|
||||
require_once 'includes/defines.php';
|
||||
require_once 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using variant: https://github.com/ivan1986/DbSimple/tree/master)
|
||||
require_once 'includes/utilities.php'; // misc™ data 'n func
|
||||
require_once 'includes/utilities.php'; // helper functions
|
||||
require_once 'includes/game.php'; // game related data & functions
|
||||
require_once 'includes/user.class.php';
|
||||
require_once 'includes/markup.class.php'; // manipulate markup text
|
||||
require_once 'includes/database.class.php'; // wrap DBSimple
|
||||
|
||||
@@ -58,7 +58,7 @@ class EnchantmentList extends BaseType
|
||||
$curTpl['dps'] = floatVal($curTpl['dps']);
|
||||
|
||||
// remove zero-stats
|
||||
foreach (Util::$itemMods as $str)
|
||||
foreach (Game::$itemMods as $str)
|
||||
if ($curTpl[$str] == 0) // empty(0.0f) => true .. yeah, sure
|
||||
unset($curTpl[$str]);
|
||||
|
||||
@@ -128,7 +128,7 @@ class EnchantmentList extends BaseType
|
||||
{
|
||||
$data = [];
|
||||
|
||||
foreach (Util::$itemMods as $str)
|
||||
foreach (Game::$itemMods as $str)
|
||||
if (isset($this->curTpl[$str]))
|
||||
$data[$str] = $this->curTpl[$str];
|
||||
|
||||
@@ -151,7 +151,7 @@ class EnchantmentList extends BaseType
|
||||
case 3: // TYPE_EQUIP_SPELL Spells from ObjectX (use of amountX?)
|
||||
if (!empty($spellStats[$obj]))
|
||||
foreach ($spellStats[$obj] as $mod => $_)
|
||||
if ($str = Util::$itemMods[$mod])
|
||||
if ($str = Game::$itemMods[$mod])
|
||||
Util::arraySumByKey($data, [$str => 0]);
|
||||
|
||||
$obj = null;
|
||||
@@ -194,7 +194,7 @@ class EnchantmentList extends BaseType
|
||||
}
|
||||
|
||||
if ($obj !== null)
|
||||
if ($str = Util::$itemMods[$obj]) // check if we use these mods
|
||||
if ($str = Game::$itemMods[$obj]) // check if we use these mods
|
||||
Util::arraySumByKey($data, [$str => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -710,7 +710,7 @@ class ItemList extends BaseType
|
||||
}
|
||||
|
||||
// magic resistances
|
||||
foreach (Util::$resistanceFields as $j => $rowName)
|
||||
foreach (Game::$resistanceFields as $j => $rowName)
|
||||
if ($rowName && $this->curTpl[$rowName] != 0)
|
||||
$x .= '+'.$this->curTpl[$rowName].' '.Lang::game('resistances', $j).'<br />';
|
||||
|
||||
@@ -773,9 +773,9 @@ class ItemList extends BaseType
|
||||
$text = $pop ? Util::localizedString($gems[$pop], 'name') : Lang::item('socket', $colorId);
|
||||
|
||||
if ($interactive)
|
||||
$x .= '<a href="?items=3&filter=cr=81;crs='.($colorId + 1).';crv=0" class="socket-'.Util::$sockets[$colorId].' q'.$col.'" '.$icon.'>'.$text.'</a><br />';
|
||||
$x .= '<a href="?items=3&filter=cr=81;crs='.($colorId + 1).';crv=0" class="socket-'.Game::$sockets[$colorId].' q'.$col.'" '.$icon.'>'.$text.'</a><br />';
|
||||
else
|
||||
$x .= '<span class="socket-'.Util::$sockets[$colorId].' q'.$col.'" '.$icon.'>'.$text.'</span><br />';
|
||||
$x .= '<span class="socket-'.Game::$sockets[$colorId].' q'.$col.'" '.$icon.'>'.$text.'</span><br />';
|
||||
}
|
||||
|
||||
// fill extra socket
|
||||
@@ -1192,7 +1192,7 @@ class ItemList extends BaseType
|
||||
{
|
||||
$this->itemMods[$this->id] = [];
|
||||
|
||||
foreach (Util::$itemMods as $mod)
|
||||
foreach (Game::$itemMods as $mod)
|
||||
{
|
||||
if (isset($this->curTpl[$mod]) && ($_ = floatVal($this->curTpl[$mod])))
|
||||
{
|
||||
@@ -1555,7 +1555,7 @@ class ItemList extends BaseType
|
||||
'subclass' => $this->curTpl['subClass'],
|
||||
'subsubclass' => $this->curTpl['subSubClass'],
|
||||
'heroic' => ($this->curTpl['flags'] & 0x8) >> 3,
|
||||
'side' => $this->curTpl['flagsExtra'] & 0x3 ? 3 - ($this->curTpl['flagsExtra'] & 0x3) : Util::sideByRaceMask($this->curTpl['requiredRace']),
|
||||
'side' => $this->curTpl['flagsExtra'] & 0x3 ? 3 - ($this->curTpl['flagsExtra'] & 0x3) : Game::sideByRaceMask($this->curTpl['requiredRace']),
|
||||
'slot' => $this->curTpl['slot'],
|
||||
'slotbak' => $this->curTpl['slotBak'],
|
||||
'level' => $this->curTpl['itemLevel'],
|
||||
|
||||
@@ -35,7 +35,7 @@ class QuestList extends BaseType
|
||||
$_curTpl['cat1'] = $_curTpl['zoneOrSort']; // should probably be in a method...
|
||||
$_curTpl['cat2'] = 0;
|
||||
|
||||
foreach (Util::$questClasses as $k => $arr)
|
||||
foreach (Game::$questClasses as $k => $arr)
|
||||
{
|
||||
if (in_array($_curTpl['cat1'], $arr))
|
||||
{
|
||||
@@ -172,7 +172,7 @@ class QuestList extends BaseType
|
||||
|
||||
foreach ($this->iterate() as $__)
|
||||
{
|
||||
if (!(Util::sideByRaceMask($this->curTpl['reqRaceMask']) & $side))
|
||||
if (!(Game::sideByRaceMask($this->curTpl['reqRaceMask']) & $side))
|
||||
continue;
|
||||
|
||||
list($series, $first) = DB::Aowow()->SelectRow(
|
||||
@@ -209,7 +209,7 @@ class QuestList extends BaseType
|
||||
'level' => $this->curTpl['level'],
|
||||
'reqlevel' => $this->curTpl['minLevel'],
|
||||
'name' => $this->getField('name', true),
|
||||
'side' => Util::sideByRaceMask($this->curTpl['reqRaceMask']),
|
||||
'side' => Game::sideByRaceMask($this->curTpl['reqRaceMask']),
|
||||
'wflags' => 0x0,
|
||||
'xp' => $this->curTpl['rewardXP']
|
||||
);
|
||||
|
||||
@@ -110,7 +110,7 @@ class SpellList extends BaseType
|
||||
$_curTpl['skillLines'] = [];
|
||||
if ($_curTpl['skillLine1'] < 0)
|
||||
{
|
||||
foreach (Util::$skillLineMask[$_curTpl['skillLine1']] as $idx => $pair)
|
||||
foreach (Game::$skillLineMask[$_curTpl['skillLine1']] as $idx => $pair)
|
||||
if ($_curTpl['skillLine2OrMask'] & (1 << $idx))
|
||||
$_curTpl['skillLines'][] = $pair[1];
|
||||
}
|
||||
@@ -165,7 +165,7 @@ class SpellList extends BaseType
|
||||
{
|
||||
$mods = [];
|
||||
foreach ($json as $str => $val)
|
||||
if ($val && ($idx = array_search($str, Util::$itemMods)))
|
||||
if ($val && ($idx = array_search($str, Game::$itemMods)))
|
||||
$mods[$idx] = $val;
|
||||
|
||||
if ($mods)
|
||||
@@ -260,7 +260,7 @@ class SpellList extends BaseType
|
||||
break;
|
||||
case 189: // CombatRating MiscVal:ratingMask
|
||||
case 220:
|
||||
if ($mod = Util::itemModByRatingMask($mv))
|
||||
if ($mod = Game::itemModByRatingMask($mv))
|
||||
Util::arraySumByKey($stats, [$mod => $pts]);
|
||||
break;
|
||||
case 143: // Resistance MiscVal:school
|
||||
@@ -981,7 +981,7 @@ class SpellList extends BaseType
|
||||
// Aura giving combat ratings
|
||||
$rType = 0;
|
||||
if ($aura == 189)
|
||||
if ($rType = Util::itemModByRatingMask($mv))
|
||||
if ($rType = Game::itemModByRatingMask($mv))
|
||||
$usesScalingRating = true;
|
||||
// Aura end
|
||||
|
||||
@@ -1071,7 +1071,7 @@ class SpellList extends BaseType
|
||||
// Aura giving combat ratings
|
||||
$rType = 0;
|
||||
if ($aura == 189)
|
||||
if ($rType = Util::itemModByRatingMask($mv))
|
||||
if ($rType = Game::itemModByRatingMask($mv))
|
||||
$usesScalingRating = true;
|
||||
// Aura end
|
||||
|
||||
|
||||
@@ -20,14 +20,6 @@ class Util
|
||||
{
|
||||
const FILE_ACCESS = 0755;
|
||||
|
||||
public static $resistanceFields = array(
|
||||
null, 'resHoly', 'resFire', 'resNature', 'resFrost', 'resShadow', 'resArcane'
|
||||
);
|
||||
|
||||
public static $rarityColorStings = array( // zero-indexed
|
||||
'9d9d9d', 'ffffff', '1eff00', '0070dd', 'a335ee', 'ff8000', 'e5cc80', 'e6cc80'
|
||||
);
|
||||
|
||||
public static $localeStrings = array( // zero-indexed
|
||||
'enus', null, 'frfr', 'dede', null, null, 'eses', null, 'ruru'
|
||||
);
|
||||
@@ -55,108 +47,13 @@ class Util
|
||||
TYPE_ENCHANTMENT => 'enchantment'
|
||||
);
|
||||
|
||||
public static $combatRatingToItemMod = array( // zero-indexed idx:CR; val:Mod
|
||||
null, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, null, null, null, 37, 44
|
||||
);
|
||||
|
||||
# todo (high): find a sensible way to write data here on setup
|
||||
public static $gtCombatRatings = array(
|
||||
private static $gtCombatRatings = array(
|
||||
12 => 1.5, 13 => 13.8, 14 => 13.8, 15 => 5, 16 => 10, 17 => 10, 18 => 8, 19 => 14, 20 => 14,
|
||||
21 => 14, 22 => 10, 23 => 10, 24 => 8, 25 => 0, 26 => 0, 27 => 0, 28 => 10, 29 => 10,
|
||||
30 => 10, 31 => 10, 32 => 14, 33 => 0, 34 => 0, 35 => 28.75, 36 => 10, 37 => 2.5, 44 => 4.268292513760655
|
||||
);
|
||||
|
||||
public static $lvlIndepRating = array( // rating doesn't scale with level
|
||||
ITEM_MOD_MANA, ITEM_MOD_HEALTH, ITEM_MOD_ATTACK_POWER, ITEM_MOD_MANA_REGENERATION, ITEM_MOD_SPELL_POWER,
|
||||
ITEM_MOD_HEALTH_REGEN, ITEM_MOD_SPELL_PENETRATION, ITEM_MOD_BLOCK_VALUE
|
||||
);
|
||||
|
||||
public static $questClasses = array( // taken from old aowow: 2 & 3 partially point to pointless mini-areas in front of dungeons
|
||||
-2 => [ 0],
|
||||
0 => [ 1, 3, 4, 8, 10, 11, 12, 25, 28, 33, 36, 38, 40, 41, 44, 45, 46, 47, 51, 85, 130, 139, 267, 279, 1497, 1519, 1537, 2257, 3430, 3433, 3487, 4080, 4298],
|
||||
1 => [ 14, 15, 16, 17, 141, 148, 215, 331, 357, 361, 400, 405, 406, 440, 490, 493, 618, 1216, 1377, 1637, 1638, 1657, 3524, 3525, 3557],
|
||||
/*todo*/ 2 => [ 133, 206, 209, 491, 717, 718, 719, 722, 796, 978, 1196, 1337, 1417, 1581, 1583, 1584, 1941, 2017, 2057, 2100, 2366, 2367, 2437, 2557, 3477, 3562, 3713, 3714, 3715, 3716, 3717, 3789, 3790, 3791, 3792, 3845, 3846, 3847, 3849, 3905, 4095, 4100, 4120, 4196, 4228, 4264, 4272, 4375, 4415, 4494, 4723],
|
||||
/*todo*/ 3 => [ 1977, 2159, 2562, 2677, 2717, 3428, 3429, 3456, 3606, 3805, 3836, 3840, 3842, 4273, 4500, 4722, 4812],
|
||||
4 => [ -372, -263, -262, -261, -162, -161, -141, -82, -81, -61],
|
||||
5 => [ -373, -371, -324, -304, -264, -201, -182, -181, -121, -101, -24],
|
||||
6 => [ -25, 2597, 3277, 3358, 3820, 4384, 4710],
|
||||
7 => [-1010, -368, -367, -365, -344, -241, -1],
|
||||
8 => [ 3483, 3518, 3519, 3520, 3521, 3522, 3523, 3679, 3703], // Skettis is no parent
|
||||
9 => [-1006, -1005, -1003, -1002, -1001, -376, -375, -374, -370, -369, -366, -364, -284, -41, -22], // 22: seasonal, 284: special => not in the actual menu
|
||||
10 => [ 65, 66, 67, 210, 394, 495, 3537, 3711, 4024, 4197, 4395, 4742] // Coldara is no parent
|
||||
);
|
||||
|
||||
/* why:
|
||||
Because petSkills (and ranged weapon skills) are the only ones with more than two skillLines attached. Because Left Joining ?_spell with ?_skillLineability causes more trouble than it has uses.
|
||||
Because this is more or less the only reaonable way to fit all that information into one database field, so..
|
||||
.. the indizes of this array are bits of skillLine2OrMask in ?_spell if skillLineId1 is negative
|
||||
*/
|
||||
public static $skillLineMask = array( // idx => [familyId, skillLineId]
|
||||
-1 => array( // Pets (Hunter)
|
||||
[ 1, 208], [ 2, 209], [ 3, 203], [ 4, 210], [ 5, 211], [ 6, 212], [ 7, 213], // Wolf, Cat, Spider, Bear, Boar, Crocolisk, Carrion Bird
|
||||
[ 8, 214], [ 9, 215], [11, 217], [12, 218], [20, 236], [21, 251], [24, 653], // Crab, Gorilla, Raptor, Tallstrider, Scorpid, Turtle, Bat
|
||||
[25, 654], [26, 655], [27, 656], [30, 763], [31, 767], [32, 766], [33, 765], // Hyena, Bird of Prey, Wind Serpent, Dragonhawk, Ravager, Warp Stalker, Sporebat
|
||||
[34, 764], [35, 768], [37, 775], [38, 780], [39, 781], [41, 783], [42, 784], // Nether Ray, Serpent, Moth, Chimaera, Devilsaur, Silithid, Worm
|
||||
[43, 786], [44, 785], [45, 787], [46, 788] // Rhino, Wasp, Core Hound, Spirit Beast
|
||||
),
|
||||
-2 => array( // Pets (Warlock)
|
||||
[15, 189], [16, 204], [17, 205], [19, 207], [23, 188], [29, 761] // Felhunter, Voidwalker, Succubus, Doomguard, Imp, Felguard
|
||||
),
|
||||
-3 => array( // Ranged Weapons
|
||||
[null, 45], [null, 46], [null, 226] // Bow, Gun, Crossbow
|
||||
)
|
||||
);
|
||||
|
||||
public static $trainerTemplates = array( // TYPE => Id => templateList
|
||||
TYPE_CLASS => array(
|
||||
1 => [-200001, -200002], // Warrior
|
||||
2 => [-200003, -200004, -200020, -200021], // Paladin
|
||||
3 => [-200013, -200014], // Hunter
|
||||
4 => [-200015, -200016], // Rogue
|
||||
5 => [-200011, -200012], // Priest
|
||||
6 => [-200019], // DK
|
||||
7 => [-200017, -200018], // Shaman (HighlevelAlly Id missing..?)
|
||||
8 => [-200007, -200008], // Mage
|
||||
9 => [-200009, -200010], // Warlock
|
||||
11 => [-200005, -200006] // Druid
|
||||
),
|
||||
TYPE_SKILL => array(
|
||||
171 => [-201001, -201002, -201003], // Alchemy
|
||||
164 => [-201004, -201005, -201006, -201007, -201008],// Blacksmithing
|
||||
333 => [-201009, -201010, -201011], // Enchanting
|
||||
202 => [-201012, -201013, -201014, -201015, -201016, -201017], // Engineering
|
||||
182 => [-201018, -201019, -201020], // Herbalism
|
||||
773 => [-201021, -201022, -201023], // Inscription
|
||||
755 => [-201024, -201025, -201026], // Jewelcrafting
|
||||
165 => [-201027, -201028, -201029, -201030, -201031, -201032], // Leatherworking
|
||||
186 => [-201033, -201034, -201035], // Mining
|
||||
393 => [-201036, -201037, -201038], // Skinning
|
||||
197 => [-201039, -201040, -201041, -201042], // Tailoring
|
||||
356 => [-202001, -202002, -202003], // Fishing
|
||||
185 => [-202004, -202005, -202006], // Cooking
|
||||
129 => [-202007, -202008, -202009], // First Aid
|
||||
762 => [-202010, -202011, -202012] // Riding
|
||||
)
|
||||
);
|
||||
|
||||
public static $sockets = array( // jsStyle Strings
|
||||
'meta', 'red', 'yellow', 'blue'
|
||||
);
|
||||
|
||||
public static $itemMods = array( // zero-indexed; "mastrtng": unused mastery; _[a-z] => taken mods..
|
||||
'dmg', 'mana', 'health', 'agi', 'str', 'int', 'spi',
|
||||
'sta', 'energy', 'rage', 'focus', 'runicpwr', 'defrtng', 'dodgertng',
|
||||
'parryrtng', 'blockrtng', 'mlehitrtng', 'rgdhitrtng', 'splhitrtng', 'mlecritstrkrtng', 'rgdcritstrkrtng',
|
||||
'splcritstrkrtng', '_mlehitrtng', '_rgdhitrtng', '_splhitrtng', '_mlecritstrkrtng', '_rgdcritstrkrtng', '_splcritstrkrtng',
|
||||
'mlehastertng', 'rgdhastertng', 'splhastertng', 'hitrtng', 'critstrkrtng', '_hitrtng', '_critstrkrtng',
|
||||
'resirtng', 'hastertng', 'exprtng', 'atkpwr', 'rgdatkpwr', 'feratkpwr', 'splheal',
|
||||
'spldmg', 'manargn', 'armorpenrtng', 'splpwr', 'healthrgn', 'splpen', 'block', // ITEM_MOD_BLOCK_VALUE
|
||||
'mastrtng', 'armor', 'firres', 'frores', 'holres', 'shares', 'natres',
|
||||
'arcres', 'firsplpwr', 'frosplpwr', 'holsplpwr', 'shasplpwr', 'natsplpwr', 'arcsplpwr'
|
||||
);
|
||||
|
||||
public static $itemFilter = array(
|
||||
20 => 'str', 21 => 'agi', 23 => 'int', 22 => 'sta', 24 => 'spi', 25 => 'arcres', 26 => 'firres', 27 => 'natres',
|
||||
28 => 'frores', 29 => 'shares', 30 => 'holres', 37 => 'mleatkpwr', 32 => 'dps', 35 => 'damagetype', 33 => 'dmgmin1', 34 => 'dmgmax1',
|
||||
@@ -209,11 +106,6 @@ class Util
|
||||
null, 'bc', 'wotlk', 'cata', 'mop'
|
||||
);
|
||||
|
||||
public static $class2SpellFamily = array(
|
||||
// null Warrior Paladin Hunter Rogue Priest DK Shaman Mage Warlock null Druid
|
||||
null, 4, 10, 9, 8, 6, 15, 11, 3, 5, null, 7
|
||||
);
|
||||
|
||||
public static $bgImagePath = array (
|
||||
'tiny' => 'style="background-image: url(%s/images/wow/icons/tiny/%s.gif)"',
|
||||
'small' => 'style="background-image: url(%s/images/wow/icons/small/%s.jpg)"',
|
||||
@@ -383,65 +275,6 @@ class Util
|
||||
}
|
||||
}
|
||||
|
||||
public static function itemModByRatingMask($mask)
|
||||
{
|
||||
if (($mask & 0x1C000) == 0x1C000) // special case resilience
|
||||
return ITEM_MOD_RESILIENCE_RATING;
|
||||
|
||||
if (($mask & 0x00E0) == 0x00E0) // special case hit rating
|
||||
return ITEM_MOD_HIT_RATING;
|
||||
|
||||
for ($j = 0; $j < count(self::$combatRatingToItemMod); $j++)
|
||||
{
|
||||
if (!self::$combatRatingToItemMod[$j])
|
||||
continue;
|
||||
|
||||
if (!($mask & (1 << $j)))
|
||||
continue;
|
||||
|
||||
return self::$combatRatingToItemMod[$j];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function sideByRaceMask($race)
|
||||
{
|
||||
// Any
|
||||
if (!$race || ($race & RACE_MASK_ALL) == RACE_MASK_ALL)
|
||||
return SIDE_BOTH;
|
||||
|
||||
// Horde
|
||||
if ($race & RACE_MASK_HORDE && !($race & RACE_MASK_ALLIANCE))
|
||||
return SIDE_HORDE;
|
||||
|
||||
// Alliance
|
||||
if ($race & RACE_MASK_ALLIANCE && !($race & RACE_MASK_HORDE))
|
||||
return SIDE_ALLIANCE;
|
||||
|
||||
return SIDE_BOTH;
|
||||
}
|
||||
|
||||
public static function getReputationLevelForPoints($pts)
|
||||
{
|
||||
if ($pts >= 41999)
|
||||
return REP_EXALTED;
|
||||
else if ($pts >= 20999)
|
||||
return REP_REVERED;
|
||||
else if ($pts >= 8999)
|
||||
return REP_HONORED;
|
||||
else if ($pts >= 2999)
|
||||
return REP_FRIENDLY;
|
||||
else if ($pts >= 0)
|
||||
return REP_NEUTRAL;
|
||||
else if ($pts >= -3000)
|
||||
return REP_UNFRIENDLY;
|
||||
else if ($pts >= -6000)
|
||||
return REP_HOSTILE;
|
||||
else
|
||||
return REP_HATED;
|
||||
}
|
||||
|
||||
// pageText for Books (Item or GO) and questText
|
||||
public static function parseHtmlText($text)
|
||||
{
|
||||
@@ -600,7 +433,7 @@ class Util
|
||||
if (in_array($type, [ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_DODGE_RATING, ITEM_MOD_PARRY_RATING, ITEM_MOD_BLOCK_RATING, ITEM_MOD_RESILIENCE_RATING]) && $level < 34)
|
||||
$level = 34;
|
||||
|
||||
if (!isset(Util::$gtCombatRatings[$type]))
|
||||
if (!isset(self::$gtCombatRatings[$type]))
|
||||
$result = 0;
|
||||
else
|
||||
{
|
||||
@@ -614,7 +447,7 @@ class Util
|
||||
$c = 2 / 52;
|
||||
|
||||
// do not use localized number format here!
|
||||
$result = number_format($val / Util::$gtCombatRatings[$type] / $c, 2);
|
||||
$result = number_format($val / self::$gtCombatRatings[$type] / $c, 2);
|
||||
}
|
||||
|
||||
if (!in_array($type, array(ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_EXPERTISE_RATING)))
|
||||
@@ -714,46 +547,6 @@ class Util
|
||||
}
|
||||
}
|
||||
|
||||
public static function getTaughtSpells(&$spell)
|
||||
{
|
||||
$extraIds = [-1]; // init with -1 to prevent empty-array errors
|
||||
$lookup = [-1];
|
||||
switch (gettype($spell))
|
||||
{
|
||||
case 'object':
|
||||
if (get_class($spell) != 'SpellList')
|
||||
return [];
|
||||
|
||||
$lookup[] = $spell->id;
|
||||
foreach ($spell->canTeachSpell() as $idx)
|
||||
$extraIds[] = $spell->getField('effect'.$idx.'TriggerSpell');
|
||||
|
||||
break;
|
||||
case 'integer':
|
||||
$lookup[] = $spell;
|
||||
break;
|
||||
case 'array':
|
||||
$lookup = $spell;
|
||||
break;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
// note: omits required spell and chance in skill_discovery_template
|
||||
$data = array_merge(
|
||||
DB::World()->selectCol('SELECT spellId FROM spell_learn_spell WHERE entry IN (?a)', $lookup),
|
||||
DB::World()->selectCol('SELECT spellId FROM skill_discovery_template WHERE reqSpell IN (?a)', $lookup),
|
||||
$extraIds
|
||||
);
|
||||
|
||||
// return list of integers, not strings
|
||||
array_walk($data, function (&$v, $k) {
|
||||
$v = intVal($v);
|
||||
});
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function urlize($str)
|
||||
{
|
||||
$search = ['<', '>', ' / ', "'", '(', ')'];
|
||||
@@ -1147,25 +940,6 @@ class Util
|
||||
return self::$realms;
|
||||
}
|
||||
|
||||
public static function getPageText($ptId)
|
||||
{
|
||||
$pages = [];
|
||||
while ($ptId)
|
||||
{
|
||||
if ($row = DB::World()->selectRow('SELECT ptl.Text AS Text_loc?d, pt.* FROM page_text pt LEFT JOIN page_text_locale ptl ON pt.ID = ptl.ID AND locale = ? WHERE pt.ID = ?d', User::$localeId, User::$localeString, $ptId))
|
||||
{
|
||||
$ptId = $row['NextPageID'];
|
||||
$pages[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('Referenced PageTextId #'.$ptId.' is not in DB', E_USER_WARNING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $pages;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -190,7 +190,7 @@ class Lang
|
||||
|
||||
public static function getReputationLevelForPoints($pts)
|
||||
{
|
||||
$_ = Util::getReputationLevelForPoints($pts);
|
||||
$_ = Game::getReputationLevelForPoints($pts);
|
||||
|
||||
return self::game('rep', $_);
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ if (!CLI)
|
||||
{
|
||||
foreach ($v as $sk => $sv)
|
||||
{
|
||||
if ($str = Util::$itemMods[$sk])
|
||||
if ($str = Game::$itemMods[$sk])
|
||||
{
|
||||
$setOut['setbonus'][$k][$str] = $sv;
|
||||
unset($setOut['setbonus'][$k][$sk]);
|
||||
|
||||
@@ -128,7 +128,7 @@ class ItemStatSetup extends ItemList
|
||||
{
|
||||
if (!$v)
|
||||
continue;
|
||||
if ($str = Util::$itemMods[$k])
|
||||
if ($str = Game::$itemMods[$k])
|
||||
$updateFields[$str] = number_format($v, 2, '.', '');
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ function enchantment_stats()
|
||||
case 3: // TYPE_EQUIP_SPELL Spells from ObjectX (use of amountX?)
|
||||
if (!empty($spellStats[$obj]))
|
||||
foreach ($spellStats[$obj] as $mod => $val)
|
||||
if ($str = Util::$itemMods[$mod])
|
||||
if ($str = Game::$itemMods[$mod])
|
||||
Util::arraySumByKey($result[$eId], [$str => $val]);
|
||||
|
||||
$obj = null;
|
||||
@@ -255,7 +255,7 @@ function enchantment_stats()
|
||||
}
|
||||
|
||||
if ($obj !== null)
|
||||
if ($str = Util::$itemMods[$obj]) // check if we use these mods
|
||||
if ($str = Game::$itemMods[$obj]) // check if we use these mods
|
||||
Util::arraySumByKey($result[$eId], [$str => $val]);
|
||||
}
|
||||
|
||||
|
||||
@@ -348,9 +348,9 @@ function spell()
|
||||
$update['skillLine1'] = $lines[0];
|
||||
break;
|
||||
default:
|
||||
for ($i = -count(Util::$skillLineMask); $i < 0; $i++)
|
||||
for ($i = -count(Game::$skillLineMask); $i < 0; $i++)
|
||||
{
|
||||
foreach (Util::$skillLineMask[$i] as $k => $pair)
|
||||
foreach (Game::$skillLineMask[$i] as $k => $pair)
|
||||
{
|
||||
if (in_array($pair[1], $lines))
|
||||
{
|
||||
@@ -537,8 +537,8 @@ function spell()
|
||||
// pet spells (-3)
|
||||
DB::Aowow()->query('UPDATE ?_spell s SET s.typeCat = -3 WHERE (s.cuFlags & 0x3) = 0 AND s.skillline1 IN (?a)',
|
||||
array_merge(
|
||||
array_column(Util::$skillLineMask[-1], 1), // hunter pets
|
||||
array_column(Util::$skillLineMask[-2], 1), // warlock pets
|
||||
array_column(Game::$skillLineMask[-1], 1), // hunter pets
|
||||
array_column(Game::$skillLineMask[-2], 1), // warlock pets
|
||||
[270, 782], // hunter generic, DK - Ghoul
|
||||
[-1, -2] // super categories
|
||||
)
|
||||
|
||||
@@ -80,7 +80,7 @@ function titles()
|
||||
if ($data['eventEntry'])
|
||||
DB::Aowow()->query('UPDATE ?_titles SET eventId = ?d WHERE id = ?d', $data['eventEntry'], $tId);
|
||||
|
||||
$side = Util::sideByRaceMask($data['AllowableRaces']);
|
||||
$side = Game::sideByRaceMask($data['AllowableRaces']);
|
||||
if ($side == 3)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user