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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user