Files
Fractured/src/server/game/Entities/Player/RaceMgr.cpp
T
2026-05-06 21:18:20 -04:00

78 lines
1.9 KiB
C++

/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "RaceMgr.h"
#include "AccountMgr.h"
#include "DatabaseEnv.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Util.h"
#include "WorldPacket.h"
#include "WorldSession.h"
uint8 RaceMgr::_maxRaces = 0;
uint32 RaceMgr::_playableRaceMask = 0;
uint32 RaceMgr::_allianceRaceMask = 0;
uint32 RaceMgr::_hordeRaceMask = 0;
RaceMgr::RaceMgr()
{
}
RaceMgr::~RaceMgr()
{
}
RaceMgr* RaceMgr::instance()
{
static RaceMgr instance;
return &instance;
}
void RaceMgr::LoadRaces()
{
SetMaxRaces(0 + 1);
_playableRaceMask = 0;
_hordeRaceMask = 0;
_allianceRaceMask = 0;
for (auto const& raceEntry : sChrRacesStore)
{
if (!raceEntry)
continue;
uint8 alliance = raceEntry->alliance;
uint8 raceId = raceEntry->RaceID;
if (raceEntry->Flags & CHRRACES_FLAGS_NOT_PLAYABLE)
continue;
if (GetMaxRaces() <= raceId)
SetMaxRaces(raceId + 1);
uint32 raceBit = (1 << (raceId - 1));
_playableRaceMask |= raceBit;
if (alliance == ALLIANCE_HORDE)
_hordeRaceMask |= raceBit;
else if (alliance == ALLIANCE_ALLIANCE)
_allianceRaceMask |= raceBit;
}
}