From 7b429811a92714811620e2d40c9e9864ed11810f Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sun, 5 Oct 2025 19:33:34 +0200 Subject: [PATCH] Defines/Races * add unplayable races to ChrRace enum so RaceDetailPage can display them. * don't show empty icons for unplayable races --- endpoints/race/race.php | 4 +++- includes/game/chrrace.class.php | 40 +++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/endpoints/race/race.php b/endpoints/race/race.php index 75c5cd47..6da89fc8 100644 --- a/endpoints/race/race.php +++ b/endpoints/race/race.php @@ -115,12 +115,14 @@ class RaceBaseResponse extends TemplateResponse implements ICache /****************/ $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; - $this->headIcons = ['race_'.$ra->json().'_male', 'race_'.$ra->json().'_female']; $this->redButtons = array( BUTTON_WOWHEAD => true, BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId] ); + if ($_ = $ra->json()) + $this->headIcons = ['race_'.$_.'_male', 'race_'.$_.'_female']; + /**************/ /* Extra Tabs */ diff --git a/includes/game/chrrace.class.php b/includes/game/chrrace.class.php index aab28ed7..0cbe80bd 100644 --- a/includes/game/chrrace.class.php +++ b/includes/game/chrrace.class.php @@ -8,20 +8,31 @@ if (!defined('AOWOW_REVISION')) enum ChrRace : int { - case HUMAN = 1; - case ORC = 2; - case DWARF = 3; - case NIGHTELF = 4; - case UNDEAD = 5; - case TAUREN = 6; - case GNOME = 7; - case TROLL = 8; - case BLOODELF = 10; - case DRAENEI = 11; + case HUMAN = 1; + case ORC = 2; + case DWARF = 3; + case NIGHTELF = 4; + case UNDEAD = 5; + case TAUREN = 6; + case GNOME = 7; + case TROLL = 8; + case GOBLIN = 9; + case BLOODELF = 10; + case DRAENEI = 11; + case FEL_ORC = 12; + case NAGA = 13; + case BROKEN = 14; + case SKELETON = 15; + case VRYKUL = 16; + case TUSKARR = 17; + case FOREST_TROLL = 18; + case TAUNKA = 19; + case NORTHREND_SKELETON = 20; + case ICE_TROLL = 21; - public const MASK_ALLIANCE = 0x44D; - public const MASK_HORDE = 0x2B2; - public const MASK_ALL = 0x6FF; + public const MASK_ALLIANCE = 0x44D; // HUMAN, DWARF, NIGHTELF, GNOME, DRAENEI + public const MASK_HORDE = 0x2B2; // ORC, UNDEAD, TAUREN, TROLL, BLOODELF + public const MASK_ALL = self::MASK_ALLIANCE | self::MASK_HORDE; public function matches(int $raceMask) : bool { @@ -80,7 +91,8 @@ enum ChrRace : int self::GNOME => 'gnome', self::TROLL => 'troll', self::BLOODELF => 'bloodelf', - self::DRAENEI => 'draenei' + self::DRAENEI => 'draenei', + default => '' }; }