mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Items/Stats
* fixed stats for random enchanted items with scaling enchantments * don't send unused 'chance' to Summary tool
This commit is contained in:
@@ -57,7 +57,12 @@ class EnchantmentList extends BaseType
|
||||
}
|
||||
}
|
||||
|
||||
$this->jsonStats[$this->id] = (new StatsContainer)->fromJson($curTpl, true);
|
||||
// issue with scaling stats enchantments
|
||||
// stats are stored as NOT NULL to be usable by the search filters and such become indistinguishable from scaling enchantments that _actually_ use the value 0
|
||||
// so filter the stats container and if it is empty, rebuild from self. .. there are no mixed scaling/static enchantments, right!?
|
||||
$this->jsonStats[$this->id] = (new StatsContainer)->fromJson($curTpl, true)->filter();
|
||||
if (!count($this->jsonStats[$this->id]))
|
||||
$this->jsonStats[$this->id]->fromEnchantment($curTpl);
|
||||
}
|
||||
|
||||
if ($relSpells)
|
||||
@@ -67,7 +72,7 @@ class EnchantmentList extends BaseType
|
||||
// use if you JUST need the name
|
||||
public static function getName($id)
|
||||
{
|
||||
$n = DB::Aowow()->SelectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc4, name_loc6, name_loc8 FROM ?_itemenchantment WHERE id = ?d', $id );
|
||||
$n = DB::Aowow()->SelectRow('SELECT `name_loc0`, `name_loc2`, `name_loc3`, `name_loc4`, `name_loc6`, `name_loc8` FROM ?_itemenchantment WHERE `id` = ?d', $id );
|
||||
return Util::localizedString($n, 'name');
|
||||
}
|
||||
// end static use
|
||||
|
||||
@@ -1578,11 +1578,11 @@ class ItemList extends BaseType
|
||||
return;
|
||||
|
||||
// remember: id < 0: randomSuffix; id > 0: randomProperty
|
||||
$subItemTpls = DB::World()->select('
|
||||
SELECT CAST( entry as SIGNED) AS ARRAY_KEY, CAST( ench as SIGNED) AS ARRAY_KEY2, chance FROM item_enchantment_template WHERE entry IN (?a) UNION
|
||||
SELECT CAST(-entry as SIGNED) AS ARRAY_KEY, CAST(-ench as SIGNED) AS ARRAY_KEY2, chance FROM item_enchantment_template WHERE entry IN (?a)',
|
||||
array_keys(array_filter($subItemIds, function ($v) { return $v > 0; })) ?: [0],
|
||||
array_keys(array_filter($subItemIds, function ($v) { return $v < 0; })) ?: [0]
|
||||
$subItemTpls = DB::World()->select(
|
||||
'SELECT CAST( `entry` as SIGNED) AS ARRAY_KEY, CAST( `ench` as SIGNED) AS ARRAY_KEY2, `chance` FROM item_enchantment_template WHERE `entry` IN (?a) UNION
|
||||
SELECT CAST(-`entry` as SIGNED) AS ARRAY_KEY, CAST(-`ench` as SIGNED) AS ARRAY_KEY2, `chance` FROM item_enchantment_template WHERE `entry` IN (?a)',
|
||||
array_keys(array_filter($subItemIds, fn($v) => $v > 0)) ?: [0],
|
||||
array_keys(array_filter($subItemIds, fn($v) => $v < 0)) ?: [0]
|
||||
);
|
||||
|
||||
$randIds = [];
|
||||
|
||||
Reference in New Issue
Block a user