mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Profiler/Fixup
* profiler expects teamId, not sideId (yes i know they are basically the same thing offset by 1!)
This commit is contained in:
@@ -510,7 +510,7 @@ class AjaxProfile extends AjaxHandler
|
||||
'level' => $pBase['level'],
|
||||
'classs' => $pBase['class'],
|
||||
'race' => $pBase['race'],
|
||||
'faction' => ChrRace::tryFrom($pBase['race'])?->getSide() ?? SIDE_NONE,
|
||||
'faction' => ChrRace::tryFrom($pBase['race'])?->getTeam() ?? TEAM_NEUTRAL,
|
||||
'gender' => $pBase['gender'],
|
||||
'skincolor' => $pBase['skincolor'],
|
||||
'hairstyle' => $pBase['hairstyle'],
|
||||
|
||||
@@ -487,6 +487,18 @@ enum ChrRace : int
|
||||
return SIDE_NONE;
|
||||
}
|
||||
|
||||
public function getTeam() : int
|
||||
{
|
||||
if ($this->isHorde() && $this->isAlliance())
|
||||
return TEAM_NEUTRAL;
|
||||
else if ($this->isHorde())
|
||||
return TEAM_HORDE;
|
||||
else if ($this->isAlliance())
|
||||
return TEAM_ALLIANCE;
|
||||
else
|
||||
return TEAM_NEUTRAL;
|
||||
}
|
||||
|
||||
public function json() : string
|
||||
{
|
||||
return match ($this)
|
||||
@@ -530,6 +542,23 @@ enum ChrRace : int
|
||||
|
||||
return SIDE_BOTH;
|
||||
}
|
||||
|
||||
public static function teamFromMask(int $raceMask) : int
|
||||
{
|
||||
// Any
|
||||
if (!$raceMask || ($raceMask & self::MASK_ALL) == self::MASK_ALL)
|
||||
return TEAM_NEUTRAL;
|
||||
|
||||
// Horde
|
||||
if ($raceMask & self::MASK_HORDE && !($raceMask & self::MASK_ALLIANCE))
|
||||
return TEAM_HORDE;
|
||||
|
||||
// Alliance
|
||||
if ($raceMask & self::MASK_ALLIANCE && !($raceMask & self::MASK_HORDE))
|
||||
return TEAM_ALLIANCE;
|
||||
|
||||
return TEAM_NEUTRAL;
|
||||
}
|
||||
}
|
||||
|
||||
// SpellFamilyNames
|
||||
|
||||
Reference in New Issue
Block a user