Creature/DetailPage

* display school resistance under stats in infobox
This commit is contained in:
Sarjuuk
2020-12-18 01:04:33 +01:00
parent cac57f5cd8
commit 5b414500a7
12 changed files with 82 additions and 5 deletions

View File

@@ -117,7 +117,7 @@ class CreatureList extends BaseType
return !$data ? 0 : $data[array_rand($data)]; return !$data ? 0 : $data[array_rand($data)];
} }
public function getBaseStats($type) public function getBaseStats(string $type) : array
{ {
// i'm aware of the BaseVariance/RangedVariance fields ... i'm just totaly unsure about the whole damage calculation // i'm aware of the BaseVariance/RangedVariance fields ... i'm just totaly unsure about the whole damage calculation
switch ($type) switch ($type)
@@ -142,8 +142,14 @@ class CreatureList extends BaseType
$rngMin = ($this->getField('dmgMin') + ($this->getField('rngAtkPwrMin') / 14)) * $this->getField('dmgMultiplier') * $this->getField('rngAtkSpeed'); $rngMin = ($this->getField('dmgMin') + ($this->getField('rngAtkPwrMin') / 14)) * $this->getField('dmgMultiplier') * $this->getField('rngAtkSpeed');
$rngMax = ($this->getField('dmgMax') * 1.5 + ($this->getField('rngAtkPwrMax') / 14)) * $this->getField('dmgMultiplier') * $this->getField('rngAtkSpeed'); $rngMax = ($this->getField('dmgMax') * 1.5 + ($this->getField('rngAtkPwrMax') / 14)) * $this->getField('dmgMultiplier') * $this->getField('rngAtkSpeed');
return [$rngMin, $rngMax]; return [$rngMin, $rngMax];
case 'resistance':
$r = [];
for ($i = SPELL_SCHOOL_HOLY; $i < SPELL_SCHOOL_ARCANE+1; $i++)
$r[$i] = $this->getField('resistance'.$i);
return $r;
default: default:
return [0, 0]; return [];
} }
} }

View File

