aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp1
-rw-r--r--src/server/game/AI/EventAI/CreatureEventAI.cpp10
-rw-r--r--src/server/game/AI/EventAI/CreatureEventAI.h6
-rw-r--r--src/server/game/AI/EventAI/CreatureEventAIMgr.cpp15
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp12
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp2
-rw-r--r--src/server/game/Events/GameEventMgr.cpp2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp12
-rw-r--r--src/server/game/Globals/ObjectMgr.h4
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp18
11 files changed, 30 insertions, 54 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index dd32d2363d7..85864cab493 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -40,7 +40,6 @@ int PetAI::Permissible(const Creature* creature)
PetAI::PetAI(Creature* c) : CreatureAI(c), i_tracker(TIME_INTERVAL_LOOK)
{
- m_AllySet.clear();
UpdateAllies();
}
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index c7dd888ef59..9a4a85b72d8 100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -406,10 +406,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (action.morph.creatureId)
{
if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(action.morph.creatureId))
- {
- uint32 display_id = sObjectMgr->ChooseDisplayId(0, ci);
- me->SetDisplayId(display_id);
- }
+ me->SetDisplayId(ObjectMgr::ChooseDisplayId(ci));
}
//if no param1, then use value from param2 (modelId)
else
@@ -780,10 +777,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (action.mount.creatureId)
{
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(action.mount.creatureId))
- {
- uint32 display_id = sObjectMgr->ChooseDisplayId(0, cInfo);
- me->Mount(display_id);
- }
+ me->Mount(ObjectMgr::ChooseDisplayId(cInfo));
}
//if no param1, then use value from param2 (modelId)
else
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index 23a2f79af67..d67fef64b95 100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -591,10 +591,8 @@ class CreatureEventAI : public CreatureAI
{
public:
explicit CreatureEventAI(Creature* c);
- ~CreatureEventAI()
- {
- m_CreatureEventAIList.clear();
- }
+ ~CreatureEventAI() { }
+
void JustRespawned();
void Reset();
void JustReachedHome();
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index 8fc8debc38a..c2698b01e19 100644
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -211,7 +211,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
if ((temp.spell_hit.schoolMask & spell->SchoolMask) != spell->SchoolMask)
- sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
+ {
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.",
+ temp.creature_id, temp.spell_hit.schoolMask, i);
+ }
}
if (!temp.spell_hit.schoolMask)
@@ -237,11 +240,17 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case SPAWNED_EVENT_MAP:
if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
- sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ {
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.",
+ temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ }
break;
case SPAWNED_EVENT_ZONE:
if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
- sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ {
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.",
+ temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ }
default:
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
break;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index b5af76a1219..9c476ea55fc 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -83,7 +83,6 @@ SmartScript::SmartScript()
mEventPhase = 0;
mPathId = 0;
mTargetStorage = new ObjectListMap();
- mStoredEvents.clear();
mTextTimer = 0;
mLastTextID = 0;
mTextGUID = 0;
@@ -313,10 +312,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
- uint32 display_id = sObjectMgr->ChooseDisplayId(0, ci);
- (*itr)->ToCreature()->SetDisplayId(display_id);
+ uint32 displayId = ObjectMgr::ChooseDisplayId(ci);
+ (*itr)->ToCreature()->SetDisplayId(displayId);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u",
- (*itr)->GetEntry(), (*itr)->GetGUIDLow(), display_id);
+ (*itr)->GetEntry(), (*itr)->GetGUIDLow(), displayId);
}
}
//if no param1, then use value from param2 (modelId)
@@ -1050,10 +1049,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (e.action.morphOrMount.creature > 0)
{
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
- {
- uint32 display_id = sObjectMgr->ChooseDisplayId(0, cInfo);
- (*itr)->ToUnit()->Mount(display_id);
- }
+ (*itr)->ToUnit()->Mount(ObjectMgr::ChooseDisplayId(cInfo));
}
else
(*itr)->ToUnit()->Mount(e.action.morphOrMount.model);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 4929d965fb6..a862670e826 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -101,8 +101,6 @@ SmartWaypointMgr::~SmartWaypointMgr()
delete itr->second;
}
-
- waypoint_map.clear();
}
void SmartAIMgr::LoadSmartAIFromDB()
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 83cdb52776c..ec97cacc64a 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -309,7 +309,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
return false;
}
- uint32 displayID = sObjectMgr->ChooseDisplayId(0, GetCreatureTemplate(), data);
+ uint32 displayID = ObjectMgr::ChooseDisplayId(GetCreatureTemplate(), data);
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
if (!minfo) // Cancel load if no model defined
{
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 99ba2391a73..685ac9029ed 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -1361,7 +1361,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
if (data2 && activate)
{
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(data2->id);
- uint32 displayID = sObjectMgr->ChooseDisplayId(0, cinfo, data2);
+ uint32 displayID = ObjectMgr::ChooseDisplayId(cinfo, data2);
sObjectMgr->GetCreatureModelRandomGender(&displayID);
if (data2->equipmentId == 0)
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index effd2057c68..b04d259c5d0 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1083,19 +1083,13 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId)
return NULL;
}
-uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureTemplate* cinfo, const CreatureData* data /*= NULL*/)
+uint32 ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data /*= NULL*/)
{
// Load creature model (display id)
- uint32 display_id = 0;
-
- if (!data || data->displayid == 0)
- {
- display_id = cinfo->GetRandomValidModelId();
- }
- else
+ if (data && data->displayid)
return data->displayid;
- return display_id;
+ return cinfo->GetRandomValidModelId();
}
void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data /*= NULL*/)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index f219b2feb5f..88836e050aa 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -683,8 +683,8 @@ class ObjectMgr
CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; }
CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId);
CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID);
- static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL);
- static void ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data = NULL);
+ static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = NULL);
+ static void ChooseCreatureFlags(CreatureTemplate const* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, CreatureData const* data = NULL);
EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id);
CreatureAddon const* GetCreatureAddon(uint32 lowguid);
CreatureAddon const* GetCreatureTemplateAddon(uint32 entry);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 24c58a666d1..71c74db7ba2 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2051,11 +2051,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
{
- uint32 team = 0;
- if (target->GetTypeId() == TYPEID_PLAYER)
- team = target->ToPlayer()->GetTeam();
-
- uint32 displayID = sObjectMgr->ChooseDisplayId(team, ci);
+ uint32 displayID = ObjectMgr::ChooseDisplayId(ci);
sObjectMgr->GetCreatureModelRandomGender(&displayID);
target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID);
@@ -2523,11 +2519,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
return;
}
- uint32 team = 0;
- if (target->GetTypeId() == TYPEID_PLAYER)
- team = target->ToPlayer()->GetTeam();
-
- uint32 displayID = sObjectMgr->ChooseDisplayId(team, ci);
+ uint32 displayID = ObjectMgr::ChooseDisplayId(ci);
sObjectMgr->GetCreatureModelRandomGender(&displayID);
//some spell has one aura of mount and one of vehicle
@@ -4905,11 +4897,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
{
- uint32 team = 0;
- if (target->GetTypeId() == TYPEID_PLAYER)
- team = target->ToPlayer()->GetTeam();
-
- uint32 displayID = sObjectMgr->ChooseDisplayId(team, creatureInfo);
+ uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo);
sObjectMgr->GetCreatureModelRandomGender(&displayID);
target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID);