Core/CharStats

* unify stat handling. If there are discrepancies left at least they are now centralized.
   - health should no longer pretend to be mana
   - stats are no longer capped to 32.7k points as items can have multiple of the same stat and handily exceed smallints
 * weight scale fixes:
   - "repair cost" is no longer a weight scale option. Why was it one in the first place? Also it wasn't even accessible before. (that was a bug)
   - "bonus armor" is now searchable and only applied to armor pieces
 * removed unused parsed stats from itemsets
This commit is contained in:
Sarjuuk
2024-04-02 23:06:09 +02:00
parent cb3c7d4ef0
commit d16b08bb29
21 changed files with 1140 additions and 875 deletions

View File

@@ -213,22 +213,16 @@ SqlGen::register(new class extends SetupScript
/* calc statbonuses */
/********************/
$gains = $spells = $mods = [];
$spells = [];
for ($i = 1; $i < 9; $i++)
if ($setData['spellId'.$i] > 0 && $setData['itemCount'.$i] > 0)
$spells[$i] = [$setData['spellId'.$i], $setData['itemCount'.$i]];
$bonusSpells = new SpellList(array(['s.id', array_column($spells, 0)]));
$mods = $bonusSpells->getStatGain();
$spells = array_pad($spells, 8, [0, 0]);
for ($i = 1; $i < 9; $i++)
if ($setData['itemCount'.$i] > 0 && !empty($mods[$setData['spellId'.$i]]))
$gains[$setData['itemCount'.$i]] = $mods[$setData['spellId'.$i]];
$row['bonusParsed'] = serialize($gains);
foreach (array_column($spells, 0) as $idx => $spellId)
$row['spell'.($idx+1)] = $spellId;
foreach (array_column($spells, 1) as $idx => $nItems)