aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/CreatureEventAI.cpp9
-rw-r--r--src/game/CreatureEventAIMgr.cpp28
-rw-r--r--src/game/ObjectMgr.cpp10
3 files changed, 33 insertions, 14 deletions
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
index bcd3500cb68..2cc5d4f14cc 100644
--- a/src/game/CreatureEventAI.cpp
+++ b/src/game/CreatureEventAI.cpp
@@ -900,10 +900,11 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
else
{
//if not available, use pActionInvoker
- Unit* pTarget = GetTargetByType(param2, pActionInvoker);
-
- if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
- pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature);
+ if (Unit* pTarget = GetTargetByType(param2, pActionInvoker))
+ {
+ if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
+ pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature);
+ }
}
}
break;
diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp
index ca483209e87..6e9947ffbd2 100644
--- a/src/game/CreatureEventAIMgr.cpp
+++ b/src/game/CreatureEventAIMgr.cpp
@@ -25,6 +25,7 @@
#include "ProgressBar.h"
#include "Policies/SingletonImp.h"
#include "ObjectDefines.h"
+#include "GridDefines.h"
INSTANTIATE_SINGLETON_1(CreatureEventAIMgr);
@@ -72,16 +73,22 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
if (temp.SoundId)
{
- if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId))
- sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has soundId %u but sound does not exist.",i,temp.SoundId);
+ if (!sSoundEntriesStore.LookupEntry(temp.SoundId))
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.",i,temp.SoundId);
}
if (!GetLanguageDescByID(temp.Language))
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language);
- if (temp.Type > CHAT_TYPE_BOSS_WHISPER)
+ if (temp.Type > CHAT_TYPE_ZONE_YELL)
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
+ if (temp.Emote)
+ {
+ if (!sEmotesStore.LookupEntry(temp.Emote))
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.",i,temp.Emote);
+ }
+
m_CreatureEventAI_TextMap[i] = temp;
++count;
} while (result->NextRow());
@@ -90,7 +97,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
sLog.outString();
sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count);
- }else
+ }
+ else
{
barGoLink bar(1);
bar.step();
@@ -128,6 +136,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
temp.orientation = fields[4].GetFloat();
temp.SpawnTimeSecs = fields[5].GetUInt32();
+ if(!MaNGOS::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation))
+ {
+ sLog.outErrorDb("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;
@@ -443,22 +457,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, temp.action[j].param3);
break;
case ACTION_T_EMOTE:
- //TODO: load emotes and check it's store for existing
- /*
if (!sEmotesStore.LookupEntry(temp.action[j].param1))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param1);
- */
break;
case ACTION_T_RANDOM_EMOTE:
- //TODO: load emotes and check it's store for existing
- /*
if (!sEmotesStore.LookupEntry(temp.action[j].param1))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param1);
if (temp.action[j].param2_s >= 0 && !sEmotesStore.LookupEntry(temp.action[j].param2))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param2);
if (temp.action[j].param3_s >= 0 && !sEmotesStore.LookupEntry(temp.action[j].param3))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param3);
- */
break;
case ACTION_T_CAST:
{
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 8cbc8f4b56d..5ddd361abf6 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -3865,6 +3865,16 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
break;
}
+ case SCRIPT_COMMAND_EMOTE:
+ {
+ if(!sEmotesStore.LookupEntry(tmp.datalong))
+ {
+ sLog.outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",tablename,tmp.datalong,tmp.id);
+ continue;
+ }
+ break;
+ }
+
case SCRIPT_COMMAND_TELEPORT_TO:
{
if(!sMapStore.LookupEntry(tmp.datalong))