From ca563f081e322ab94aa6f910209b1ee6a0403294 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 2 Dec 2025 18:05:23 +0100 Subject: [PATCH] NPCs/Resistances * evalue and display school immune mask --- endpoints/npc/npc.php | 27 ++++++++++++++++++++++----- setup/sql/01-db_structure.sql | 1 + setup/sql/updates/1764691622_01.sql | 4 ++++ setup/tools/sqlgen/creature.ss.php | 1 + static/js/locale_dede.js | 2 ++ static/js/locale_enus.js | 2 ++ static/js/locale_eses.js | 2 ++ static/js/locale_frfr.js | 2 ++ static/js/locale_ruru.js | 2 ++ static/js/locale_zhcn.js | 2 ++ 10 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 setup/sql/updates/1764691622_01.sql diff --git a/endpoints/npc/npc.php b/endpoints/npc/npc.php index 2ba63bbb..d981295d 100644 --- a/endpoints/npc/npc.php +++ b/endpoints/npc/npc.php @@ -972,10 +972,18 @@ class NpcBaseResponse extends TemplateResponse implements ICache // Resistances $resNames = [null, 'hol', 'fir', 'nat', 'fro', 'sha', 'arc']; $tmpRes = []; + $res = $this->subject->getBaseStats('resistance'); // $sc => $amt $stats['resistance'] = ''; - foreach ($this->subject->getBaseStats('resistance') as $sc => $amt) - if ($amt) - $tmpRes[] = '[span class="moneyschool'.$resNames[$sc].'"]'.$amt.'[/span]'; + foreach ($resNames as $idx => $sc) + { + if (!$sc) + continue; + + if ((1 << $idx) & $this->subject->getField('schoolImmuneMask')) + $tmpRes[] = '[tooltip=tooltip_immune][span class="tip moneyschool'.$sc.'"]∞[/span][/tooltip]'; + else if ($res[$idx]) + $tmpRes[] = '[span class="moneyschool'.$sc.'"]'.$res[$idx].'[/span]'; + } if ($tmpRes) { @@ -1026,8 +1034,17 @@ class NpcBaseResponse extends TemplateResponse implements ICache $stats['resistance'] = Lang::npc('resistances').'…'; $tmpRes = ''; - foreach ($this->altNPCs->getBaseStats('resistance') as $sc => $amt) - $tmpRes .= '[td][span style="margin: 0px 5px"]'.$amt.'[/span][/td]'; + $res = $this->altNPCs->getBaseStats('resistance'); + foreach ($resNames as $idx => $sc) + { + if (!$sc) + continue; + + if ((1 << $idx) & $this->altNPCs->getField('schoolImmuneMask')) + $tmpRes .= '[td][span style="margin: 0px 5px"]∞[/span][/td]'; + else if ($res[$idx]) + $tmpRes .= '[td][span style="margin: 0px 5px"]'.$res[$idx].'[/span][/td]'; + } $modes['resistance'][] = '[td]'.$m.'    [/td]'.$tmpRes; } diff --git a/setup/sql/01-db_structure.sql b/setup/sql/01-db_structure.sql index 436226a3..83ccc3d4 100644 --- a/setup/sql/01-db_structure.sql +++ b/setup/sql/01-db_structure.sql @@ -565,6 +565,7 @@ CREATE TABLE `aowow_creature` ( `resistance6` smallint(6) NOT NULL DEFAULT 0, `racialLeader` tinyint(3) unsigned NOT NULL DEFAULT 0, `mechanicImmuneMask` int(10) unsigned NOT NULL DEFAULT 0, + `schoolImmuneMask` int(10) unsigned NOT NULL DEFAULT 0, `flagsExtra` int(10) unsigned NOT NULL DEFAULT 0, `scriptName` varchar(50) NOT NULL DEFAULT '', PRIMARY KEY (`id`), diff --git a/setup/sql/updates/1764691622_01.sql b/setup/sql/updates/1764691622_01.sql new file mode 100644 index 00000000..8c20c87c --- /dev/null +++ b/setup/sql/updates/1764691622_01.sql @@ -0,0 +1,4 @@ +ALTER TABLE aowow_creature + ADD COLUMN `schoolImmuneMask` int(10) unsigned NOT NULL DEFAULT 0 AFTER `mechanicImmuneMask`; + +UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' creature'); diff --git a/setup/tools/sqlgen/creature.ss.php b/setup/tools/sqlgen/creature.ss.php index 4b8b7e41..954b4fc6 100644 --- a/setup/tools/sqlgen/creature.ss.php +++ b/setup/tools/sqlgen/creature.ss.php @@ -71,6 +71,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript 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, mechanic_immune_mask, + spell_school_immune_mask, flags_extra, ScriptName FROM creature_template ct diff --git a/static/js/locale_dede.js b/static/js/locale_dede.js index 9975d1f7..a7d4cbda 100644 --- a/static/js/locale_dede.js +++ b/static/js/locale_dede.js @@ -3097,6 +3097,8 @@ var LANG = { tooltip_uprate: "Hilfreich/lustig", tooltip_zonelink: "Ein Klick auf diesen Link
bringt Euch zur Gebietsseite.", + tooltip_immune: "Immun", // aowow - custom + reputationhistory: "Rufgeschichte", reputationaction: "Aktion", diff --git a/static/js/locale_enus.js b/static/js/locale_enus.js index 6c898ac3..98c12ce1 100644 --- a/static/js/locale_enus.js +++ b/static/js/locale_enus.js @@ -3146,6 +3146,8 @@ var LANG = { tooltip_uprate: "Insightful/funny", tooltip_zonelink: "Clicking on this link will
take you to the zone page.", + tooltip_immune: "Immune", // aowow - custom + reputationhistory: "Reputation History", reputationaction: "Reputation Action", diff --git a/static/js/locale_eses.js b/static/js/locale_eses.js index d21cec72..c1cda5f7 100644 --- a/static/js/locale_eses.js +++ b/static/js/locale_eses.js @@ -3097,6 +3097,8 @@ var LANG = { tooltip_uprate: "Útil/gracioso", tooltip_zonelink: "Hacer click en este enlace, te
llevará a la página de la zona.", + tooltip_immune: "Inmune", // aowow - custom + reputationhistory: "Historial de reputación", reputationaction: "Acción de reputación", diff --git a/static/js/locale_frfr.js b/static/js/locale_frfr.js index f6aa7d95..7c8375ed 100644 --- a/static/js/locale_frfr.js +++ b/static/js/locale_frfr.js @@ -3098,6 +3098,8 @@ var LANG = { tooltip_uprate: "Intéressant/drôle", tooltip_zonelink: "Cliquer sur ce lien vous amènera
à la page de la zone correspondante.", + tooltip_immune: "Immunisé", // aowow - custom + reputationhistory: "Historique de réputation", reputationaction: "Action de réputation", diff --git a/static/js/locale_ruru.js b/static/js/locale_ruru.js index dfcb1651..a5ab2b2c 100644 --- a/static/js/locale_ruru.js +++ b/static/js/locale_ruru.js @@ -3098,6 +3098,8 @@ var LANG = { tooltip_uprate: "Высокий", tooltip_zonelink: "Щелкнув по этой ссылке вы
попадете на страницу местности.", + tooltip_immune: "Иммунный", // aowow - custom + reputationhistory: "История репутации", reputationaction: "Действие Репутации", diff --git a/static/js/locale_zhcn.js b/static/js/locale_zhcn.js index 9085af50..2c4c609b 100644 --- a/static/js/locale_zhcn.js +++ b/static/js/locale_zhcn.js @@ -3145,6 +3145,8 @@ var LANG = { tooltip_uprate: "犀利/有趣", tooltip_zonelink: "点击此链接就能够
跳转到地区页。", + tooltip_immune: "免疫", // aowow - custom + reputationhistory: "声望历史", reputationaction: "声望行动",