From e83be70aca362024bb3529bec8c295c682ce6cd3 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 2 Feb 2009 18:09:51 +0300 Subject: [PATCH] [7220] Check creature spells data at server startup. --- src/game/Creature.cpp | 6 ++---- src/game/Creature.h | 5 +---- src/game/ObjectMgr.cpp | 9 +++++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 9b3d80f33..85c4eff67 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -303,10 +303,8 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) SetPvP(true); } - m_spells[0] = GetCreatureInfo()->spell1; - m_spells[1] = GetCreatureInfo()->spell2; - m_spells[2] = GetCreatureInfo()->spell3; - m_spells[3] = GetCreatureInfo()->spell4; + for(int i=0; i < CREATURE_MAX_SPELLS; ++i) + m_spells[i] = GetCreatureInfo()->spells[i]; return true; } diff --git a/src/game/Creature.h b/src/game/Creature.h index 65da8b6e1..0aafaf84a 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -188,10 +188,7 @@ struct CreatureInfo int32 resistance4; int32 resistance5; int32 resistance6; - uint32 spell1; - uint32 spell2; - uint32 spell3; - uint32 spell4; + uint32 spells[CREATURE_MAX_SPELLS]; uint32 PetSpellDataId; uint32 mingold; uint32 maxgold; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 318da3ed5..dc4150511 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -792,6 +792,15 @@ void ObjectMgr::LoadCreatureTemplates() sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId); } + for(int i = 0; i < CREATURE_MAX_SPELLS; ++i) + { + if(cInfo->spells[i] && !sSpellStore.LookupEntry(cInfo->spells[i])) + { + sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, i+1,cInfo->spells[i]); + const_cast(cInfo)->spells[i] = 0; + } + } + if(cInfo->MovementType >= MAX_DB_MOTION_TYPE) { sLog.outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignore and set to IDLE.",cInfo->Entry,cInfo->MovementType); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e998ebc1e..2305f7677 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7219" + #define REVISION_NR "7220" #endif // __REVISION_NR_H__