mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Entities: Sixth part of removing GetGUIDLow() uses
This commit is contained in:
@@ -113,10 +113,10 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
|
||||
player = source->ToPlayer();
|
||||
|
||||
if (!player)
|
||||
TC_LOG_ERROR("scripts", "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
TC_LOG_ERROR("scripts", "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, %s; target: TypeId: %u, Entry: %u, %s), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(),
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(),
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str());
|
||||
}
|
||||
return player;
|
||||
}
|
||||
@@ -148,8 +148,8 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
|
||||
if (!creature)
|
||||
TC_LOG_ERROR("scripts", "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(),
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(),
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str());
|
||||
}
|
||||
return creature;
|
||||
}
|
||||
@@ -160,8 +160,10 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
|
||||
if (!obj)
|
||||
TC_LOG_ERROR("scripts", "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
else if (!obj->isType(TYPEMASK_UNIT))
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not unit (TypeId: %u, Entry: %u, %s), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
unit = obj->ToUnit();
|
||||
@@ -181,8 +183,10 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf
|
||||
{
|
||||
player = obj->ToPlayer();
|
||||
if (!player)
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not a player (TypeId: %u, Entry: %u, %s).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
return player;
|
||||
}
|
||||
@@ -196,8 +200,10 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip
|
||||
{
|
||||
creature = obj->ToCreature();
|
||||
if (!creature)
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
|
||||
isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not a creature (TypeId: %u, Entry: %u, %s).", scriptInfo->GetDebugInfo().c_str(),
|
||||
isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
return creature;
|
||||
}
|
||||
@@ -212,8 +218,10 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const
|
||||
{
|
||||
pWorldObject = dynamic_cast<WorldObject*>(obj);
|
||||
if (!pWorldObject)
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s %s object is not a world object (TypeId: %u, Entry: %u, %s).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
return pWorldObject;
|
||||
}
|
||||
@@ -236,22 +244,28 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
|
||||
else if (!source)
|
||||
TC_LOG_ERROR("scripts", "%s source object is NULL.", scriptInfo->GetDebugInfo().c_str());
|
||||
else if (!source->isType(TYPEMASK_UNIT))
|
||||
TC_LOG_ERROR("scripts", "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
|
||||
source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s source object is not unit (TypeId: %u, Entry: %u, %s), skipping.", scriptInfo->GetDebugInfo().c_str(),
|
||||
source->GetTypeId(), source->GetEntry(), source->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
|
||||
if (!wSource)
|
||||
TC_LOG_ERROR("scripts", "%s source object could not be cast to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s source object could not be cast to world object (TypeId: %u, Entry: %u, %s), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject* pDoor = _FindGameObject(wSource, guid);
|
||||
if (!pDoor)
|
||||
TC_LOG_ERROR("scripts", "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
|
||||
else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
|
||||
TC_LOG_ERROR("scripts", "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s gameobject is not a door (GoType: %u, Entry: %u, %s).",
|
||||
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUID().ToString().c_str());
|
||||
}
|
||||
else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
|
||||
{
|
||||
pDoor->UseDoorOrButton(nTimeToToggle);
|
||||
@@ -469,9 +483,11 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
|
||||
TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, %s) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
cSource->SetFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue);
|
||||
}
|
||||
@@ -483,9 +499,11 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
|
||||
TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, %s) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
cSource->RemoveFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue);
|
||||
}
|
||||
@@ -526,8 +544,8 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
TC_LOG_ERROR("scripts", "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, %s), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
worldObject = dynamic_cast<WorldObject*>(source);
|
||||
@@ -539,17 +557,17 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
TC_LOG_ERROR("scripts", "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, %s), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
worldObject = dynamic_cast<WorldObject*>(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(),
|
||||
target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
TC_LOG_ERROR("scripts", "%s neither source nor target is player (Entry: %u, GUID: %u; target: Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetEntry(), source->GetGUID().ToString().c_str(),
|
||||
target->GetEntry(), target->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -653,8 +671,8 @@ void Map::ScriptsProcess()
|
||||
|
||||
if (target->GetTypeId() != TYPEID_GAMEOBJECT)
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
TC_LOG_ERROR("scripts", "%s target object is not gameobject (TypeId: %u, Entry: %u, %s), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -839,8 +857,10 @@ void Map::ScriptsProcess()
|
||||
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
|
||||
{
|
||||
if (cSource->isDead())
|
||||
TC_LOG_ERROR("scripts", "%s creature is already dead (Entry: %u, GUID: %u)",
|
||||
step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s creature is already dead (Entry: %u, %s)",
|
||||
step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
cSource->setDeathState(JUST_DIED);
|
||||
|
||||
Reference in New Issue
Block a user