Core/Misc: Do not use singleton when calling to static function ChooseDisplayId (and remove unused parameter)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -591,10 +591,8 @@ class CreatureEventAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit CreatureEventAI(Creature* c);
|
||||
~CreatureEventAI()
|
||||
{
|
||||
m_CreatureEventAIList.clear();
|
||||
}
|
||||
~CreatureEventAI() { }
|
||||
|
||||
void JustRespawned();
|
||||
void Reset();
|
||||
void JustReachedHome();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -101,8 +101,6 @@ SmartWaypointMgr::~SmartWaypointMgr()
|
||||
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
waypoint_map.clear();
|
||||
}
|
||||
|
||||
void SmartAIMgr::LoadSmartAIFromDB()
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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*/)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user