mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[7689] Batter EventAI loading checks and fix one from possible crash cases.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
f4adf83cd7
commit
ee9ea143d1
5 changed files with 40 additions and 15 deletions
|
|
@ -910,10 +910,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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3680,6 +3680,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))
|
||||
|
|
|
|||
|
|
@ -141,6 +141,12 @@ void WaypointManager::Load()
|
|||
}
|
||||
}
|
||||
|
||||
if (be.emote)
|
||||
{
|
||||
if (!sEmotesStore.LookupEntry(be.emote))
|
||||
sLog.outErrorDb("Waypoint path %u (Point %u) are using emote %u, but emote does not exist.",id, point, be.emote);
|
||||
}
|
||||
|
||||
// save memory by not storing empty behaviors
|
||||
if(!be.isEmpty())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7688"
|
||||
#define REVISION_NR "7689"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue