mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +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
|
else
|
||||||
{
|
{
|
||||||
//if not available, use pActionInvoker
|
//if not available, use pActionInvoker
|
||||||
Unit* pTarget = GetTargetByType(param2, pActionInvoker);
|
if (Unit* pTarget = GetTargetByType(param2, pActionInvoker))
|
||||||
|
{
|
||||||
if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
|
if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||||
pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature);
|
pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
#include "Policies/SingletonImp.h"
|
#include "Policies/SingletonImp.h"
|
||||||
#include "ObjectDefines.h"
|
#include "ObjectDefines.h"
|
||||||
|
#include "GridDefines.h"
|
||||||
|
|
||||||
INSTANTIATE_SINGLETON_1(CreatureEventAIMgr);
|
INSTANTIATE_SINGLETON_1(CreatureEventAIMgr);
|
||||||
|
|
||||||
|
|
@ -72,16 +73,22 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
|
||||||
|
|
||||||
if (temp.SoundId)
|
if (temp.SoundId)
|
||||||
{
|
{
|
||||||
if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId))
|
if (!sSoundEntriesStore.LookupEntry(temp.SoundId))
|
||||||
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has soundId %u but sound does not exist.",i,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))
|
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);
|
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);
|
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;
|
m_CreatureEventAI_TextMap[i] = temp;
|
||||||
++count;
|
++count;
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
@ -90,7 +97,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count);
|
sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count);
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
barGoLink bar(1);
|
barGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
@ -128,6 +136,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
|
||||||
temp.orientation = fields[4].GetFloat();
|
temp.orientation = fields[4].GetFloat();
|
||||||
temp.SpawnTimeSecs = fields[5].GetUInt32();
|
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
|
//Add to map
|
||||||
m_CreatureEventAI_Summon_Map[i] = temp;
|
m_CreatureEventAI_Summon_Map[i] = temp;
|
||||||
++Count;
|
++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);
|
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, temp.action[j].param3);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_EMOTE:
|
case ACTION_T_EMOTE:
|
||||||
//TODO: load emotes and check it's store for existing
|
|
||||||
/*
|
|
||||||
if (!sEmotesStore.LookupEntry(temp.action[j].param1))
|
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);
|
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param1);
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case ACTION_T_RANDOM_EMOTE:
|
case ACTION_T_RANDOM_EMOTE:
|
||||||
//TODO: load emotes and check it's store for existing
|
|
||||||
/*
|
|
||||||
if (!sEmotesStore.LookupEntry(temp.action[j].param1))
|
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);
|
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))
|
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);
|
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))
|
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);
|
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param3);
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case ACTION_T_CAST:
|
case ACTION_T_CAST:
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3680,6 +3680,16 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
break;
|
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:
|
case SCRIPT_COMMAND_TELEPORT_TO:
|
||||||
{
|
{
|
||||||
if(!sMapStore.LookupEntry(tmp.datalong))
|
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
|
// save memory by not storing empty behaviors
|
||||||
if(!be.isEmpty())
|
if(!be.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7688"
|
#define REVISION_NR "7689"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue