Core/Entities: Use ObjectGuid class in game project

This commit is contained in:
Shauren committed 2014-09-14 16:14:12 +02:00
1 parent ce67a097bf
commit a0e50ea35f
256 files changed
+3334 -3833

No files matched your search

+5 -5
View File
@@ -61,7 +61,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mDespawnState = 0;
mEscortInvokerCheckTimer = 1000;
mFollowGuid = 0;
mFollowGuid.Clear();
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
@@ -540,7 +540,7 @@ void SmartAI::JustRespawned()
mJustReset = true;
JustReachedHome();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade
mFollowGuid.Clear();//do not reset follower on Reset(), we need it after combat evade
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
@@ -674,8 +674,8 @@ void SmartAI::OnCharmed(bool apply)
{
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply);
if (!apply && !me->IsInEvadeMode() && me->GetUInt64Value(UNIT_FIELD_CHARMEDBY))
if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetUInt64Value(UNIT_FIELD_CHARMEDBY)))
if (!apply && !me->IsInEvadeMode() && me->GetCharmerGUID())
if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetCharmerGUID()))
AttackStart(charmer);
}
@@ -800,7 +800,7 @@ void SmartAI::StopFollow()
player->GroupEventHappens(mFollowCredit, me);
}
mFollowGuid = 0;
mFollowGuid.Clear();
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
+1 -1
View File
@@ -199,7 +199,7 @@ class SmartAI : public CreatureAI
uint32 mFollowArrivedTimer;
uint32 mFollowCredit;
uint32 mFollowArrivedEntry;
uint64 mFollowGuid;
ObjectGuid mFollowGuid;
float mFollowDist;
float mFollowAngle;
+12 -15
View File
@@ -71,9 +71,6 @@ SmartScript::SmartScript()
mUseTextTimer = false;
mTalkerEntry = 0;
mTemplate = SMARTAI_TEMPLATE_BASIC;
meOrigGUID = 0;
goOrigGUID = 0;
mLastInvoker = 0;
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
isProcessingTimedActionList = false;
}
@@ -99,7 +96,7 @@ void SmartScript::OnReset()
}
}
ProcessEventsFor(SMART_EVENT_RESET);
mLastInvoker = 0;
mLastInvoker.Clear();
}
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
@@ -529,7 +526,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
go->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: %s: %u casts spell %u on target %u with castflags %u",
GetLogNameForGuid(me ? me->GetGUID() : go->GetGUID()), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
(me ? me->GetGUID() : go->GetGUID()).GetTypeName(), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
@@ -959,7 +956,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!targets)
break;
instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID());
instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID().GetRawValue());
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: " UI64FMTD,
e.action.setInstanceData64.field, targets->front()->GetGUID());
@@ -1578,20 +1575,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsCreature(*itr))
{
if (!meOrigGUID)
meOrigGUID = me ? me->GetGUID() : 0;
if (!goOrigGUID)
goOrigGUID = go ? go->GetGUID() : 0;
if (!meOrigGUID && me)
meOrigGUID = me->GetGUID();
if (!goOrigGUID && go)
goOrigGUID = go->GetGUID();
go = NULL;
me = (*itr)->ToCreature();
break;
}
else if (IsGameObject(*itr))
{
if (!meOrigGUID)
meOrigGUID = me ? me->GetGUID() : 0;
if (!goOrigGUID)
goOrigGUID = go ? go->GetGUID() : 0;
if (!meOrigGUID && me)
meOrigGUID = me->GetGUID();
if (!goOrigGUID && go)
goOrigGUID = go->GetGUID();
go = (*itr)->ToGameObject();
me = NULL;
break;
@@ -2647,7 +2644,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (me)
{
uint64 charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID();
ObjectGuid charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID();
if (!charmerOrOwnerGuid)
charmerOrOwnerGuid = me->GetCreatorGUID();
@@ -197,14 +197,14 @@ class SmartScript
go = o;
}
}
goOrigGUID = 0;
meOrigGUID = 0;
goOrigGUID.Clear();
meOrigGUID.Clear();
}
//TIMED_ACTIONLIST (script type 9 aka script9)
void SetScript9(SmartScriptHolder& e, uint32 entry);
Unit* GetLastInvoker();
uint64 mLastInvoker;
ObjectGuid mLastInvoker;
private:
void IncPhase(int32 p = 1)
@@ -224,9 +224,9 @@ class SmartScript
SmartAIEventList mTimedActionList;
bool isProcessingTimedActionList;
Creature* me;
uint64 meOrigGUID;
ObjectGuid meOrigGUID;
GameObject* go;
uint64 goOrigGUID;
ObjectGuid goOrigGUID;
AreaTriggerEntry const* trigger;
SmartScriptType mScriptType;
uint32 mEventPhase;
@@ -1352,7 +1352,7 @@ struct SmartScriptHolder
typedef std::unordered_map<uint32, WayPoint*> WPPath;
typedef std::list<WorldObject*> ObjectList;
typedef std::list<uint64> GuidList;
class ObjectGuidList
{
ObjectList* m_objectList;