Itemstats/Ammunition

* don't use 'delay' to calc added dps from ammunition
This commit is contained in:
Sarjuuk
2024-07-31 01:20:08 +02:00
parent 481a3dc63f
commit b330f88699
2 changed files with 15 additions and 10 deletions

View File

@@ -1661,15 +1661,18 @@ class ItemList extends BaseType
private function initJsonStats() private function initJsonStats()
{ {
$class = $this->curTpl['class'];
$subclass = $this->curTpl['subClass'];
$json = array( $json = array(
'id' => $this->id, 'id' => $this->id,
'name' => $this->getField('name', true), 'name' => $this->getField('name', true),
'quality' => ITEM_QUALITY_HEIRLOOM - $this->curTpl['quality'], 'quality' => ITEM_QUALITY_HEIRLOOM - $this->curTpl['quality'],
'icon' => $this->curTpl['iconString'], 'icon' => $this->curTpl['iconString'],
'classs' => $this->curTpl['class'], 'classs' => $class,
'subclass' => $this->curTpl['subClass'], 'subclass' => $subclass,
'subsubclass' => $this->curTpl['subSubClass'], 'subsubclass' => $this->curTpl['subSubClass'],
'heroic' => ($this->curTpl['flags'] & 0x8) >> 3, 'heroic' => ($this->curTpl['flags'] & ITEM_FLAG_HEROIC) >> 3,
'side' => $this->curTpl['flagsExtra'] & 0x3 ? SIDE_BOTH - ($this->curTpl['flagsExtra'] & 0x3) : Game::sideByRaceMask($this->curTpl['requiredRace']), 'side' => $this->curTpl['flagsExtra'] & 0x3 ? SIDE_BOTH - ($this->curTpl['flagsExtra'] & 0x3) : Game::sideByRaceMask($this->curTpl['requiredRace']),
'slot' => $this->curTpl['slot'], 'slot' => $this->curTpl['slot'],
'slotbak' => $this->curTpl['slotBak'], 'slotbak' => $this->curTpl['slotBak'],
@@ -1683,7 +1686,7 @@ class ItemList extends BaseType
'frores' => $this->curTpl['resFrost'], 'frores' => $this->curTpl['resFrost'],
'shares' => $this->curTpl['resShadow'], 'shares' => $this->curTpl['resShadow'],
'arcres' => $this->curTpl['resArcane'], 'arcres' => $this->curTpl['resArcane'],
'armorbonus' => $this->curTpl['class'] != ITEM_CLASS_ARMOR || $this->curTpl['armorDamageModifier'] <= 0 ? 0 : intVal($this->curTpl['armorDamageModifier']), 'armorbonus' => $class != ITEM_CLASS_ARMOR ? 0 : max(0, intVal($this->curTpl['armorDamageModifier'])),
'armor' => $this->curTpl['tplArmor'], 'armor' => $this->curTpl['tplArmor'],
'dura' => $this->curTpl['durability'], 'dura' => $this->curTpl['durability'],
'itemset' => $this->curTpl['itemset'], 'itemset' => $this->curTpl['itemset'],
@@ -1696,23 +1699,24 @@ class ItemList extends BaseType
'scaflags' => $this->curTpl['scalingStatValue'] 'scaflags' => $this->curTpl['scalingStatValue']
); );
if ($this->curTpl['class'] == ITEM_CLASS_WEAPON || $this->curTpl['class'] == ITEM_CLASS_AMMUNITION) if ($class == ITEM_CLASS_AMMUNITION)
$json['dps'] = round(($this->curTpl['tplDmgMin1'] + $this->curTpl['dmgMin2'] + $this->curTpl['tplDmgMax1'] + $this->curTpl['dmgMax2']) / 2, 2);
else if ($class == ITEM_CLASS_WEAPON)
{ {
$json['dmgtype1'] = $this->curTpl['dmgType1']; $json['dmgtype1'] = $this->curTpl['dmgType1'];
$json['dmgmin1'] = $this->curTpl['tplDmgMin1'] + $this->curTpl['dmgMin2']; $json['dmgmin1'] = $this->curTpl['tplDmgMin1'] + $this->curTpl['dmgMin2'];
$json['dmgmax1'] = $this->curTpl['tplDmgMax1'] + $this->curTpl['dmgMax2']; $json['dmgmax1'] = $this->curTpl['tplDmgMax1'] + $this->curTpl['dmgMax2'];
$json['speed'] = round($this->curTpl['delay'] / 1000, 2); $json['speed'] = round($this->curTpl['delay'] / 1000, 2);
$json['dps'] = $json['speed'] ? round(($json['dmgmin1'] + $json['dmgmax1']) / (2 * $json['speed']), 1) : 0; $json['dps'] = $json['speed'] ? round(($json['dmgmin1'] + $json['dmgmax1']) / (2 * $json['speed']), 1) : 0;
if (in_array($json['subclass'], [2, 3, 18, 19])) if (in_array($subclass, [2, 3, 18, 19]))
{ {
$json['rgddmgmin'] = $json['dmgmin1']; $json['rgddmgmin'] = $json['dmgmin1'];
$json['rgddmgmax'] = $json['dmgmax1']; $json['rgddmgmax'] = $json['dmgmax1'];
$json['rgdspeed'] = $json['speed']; $json['rgdspeed'] = $json['speed'];
$json['rgddps'] = $json['dps']; $json['rgddps'] = $json['dps'];
} }
else if ($json['classs'] != ITEM_CLASS_AMMUNITION) else
{ {
$json['mledmgmin'] = $json['dmgmin1']; $json['mledmgmin'] = $json['dmgmin1'];
$json['mledmgmax'] = $json['dmgmax1']; $json['mledmgmax'] = $json['dmgmax1'];
@@ -1724,9 +1728,9 @@ class ItemList extends BaseType
$json['feratkpwr'] = $fap; $json['feratkpwr'] = $fap;
} }
if ($this->curTpl['class'] == ITEM_CLASS_ARMOR || $this->curTpl['class'] == ITEM_CLASS_WEAPON) if ($class == ITEM_CLASS_ARMOR || $class == ITEM_CLASS_WEAPON)
$json['gearscore'] = Util::getEquipmentScore($json['level'], $this->getField('quality'), $json['slot'], $json['nsockets']); $json['gearscore'] = Util::getEquipmentScore($json['level'], $this->getField('quality'), $json['slot'], $json['nsockets']);
else if ($this->curTpl['class'] == ITEM_CLASS_GEM) else if ($class == ITEM_CLASS_GEM)
$json['gearscore'] = Util::getGemScore($json['level'], $this->getField('quality'), $this->getField('requiredSkill') == SKILL_JEWELCRAFTING, $this->id); $json['gearscore'] = Util::getGemScore($json['level'], $this->getField('quality'), $this->getField('requiredSkill') == SKILL_JEWELCRAFTING, $this->id);
// clear zero-values afterwards // clear zero-values afterwards

View File

@@ -0,0 +1 @@
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' stats');