@@ -891,6 +891,7 @@ $lang = array(
'melee' => "Nahkampf", 'melee' => "Nahkampf",
'ranged' => "Fernkampf", 'ranged' => "Fernkampf",
'armor' => "Rüstung", 'armor' => "Rüstung",
'resistances' => "Widerstände",
'foundIn' => "Dieser NPC befindet sich in", 'foundIn' => "Dieser NPC befindet sich in",
'tameable' => "Zähmbar (%s)", 'tameable' => "Zähmbar (%s)",
'waypoint' => "Wegpunkt", 'waypoint' => "Wegpunkt",

View File

@@ -892,6 +892,7 @@ $lang = array(
'melee' => "Melee", 'melee' => "Melee",
'ranged' => "Ranged", 'ranged' => "Ranged",
'armor' => "Armor", 'armor' => "Armor",
'resistances' => "Resistances",
'foundIn' => "This NPC can be found in", 'foundIn' => "This NPC can be found in",
'tameable' => "Tameable (%s)", 'tameable' => "Tameable (%s)",
'waypoint' => "Waypoint", 'waypoint' => "Waypoint",

View File

@@ -892,6 +892,7 @@ $lang = array(
'melee' => "Cuerpo a cuerpo", 'melee' => "Cuerpo a cuerpo",
'ranged' => "Ataque a distancia", 'ranged' => "Ataque a distancia",
'armor' => "Armadura", 'armor' => "Armadura",
'resistances' => "Resitencias",
'foundIn' => "Este PNJ se puede encontrar en", 'foundIn' => "Este PNJ se puede encontrar en",
'tameable' => "Domesticable (%s)", 'tameable' => "Domesticable (%s)",
'waypoint' => "punto de recorrido", 'waypoint' => "punto de recorrido",

View File

@@ -892,6 +892,7 @@ $lang = array(
'melee' => "de mêlée", 'melee' => "de mêlée",
'ranged' => "à distance", 'ranged' => "à distance",
'armor' => "Armure", 'armor' => "Armure",
'resistances' => "Résistances",
'foundIn' => "Ce PNJ se trouve dans", 'foundIn' => "Ce PNJ se trouve dans",
'tameable' => "Domptable (%s)", 'tameable' => "Domptable (%s)",
'waypoint' => "Point de route", 'waypoint' => "Point de route",

View File

@@ -892,6 +892,7 @@ $lang = array(
'melee' => "Ближнего боя", 'melee' => "Ближнего боя",
'ranged' => "Дальнего боя", 'ranged' => "Дальнего боя",
'armor' => "Броня", 'armor' => "Броня",
'resistances' => "Сопротивление",
'foundIn' => "Этот объект может быть найден в следующих зонах:", 'foundIn' => "Этот объект может быть найден в следующих зонах:",
'tameable' => "Можно приручить (%s)", 'tameable' => "Можно приручить (%s)",
'waypoint' => "Путевой точки", 'waypoint' => "Путевой точки",

View File

@@ -892,6 +892,7 @@ $lang = array(
'melee' => "近战", 'melee' => "近战",
'ranged' => "远程", 'ranged' => "远程",
'armor' => "护甲", 'armor' => "护甲",
'resistances' => "韧性",
'foundIn' => "这个NPC能在以下地区找到", 'foundIn' => "这个NPC能在以下地区找到",
'tameable' => "可驯服的(%s)", 'tameable' => "可驯服的(%s)",
'waypoint' => "路径点", 'waypoint' => "路径点",

View File

@@ -386,7 +386,7 @@ class ItemPage extends genericPage
'quality' => $this->subject->getField('quality') 'quality' => $this->subject->getField('quality')
); );
// merge identical stats and names for normal users (e.g. spellPower of a specific school became generel spellPower with 3.0) // merge identical stats and names for normal users (e.g. spellPower of a specific school became general spellPower with 3.0)
if (!User::isInGroup(U_GROUP_EMPLOYEE)) if (!User::isInGroup(U_GROUP_EMPLOYEE))
{ {

View File

@@ -17,6 +17,7 @@ class NpcPage extends GenericPage
protected $tabId = 0; protected $tabId = 0;
protected $mode = CACHE_TYPE_PAGE; protected $mode = CACHE_TYPE_PAGE;
protected $js = ['swfobject.js']; protected $js = ['swfobject.js'];
protected $css = [['path' => 'Profiler.css']];
private $soundIds = []; private $soundIds = [];
private $powerTpl = '$WowheadPower.registerNpc(%d, %d, %s);'; private $powerTpl = '$WowheadPower.registerNpc(%d, %d, %s);';
@@ -107,6 +108,9 @@ class NpcPage extends GenericPage
} }
/***********/ /***********/
/* Infobox */ /* Infobox */
/***********/ /***********/
@@ -247,6 +251,23 @@ class NpcPage extends GenericPage
$armor = $this->subject->getBaseStats('armor'); $armor = $this->subject->getBaseStats('armor');
$stats['armor'] = Lang::npc('armor').Lang::main('colon').($armor[0] < $armor[1] ? Lang::nf($armor[0]).' - '.Lang::nf($armor[1]) : Lang::nf($armor[0])); $stats['armor'] = Lang::npc('armor').Lang::main('colon').($armor[0] < $armor[1] ? Lang::nf($armor[0]).' - '.Lang::nf($armor[1]) : Lang::nf($armor[0]));
// Resistances
$resNames = [null, 'hol', 'fir', 'nat', 'fro', 'sha', 'arc'];
$tmpRes = [];
$stats['resistance'] = '';
foreach ($this->subject->getBaseStats('resistance') as $sc => $amt)
if ($amt)
$tmpRes[] = '[span class="moneyschool'.$resNames[$sc].'"]'.$amt.'[/span]';
if ($tmpRes)
{
$stats['resistance'] = Lang::npc('resistances').Lang::main('colon');
if (count($tmpRes > 3))
$stats['resistance'] .= implode('&nbsp;', array_slice($tmpRes, 0, 3)).'[br]'.implode('&nbsp;', array_slice($tmpRes, 3));
else
$stats['resistance'] .= implode('&nbsp;', $tmpRes);
}
// Melee Damage // Melee Damage
$melee = $this->subject->getBaseStats('melee'); $melee = $this->subject->getBaseStats('melee');
if ($_ = $this->subject->getField('dmgSchool')) // magic damage if ($_ = $this->subject->getField('dmgSchool')) // magic damage
@@ -281,6 +302,22 @@ class NpcPage extends GenericPage
$armor = $_altNPCs->getBaseStats('armor'); $armor = $_altNPCs->getBaseStats('armor');
$modes['armor'][] = sprintf($modeRow, $m, $armor[0] < $armor[1] ? Lang::nf($armor[0]).' - '.Lang::nf($armor[1]) : Lang::nf($armor[0])); $modes['armor'][] = sprintf($modeRow, $m, $armor[0] < $armor[1] ? Lang::nf($armor[0]).' - '.Lang::nf($armor[1]) : Lang::nf($armor[0]));
// Resistances
$tmpRes = '';
foreach ($_altNPCs->getBaseStats('resistance') as $sc => $amt)
$tmpRes .= '[td]'.$amt.'[/td]';
if ($tmpRes)
{
if (!isset($modes['resistance'])) // init table head
$modes['resistance'][] = '[td][/td][td][span class="moneyschoolhol"]&nbsp;&nbsp;&nbsp;&nbsp;[/span][/td][td][span class="moneyschoolfir"]&nbsp;&nbsp;&nbsp;&nbsp;[/span][/td][td][span class="moneyschoolnat"]&nbsp;&nbsp;&nbsp;&nbsp;[/span][/td][td][span class="moneyschoolfro"]&nbsp;&nbsp;&nbsp;&nbsp;[/span][/td][td][span class="moneyschoolsha"]&nbsp;&nbsp;&nbsp;&nbsp;[/span][/td][td][span class="moneyschoolarc"][/span][/td]';
if (!$stats['resistance']) // base creature has no resistance. -> display list item.
$stats['resistance'] = Lang::npc('resistances').Lang::main('colon').'…';
$modes['resistance'][] = '[td]'.$m.'&nbsp;&nbsp;&nbsp;&nbsp;[/td]'.$tmpRes;
}
// Melee Damage // Melee Damage
$melee = $_altNPCs->getBaseStats('melee'); $melee = $_altNPCs->getBaseStats('melee');
if ($_ = $_altNPCs->getField('dmgSchool')) // magic damage if ($_ = $_altNPCs->getField('dmgSchool')) // magic damage

View File

@@ -560,6 +560,12 @@ CREATE TABLE `aowow_creature` (
`manaMax` int(10) unsigned NOT NULL DEFAULT 1, `manaMax` int(10) unsigned NOT NULL DEFAULT 1,
`armorMin` mediumint(8) unsigned NOT NULL DEFAULT 1, `armorMin` mediumint(8) unsigned NOT NULL DEFAULT 1,
`armorMax` mediumint(8) unsigned NOT NULL DEFAULT 1, `armorMax` mediumint(8) unsigned NOT NULL DEFAULT 1,
`resistance1` smallint(5) NOT NULL DEFAULT 0,
`resistance2` smallint(5) NOT NULL DEFAULT 0,
`resistance3` smallint(5) NOT NULL DEFAULT 0,
`resistance4` smallint(5) NOT NULL DEFAULT 0,
`resistance5` smallint(5) NOT NULL DEFAULT 0,
`resistance6` smallint(5) NOT NULL DEFAULT 0,
`racialLeader` tinyint(3) unsigned NOT NULL DEFAULT 0, `racialLeader` tinyint(3) unsigned NOT NULL DEFAULT 0,
`mechanicImmuneMask` int(10) unsigned NOT NULL DEFAULT 0, `mechanicImmuneMask` int(10) unsigned NOT NULL DEFAULT 0,
`flagsExtra` int(10) unsigned NOT NULL DEFAULT 0, `flagsExtra` int(10) unsigned NOT NULL DEFAULT 0,
@@ -3132,7 +3138,7 @@ UNLOCK TABLES;
LOCK TABLES `aowow_dbversion` WRITE; LOCK TABLES `aowow_dbversion` WRITE;
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
INSERT INTO `aowow_dbversion` VALUES (1591223186,0,NULL,NULL); INSERT INTO `aowow_dbversion` VALUES (1608244865,0,NULL,NULL);
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;

View File

@@ -11,7 +11,7 @@ SqlGen::register(new class extends SetupScript
{ {
protected $command = 'creature'; protected $command = 'creature';
protected $tblDependancyTC = ['creature_template', 'creature_template_locale', 'creature_classlevelstats', 'instance_encounters']; protected $tblDependancyTC = ['creature_template', 'creature_template_locale', 'creature_template_resistance', 'creature_template_spell', 'creature_classlevelstats', 'instance_encounters'];
protected $dbcSourceFiles = ['creaturedisplayinfo', 'creaturedisplayinfoextra']; protected $dbcSourceFiles = ['creaturedisplayinfo', 'creaturedisplayinfoextra'];
public function generate(array $ids = []) : bool public function generate(array $ids = []) : bool
@@ -65,6 +65,7 @@ SqlGen::register(new class extends SetupScript
max.basemana * ct.ManaModifier AS manaMax, max.basemana * ct.ManaModifier AS manaMax,
min.basearmor * ct.ArmorModifier AS armorMin, min.basearmor * ct.ArmorModifier AS armorMin,
max.basearmor * ct.ArmorModifier AS armorMax, max.basearmor * ct.ArmorModifier AS armorMax,
IFNULL(ctr1.Resistance, 0), IFNULL(ctr2.Resistance, 0), IFNULL(ctr3.Resistance, 0), IFNULL(ctr4.Resistance, 0), IFNULL(ctr5.Resistance, 0), IFNULL(ctr6.Resistance, 0),
RacialLeader, RacialLeader,
mechanic_immune_mask, mechanic_immune_mask,
flags_extra, flags_extra,
@@ -107,6 +108,18 @@ SqlGen::register(new class extends SetupScript
creature_template_spell cts6 ON ct.entry = cts6.CreatureID AND cts6.Index = 6 creature_template_spell cts6 ON ct.entry = cts6.CreatureID AND cts6.Index = 6
LEFT JOIN LEFT JOIN
creature_template_spell cts7 ON ct.entry = cts7.CreatureID AND cts7.Index = 7 creature_template_spell cts7 ON ct.entry = cts7.CreatureID AND cts7.Index = 7
LEFT JOIN
creature_template_resistance ctr1 ON ct.entry = ctr1.CreatureID AND ctr1.School = 1
LEFT JOIN
creature_template_resistance ctr2 ON ct.entry = ctr2.CreatureID AND ctr2.School = 2
LEFT JOIN
creature_template_resistance ctr3 ON ct.entry = ctr3.CreatureID AND ctr3.School = 3
LEFT JOIN
creature_template_resistance ctr4 ON ct.entry = ctr4.CreatureID AND ctr4.School = 4
LEFT JOIN
creature_template_resistance ctr5 ON ct.entry = ctr5.CreatureID AND ctr5.School = 5
LEFT JOIN
creature_template_resistance ctr6 ON ct.entry = ctr6.CreatureID AND ctr6.School = 6
WHERE WHERE
ct.entry > ?d ct.entry > ?d
{ {

View File

@@ -0,0 +1,9 @@
ALTER TABLE `aowow_creature`
ADD COLUMN `resistance1` SMALLINT NOT NULL DEFAULT 0 AFTER `armorMax`,
ADD COLUMN `resistance2` SMALLINT NOT NULL DEFAULT 0 AFTER `resistance1`,
ADD COLUMN `resistance3` SMALLINT NOT NULL DEFAULT 0 AFTER `resistance2`,
ADD COLUMN `resistance4` SMALLINT NOT NULL DEFAULT 0 AFTER `resistance3`,
ADD COLUMN `resistance5` SMALLINT NOT NULL DEFAULT 0 AFTER `resistance4`,
ADD COLUMN `resistance6` SMALLINT NOT NULL DEFAULT 0 AFTER `resistance5`;
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' creature');