Further improve ChrRace DBC handling

Port From (https://github.com/TrinityCore/TrinityCore/commit/406c7219ad6454a3f3855c9e0732245dcc34b2dc)
This commit is contained in:
hondacrx
2022-02-22 14:08:30 -05:00
parent 7b0eb70fe7
commit 0600993129
2 changed files with 11 additions and 1 deletions
+4 -1
View File
@@ -1980,7 +1980,10 @@ namespace Game.Entities
if (ssEntry != null && ssEntry.CreatureType > 0)
return (CreatureType)ssEntry.CreatureType;
else
return CreatureType.Humanoid;
{
var raceEntry = CliDB.ChrRacesStorage.LookupByKey(GetRace());
return raceEntry.CreatureType;
}
}
else
return ToCreature().GetCreatureTemplate().CreatureType;
+7
View File
@@ -356,6 +356,13 @@ namespace Game
if (!HasPermission(RBACPermissions.SkipCheckCharacterCreationRacemask))
{
if (raceEntry.GetFlags().HasFlag(ChrRacesFlag.NPCOnly))
{
Log.outError(LogFilter.Network, $"Race ({charCreate.CreateInfo.RaceId}) was not playable but requested while creating new char for account (ID: {GetAccountId()}): wrong DBC files or cheater?");
SendCharCreate(ResponseCodes.CharCreateDisabled);
return;
}
ulong raceMaskDisabled = WorldConfig.GetUInt64Value(WorldCfg.CharacterCreatingDisabledRacemask);
if (Convert.ToBoolean((ulong)SharedConst.GetMaskForRace(charCreate.CreateInfo.RaceId) & raceMaskDisabled))
{