mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[10941] More strict check player race/class allowed values.
This commit is contained in:
parent
b325e93538
commit
16768da053
3 changed files with 32 additions and 31 deletions
|
|
@ -2764,26 +2764,15 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
float positionZ = fields[6].GetFloat();
|
||||
float orientation = fields[7].GetFloat();
|
||||
|
||||
if(current_race >= MAX_RACES)
|
||||
{
|
||||
sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
|
||||
if(!rEntry)
|
||||
if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(current_class >= MAX_CLASSES)
|
||||
{
|
||||
sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!sChrClassesStore.LookupEntry(current_class))
|
||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class);
|
||||
if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
|
||||
continue;
|
||||
|
|
@ -2850,14 +2839,17 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 current_race = fields[0].GetUInt32();
|
||||
if(current_race >= MAX_RACES)
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
|
||||
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
|
||||
if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.",current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
if(current_class >= MAX_CLASSES)
|
||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class);
|
||||
if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.",current_class);
|
||||
continue;
|
||||
|
|
@ -2919,14 +2911,17 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 current_race = fields[0].GetUInt32();
|
||||
if(current_race >= MAX_RACES)
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
|
||||
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
|
||||
if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.",current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
if(current_class >= MAX_CLASSES)
|
||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class);
|
||||
if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.",current_class);
|
||||
continue;
|
||||
|
|
@ -2978,14 +2973,17 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 current_race = fields[0].GetUInt32();
|
||||
if(current_race >= MAX_RACES)
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
|
||||
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
|
||||
if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.",current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
if(current_class >= MAX_CLASSES)
|
||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class);
|
||||
if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.",current_class);
|
||||
continue;
|
||||
|
|
@ -3136,14 +3134,17 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 current_race = fields[0].GetUInt32();
|
||||
if(current_race >= MAX_RACES)
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
|
||||
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
|
||||
if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.",current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 current_class = fields[1].GetUInt32();
|
||||
if(current_class >= MAX_CLASSES)
|
||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class);
|
||||
if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.",current_class);
|
||||
continue;
|
||||
|
|
@ -3189,13 +3190,13 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
for (int race = 0; race < MAX_RACES; ++race)
|
||||
{
|
||||
// skip nonexistent races
|
||||
if(!sChrRacesStore.LookupEntry(race))
|
||||
if(!((1 << (race-1)) & RACEMASK_ALL_PLAYABLE) || !sChrRacesStore.LookupEntry(race))
|
||||
continue;
|
||||
|
||||
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
|
||||
{
|
||||
// skip nonexistent classes
|
||||
if(!sChrClassesStore.LookupEntry(class_))
|
||||
if(!((1 << (class_-1)) & CLASSMASK_ALL_PLAYABLE) || !sChrClassesStore.LookupEntry(class_))
|
||||
continue;
|
||||
|
||||
PlayerInfo* pInfo = &playerInfo[race][class_];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue