Core/EventAI: Removed table creature_ai_summons.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DROP TABLE `creature_ai_summons`;
|
||||
@@ -497,23 +497,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ACTION_T_SUMMON:
|
||||
{
|
||||
Unit* target = GetTargetByType(action.summon.target, actionInvoker);
|
||||
|
||||
Creature* creature = NULL;
|
||||
|
||||
if (action.summon.duration)
|
||||
creature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration);
|
||||
else
|
||||
creature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
|
||||
|
||||
if (!creature)
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, eventId, me->GetEntry());
|
||||
else if (action.summon.target != TARGET_T_SELF && target)
|
||||
creature->AI()->AttackStart(target);
|
||||
break;
|
||||
}
|
||||
case ACTION_T_THREAT_SINGLE_PCT:
|
||||
if (Unit* target = GetTargetByType(action.threat_single_pct.target, actionInvoker))
|
||||
me->getThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
|
||||
@@ -663,30 +646,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
else
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry());
|
||||
break;
|
||||
case ACTION_T_SUMMON_ID:
|
||||
{
|
||||
Unit* target = GetTargetByType(action.summon_id.target, actionInvoker);
|
||||
|
||||
CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr->GetCreatureEventAISummonMap().find(action.summon_id.spawnId);
|
||||
if (i == sEventAIMgr->GetCreatureEventAISummonMap().end())
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, eventId, me->GetEntry());
|
||||
return;
|
||||
}
|
||||
|
||||
Creature* creature = NULL;
|
||||
if ((*i).second.SpawnTimeSecs)
|
||||
creature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs);
|
||||
else
|
||||
creature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
|
||||
|
||||
if (!creature)
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, eventId, me->GetEntry());
|
||||
else if (action.summon_id.target != TARGET_T_SELF && target)
|
||||
creature->AI()->AttackStart(target);
|
||||
|
||||
break;
|
||||
}
|
||||
case ACTION_T_KILLED_MONSTER:
|
||||
//first attempt player who tapped creature
|
||||
if (Player* player = me->GetLootRecipient())
|
||||
@@ -798,7 +757,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ACTION_T_SET_SHEATH:
|
||||
{
|
||||
me->SetSheath(SheathState(action.set_sheath.sheath));
|
||||
|
||||
@@ -100,52 +100,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
//Drop Existing EventSummon Map
|
||||
m_CreatureEventAI_Summon_Map.clear();
|
||||
|
||||
// Gather additional data for EventAI
|
||||
QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
CreatureEventAI_Summon temp;
|
||||
|
||||
uint32 i = fields[0].GetUInt32();
|
||||
temp.position_x = fields[1].GetFloat();
|
||||
temp.position_y = fields[2].GetFloat();
|
||||
temp.position_z = fields[3].GetFloat();
|
||||
temp.orientation = fields[4].GetFloat();
|
||||
temp.SpawnTimeSecs = fields[5].GetUInt32();
|
||||
|
||||
if (!Trinity::IsValidMapCoord(temp.position_x, temp.position_y, temp.position_z, temp.orientation))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Add to map
|
||||
m_CreatureEventAI_Summon_Map[i] = temp;
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
@@ -622,14 +576,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
// equal case processed at call
|
||||
}
|
||||
break;
|
||||
case ACTION_T_SUMMON_ID:
|
||||
if (!sObjectMgr->GetCreatureTemplate(action.summon_id.creatureId))
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId);
|
||||
if (action.summon_id.target >= TARGET_T_END)
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
|
||||
if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end())
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId);
|
||||
break;
|
||||
case ACTION_T_KILLED_MONSTER:
|
||||
if (!sObjectMgr->GetCreatureTemplate(action.killed_monster.creatureId))
|
||||
sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
|
||||
|
||||
@@ -32,16 +32,13 @@ class CreatureEventAIMgr
|
||||
|
||||
public:
|
||||
void LoadCreatureEventAI_Texts();
|
||||
void LoadCreatureEventAI_Summons();
|
||||
void LoadCreatureEventAI_Scripts();
|
||||
|
||||
CreatureEventAI_Event_Map const& GetCreatureEventAIMap() const { return m_CreatureEventAI_Event_Map; }
|
||||
CreatureEventAI_Summon_Map const& GetCreatureEventAISummonMap() const { return m_CreatureEventAI_Summon_Map; }
|
||||
CreatureEventAI_TextMap const& GetCreatureEventAITextMap() const { return m_CreatureEventAI_TextMap; }
|
||||
|
||||
private:
|
||||
CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map;
|
||||
CreatureEventAI_Summon_Map m_CreatureEventAI_Summon_Map;
|
||||
CreatureEventAI_TextMap m_CreatureEventAI_TextMap;
|
||||
};
|
||||
|
||||
|
||||
@@ -1660,9 +1660,6 @@ void World::SetInitialWorldSettings()
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts...");
|
||||
sEventAIMgr->LoadCreatureEventAI_Texts();
|
||||
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Summons...");
|
||||
sEventAIMgr->LoadCreatureEventAI_Summons();
|
||||
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts...");
|
||||
sEventAIMgr->LoadCreatureEventAI_Scripts();
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ public:
|
||||
{ "config", SEC_ADMINISTRATOR, true, &HandleReloadConfigCommand, "", NULL },
|
||||
{ "creature_text", SEC_ADMINISTRATOR, true, &HandleReloadCreatureText, "", NULL },
|
||||
{ "creature_ai_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventAIScriptsCommand, "", NULL },
|
||||
{ "creature_ai_summons", SEC_ADMINISTRATOR, true, &HandleReloadEventAISummonsCommand, "", NULL },
|
||||
{ "creature_ai_texts", SEC_ADMINISTRATOR, true, &HandleReloadEventAITextsCommand, "", NULL },
|
||||
{ "creature_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestInvRelationsCommand, "", NULL },
|
||||
{ "creature_linked_respawn", SEC_GAMEMASTER, true, &HandleReloadLinkedRespawnCommand, "", NULL },
|
||||
@@ -276,7 +275,6 @@ public:
|
||||
static bool HandleReloadAllEventAICommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
HandleReloadEventAITextsCommand(handler, "a");
|
||||
HandleReloadEventAISummonsCommand(handler, "a");
|
||||
HandleReloadEventAIScriptsCommand(handler, "a");
|
||||
return true;
|
||||
}
|
||||
@@ -1037,14 +1035,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleReloadEventAISummonsCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Summons from `creature_ai_summons`...");
|
||||
sEventAIMgr->LoadCreatureEventAI_Summons();
|
||||
handler->SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`...");
|
||||
|
||||
Reference in New Issue
Block a user