aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp6
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp31
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h2
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp4
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp2
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp2
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp2
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp23
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp14
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp44
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h33
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp2
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp32
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.h4
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp10
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h2
-rwxr-xr-xsrc/server/game/Entities/Totem/Totem.cpp2
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp10
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp4
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp287
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h11
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp55
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp2
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/NPCHandler.cpp6
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/QueryHandler.cpp2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp10
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp19
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp2
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp2
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp10
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp2
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp189
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp4
-rwxr-xr-xsrc/server/shared/Database/SQLStorage.cpp4
45 files changed, 474 insertions, 396 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index adc7a052430..26adbe60c76 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -392,7 +392,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
me->setFaction(action.set_faction.factionId);
else
{
- if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(me->GetEntry()))
+ if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(me->GetEntry()))
{
//if no id provided, assume reset and then use default
if (me->getFaction() != ci->faction_A)
@@ -408,7 +408,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
//set model based on entry from creature_template
if (action.morph.creatureId)
{
- if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(action.morph.creatureId))
+ if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(action.morph.creatureId))
{
uint32 display_id = sObjectMgr->ChooseDisplayId(0,ci);
me->SetDisplayId(display_id);
@@ -831,7 +831,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
// set model based on entry from creature_template
if (action.mount.creatureId)
{
- if (CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(action.mount.creatureId))
+ if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(action.mount.creatureId))
{
uint32 display_id = sObjectMgr->ChooseDisplayId(0, cInfo);
me->Mount(display_id);
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index 280b7f227b0..da9daa9f7d0 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -204,7 +204,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
temp.raw.param4 = fields[9].GetUInt32();
//Creature does not exist in database
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
+ if (!sObjectMgr->GetCreatureTemplate(temp.creature_id))
{
sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id);
continue;
@@ -322,7 +322,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_SUMMONED_UNIT:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(temp.summon_unit.creatureId))
+ if (!sObjectMgr->GetCreatureTemplate(temp.summon_unit.creatureId))
sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId);
if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin)
sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
@@ -453,7 +453,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
if (action.morph.creatureId !=0 || action.morph.modelId !=0)
{
- if (action.morph.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.morph.creatureId))
+ if (action.morph.creatureId && !sObjectMgr->GetCreatureTemplate(action.morph.creatureId))
{
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId);
action.morph.creatureId = 0;
@@ -524,7 +524,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
}
case ACTION_T_SUMMON:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon.creatureId))
+ if (!sObjectMgr->GetCreatureTemplate(action.summon.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId);
if (action.summon.target >= TARGET_T_END)
@@ -554,7 +554,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case ACTION_T_CAST_EVENT:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event.creatureId))
+ if (!sObjectMgr->GetCreatureTemplate(action.cast_event.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
if (!sSpellStore.LookupEntry(action.cast_event.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
@@ -592,7 +592,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId);
break;
case ACTION_T_CAST_EVENT_ALL:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
+ if (!sObjectMgr->GetCreatureTemplate(action.cast_event_all.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
if (!sSpellStore.LookupEntry(action.cast_event_all.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
@@ -624,7 +624,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
break;
case ACTION_T_SUMMON_ID:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon_id.creatureId))
+ if (!sObjectMgr->GetCreatureTemplate(action.summon_id.creatureId))
sLog->outErrorDb("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->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
@@ -632,7 +632,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog->outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId);
break;
case ACTION_T_KILLED_MONSTER:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.killed_monster.creatureId))
+ if (!sObjectMgr->GetCreatureTemplate(action.killed_monster.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
if (action.killed_monster.target >= TARGET_T_END)
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
@@ -650,7 +650,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_UPDATE_TEMPLATE:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.update_template.creatureId))
+ if (!sObjectMgr->GetCreatureTemplate(action.update_template.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
break;
case ACTION_T_SET_SHEATH:
@@ -673,7 +673,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
if (action.mount.creatureId != 0 || action.mount.modelId != 0)
{
- if (action.mount.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.mount.creatureId))
+ if (action.mount.creatureId && !sObjectMgr->GetCreatureTemplate(action.mount.creatureId))
{
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
action.morph.creatureId = 0;
@@ -731,16 +731,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
m_CreatureEventAI_Event_Map[creature_id].push_back(temp);
++count;
- if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
+ if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(temp.creature_id))
{
- if (!cInfo->AIName || !cInfo->AIName[0])
+ if (!cInfo->AIName.empty())
{
- //sLog->outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but its AIName is empty. Set to EventAI as default.", cInfo->Entry);
- size_t len = strlen("EventAI")+1;
- const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
- strncpy(const_cast<char*>(cInfo->AIName), "EventAI", len);
+ const_cast<CreatureTemplate*>(cInfo)->AIName = "EventAI";
}
- if (strcmp(cInfo->AIName, "EventAI"))
+ if (cInfo->AIName.compare("EventAI"))
{
//sLog->outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it has AIName %s. EventAI script will be overriden.", cInfo->Entry, cInfo->AIName);
}
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 75ba3790e54..0909954be63 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -421,7 +421,7 @@ void ScriptedAI::SetEquipmentSlots(bool loadDefault, int32 mainHand /*= EQUIP_NO
{
if (loadDefault)
{
- if (CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(me->GetEntry()))
+ if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(me->GetEntry()))
me->LoadEquipment(creatureInfo->equipmentId, true);
return;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index f08be714ea8..dee4b4c2c71 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -234,7 +234,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
else
{
- if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate((*itr)->ToCreature()->GetEntry()))
+ if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate((*itr)->ToCreature()->GetEntry()))
{
if ((*itr)->ToCreature()->getFaction() != ci->faction_A)
{
@@ -266,7 +266,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
//set model based on entry from creature_template
if (e.action.morphOrMount.creature)
{
- if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(e.action.morphOrMount.creature))
+ if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
uint32 display_id = sObjectMgr->ChooseDisplayId(0, ci);
(*itr)->ToCreature()->SetDisplayId(display_id);
@@ -940,7 +940,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (e.action.morphOrMount.creature > 0)
{
- if (CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(e.action.morphOrMount.creature))
+ if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
uint32 display_id = sObjectMgr->ChooseDisplayId(0, cInfo);
(*itr)->ToUnit()->Mount(display_id);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index cdd07afad52..fe6db0bf6d1 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -128,7 +128,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
case SMART_SCRIPT_TYPE_CREATURE:
{
- if (!sCreatureStorage.LookupEntry<CreatureInfo>((uint32)temp.entryOrGuid))
+ if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
@@ -231,7 +231,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder e)
case SMART_TARGET_CREATURE_DISTANCE:
case SMART_TARGET_CREATURE_RANGE:
{
- if (e.target.unitDistance.creature && !sCreatureStorage.LookupEntry<CreatureInfo>(e.target.unitDistance.creature))
+ if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
return false;
@@ -505,7 +505,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL:
if (e.action.morphOrMount.creature || e.action.morphOrMount.model)
{
- if (e.action.morphOrMount.creature > 0 && !sCreatureStorage.LookupEntry<CreatureInfo>(e.action.morphOrMount.creature))
+ if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
return false;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index c686d0bc51d..bbd38df61d6 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1264,7 +1264,7 @@ class SmartAIMgr
}
inline bool IsCreatureValid(SmartScriptHolder e, uint32 entry)
{
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(entry))
+ if (!sObjectMgr->GetCreatureTemplate(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index d490b95d08d..1c12b88ab3d 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -110,7 +110,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT:
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
- if (!creature.id || !ObjectMgr::GetCreatureTemplate(creature.id))
+ if (!creature.id || !sObjectMgr->GetCreatureTemplate(creature.id))
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType,dataType,creature.id);
@@ -2406,7 +2406,7 @@ void AchievementGlobalMgr::LoadRewards()
//check mail data before item for report including wrong item case
if (reward.sender)
{
- if (!ObjectMgr::GetCreatureTemplate(reward.sender))
+ if (!sObjectMgr->GetCreatureTemplate(reward.sender))
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
reward.sender = 0;
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 8a13201c62a..7e715cc5f38 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -748,7 +748,7 @@ bool AuctionEntry::LoadFromDB(Field* fields)
return false;
}
- CreatureInfo const* auctioneerInfo = ObjectMgr::GetCreatureTemplate(auctioneerData->id);
+ CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
if (!auctioneerInfo)
{
sLog->outError("Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 2e8a67d0da8..dbb99218b1d 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -1497,7 +1497,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
pCreature->SetHomePosition(x, y, z, o);
- CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(entry);
+ CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
index 00962a9b6d7..2f85c764270 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -762,7 +762,7 @@ bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
return false;
}
- CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(creatureTarget->GetEntry());
+ CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
// Creatures with family 0 crashes the server
if (cInfo->family == 0)
{
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index 72db4e2c527..8247f1b7fed 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -684,7 +684,7 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
return false;
}
- CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(cr_id);
+ CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cr_id);
if (!cInfo)
{
PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
@@ -1223,21 +1223,18 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
uint32 count = 0;
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
- for (uint32 id = 0; id< sCreatureStorage.MaxEntry; ++id)
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
{
- CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo> (id);
- if (!cInfo)
- continue;
-
- int loc_idx = GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
+ uint32 id = itr->second.Entry;
+ uint8 localeIndex = GetSessionDbLocaleIndex();
+ if (localeIndex >= 0)
{
- uint8 uloc_idx = uint8(loc_idx);
- if (CreatureLocale const *cl = sObjectMgr->GetCreatureLocale (id))
+ if (CreatureLocale const *cl = sObjectMgr->GetCreatureLocale(id))
{
- if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty ())
+ if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty ())
{
- std::string name = cl->Name[uloc_idx];
+ std::string name = cl->Name[localeIndex];
if (Utf8FitTo (name, wnamepart))
{
@@ -1261,7 +1258,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
}
}
- std::string name = cInfo->Name;
+ std::string name = itr->second.Name;
if (name.empty ())
continue;
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 4f19b7c826d..92e0acb9892 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -908,7 +908,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
}
case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE:
{
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(cond->mSourceEntry))
+ if (!sObjectMgr->GetCreatureTemplate(cond->mSourceEntry))
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceEntry);
return false;
@@ -1000,7 +1000,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
break;
case CONDITION_SOURCE_TYPE_VEHICLE_SPELL:
{
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(cond->mSourceGroup))
+ if (!sObjectMgr->GetCreatureTemplate(cond->mSourceGroup))
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceGroup);
return false;
@@ -1237,13 +1237,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
case SPELL_TARGET_TYPE_CREATURE:
case SPELL_TARGET_TYPE_DEAD:
{
- if (cond->mConditionValue2 && !sCreatureStorage.LookupEntry<CreatureInfo>(cond->mConditionValue2))
+ if (cond->mConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue2))
{
sLog->outErrorDb("SpellTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue2);
return false;
}
- const CreatureInfo* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(cond->mConditionValue2);
+ const CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(cond->mConditionValue2);
if (cond->mSourceEntry == 30427 && !cInfo->SkinLootId)
{
sLog->outErrorDb("SpellTarget condition has creature entry %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!, skipped", cond->mConditionValue2);
@@ -1256,7 +1256,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_CREATURE_TARGET:
{
- if (!cond->mConditionValue1 && !sCreatureStorage.LookupEntry<CreatureInfo>(cond->mConditionValue1))
+ if (!cond->mConditionValue1 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue1))
{
sLog->outErrorDb("CreatureTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue1);
return false;
@@ -1308,7 +1308,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
return false;
}
- if (!cond->mConditionValue2 && !sCreatureStorage.LookupEntry<CreatureInfo>(cond->mConditionValue2))
+ if (!cond->mConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue2))
{
sLog->outErrorDb("ItemTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue2);
return false;
@@ -1360,7 +1360,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_NEAR_CREATURE:
{
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(cond->mConditionValue1))
+ if (!sObjectMgr->GetCreatureTemplate(cond->mConditionValue1))
{
sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->mConditionValue1);
return false;
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 8bd7be73fcf..a53e5de6ebe 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -82,7 +82,7 @@ VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint32 extend
return NULL;
}
-uint32 CreatureInfo::GetRandomValidModelId() const
+uint32 CreatureTemplate::GetRandomValidModelId() const
{
uint8 c = 0;
uint32 modelIDs[4];
@@ -95,7 +95,7 @@ uint32 CreatureInfo::GetRandomValidModelId() const
return ((c>0) ? modelIDs[urand(0,c-1)] : 0);
}
-uint32 CreatureInfo::GetFirstValidModelId() const
+uint32 CreatureTemplate::GetFirstValidModelId() const
{
if (Modelid1) return Modelid1;
if (Modelid2) return Modelid2;
@@ -254,7 +254,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
*/
bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data)
{
- CreatureInfo const *normalInfo = ObjectMgr::GetCreatureTemplate(Entry);
+ CreatureTemplate const *normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!normalInfo)
{
sLog->outErrorDb("Creature::InitEntry creature entry %u does not exist.", Entry);
@@ -262,13 +262,13 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data
}
// get difficulty 1 mode entry
- CreatureInfo const *cinfo = normalInfo;
+ CreatureTemplate const *cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0;)
{
// we already have valid Map pointer for current creature!
if (normalInfo->DifficultyEntry[diff - 1])
{
- cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
+ cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
if (cinfo)
break; // template found
@@ -347,7 +347,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data)
if (!InitEntry(Entry,team,data))
return false;
- CreatureInfo const* cInfo = GetCreatureInfo();
+ CreatureTemplate const* cInfo = GetCreatureInfo();
m_regenHealth = cInfo->RegenHealth;
@@ -382,12 +382,12 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data)
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class);
float armor = (float)stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float?
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, armor);
- SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance1));
- SetModifierValue(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance2));
- SetModifierValue(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(cInfo->resistance3));
- SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(cInfo->resistance4));
- SetModifierValue(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(cInfo->resistance5));
- SetModifierValue(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(cInfo->resistance6));
+ SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY]));
+ SetModifierValue(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FIRE]));
+ SetModifierValue(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_NATURE]));
+ SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FROST]));
+ SetModifierValue(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_SHADOW]));
+ SetModifierValue(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_ARCANE]));
SetCanModifyStats(true);
UpdateAllStats();
@@ -739,7 +739,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
SetMap(map);
SetPhaseMask(phaseMask,false);
- CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry);
+ CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!cinfo)
{
sLog->outErrorDb("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
@@ -1048,7 +1048,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS);
// check if it's a custom model and if not, use 0 for displayId
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
if (cinfo)
{
if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 ||
@@ -1124,7 +1124,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
WorldDatabase.CommitTransaction(trans);
}
-void Creature::SelectLevel(const CreatureInfo *cinfo)
+void Creature::SelectLevel(const CreatureTemplate *cinfo)
{
uint32 rank = isPet()? 0 : cinfo->rank;
@@ -1239,7 +1239,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
return false;
}
- CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry);
+ CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!cinfo)
{
sLog->outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
@@ -1542,7 +1542,7 @@ void Creature::setDeathState(DeathState s)
SetFullHealth();
SetLootRecipient(NULL);
ResetPlayerDamageReq();
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
if (GetCreatureInfo()->InhabitType & INHABIT_AIR)
AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING);
@@ -1604,7 +1604,7 @@ void Creature::Respawn(bool force)
if (m_originalEntry != GetEntry())
UpdateEntry(m_originalEntry);
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
SelectLevel(cinfo);
if (m_isDeadByDefault)
@@ -2255,7 +2255,7 @@ void Creature::AllLootRemovedFromCorpse()
return;
float decayRate;
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED);
uint32 diff = uint32((m_corpseRemoveTime - now) * decayRate);
@@ -2285,7 +2285,7 @@ uint8 Creature::getLevelForTarget(WorldObject const* target) const
std::string Creature::GetAIName() const
{
- return ObjectMgr::GetCreatureTemplate(GetEntry())->AIName;
+ return sObjectMgr->GetCreatureTemplate(GetEntry())->AIName;
}
std::string Creature::GetScriptName() const
@@ -2295,7 +2295,7 @@ std::string Creature::GetScriptName() const
uint32 Creature::GetScriptId() const
{
- return ObjectMgr::GetCreatureTemplate(GetEntry())->ScriptID;
+ return sObjectMgr->GetCreatureTemplate(GetEntry())->ScriptID;
}
VendorItemData const* Creature::GetVendorItems() const
@@ -2416,6 +2416,6 @@ void Creature::FarTeleportTo(Map* map, float X, float Y, float Z, float O)
bool Creature::IsDungeonBoss() const
{
- CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(GetEntry());
+ CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS);
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index d3f26590f07..0ece92cc86f 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -77,7 +77,7 @@ enum CreatureFlagsExtra
#define MAX_CREATURE_QUEST_ITEMS 6
// from `creature_template` table
-struct CreatureInfo
+struct CreatureTemplate
{
uint32 Entry;
uint32 DifficultyEntry[MAX_DIFFICULTY - 1];
@@ -86,9 +86,9 @@ struct CreatureInfo
uint32 Modelid2;
uint32 Modelid3;
uint32 Modelid4;
- char* Name;
- char* SubName;
- char* IconName;
+ std::string Name;
+ std::string SubName;
+ std::string IconName;
uint32 GossipMenuId;
uint8 minlevel;
uint8 maxlevel;
@@ -123,18 +123,13 @@ struct CreatureInfo
uint32 lootid;
uint32 pickpocketLootId;
uint32 SkinLootId;
- int32 resistance1;
- int32 resistance2;
- int32 resistance3;
- int32 resistance4;
- int32 resistance5;
- int32 resistance6;
+ int32 resistance[MAX_SPELL_SCHOOL];
uint32 spells[CREATURE_MAX_SPELLS];
uint32 PetSpellDataId;
uint32 VehicleId;
uint32 mingold;
uint32 maxgold;
- char const* AIName;
+ std::string AIName;
uint32 MovementType;
uint32 InhabitType;
float ModHealth;
@@ -174,6 +169,9 @@ struct CreatureInfo
}
};
+// Benchmarked: Faster than std::map (insert/find)
+typedef UNORDERED_MAP<uint32, CreatureTemplate> CreatureTemplateContainer;
+
// Represents max amount of expansions.
// TODO: Add MAX_EXPANSION constant.
#define MAX_CREATURE_BASE_HP 3
@@ -187,12 +185,12 @@ struct CreatureBaseStats
// Helpers
- uint32 GenerateHealth(CreatureInfo const* info) const
+ uint32 GenerateHealth(CreatureTemplate const* info) const
{
return uint32((BaseHealth[info->expansion] * info->ModHealth) + 0.5f);
}
- uint32 GenerateMana(CreatureInfo const* info) const
+ uint32 GenerateMana(CreatureTemplate const* info) const
{
// Mana can be 0.
if (!BaseMana)
@@ -201,7 +199,7 @@ struct CreatureBaseStats
return uint32((BaseMana * info->ModMana) + 0.5f);
}
- uint32 GenerateArmor(CreatureInfo const* info) const
+ uint32 GenerateArmor(CreatureTemplate const* info) const
{
return uint32((BaseArmor * info->ModArmor) + 0.5f);
}
@@ -422,11 +420,10 @@ class Creature : public Unit, public GridObject<Creature>
bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData *data = NULL);
bool LoadCreaturesAddon(bool reload = false);
- void SelectLevel(const CreatureInfo *cinfo);
+ void SelectLevel(const CreatureTemplate *cinfo);
void LoadEquipment(uint32 equip_entry, bool force=false);
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
- char const* GetSubName() const { return GetCreatureInfo()->SubName; }
void Update(uint32 time); // overwrited Unit::Update
void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
@@ -527,7 +524,7 @@ class Creature : public Unit, public GridObject<Creature>
TrainerSpellData const* GetTrainerSpells() const;
- CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; }
+ CreatureTemplate const *GetCreatureInfo() const { return m_creatureInfo; }
CreatureData const *GetCreatureData() const { return m_creatureData; }
CreatureAddon const* GetCreatureAddon() const;
@@ -721,7 +718,7 @@ class Creature : public Unit, public GridObject<Creature>
bool DisableReputationGain;
- CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjectMgr::GetCreatureTemplate(GetEntry())
+ CreatureTemplate const* m_creatureInfo; // in difficulty mode > 0 can different from sObjectMgr->GetCreatureTemplate(GetEntry())
CreatureData const* m_creatureData;
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 49e6cafba47..7a79c526f1e 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -585,7 +585,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
{
if (GetTypeId() == TYPEID_UNIT)
{
- const CreatureInfo* cinfo = this->ToCreature()->GetCreatureInfo();
+ const CreatureTemplate* cinfo = this->ToCreature()->GetCreatureInfo();
if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
{
if (target->isGameMaster())
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index e82f06cf5d2..2be91237121 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -154,7 +154,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
PetType pet_type = PetType(fields[18].GetUInt8());
if (pet_type == HUNTER_PET)
{
- CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(petentry);
+ CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petentry);
if (!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets()))
return false;
}
@@ -187,7 +187,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
setFaction(owner->getFaction());
SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
if (cinfo->type == CREATURE_TYPE_CRITTER)
{
map->Add(this->ToCreature());
@@ -754,7 +754,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
return false;
}
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
if (!cinfo)
{
sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!");
@@ -771,7 +771,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
return true;
}
-bool Pet::CreateBaseAtCreatureInfo(CreatureInfo const* cinfo, Unit * owner)
+bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit * owner)
{
if (!CreateBaseAtTamed(cinfo, owner->GetMap(), owner->GetPhaseMask()))
return false;
@@ -784,7 +784,7 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureInfo const* cinfo, Unit * owner)
return true;
}
-bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseMask)
+bool Pet::CreateBaseAtTamed(CreatureTemplate const * cinfo, Map * map, uint32 phaseMask)
{
sLog->outDebug(LOG_FILTER_PETS, "Pet::CreateBaseForTamed");
uint32 guid=sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
@@ -813,7 +813,7 @@ bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseM
// TODO: Move stat mods code to pet passive auras
bool Guardian::InitStatsForLevel(uint8 petlevel)
{
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
ASSERT(cinfo);
SetLevel(petlevel);
@@ -862,19 +862,9 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetFloatValue(OBJECT_FIELD_SCALE_X, scale);
}
- //resistance
- int32 createResistance[MAX_SPELL_SCHOOL] = {0,0,0,0,0,0,0};
- if (cinfo && petType != HUNTER_PET)
- {
- createResistance[SPELL_SCHOOL_HOLY] = cinfo->resistance1;
- createResistance[SPELL_SCHOOL_FIRE] = cinfo->resistance2;
- createResistance[SPELL_SCHOOL_NATURE] = cinfo->resistance3;
- createResistance[SPELL_SCHOOL_FROST] = cinfo->resistance4;
- createResistance[SPELL_SCHOOL_SHADOW] = cinfo->resistance5;
- createResistance[SPELL_SCHOOL_ARCANE] = cinfo->resistance6;
- }
+ // Resistance
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
+ SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(cinfo->resistance[i]));
//health, mana, armor and resistance
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(creature_ID, petlevel);
@@ -1056,7 +1046,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const
if (!item->FoodType)
return false;
- CreatureInfo const* cInfo = GetCreatureInfo();
+ CreatureTemplate const* cInfo = GetCreatureInfo();
if (!cInfo)
return false;
@@ -1583,7 +1573,7 @@ bool Pet::resetTalents(bool no_cost)
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS,true);
- CreatureInfo const * ci = GetCreatureInfo();
+ CreatureTemplate const * ci = GetCreatureInfo();
if (!ci)
return false;
// Check pet talent type
@@ -1888,7 +1878,7 @@ bool Pet::HasSpell(uint32 spell) const
// Get all passive spells in our skill line
void Pet::LearnPetPassives()
{
- CreatureInfo const* cInfo = GetCreatureInfo();
+ CreatureTemplate const* cInfo = GetCreatureInfo();
if (!cInfo)
return;
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index c52bde72b87..299d050b3ca 100755
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -138,8 +138,8 @@ class Pet : public Guardian
bool Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
bool CreateBaseAtCreature(Creature* creature);
- bool CreateBaseAtCreatureInfo(CreatureInfo const* cinfo,Unit * owner);
- bool CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseMask);
+ bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo,Unit * owner);
+ bool CreateBaseAtTamed(CreatureTemplate const * cinfo, Map * map, uint32 phaseMask);
bool LoadPetFromDB(Player* owner,uint32 petentry = 0,uint32 petnumber = 0, bool current = false);
bool isBeingLoaded() const { return m_loading;}
void SavePetToDB(PetSaveMode mode);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index dc86a43a088..ec77668e829 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -1942,7 +1942,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket* data)
if (result && !(playerFlags & PLAYER_FLAGS_GHOST) && (plrClass == CLASS_WARLOCK || plrClass == CLASS_HUNTER || plrClass == CLASS_DEATH_KNIGHT))
{
uint32 entry = fields[16].GetUInt32();
- CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(entry);
+ CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(entry);
if (creatureInfo)
{
petDisplayId = fields[17].GetUInt32();
@@ -15701,7 +15701,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
UpdateForQuestWorldObjects();
}
-void Player::KilledMonster(CreatureInfo const* cInfo, uint64 guid)
+void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid)
{
if (cInfo->Entry)
KilledMonsterCredit(cInfo->Entry, guid);
@@ -15814,7 +15814,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
reqTarget = qInfo->ReqCreatureOrGOId[j];
if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template
{
- CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(entry);
+ CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(entry);
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
if (cinfo->KillCredit[i] == reqTarget)
entry = cinfo->KillCredit[i];
@@ -23533,7 +23533,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
if (!talentTabInfo)
return;
- CreatureInfo const *ci = pet->GetCreatureInfo();
+ CreatureTemplate const *ci = pet->GetCreatureInfo();
if (!ci)
return;
@@ -23787,7 +23787,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data)
data->put<uint32>(pointsPos, unspentTalentPoints); // put real points
- CreatureInfo const *ci = pet->GetCreatureInfo();
+ CreatureTemplate const *ci = pet->GetCreatureInfo();
if (!ci)
return;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 0eab635bf60..9b97bfbf9c5 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1428,7 +1428,7 @@ class Player : public Unit, public GridObject<Player>
void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
void ItemAddedQuestCheck(uint32 entry, uint32 count);
void ItemRemovedQuestCheck(uint32 entry, uint32 count);
- void KilledMonster(CreatureInfo const* cInfo, uint64 guid);
+ void KilledMonster(CreatureTemplate const* cInfo, uint64 guid);
void KilledMonsterCredit(uint32 entry, uint64 guid);
void CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id);
void TalkedToCreature(uint32 entry, uint64 guid);
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index be36cdd441c..793b9119dfe 100755
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -54,7 +54,7 @@ void Totem::InitStats(uint32 duration)
{
Minion::InitStats(duration);
- CreatureInfo const *cinfo = GetCreatureInfo();
+ CreatureTemplate const *cinfo = GetCreatureInfo();
if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 displayID = sObjectMgr->ChooseDisplayId(m_owner->ToPlayer()->GetTeam(), cinfo);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index b7a7ea40e3d..0c78294b645 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -14744,7 +14744,7 @@ Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id)
if (GetTypeId() != TYPEID_PLAYER)
return NULL;
- CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creatureEntry);
+ CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
if (!creatureInfo)
return NULL;
@@ -15165,7 +15165,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
if (!creature->isPet())
{
creature->DeleteThreatList();
- CreatureInfo const* cInfo = creature->GetCreatureInfo();
+ CreatureTemplate const* cInfo = creature->GetCreatureInfo();
if (cInfo && (cInfo->lootid || cInfo->maxgold > 0))
creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
@@ -15603,7 +15603,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const * a
case CHARM_TYPE_CHARM:
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
{
- CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo();
+ CreatureTemplate const *cinfo = this->ToCreature()->GetCreatureInfo();
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
{
//to prevent client crash
@@ -15707,7 +15707,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
case CHARM_TYPE_CHARM:
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
{
- CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo();
+ CreatureTemplate const *cinfo = this->ToCreature()->GetCreatureInfo();
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
{
SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class));
@@ -15746,7 +15746,7 @@ void Unit::RestoreFaction()
}
}
- if (CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo()) // normal creature
+ if (CreatureTemplate const *cinfo = this->ToCreature()->GetCreatureInfo()) // normal creature
{
FactionTemplateEntry const *faction = getFactionTemplateEntry();
setFaction((faction && faction->friendlyMask & 0x004) ? cinfo->faction_H : cinfo->faction_A);
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 654d69e4e4b..d4d6bccfe67 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -1114,7 +1114,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
if (cr)
{
uint32 npcflag = GetNPCFlag(cr);
- if (const CreatureInfo * ci = cr->GetCreatureInfo())
+ if (const CreatureTemplate * ci = cr->GetCreatureInfo())
npcflag |= ci->npcflag;
cr->SetUInt32Value(UNIT_NPC_FLAGS,npcflag);
// reset gossip options, since the flag change might have added / removed some
@@ -1330,7 +1330,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
CreatureData const* data2 = sObjectMgr->GetCreatureData(itr->first);
if (data2 && activate)
{
- CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(data2->id);
+ CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(data2->id);
uint32 displayID = sObjectMgr->ChooseDisplayId(0,cinfo,data2);
CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(displayID);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index acbb5d9a154..89578772417 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -547,17 +547,143 @@ void ObjectMgr::LoadCreatureTemplates()
{
uint32 oldMSTime = getMSTime();
- SQLCreatureLoader loader;
- loader.Load(sCreatureStorage);
+ // 0 1 2 3 4 5 6 7 8
+ QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
+ // 9 10 11 12 13 14 15 16 17 18 19 20 21
+ "modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, "
+ // 22 23 24 25 26 27 28 29 30 31 32
+ "scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, "
+ // 33 34 35 36 37 38 39 40 41 42
+ "dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, "
+ // 43 44 45 46 47 48 49 50 51 52 53
+ "type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
+ // 54 55 56 57 58 59 60 61 62 63 64 65 66
+ "spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
+ // 67 68 69 70 71 72 73 74 75 76 77
+ "InhabitType, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, "
+ // 78 79 80 81 82 83
+ "movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName "
+ "FROM creature_template;");
- // check data correctness
- for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
+ if (!result)
+ {
+ sLog->outString(">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
+ sLog->outString();
+ return;
+ }
+
+ uint32 count = 0;
+ do
+ {
+ Field *fields = result->Fetch();
+
+ uint32 entry = fields[0].GetUInt32();
+
+
+ CreatureTemplate creatureTemplate;
+
+ creatureTemplate.Entry = entry;
+
+ for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i)
+ {
+ creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32();
+ }
+
+ for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
+ {
+ creatureTemplate.KillCredit[i] = fields[4 + i].GetUInt32();
+ }
+
+ creatureTemplate.Modelid1 = fields[6].GetUInt32();
+ creatureTemplate.Modelid2 = fields[7].GetUInt32();
+ creatureTemplate.Modelid3 = fields[8].GetUInt32();
+ creatureTemplate.Modelid4 = fields[9].GetUInt32();
+ creatureTemplate.Name = fields[10].GetString();
+ creatureTemplate.SubName = fields[11].GetString();
+ creatureTemplate.IconName = fields[12].GetString();
+ creatureTemplate.GossipMenuId = fields[13].GetUInt32();
+ creatureTemplate.minlevel = fields[14].GetUInt8();
+ creatureTemplate.maxlevel = fields[15].GetUInt8();
+ creatureTemplate.expansion = uint32(fields[16].GetUInt16());
+ creatureTemplate.faction_A = uint32(fields[17].GetUInt16());
+ creatureTemplate.faction_H = uint32(fields[18].GetUInt16());
+ creatureTemplate.npcflag = fields[19].GetUInt32();
+ creatureTemplate.speed_walk = fields[20].GetFloat();
+ creatureTemplate.speed_run = fields[21].GetFloat();
+ creatureTemplate.scale = fields[22].GetFloat();
+ creatureTemplate.rank = uint32(fields[23].GetUInt8());
+ creatureTemplate.mindmg = fields[24].GetFloat();
+ creatureTemplate.maxdmg = fields[25].GetFloat();
+ creatureTemplate.dmgschool = uint32(fields[26].GetInt8());
+ creatureTemplate.attackpower = fields[27].GetUInt32();
+ creatureTemplate.dmg_multiplier = fields[28].GetFloat();
+ creatureTemplate.baseattacktime = fields[29].GetUInt32();
+ creatureTemplate.rangeattacktime = fields[30].GetUInt32();
+ creatureTemplate.unit_class = uint32(fields[31].GetUInt8());
+ creatureTemplate.unit_flags = fields[32].GetUInt32();
+ creatureTemplate.dynamicflags = fields[33].GetUInt32();
+ creatureTemplate.family = uint32(fields[34].GetUInt8());
+ creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
+ creatureTemplate.trainer_spell = fields[36].GetUInt32();
+ creatureTemplate.trainer_class = uint32(fields[37].GetUInt8());
+ creatureTemplate.trainer_race = uint32(fields[38].GetUInt8());
+ creatureTemplate.minrangedmg = fields[39].GetFloat();
+ creatureTemplate.maxrangedmg = fields[40].GetFloat();
+ creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16());
+ creatureTemplate.type = uint32(fields[42].GetUInt8());
+ creatureTemplate.type_flags = fields[43].GetUInt32();
+ creatureTemplate.lootid = fields[44].GetUInt32();
+ creatureTemplate.pickpocketLootId = fields[45].GetUInt32();
+ creatureTemplate.SkinLootId = fields[46].GetUInt32();
+
+ for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
+ {
+ creatureTemplate.resistance[i] = fields[47 + i -1].GetInt32();
+ }
+
+ for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
+ {
+ creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
+ }
+
+ creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
+ creatureTemplate.VehicleId = fields[62].GetUInt32();
+ creatureTemplate.mingold = fields[63].GetUInt32();
+ creatureTemplate.maxgold = fields[64].GetUInt32();
+ creatureTemplate.AIName = fields[65].GetString();
+ creatureTemplate.MovementType = uint32(fields[66].GetUInt8());
+ creatureTemplate.InhabitType = uint32(fields[67].GetUInt8());
+ creatureTemplate.ModHealth = fields[68].GetFloat();
+ creatureTemplate.ModMana = fields[69].GetFloat();
+ creatureTemplate.ModArmor = fields[70].GetFloat();
+ creatureTemplate.RacialLeader = fields[71].GetBool();
+
+ for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
+ {
+ creatureTemplate.questItems[i] = fields[72 + i].GetUInt32();
+ }
+
+ creatureTemplate.movementId = fields[78].GetUInt32();
+ creatureTemplate.RegenHealth = fields[79].GetBool();
+ creatureTemplate.equipmentId = fields[80].GetUInt32();
+ creatureTemplate.MechanicImmuneMask = fields[81].GetUInt32();
+ creatureTemplate.flags_extra = fields[82].GetUInt32();
+ creatureTemplate.ScriptID = GetScriptId(fields[83].GetCString());
+
+ // Add to map
+ CreatureTemplateStore[entry] = creatureTemplate;
+
+ ++count;
+ }
+ while (result->NextRow());
+
+ // Checking needs to be done after loading because of the difficulty self referencing
+ for (CreatureTemplateContainer::const_iterator itr = CreatureTemplateStore.begin(); itr != CreatureTemplateStore.end(); ++itr)
{
- CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i);
- CheckCreatureTemplate(cInfo);
+ CheckCreatureTemplate(&itr->second);
}
- sLog->outString(">> Loaded %u creature definitions in %u ms", sCreatureStorage.RecordCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -582,7 +708,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
uint32 entry = fields[0].GetUInt32();
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(entry))
+ if (!sObjectMgr->GetCreatureTemplate(entry))
{
sLog->outErrorDb("Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry);
continue;
@@ -632,7 +758,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
sLog->outString();
}
-void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
+void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
{
if (!cInfo)
return;
@@ -644,7 +770,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
continue;
ok = false; // will be set to true at the end of this loop again
- CreatureInfo const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
+ CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
if (!difficultyInfo)
{
sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.",
@@ -717,7 +843,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
continue;
}
- if (difficultyInfo->AIName && *difficultyInfo->AIName)
+ if (!difficultyInfo->AIName.empty())
{
sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
@@ -753,7 +879,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!displayEntry)
{
sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1);
- const_cast<CreatureInfo*>(cInfo)->Modelid1 = 0;
+ const_cast<CreatureTemplate*>(cInfo)->Modelid1 = 0;
}
else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
@@ -769,7 +895,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!displayEntry)
{
sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2);
- const_cast<CreatureInfo*>(cInfo)->Modelid2 = 0;
+ const_cast<CreatureTemplate*>(cInfo)->Modelid2 = 0;
}
else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
@@ -785,7 +911,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!displayEntry)
{
sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3);
- const_cast<CreatureInfo*>(cInfo)->Modelid3 = 0;
+ const_cast<CreatureTemplate*>(cInfo)->Modelid3 = 0;
}
else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
@@ -801,7 +927,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!displayEntry)
{
sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4);
- const_cast<CreatureInfo*>(cInfo)->Modelid4 = 0;
+ const_cast<CreatureTemplate*>(cInfo)->Modelid4 = 0;
}
else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
@@ -821,7 +947,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!GetCreatureTemplate(cInfo->KillCredit[k]))
{
sLog->outErrorDb("Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
- const_cast<CreatureInfo*>(cInfo)->KillCredit[k] = 0;
+ const_cast<CreatureTemplate*>(cInfo)->KillCredit[k] = 0;
}
}
}
@@ -829,20 +955,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
{
sLog->outErrorDb("Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
- const_cast<CreatureInfo*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
+ const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
}
if (cInfo->dmgschool >= MAX_SPELL_SCHOOL)
{
sLog->outErrorDb("Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
- const_cast<CreatureInfo*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
+ const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
}
if (cInfo->baseattacktime == 0)
- const_cast<CreatureInfo*>(cInfo)->baseattacktime = BASE_ATTACK_TIME;
+ const_cast<CreatureTemplate*>(cInfo)->baseattacktime = BASE_ATTACK_TIME;
if (cInfo->rangeattacktime == 0)
- const_cast<CreatureInfo*>(cInfo)->rangeattacktime = BASE_ATTACK_TIME;
+ const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = BASE_ATTACK_TIME;
if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
sLog->outErrorDb("Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type);
@@ -850,20 +976,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
{
sLog->outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type);
- const_cast<CreatureInfo*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
+ const_cast<CreatureTemplate*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
}
// must exist or used hidden but used in data horse case
if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM)
{
sLog->outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family);
- const_cast<CreatureInfo*>(cInfo)->family = 0;
+ const_cast<CreatureTemplate*>(cInfo)->family = 0;
}
if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE)
{
sLog->outErrorDb("Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType);
- const_cast<CreatureInfo*>(cInfo)->InhabitType = INHABIT_ANYWHERE;
+ const_cast<CreatureTemplate*>(cInfo)->InhabitType = INHABIT_ANYWHERE;
}
if (cInfo->VehicleId)
@@ -872,7 +998,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!vehId)
{
sLog->outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
- const_cast<CreatureInfo*>(cInfo)->VehicleId = 0;
+ const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0;
}
}
@@ -888,14 +1014,14 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j]))
{
sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
- const_cast<CreatureInfo*>(cInfo)->spells[j] = 0;
+ const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
}
}
if (cInfo->MovementType >= MAX_DB_MOTION_TYPE)
{
sLog->outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
- const_cast<CreatureInfo*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
+ const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
}
if (cInfo->equipmentId > 0) // 0 no equipment
@@ -903,7 +1029,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (!GetEquipmentInfo(cInfo->equipmentId))
{
sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with `equipment_id` %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId);
- const_cast<CreatureInfo*>(cInfo)->equipmentId = 0;
+ const_cast<CreatureTemplate*>(cInfo)->equipmentId = 0;
}
}
@@ -911,24 +1037,24 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
if (cInfo->scale <= 0.0f)
{
if (displayScaleEntry)
- const_cast<CreatureInfo*>(cInfo)->scale = displayScaleEntry->scale;
+ const_cast<CreatureTemplate*>(cInfo)->scale = displayScaleEntry->scale;
else
- const_cast<CreatureInfo*>(cInfo)->scale = 1.0f;
+ const_cast<CreatureTemplate*>(cInfo)->scale = 1.0f;
}
if (cInfo->expansion > (MAX_CREATURE_BASE_HP - 1))
{
sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
- const_cast<CreatureInfo*>(cInfo)->expansion = 0;
+ const_cast<CreatureTemplate*>(cInfo)->expansion = 0;
}
if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
{
sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags);
- const_cast<CreatureInfo*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
+ const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
}
- const_cast<CreatureInfo*>(cInfo)->dmg_multiplier *= Creature::_GetDamageMod(cInfo->rank);
+ const_cast<CreatureTemplate*>(cInfo)->dmg_multiplier *= Creature::_GetDamageMod(cInfo->rank);
}
void ObjectMgr::LoadCreatureAddons()
@@ -1105,7 +1231,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId)
return NULL;
}
-uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureInfo *cinfo, const CreatureData *data /*= NULL*/)
+uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureTemplate *cinfo, const CreatureData *data /*= NULL*/)
{
// Load creature model (display id)
uint32 display_id = 0;
@@ -1120,7 +1246,7 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureInfo *cinfo, co
return display_id;
}
-void ObjectMgr::ChooseCreatureFlags(const CreatureInfo *cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData *data /*= NULL*/)
+void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate *cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData *data /*= NULL*/)
{
npcflag = cinfo->npcflag;
unit_flags = cinfo->unit_flags;
@@ -1473,11 +1599,12 @@ void ObjectMgr::LoadCreatures()
// Build single time for check creature data
std::set<uint32> difficultyCreatures[MAX_DIFFICULTY - 1];
- for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
- if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
+
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
- if (cInfo->DifficultyEntry[diff])
- difficultyCreatures[diff].insert(cInfo->DifficultyEntry[diff]);
+ if (itr->second.DifficultyEntry[diff])
+ difficultyCreatures[diff].insert(itr->second.DifficultyEntry[diff]);
// Build single time for check spawnmask
std::map<uint32,uint32> spawnMasks;
@@ -1495,7 +1622,7 @@ void ObjectMgr::LoadCreatures()
uint32 guid = fields[ 0].GetUInt32();
uint32 entry = fields[ 1].GetUInt32();
- CreatureInfo const* cInfo = GetCreatureTemplate(entry);
+ CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
{
sLog->outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
@@ -1733,7 +1860,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay)
{
- CreatureInfo const *cInfo = GetCreatureTemplate(entry);
+ CreatureTemplate const *cInfo = GetCreatureTemplate(entry);
if (!cInfo)
return 0;
@@ -2905,13 +3032,13 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
uint8 uiSummonType = fields[4].GetUInt8();
uint32 uiSummonTimer= fields[5].GetUInt32();
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiEntry))
+ if (!sObjectMgr->GetCreatureTemplate(uiEntry))
{
sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry);
continue;
}
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiAccessory))
+ if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
{
sLog->outErrorDb("Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory);
continue;
@@ -2961,7 +3088,7 @@ void ObjectMgr::LoadVehicleAccessories()
uint8 uiSummonType = fields[4].GetUInt8();
uint32 uiSummonTimer= fields[5].GetUInt32();
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiAccessory))
+ if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
{
sLog->outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
continue;
@@ -3040,7 +3167,7 @@ void ObjectMgr::LoadPetLevelInfo()
Field* fields = result->Fetch();
uint32 creature_id = fields[0].GetUInt32();
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(creature_id))
+ if (!sObjectMgr->GetCreatureTemplate(creature_id))
{
sLog->outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.",creature_id);
continue;
@@ -4733,7 +4860,7 @@ void ObjectMgr::LoadQuests()
qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement
}
- if (id > 0 && !sCreatureStorage.LookupEntry<CreatureInfo>(id))
+ if (id > 0 && !sObjectMgr->GetCreatureTemplate(id))
{
sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but creature with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,uint32(id));
@@ -5839,13 +5966,13 @@ void ObjectMgr::LoadInstanceEncounters()
{
case ENCOUNTER_CREDIT_KILL_CREATURE:
{
- CreatureInfo const* creatureInfo = GetCreatureTemplate(creditEntry);
+ CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry);
if (!creatureInfo)
{
sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
- const_cast<CreatureInfo*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS;
+ const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS;
break;
}
case ENCOUNTER_CREDIT_CAST_SPELL:
@@ -6323,7 +6450,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
mount_entry = team == ALLIANCE ? node->MountCreatureID[0] : node->MountCreatureID[1];
}
- CreatureInfo const *mount_info = GetCreatureTemplate(mount_entry);
+ CreatureTemplate const *mount_info = GetCreatureTemplate(mount_entry);
if (mount_info)
{
mount_id = mount_info->GetRandomValidModelId();
@@ -7400,10 +7527,11 @@ std::string ObjectMgr::GeneratePetName(uint32 entry)
if (list0.empty() || list1.empty())
{
- CreatureInfo const *cinfo = GetCreatureTemplate(entry);
+ CreatureTemplate const *cinfo = GetCreatureTemplate(entry);
char* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale());
if (!petname)
- petname = cinfo->Name;
+ return cinfo->Name;
+
return std::string(petname);
}
@@ -7842,7 +7970,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
Field *fields = result->Fetch();
uint32 npc_entry = fields[0].GetUInt32();
- CreatureInfo const* cInfo = GetCreatureTemplate(npc_entry);
+ CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry);
if (!cInfo)
{
sLog->outErrorDb("Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry);
@@ -7926,15 +8054,13 @@ void ObjectMgr::LoadNPCSpellClickSpells()
// all spellclick data loaded, now we check if there are creatures with NPC_FLAG_SPELLCLICK but with no data
// NOTE: It *CAN* be the other way around: no spellclick flag but with spellclick data, in case of creature-only vehicle accessories
- for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
{
- if (CreatureInfo const* cInfo = GetCreatureTemplate(i))
+ if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && mSpellClickInfoMap.find(itr->second.Entry) == mSpellClickInfoMap.end())
{
- if ((cInfo->npcflag & UNIT_NPC_FLAG_SPELLCLICK) && mSpellClickInfoMap.find(i) == mSpellClickInfoMap.end())
- {
- sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", i);
- const_cast<CreatureInfo*>(cInfo)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK;
- }
+ sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry);
+ const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK;
}
}
@@ -8169,7 +8295,7 @@ void ObjectMgr::LoadCreatureQuestRelations()
for (QuestRelations::iterator itr = mCreatureQuestRelations.begin(); itr != mCreatureQuestRelations.end(); ++itr)
{
- CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
+ CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
sLog->outErrorDb("Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u",itr->first,itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
@@ -8183,7 +8309,7 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
for (QuestRelations::iterator itr = mCreatureQuestInvolvedRelations.begin(); itr != mCreatureQuestInvolvedRelations.end(); ++itr)
{
- CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
+ CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
sLog->outErrorDb("Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u",itr->first,itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
@@ -8840,7 +8966,7 @@ void ObjectMgr::AddSpellToTrainer( uint32 entry, uint32 spell, uint32 spellCost,
if (entry >= TRINITY_TRAINER_START_REF)
return;
- CreatureInfo const* cInfo = GetCreatureTemplate(entry);
+ CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
{
sLog->outErrorDb("Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry);
@@ -9205,7 +9331,7 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry,uint32 item, bool savetodb)
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
{
- CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry);
+ CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
if (!cInfo)
{
if (pl)
@@ -9447,8 +9573,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()
return;
}
- uint32 counter = 0;
-
+ uint32 count = 0;
do
{
Field *fields = result->Fetch();
@@ -9457,45 +9582,42 @@ void ObjectMgr::LoadCreatureClassLevelStats()
uint8 Class = fields[1].GetUInt8();
CreatureBaseStats stats;
+
for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i)
stats.BaseHealth[i] = fields[i + 2].GetUInt32();
+
stats.BaseMana = fields[5].GetUInt32();
stats.BaseArmor = fields[6].GetUInt32();
if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
- sLog->outErrorDb("Creature base stats for level %u has invalid class %u",
- Level, Class);
+ sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class);
for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i)
{
if (stats.BaseHealth[i] < 1)
{
- sLog->outErrorDb("Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1",
- Class, Level, i);
+ sLog->outErrorDb("Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i);
stats.BaseHealth[i] = 1;
}
}
m_creatureBaseStatsMap[MAKE_PAIR16(Level, Class)] = stats;
- ++counter;
+ ++count;
}
while (result->NextRow());
- for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
{
- CreatureInfo const* info = sCreatureStorage.LookupEntry<CreatureInfo>(i);
- if (!info)
- continue;
-
- for (uint16 lvl = info->minlevel; lvl <= info->maxlevel; ++lvl)
+ for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl)
{
- if (m_creatureBaseStatsMap.find(MAKE_PAIR16(lvl, info->unit_class)) == m_creatureBaseStatsMap.end())
- sLog->outErrorDb("Missing base stats for creature class %u level %u", info->unit_class, lvl);
+ if (m_creatureBaseStatsMap.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == m_creatureBaseStatsMap.end())
+ sLog->outErrorDb("Missing base stats for creature class %u level %u", itr->second.unit_class, lvl);
}
}
- sLog->outString(">> Loaded %u creature base stats in %u ms", counter, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -9696,3 +9818,12 @@ GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry)
return NULL;
}
+
+CreatureTemplate const* ObjectMgr::GetCreatureTemplate(uint32 entry)
+{
+ CreatureTemplateContainer::const_iterator itr = CreatureTemplateStore.find(entry);
+ if (itr != CreatureTemplateStore.end())
+ return &(itr->second);
+
+ return NULL;
+}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 6510636ce85..f4619fe7dbb 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -44,7 +44,6 @@
#include "ConditionMgr.h"
#include <functional>
-extern SQLStorage sCreatureStorage;
class Group;
class Guild;
@@ -671,11 +670,12 @@ class ObjectMgr
ArenaTeamMap::iterator GetArenaTeamMapBegin() { return mArenaTeamMap.begin(); }
ArenaTeamMap::iterator GetArenaTeamMapEnd() { return mArenaTeamMap.end(); }
- static CreatureInfo const *GetCreatureTemplate(uint32 id) { return sCreatureStorage.LookupEntry<CreatureInfo>(id); }
+ CreatureTemplate const* GetCreatureTemplate(uint32 entry);
+ CreatureTemplateContainer const* GetCreatureTemplates() { return &CreatureTemplateStore; }
CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId);
CreatureModelInfo const* GetCreatureModelRandomGender(uint32 &displayID);
- uint32 ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const CreatureData *data = NULL);
- static void ChooseCreatureFlags(const CreatureInfo *cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData *data = NULL);
+ uint32 ChooseDisplayId(uint32 team, const CreatureTemplate *cinfo, const CreatureData *data = NULL);
+ static void ChooseCreatureFlags(const CreatureTemplate *cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData *data = NULL);
EquipmentInfo const *GetEquipmentInfo(uint32 entry);
CreatureAddon const *GetCreatureAddon(uint32 lowguid);
CreatureAddon const *GetCreatureTemplateAddon(uint32 entry);
@@ -918,7 +918,7 @@ class ObjectMgr
void LoadCreatureLocales();
void LoadCreatureTemplates();
void LoadCreatureTemplateAddons();
- void CheckCreatureTemplate(CreatureInfo const* cInfo);
+ void CheckCreatureTemplate(CreatureTemplate const* cInfo);
void LoadCreatures();
void LoadLinkedRespawn();
bool SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid);
@@ -1397,6 +1397,7 @@ class ObjectMgr
MapObjectGuids mMapObjectGuids;
CreatureDataMap mCreatureDataMap;
+ CreatureTemplateContainer CreatureTemplateStore;
CreatureModelContainer CreatureModelStore;
CreatureAddonContainer CreatureAddonStore;
CreatureAddonContainer CreatureTemplateAddonStore;
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index a8e75de586e..154e8929e38 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -1424,20 +1424,19 @@ void LoadLootTemplates_Creature()
LootIdSet ids_set, ids_setUsed;
uint32 count = LootTemplates_Creature.LoadAndCollectLootIds(ids_set);
- // remove real entries and check existence loot
- for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
+ // Remove real entries and check loot existence
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
{
- if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
+ if (uint32 lootid = itr->second.lootid)
{
- if (uint32 lootid = cInfo->lootid)
- {
- if (ids_set.find(lootid) == ids_set.end())
- LootTemplates_Creature.ReportNotExistedId(lootid);
- else
- ids_setUsed.insert(lootid);
- }
+ if (ids_set.find(lootid) == ids_set.end())
+ LootTemplates_Creature.ReportNotExistedId(lootid);
+ else
+ ids_setUsed.insert(lootid);
}
}
+
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
@@ -1614,20 +1613,19 @@ void LoadLootTemplates_Pickpocketing()
LootIdSet ids_set, ids_setUsed;
uint32 count = LootTemplates_Pickpocketing.LoadAndCollectLootIds(ids_set);
- // remove real entries and check existence loot
- for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
+ // Remove real entries and check loot existence
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
{
- if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
+ if (uint32 lootid = itr->second.pickpocketLootId)
{
- if (uint32 lootid = cInfo->pickpocketLootId)
- {
- if (ids_set.find(lootid) == ids_set.end())
- LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
- else
- ids_setUsed.insert(lootid);
- }
+ if (ids_set.find(lootid) == ids_set.end())
+ LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
+ else
+ ids_setUsed.insert(lootid);
}
}
+
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
@@ -1709,19 +1707,18 @@ void LoadLootTemplates_Skinning()
uint32 count = LootTemplates_Skinning.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
- for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
{
- if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
+ if (uint32 lootid = itr->second.SkinLootId)
{
- if (uint32 lootid = cInfo->SkinLootId)
- {
- if (ids_set.find(lootid) == ids_set.end())
- LootTemplates_Skinning.ReportNotExistedId(lootid);
- else
- ids_setUsed.insert(lootid);
- }
+ if (ids_set.find(lootid) == ids_set.end())
+ LootTemplates_Skinning.ReportNotExistedId(lootid);
+ else
+ ids_setUsed.insert(lootid);
}
}
+
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index b7d57d46a05..53e42784f84 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -203,7 +203,7 @@ void SystemMgr::LoadScriptWaypoints()
pTemp.fZ = pFields[4].GetFloat();
pTemp.uiWaitTime = pFields[5].GetUInt32();
- CreatureInfo const* pCInfo = ObjectMgr::GetCreatureTemplate(pTemp.uiCreatureEntry);
+ CreatureTemplate const* pCInfo = sObjectMgr->GetCreatureTemplate(pTemp.uiCreatureEntry);
if (!pCInfo)
{
diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
index 4c8e739d1be..cf4b0ac1896 100755
--- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
@@ -134,7 +134,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
if (!unit->isCanTrainingOf(_player,true))
return;
- CreatureInfo const *ci = unit->GetCreatureInfo();
+ CreatureTemplate const *ci = unit->GetCreatureInfo();
if (!ci)
{
@@ -704,7 +704,7 @@ void WorldSession::HandleUnstablePetCallback(QueryResult result, uint32 petnumbe
return;
}
- CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id);
+ CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature_id);
if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{
// if problem in exotic pet
@@ -832,7 +832,7 @@ void WorldSession::HandleStableSwapPetCallback(QueryResult result, uint32 petnum
return;
}
- CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id);
+ CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature_id);
if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{
// if problem in exotic pet
diff --git a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
index 69e0cb38096..65f57c64d6b 100755
--- a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
@@ -155,7 +155,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data)
uint64 guid;
recv_data >> guid;
- CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry);
+ CreatureTemplate const *ci = sObjectMgr->GetCreatureTemplate(entry);
if (ci)
{
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index e743bec6465..b2342c98c77 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3351,7 +3351,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
}
else
{
- CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(GetMiscValue());
+ CreatureTemplate const * ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
if (!ci)
{
target->SetDisplayId(16358); // pig pink ^_^
@@ -3410,7 +3410,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
{
uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
- if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(cr_id))
+ if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
{
uint32 team = 0;
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -3866,7 +3866,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, b
creatureEntry = 15665;
}
- CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(creatureEntry);
+ CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry);
if (!ci)
{
sLog->outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need its modelid)",GetMiscValue());
@@ -6147,7 +6147,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
else
creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
- if (CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creatureEntry))
+ if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
{
uint32 team = 0;
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -6389,7 +6389,7 @@ void AuraEffect::HandleAuraEmpathy(AuraApplication const * aurApp, uint8 mode, b
return;
}
- CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(target->GetEntry());
+ CreatureTemplate const * ci = sObjectMgr->GetCreatureTemplate(target->GetEntry());
if (ci && ci->type == CREATURE_TYPE_BEAST)
target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
}
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 7a78f5f404a..7997ae0c05c 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -2195,7 +2195,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
sLog->outString();
}
-bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntry& petDefSpells)
+bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells)
{
// skip empty list;
bool have_spell = false;
@@ -2252,27 +2252,24 @@ void SpellMgr::LoadPetDefaultSpells()
uint32 countCreature = 0;
uint32 countData = 0;
- for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
{
- CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i);
- if (!cInfo)
- continue;
-
- if (!cInfo->PetSpellDataId)
+ if (!itr->second.PetSpellDataId)
continue;
// for creature with PetSpellDataId get default pet spells from dbc
- CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
+ CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(itr->second.PetSpellDataId);
if (!spellDataEntry)
continue;
- int32 petSpellsId = -int32(cInfo->PetSpellDataId);
+ int32 petSpellsId = -int32(itr->second.PetSpellDataId);
PetDefaultSpellsEntry petDefSpells;
for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
petDefSpells.spellid[j] = spellDataEntry->spellId[j];
- if (LoadPetDefaultSpells_helper(cInfo, petDefSpells))
+ if (LoadPetDefaultSpells_helper(&itr->second, petDefSpells))
{
mPetDefaultSpellsMap[petSpellsId] = petDefSpells;
++countData;
@@ -2298,7 +2295,7 @@ void SpellMgr::LoadPetDefaultSpells()
if (spellEntry->Effect[k] == SPELL_EFFECT_SUMMON || spellEntry->Effect[k] == SPELL_EFFECT_SUMMON_PET)
{
uint32 creature_id = spellEntry->EffectMiscValue[k];
- CreatureInfo const *cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creature_id);
+ CreatureTemplate const *cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
if (!cInfo)
continue;
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 33dad2ff918..a0a01ea2875 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -845,7 +845,7 @@ public:
uint32 id = (uint32)atoi(i);
- CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry);
+ CreatureTemplate const *ci = sObjectMgr->GetCreatureTemplate(entry);
if (!ci)
return false;
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index 8648b2c822e..5b88e83371f 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -241,7 +241,7 @@ public:
return false;
}
- CreatureInfo const *ci = pet->GetCreatureInfo();
+ CreatureTemplate const *ci = pet->GetCreatureInfo();
if (!ci)
{
handler->SendSysMessage(LANG_WRONG_PET_TYPE);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index a6ac7c9b597..b5431b823f8 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -454,10 +454,10 @@ public:
// faction is set in creature_template - not inside creature
// update in memory
- if (CreatureInfo const *cinfo = pCreature->GetCreatureInfo())
+ if (CreatureTemplate const *cinfo = pCreature->GetCreatureInfo())
{
- const_cast<CreatureInfo*>(cinfo)->faction_A = factionId;
- const_cast<CreatureInfo*>(cinfo)->faction_H = factionId;
+ const_cast<CreatureTemplate*>(cinfo)->faction_A = factionId;
+ const_cast<CreatureTemplate*>(cinfo)->faction_H = factionId;
}
// and DB
@@ -528,7 +528,7 @@ public:
uint32 displayid = target->GetDisplayId();
uint32 nativeid = target->GetNativeDisplayId();
uint32 Entry = target->GetEntry();
- CreatureInfo const* cInfo = target->GetCreatureInfo();
+ CreatureTemplate const* cInfo = target->GetCreatureInfo();
int64 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL);
if (curRespawnDelay < 0)
@@ -1110,7 +1110,7 @@ public:
return false;
}
- CreatureInfo const* cInfo = creatureTarget->GetCreatureInfo();
+ CreatureTemplate const* cInfo = creatureTarget->GetCreatureInfo();
if (!cInfo->isTameable (player->CanTameExoticPets()))
{
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index df5f9703ab2..9538221c3ba 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -205,7 +205,7 @@ public:
}
else if (creature > 0)
{
- if (CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(creature))
+ if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature))
for (uint16 z = 0; z < creaturecount; ++z)
player->KilledMonster(cInfo,0);
}
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index a08befe24ba..9fed2a2167a 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -411,7 +411,7 @@ public:
return false;
}
- CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(entry);
+ CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cInfo)
{
handler->PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry);
@@ -423,114 +423,89 @@ public:
Field *fields = result->Fetch();
- const_cast<CreatureInfo*>(cInfo)->DifficultyEntry[0] = fields[0].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->DifficultyEntry[1] = fields[1].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->DifficultyEntry[2] = fields[2].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->KillCredit[0] = fields[3].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->KillCredit[1] = fields[4].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->Modelid1 = fields[5].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->Modelid2 = fields[6].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->Modelid3 = fields[7].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->Modelid4 = fields[8].GetUInt32();
- size_t len = 0;
- if (const char* temp = fields[9].GetCString())
+ const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[0] = fields[0].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[1] = fields[1].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[2] = fields[2].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->KillCredit[0] = fields[3].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->KillCredit[1] = fields[4].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->Modelid1 = fields[5].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->Modelid2 = fields[6].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->Modelid3 = fields[7].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->Modelid4 = fields[8].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->Name = fields[9].GetString();
+ const_cast<CreatureTemplate*>(cInfo)->SubName = fields[10].GetString();
+ const_cast<CreatureTemplate*>(cInfo)->IconName = fields[11].GetString();
+ const_cast<CreatureTemplate*>(cInfo)->GossipMenuId = fields[12].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->minlevel = fields[13].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->maxlevel = fields[14].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->expansion = fields[15].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->faction_A = fields[16].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->faction_H = fields[17].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->npcflag = fields[18].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->speed_walk = fields[19].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->speed_run = fields[20].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->scale = fields[21].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->rank = fields[22].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->mindmg = fields[23].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->maxdmg = fields[24].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->dmgschool = fields[25].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->attackpower = fields[26].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->dmg_multiplier = fields[27].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->baseattacktime = fields[28].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = fields[29].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->unit_class = fields[30].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->unit_flags = fields[31].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->dynamicflags = fields[32].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->family = fields[33].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->trainer_type = fields[34].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->trainer_spell = fields[35].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->trainer_class = fields[36].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->trainer_race = fields[37].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->minrangedmg = fields[38].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->maxrangedmg = fields[39].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->rangedattackpower = fields[40].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->type = fields[41].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->type_flags = fields[42].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->lootid = fields[43].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->pickpocketLootId = fields[44].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->SkinLootId = fields[45].GetUInt32();
+
+ for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
- delete[] cInfo->Name;
- len = strlen(temp)+1;
- const_cast<CreatureInfo*>(cInfo)->Name = new char[len];
- strncpy(cInfo->Name, temp, len);
+ const_cast<CreatureTemplate*>(cInfo)->resistance[i] = fields[46 + i -1].GetUInt32();
}
- if (const char* temp = fields[10].GetCString())
- {
- delete[] cInfo->SubName;
- len = strlen(temp)+1;
- const_cast<CreatureInfo*>(cInfo)->SubName = new char[len];
- strncpy(cInfo->SubName, temp, len);
- }
- if (const char* temp = fields[11].GetCString())
- {
- delete[] cInfo->IconName;
- len = strlen(temp)+1;
- const_cast<CreatureInfo*>(cInfo)->IconName = new char[len];
- strncpy(cInfo->IconName, temp, len);
- }
- const_cast<CreatureInfo*>(cInfo)->GossipMenuId = fields[12].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->minlevel = fields[13].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->maxlevel = fields[14].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->expansion = fields[15].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->faction_A = fields[16].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->faction_H = fields[17].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->npcflag = fields[18].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->speed_walk = fields[19].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->speed_run = fields[20].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->scale = fields[21].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->rank = fields[22].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->mindmg = fields[23].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->maxdmg = fields[24].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->dmgschool = fields[25].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->attackpower = fields[26].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->dmg_multiplier = fields[27].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->baseattacktime = fields[28].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->rangeattacktime = fields[29].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->unit_class = fields[30].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->unit_flags = fields[31].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->dynamicflags = fields[32].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->family = fields[33].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->trainer_type = fields[34].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->trainer_spell = fields[35].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->trainer_class = fields[36].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->trainer_race = fields[37].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->minrangedmg = fields[38].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->maxrangedmg = fields[39].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->rangedattackpower = fields[40].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->type = fields[41].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->type_flags = fields[42].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->lootid = fields[43].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->pickpocketLootId = fields[44].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->SkinLootId = fields[45].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->resistance1 = fields[46].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->resistance2 = fields[47].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->resistance3 = fields[48].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->resistance4 = fields[49].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->resistance5 = fields[50].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->resistance6 = fields[51].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[0] = fields[52].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[1] = fields[53].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[2] = fields[54].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[3] = fields[55].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[4] = fields[56].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[5] = fields[57].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[6] = fields[58].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->spells[7] = fields[59].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->PetSpellDataId = fields[60].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->VehicleId = fields[61].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->mingold = fields[62].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->maxgold = fields[63].GetUInt32();
- if (const char* temp = fields[64].GetCString())
- {
- delete[] cInfo->AIName;
- len = strlen(temp)+1;
- const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
- strncpy(const_cast<char*>(cInfo->AIName), temp, len);
- }
- const_cast<CreatureInfo*>(cInfo)->MovementType = fields[65].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->InhabitType = fields[66].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->ModHealth = fields[67].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->ModMana = fields[68].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->ModArmor = fields[69].GetFloat();
- const_cast<CreatureInfo*>(cInfo)->RacialLeader = fields[70].GetBool();
- const_cast<CreatureInfo*>(cInfo)->questItems[0] = fields[71].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->questItems[1] = fields[72].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->questItems[2] = fields[73].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->questItems[3] = fields[74].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->questItems[4] = fields[75].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->questItems[5] = fields[76].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->movementId = fields[77].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->RegenHealth = fields[78].GetBool();
- const_cast<CreatureInfo*>(cInfo)->equipmentId = fields[79].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->MechanicImmuneMask = fields[80].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->flags_extra = fields[81].GetUInt32();
- const_cast<CreatureInfo*>(cInfo)->ScriptID = sObjectMgr->GetScriptId(fields[82].GetCString());
+
+ const_cast<CreatureTemplate*>(cInfo)->spells[0] = fields[52].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->spells[1] = fields[53].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->spells[2] = fields[54].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->spells[3] = fields[55].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->spells[4] = fields[56].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->spells[5] = fields[57].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->spells[6] = fields[58].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->spells[7] = fields[59].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->PetSpellDataId = fields[60].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->VehicleId = fields[61].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->mingold = fields[62].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->maxgold = fields[63].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->AIName = fields[64].GetString();
+ const_cast<CreatureTemplate*>(cInfo)->MovementType = fields[65].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->InhabitType = fields[66].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->ModHealth = fields[67].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->ModMana = fields[68].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->ModArmor = fields[69].GetFloat();
+ const_cast<CreatureTemplate*>(cInfo)->RacialLeader = fields[70].GetBool();
+ const_cast<CreatureTemplate*>(cInfo)->questItems[0] = fields[71].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->questItems[1] = fields[72].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->questItems[2] = fields[73].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->questItems[3] = fields[74].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->questItems[4] = fields[75].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->questItems[5] = fields[76].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->movementId = fields[77].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->RegenHealth = fields[78].GetBool();
+ const_cast<CreatureTemplate*>(cInfo)->equipmentId = fields[79].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->MechanicImmuneMask = fields[80].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->flags_extra = fields[81].GetUInt32();
+ const_cast<CreatureTemplate*>(cInfo)->ScriptID = sObjectMgr->GetScriptId(fields[82].GetCString());
sObjectMgr->CheckCreatureTemplate(cInfo);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index 599cbc3d3f1..ad33f9f9398 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -297,7 +297,7 @@ public:
SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
//damage
- const CreatureInfo *cinfo = me->GetCreatureInfo();
+ const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg);
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg);
me->UpdateDamagePhysical(BASE_ATTACK);
@@ -420,7 +420,7 @@ public:
SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE);
//damage
- const CreatureInfo *cinfo = me->GetCreatureInfo();
+ const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg);
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg);
me->UpdateDamagePhysical(BASE_ATTACK);
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index ec2f0f097b4..5f74f998f95 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -106,9 +106,9 @@ public:
{
me->SetReactState(REACT_PASSIVE);
if (!me->GetEquipmentId())
- if (const CreatureInfo *info = ObjectMgr::GetCreatureTemplate(28406))
+ if (const CreatureTemplate *info = sObjectMgr->GetCreatureTemplate(28406))
if (info->equipmentId)
- const_cast<CreatureInfo*>(me->GetCreatureInfo())->equipmentId = info->equipmentId;
+ const_cast<CreatureTemplate*>(me->GetCreatureInfo())->equipmentId = info->equipmentId;
}
uint64 playerGUID;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
index f554894c6f3..9f787589b8e 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
@@ -237,7 +237,7 @@ class boss_arlokk : public CreatureScript
me->SetDisplayId(MODEL_ID_PANTHER);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- const CreatureInfo *cinfo = me->GetCreatureInfo();
+ const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
me->UpdateDamagePhysical(BASE_ATTACK);
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
index 4f191b11249..8674a821517 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
@@ -156,7 +156,7 @@ class boss_marli : public CreatureScript
{
DoScriptText(SAY_TRANSFORM, me);
DoCast(me, SPELL_SPIDER_FORM);
- const CreatureInfo *cinfo = me->GetCreatureInfo();
+ const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
me->UpdateDamagePhysical(BASE_ATTACK);
@@ -196,7 +196,7 @@ class boss_marli : public CreatureScript
if (TransformBack_Timer <= diff)
{
me->SetDisplayId(15220);
- const CreatureInfo *cinfo = me->GetCreatureInfo();
+ const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1)));
me->UpdateDamagePhysical(BASE_ATTACK);
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
index a20eb271963..56b2fd34872 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
@@ -201,7 +201,7 @@ class boss_thekal : public CreatureScript
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFullHealth();
- const CreatureInfo *cinfo = me->GetCreatureInfo();
+ const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40)));
me->UpdateDamagePhysical(BASE_ATTACK);
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
index d7aaee44857..4aaff206375 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
@@ -158,7 +158,7 @@ class boss_venoxis : public CreatureScript
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_SNAKE_FORM);
me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
- const CreatureInfo *cinfo = me->GetCreatureInfo();
+ const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25)));
me->UpdateDamagePhysical(BASE_ATTACK);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index 92bdbe4ea16..922957cd106 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -1092,7 +1092,7 @@ class spell_sindragosa_ice_tomb : public SpellScriptLoader
bool Validate(SpellEntry const* /*spell*/)
{
- if (!ObjectMgr::GetCreatureTemplate(NPC_ICE_TOMB))
+ if (!sObjectMgr->GetCreatureTemplate(NPC_ICE_TOMB))
return false;
if (!sObjectMgr->GetGameObjectTemplate(GO_ICE_BLOCK))
return false;
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 31d35db5edd..7a6ad66280a 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -67,7 +67,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
{
if (targetCreature->isPet())
{
- CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(targetCreature->GetEntry());
+ CreatureTemplate const * ci = sObjectMgr->GetCreatureTemplate(targetCreature->GetEntry());
switch (ci->family)
{
case CREATURE_FAMILY_SUCCUBUS:
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 96fc9df041e..0cc5545e9c8 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -133,7 +133,7 @@ public:
sLog->outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", pCreature->GetEntry());
else
{
- CreatureInfo const* spawnedTemplate = ObjectMgr::GetCreatureTemplate(m_pSpawnAssoc->m_uiSpawnedCreatureEntry);
+ CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(m_pSpawnAssoc->m_uiSpawnedCreatureEntry);
if (!spawnedTemplate)
{
@@ -1674,7 +1674,7 @@ public:
{
SpellTimer = 0;
- CreatureInfo const *Info = me->GetCreatureInfo();
+ CreatureTemplate const *Info = me->GetCreatureInfo();
if (Info->Entry == C_VIPER)
IsViper = true;
diff --git a/src/server/shared/Database/SQLStorage.cpp b/src/server/shared/Database/SQLStorage.cpp
index b62b80aeaab..0175d0fbe30 100755
--- a/src/server/shared/Database/SQLStorage.cpp
+++ b/src/server/shared/Database/SQLStorage.cpp
@@ -19,10 +19,6 @@
#include "SQLStorage.h"
#include "SQLStorageImpl.h"
-const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiifffliiiiiiiliiisi";
-const char CreatureInfodstfmt[]="iiiiiiiiiisssibbiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiifffliiiiiiiliiiii";
-
-SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "entry","creature_template");
void SQLStorage::Free ()
{