diff options
-rw-r--r-- | sql/updates/world/2015_07_04_00_world.sql | 1 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStores.cpp | 6 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStores.h | 1 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStructure.h | 9 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCfmt.h | 1 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 1 | ||||
-rw-r--r-- | src/server/game/Entities/Pet/Pet.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 58 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 32 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.h | 2 | ||||
-rw-r--r-- | src/server/shared/Database/Implementation/WorldDatabase.cpp | 2 |
11 files changed, 33 insertions, 84 deletions
diff --git a/sql/updates/world/2015_07_04_00_world.sql b/sql/updates/world/2015_07_04_00_world.sql new file mode 100644 index 00000000000..1d9c803e617 --- /dev/null +++ b/sql/updates/world/2015_07_04_00_world.sql @@ -0,0 +1 @@ +ALTER TABLE `creature_template` DROP `PetSpellDataId`; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 32cd2f8d2a3..672ee5fc309 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -84,7 +84,6 @@ DBCStorage <CreatureDisplayInfoEntry> sCreatureDisplayInfoStore(CreatureDisplayI DBCStorage <CreatureDisplayInfoExtraEntry> sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt); DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore(CreatureFamilyfmt); DBCStorage <CreatureModelDataEntry> sCreatureModelDataStore(CreatureModelDatafmt); -DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore(CreatureSpellDatafmt); DBCStorage <CreatureTypeEntry> sCreatureTypeStore(CreatureTypefmt); DBCStorage <CriteriaEntry> sCriteriaStore(Criteriafmt); DBCStorage <CriteriaTreeEntry> sCriteriaTreeStore(CriteriaTreefmt); @@ -388,7 +387,6 @@ void LoadDBCStores(const std::string& dataPath) LOAD_DBC(sCreatureDisplayInfoExtraStore, "CreatureDisplayInfoExtra.dbc");//19116 LOAD_DBC(sCreatureFamilyStore, "CreatureFamily.dbc");//19116 LOAD_DBC(sCreatureModelDataStore, "CreatureModelData.dbc");//19116 - LOAD_DBC(sCreatureSpellDataStore, "CreatureSpellData.dbc");//19116 LOAD_DBC(sCreatureTypeStore, "CreatureType.dbc");//19116 LOAD_DBC(sCriteriaStore, "Criteria.dbc");//19342 LOAD_DBC(sCriteriaTreeStore, "CriteriaTree.dbc");//19342 @@ -518,7 +516,7 @@ void LoadDBCStores(const std::string& dataPath) for (uint32 i = 0; i < sCharStartOutfitStore.GetNumRows(); ++i) if (CharStartOutfitEntry const* outfit = sCharStartOutfitStore.LookupEntry(i)) sCharStartOutfitMap[outfit->RaceID | (outfit->ClassID << 8) | (outfit->GenderID << 16)] = outfit; - + for (uint32 i = 0; i < sCharSectionsStore.GetNumRows(); ++i) if (CharSectionsEntry const* entry = sCharSectionsStore.LookupEntry(i)) if (entry->Race && ((1 << (entry->Race - 1)) & RACEMASK_ALL_PLAYABLE) != 0) //ignore Nonplayable races @@ -540,7 +538,7 @@ void LoadDBCStores(const std::string& dataPath) PowersByClass[power->ClassID][power->PowerType] = index; } } - + memset(sChrSpecializationByIndexStore, 0, sizeof(sChrSpecializationByIndexStore)); for (uint32 i = 0; i < sChrSpecializationStore.GetNumRows(); ++i) if (ChrSpecializationEntry const* chrSpec = sChrSpecializationStore.LookupEntry(i)) diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 3e27d8e857d..863d6efcba7 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -147,7 +147,6 @@ extern DBCStorage <CreatureDisplayInfoEntry> sCreatureDisplayInfoStore; extern DBCStorage <CreatureDisplayInfoExtraEntry> sCreatureDisplayInfoExtraStore; extern DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore; extern DBCStorage <CreatureModelDataEntry> sCreatureModelDataStore; -extern DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore; extern DBCStorage <CreatureTypeEntry> sCreatureTypeStore; extern DBCStorage <CriteriaEntry> sCriteriaStore; extern DBCStorage <CriteriaTreeEntry> sCriteriaTreeStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 2978ad5e38d..8656f01273c 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -424,15 +424,6 @@ struct CreatureModelDataEntry //float HoverHeight; // 33 }; -#define MAX_CREATURE_SPELL_DATA_SLOT 4 - -struct CreatureSpellDataEntry -{ - uint32 ID; // 0 - uint32 Spells[MAX_CREATURE_SPELL_DATA_SLOT]; // 1-4 - //uint32 Availability[MAX_CREATURE_SPELL_DATA_SLOT]; // 4-7 -}; - struct CreatureTypeEntry { uint32 ID; // 0 diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index ad6178c9e64..fcad93b4f87 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -47,7 +47,6 @@ char const CreatureDisplayInfofmt[] = "nixifxxxxxxxxxxxxxxix"; char const CreatureDisplayInfoExtrafmt[] = "dixxxxxxxxxxxxxxxxxxxx"; char const CreatureFamilyfmt[] = "nfifiiiiixsx"; char const CreatureModelDatafmt[] = "nixxxxxxxxxxxxxffxxxxxxxxxxxxxxxxx"; -char const CreatureSpellDatafmt[] = "niiiixxxx"; char const CreatureTypefmt[] = "nxx"; char const Criteriafmt[] = "niiiiiiiixii"; char const CriteriaTreefmt[] = "niliixxx"; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index d1fdc7ad077..17cef733e6c 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -119,7 +119,6 @@ struct CreatureTemplate uint32 SkinLootId; int32 resistance[MAX_SPELL_SCHOOL]; uint32 spells[CREATURE_MAX_SPELLS]; - uint32 PetSpellDataId; uint32 VehicleId; uint32 mingold; uint32 maxgold; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index b6430a8dd26..3f83915c141 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1455,10 +1455,8 @@ void Pet::InitLevelupSpellsForLevel() } } - int32 petSpellsId = GetCreatureTemplate()->PetSpellDataId ? -(int32)GetCreatureTemplate()->PetSpellDataId : GetEntry(); - // default spells (can be not learned if pet level (as owner level decrease result for example) less first possible in normal game) - if (PetDefaultSpellsEntry const* defSpells = sSpellMgr->GetPetDefaultSpellsEntry(petSpellsId)) + if (PetDefaultSpellsEntry const* defSpells = sSpellMgr->GetPetDefaultSpellsEntry(int32(GetEntry()))) { for (uint8 i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i) { diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 033fa6e3c02..d590f2f9bd7 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -416,11 +416,11 @@ void ObjectMgr::LoadCreatureTemplates() "dynamicflags, family, trainer_type, trainer_class, trainer_race, type, " // 39 40 41 42 43 44 45 46 47 48 49 "type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, " - // 50 51 52 53 54 55 56 57 58 59 60 61 62 63 - "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, " - // 64 65 66 67 68 69 70 71 72 + // 50 51 52 53 54 55 56 57 58 59 60 61 62 + "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, " + // 63 64 65 66 67 68 69 70 71 "InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, " - // 73 74 75 76 77 78 + // 72 73 74 75 76 77 "RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template"); if (!result) @@ -505,28 +505,27 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields) for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) creatureTemplate.spells[i] = fields[50 + i].GetUInt32(); - creatureTemplate.PetSpellDataId = fields[58].GetUInt32(); - creatureTemplate.VehicleId = fields[59].GetUInt32(); - creatureTemplate.mingold = fields[60].GetUInt32(); - creatureTemplate.maxgold = fields[61].GetUInt32(); - creatureTemplate.AIName = fields[62].GetString(); - creatureTemplate.MovementType = uint32(fields[63].GetUInt8()); - creatureTemplate.InhabitType = uint32(fields[64].GetUInt8()); - creatureTemplate.HoverHeight = fields[65].GetFloat(); - creatureTemplate.ModHealth = fields[66].GetFloat(); - creatureTemplate.ModHealthExtra = fields[67].GetFloat(); - creatureTemplate.ModMana = fields[68].GetFloat(); - creatureTemplate.ModManaExtra = fields[69].GetFloat(); - creatureTemplate.ModArmor = fields[70].GetFloat(); - creatureTemplate.ModDamage = fields[71].GetFloat(); - creatureTemplate.ModExperience = fields[72].GetFloat(); - creatureTemplate.RacialLeader = fields[73].GetBool(); - - creatureTemplate.movementId = fields[74].GetUInt32(); - creatureTemplate.RegenHealth = fields[75].GetBool(); - creatureTemplate.MechanicImmuneMask = fields[76].GetUInt32(); - creatureTemplate.flags_extra = fields[77].GetUInt32(); - creatureTemplate.ScriptID = GetScriptId(fields[78].GetCString()); + creatureTemplate.VehicleId = fields[58].GetUInt32(); + creatureTemplate.mingold = fields[59].GetUInt32(); + creatureTemplate.maxgold = fields[60].GetUInt32(); + creatureTemplate.AIName = fields[61].GetString(); + creatureTemplate.MovementType = uint32(fields[62].GetUInt8()); + creatureTemplate.InhabitType = uint32(fields[63].GetUInt8()); + creatureTemplate.HoverHeight = fields[64].GetFloat(); + creatureTemplate.ModHealth = fields[65].GetFloat(); + creatureTemplate.ModHealthExtra = fields[66].GetFloat(); + creatureTemplate.ModMana = fields[67].GetFloat(); + creatureTemplate.ModManaExtra = fields[68].GetFloat(); + creatureTemplate.ModArmor = fields[69].GetFloat(); + creatureTemplate.ModDamage = fields[70].GetFloat(); + creatureTemplate.ModExperience = fields[71].GetFloat(); + creatureTemplate.RacialLeader = fields[72].GetBool(); + + creatureTemplate.movementId = fields[73].GetUInt32(); + creatureTemplate.RegenHealth = fields[74].GetBool(); + creatureTemplate.MechanicImmuneMask = fields[75].GetUInt32(); + creatureTemplate.flags_extra = fields[76].GetUInt32(); + creatureTemplate.ScriptID = GetScriptId(fields[77].GetCString()); } void ObjectMgr::LoadCreatureTemplateAddons() @@ -907,13 +906,6 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) } } - if (cInfo->PetSpellDataId) - { - CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); - if (!spellDataId) - TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId); - } - for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j) { if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j])) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 4f73eee601f..c100e34acb1 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2509,32 +2509,6 @@ void SpellMgr::LoadPetDefaultSpells() uint32 countCreature = 0; uint32 countData = 0; - CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); - for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr) - { - - if (!itr->second.PetSpellDataId) - continue; - - // for creature with PetSpellDataId get default pet spells from dbc - CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(itr->second.PetSpellDataId); - if (!spellDataEntry) - continue; - - int32 petSpellsId = -int32(itr->second.PetSpellDataId); - PetDefaultSpellsEntry petDefSpells; - for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) - petDefSpells.spellid[j] = spellDataEntry->Spells[j]; - - if (LoadPetDefaultSpells_helper(&itr->second, petDefSpells)) - { - mPetDefaultSpellsMap[petSpellsId] = petDefSpells; - ++countData; - } - } - - TC_LOG_INFO("server.loading", ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - TC_LOG_INFO("server.loading", "Loading summonable creature templates..."); oldMSTime = getMSTime(); @@ -2554,11 +2528,7 @@ void SpellMgr::LoadPetDefaultSpells() if (!cInfo) continue; - // already loaded - if (cInfo->PetSpellDataId) - continue; - - // for creature without PetSpellDataId get default pet spells from creature_template + // get default pet spells from creature_template int32 petSpellsId = cInfo->Entry; if (mPetDefaultSpellsMap.find(cInfo->Entry) != mPetDefaultSpellsMap.end()) continue; diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 9aafb508f86..cf501df98c2 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -552,6 +552,8 @@ typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap; typedef std::map<uint32, uint32> SpellDifficultySearcherMap; +#define MAX_CREATURE_SPELL_DATA_SLOT 4 + struct PetDefaultSpellsEntry { uint32 spellid[MAX_CREATURE_SPELL_DATA_SLOT]; diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index 28c4f43b1ea..4650f43ee0a 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -76,7 +76,7 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, permission, help FROM command", CONNECTION_SYNCH); - PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); + PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); |