Core/Log: Gameobjects may have faction template id = 0
Port From (https://github.com/TrinityCore/TrinityCore/commit/89edc84c23f867855ee119c7a9eb5dbf31692cf8)
This commit is contained in:
@@ -1990,9 +1990,27 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public FactionTemplateRecord GetFactionTemplateEntry()
|
public FactionTemplateRecord GetFactionTemplateEntry()
|
||||||
{
|
{
|
||||||
var entry = CliDB.FactionTemplateStorage.LookupByKey(GetFaction());
|
uint factionId = GetFaction();
|
||||||
|
var entry = CliDB.FactionTemplateStorage.LookupByKey(factionId);
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
Log.outError(LogFilter.Server, $"{GetGUID()} has invalid faction {GetFaction()}");
|
{
|
||||||
|
switch (GetTypeId())
|
||||||
|
{
|
||||||
|
case TypeId.Player:
|
||||||
|
Log.outError(LogFilter.Unit, $"Player {ToPlayer().GetName()} has invalid faction (faction template id) #{factionId}");
|
||||||
|
break;
|
||||||
|
case TypeId.Unit:
|
||||||
|
Log.outError(LogFilter.Unit, $"Creature (template id: {ToCreature().GetCreatureTemplate().Entry}) has invalid faction (faction template Id) #{factionId}");
|
||||||
|
break;
|
||||||
|
case TypeId.GameObject:
|
||||||
|
if (factionId != 0) // Gameobjects may have faction template id = 0
|
||||||
|
Log.outError(LogFilter.Unit, $"GameObject (template id: {ToGameObject().GetGoInfo().entry}) has invalid faction (faction template Id) #{factionId}");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log.outError(LogFilter.Unit, $"Object (name={GetName()}, type={GetTypeId()}) has invalid faction (faction template Id) #{factionId}");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user