mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
fix(Scripts/Commands): correct reloading creature_template table (#5020)
This commit is contained in:
@@ -65,7 +65,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, security, help FROM command", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, `rank`, dmgschool, DamageModifier, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, type_flags, lootid, pickpocketloot, skinloot, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_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, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, `rank`, dmgschool, DamageModifier, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, type_flags, lootid, pickpocketloot, skinloot, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_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_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH);
|
||||
|
||||
@@ -2742,7 +2742,6 @@ void Player::Regenerate(Powers power)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32 curValue = GetPower(power);
|
||||
|
||||
// TODO: possible use of miscvalueb instead of amount
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef _PLAYER_H
|
||||
#define _PLAYER_H
|
||||
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GroupReference.h"
|
||||
|
||||
@@ -5855,7 +5855,6 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
|
||||
data << uint32(damage); // damage
|
||||
data << uint32(pInfo->overDamage); // overkill?
|
||||
data << uint32(aura->GetSpellInfo()->GetSchoolMask());
|
||||
|
||||
@@ -502,86 +502,12 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
}
|
||||
|
||||
_creatureTemplateStore.rehash(result->GetRowCount());
|
||||
|
||||
uint32 count = 0;
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
CreatureTemplate& creatureTemplate = _creatureTemplateStore[entry];
|
||||
|
||||
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].GetInt16());
|
||||
creatureTemplate.faction = uint32(fields[17].GetUInt16());
|
||||
creatureTemplate.npcflag = fields[18].GetUInt32();
|
||||
creatureTemplate.speed_walk = fields[19].GetFloat();
|
||||
creatureTemplate.speed_run = fields[20].GetFloat();
|
||||
creatureTemplate.scale = fields[21].GetFloat();
|
||||
creatureTemplate.rank = uint32(fields[22].GetUInt8());
|
||||
creatureTemplate.dmgschool = uint32(fields[23].GetInt8());
|
||||
creatureTemplate.DamageModifier = fields[24].GetFloat();
|
||||
creatureTemplate.BaseAttackTime = fields[25].GetUInt32();
|
||||
creatureTemplate.RangeAttackTime = fields[26].GetUInt32();
|
||||
creatureTemplate.BaseVariance = fields[27].GetFloat();
|
||||
creatureTemplate.RangeVariance = fields[28].GetFloat();
|
||||
creatureTemplate.unit_class = uint32(fields[29].GetUInt8());
|
||||
creatureTemplate.unit_flags = fields[30].GetUInt32();
|
||||
creatureTemplate.unit_flags2 = fields[31].GetUInt32();
|
||||
creatureTemplate.dynamicflags = fields[32].GetUInt32();
|
||||
creatureTemplate.family = uint32(fields[33].GetUInt8());
|
||||
creatureTemplate.trainer_type = uint32(fields[34].GetUInt8());
|
||||
creatureTemplate.trainer_spell = fields[35].GetUInt32();
|
||||
creatureTemplate.trainer_class = uint32(fields[36].GetUInt8());
|
||||
creatureTemplate.trainer_race = uint32(fields[37].GetUInt8());
|
||||
creatureTemplate.type = uint32(fields[38].GetUInt8());
|
||||
creatureTemplate.type_flags = fields[39].GetUInt32();
|
||||
creatureTemplate.lootid = fields[40].GetUInt32();
|
||||
creatureTemplate.pickpocketLootId = fields[41].GetUInt32();
|
||||
creatureTemplate.SkinLootId = fields[42].GetUInt32();
|
||||
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
creatureTemplate.resistance[i] = 0;
|
||||
|
||||
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||
creatureTemplate.spells[i] = 0;
|
||||
|
||||
creatureTemplate.PetSpellDataId = fields[43].GetUInt32();
|
||||
creatureTemplate.VehicleId = fields[44].GetUInt32();
|
||||
creatureTemplate.mingold = fields[45].GetUInt32();
|
||||
creatureTemplate.maxgold = fields[46].GetUInt32();
|
||||
creatureTemplate.AIName = fields[47].GetString();
|
||||
creatureTemplate.MovementType = uint32(fields[48].GetUInt8());
|
||||
creatureTemplate.InhabitType = uint32(fields[49].GetUInt8());
|
||||
creatureTemplate.HoverHeight = fields[50].GetFloat();
|
||||
creatureTemplate.ModHealth = fields[51].GetFloat();
|
||||
creatureTemplate.ModMana = fields[52].GetFloat();
|
||||
creatureTemplate.ModArmor = fields[53].GetFloat();
|
||||
creatureTemplate.RacialLeader = fields[54].GetBool();
|
||||
creatureTemplate.movementId = fields[55].GetUInt32();
|
||||
creatureTemplate.RegenHealth = fields[56].GetBool();
|
||||
creatureTemplate.MechanicImmuneMask = fields[57].GetUInt32();
|
||||
creatureTemplate.SpellSchoolImmuneMask = fields[58].GetUInt8();
|
||||
creatureTemplate.flags_extra = fields[59].GetUInt32();
|
||||
creatureTemplate.ScriptID = GetScriptId(fields[60].GetCString());
|
||||
|
||||
LoadCreatureTemplate(fields);
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
@@ -614,6 +540,92 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureTemplate(Field* fields)
|
||||
{
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
CreatureTemplate& creatureTemplate = _creatureTemplateStore[entry];
|
||||
|
||||
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].GetInt16());
|
||||
creatureTemplate.faction = uint32(fields[17].GetUInt16());
|
||||
creatureTemplate.npcflag = fields[18].GetUInt32();
|
||||
creatureTemplate.speed_walk = fields[19].GetFloat();
|
||||
creatureTemplate.speed_run = fields[20].GetFloat();
|
||||
creatureTemplate.scale = fields[21].GetFloat();
|
||||
creatureTemplate.rank = uint32(fields[22].GetUInt8());
|
||||
creatureTemplate.dmgschool = uint32(fields[23].GetInt8());
|
||||
creatureTemplate.DamageModifier = fields[24].GetFloat();
|
||||
creatureTemplate.BaseAttackTime = fields[25].GetUInt32();
|
||||
creatureTemplate.RangeAttackTime = fields[26].GetUInt32();
|
||||
creatureTemplate.BaseVariance = fields[27].GetFloat();
|
||||
creatureTemplate.RangeVariance = fields[28].GetFloat();
|
||||
creatureTemplate.unit_class = uint32(fields[29].GetUInt8());
|
||||
creatureTemplate.unit_flags = fields[30].GetUInt32();
|
||||
creatureTemplate.unit_flags2 = fields[31].GetUInt32();
|
||||
creatureTemplate.dynamicflags = fields[32].GetUInt32();
|
||||
creatureTemplate.family = uint32(fields[33].GetUInt8());
|
||||
creatureTemplate.trainer_type = uint32(fields[34].GetUInt8());
|
||||
creatureTemplate.trainer_spell = fields[35].GetUInt32();
|
||||
creatureTemplate.trainer_class = uint32(fields[36].GetUInt8());
|
||||
creatureTemplate.trainer_race = uint32(fields[37].GetUInt8());
|
||||
creatureTemplate.type = uint32(fields[38].GetUInt8());
|
||||
creatureTemplate.type_flags = fields[39].GetUInt32();
|
||||
creatureTemplate.lootid = fields[40].GetUInt32();
|
||||
creatureTemplate.pickpocketLootId = fields[41].GetUInt32();
|
||||
creatureTemplate.SkinLootId = fields[42].GetUInt32();
|
||||
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
{
|
||||
creatureTemplate.resistance[i] = 0;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||
{
|
||||
creatureTemplate.spells[i] = 0;
|
||||
}
|
||||
|
||||
creatureTemplate.PetSpellDataId = fields[43].GetUInt32();
|
||||
creatureTemplate.VehicleId = fields[44].GetUInt32();
|
||||
creatureTemplate.mingold = fields[45].GetUInt32();
|
||||
creatureTemplate.maxgold = fields[46].GetUInt32();
|
||||
creatureTemplate.AIName = fields[47].GetString();
|
||||
creatureTemplate.MovementType = uint32(fields[48].GetUInt8());
|
||||
creatureTemplate.InhabitType = uint32(fields[49].GetUInt8());
|
||||
creatureTemplate.HoverHeight = fields[50].GetFloat();
|
||||
creatureTemplate.ModHealth = fields[51].GetFloat();
|
||||
creatureTemplate.ModMana = fields[52].GetFloat();
|
||||
creatureTemplate.ModArmor = fields[53].GetFloat();
|
||||
creatureTemplate.RacialLeader = fields[54].GetBool();
|
||||
creatureTemplate.movementId = fields[55].GetUInt32();
|
||||
creatureTemplate.RegenHealth = fields[56].GetBool();
|
||||
creatureTemplate.MechanicImmuneMask = fields[57].GetUInt32();
|
||||
creatureTemplate.SpellSchoolImmuneMask = fields[58].GetUInt8();
|
||||
creatureTemplate.flags_extra = fields[59].GetUInt32();
|
||||
creatureTemplate.ScriptID = GetScriptId(fields[60].GetCString());
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureTemplateResistances()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -978,6 +978,7 @@ public:
|
||||
void LoadCreatureClassLevelStats();
|
||||
void LoadCreatureLocales();
|
||||
void LoadCreatureTemplates();
|
||||
void LoadCreatureTemplate(Field* fields);
|
||||
void LoadCreatureTemplateAddons();
|
||||
void LoadCreatureTemplateResistances();
|
||||
void LoadCreatureTemplateSpells();
|
||||
|
||||
@@ -6555,7 +6555,6 @@ SpellCastResult Spell::CheckPower()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// health as power used - need check health amount
|
||||
if (m_spellInfo->PowerType == POWER_HEALTH)
|
||||
{
|
||||
|
||||
@@ -437,74 +437,7 @@ public:
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
cInfo->DifficultyEntry[0] = fields[0].GetUInt32();
|
||||
cInfo->DifficultyEntry[1] = fields[1].GetUInt32();
|
||||
cInfo->DifficultyEntry[2] = fields[2].GetUInt32();
|
||||
cInfo->KillCredit[0] = fields[3].GetUInt32();
|
||||
cInfo->KillCredit[1] = fields[4].GetUInt32();
|
||||
cInfo->Modelid1 = fields[5].GetUInt32();
|
||||
cInfo->Modelid2 = fields[6].GetUInt32();
|
||||
cInfo->Modelid3 = fields[7].GetUInt32();
|
||||
cInfo->Modelid4 = fields[8].GetUInt32();
|
||||
cInfo->Name = fields[9].GetString();
|
||||
cInfo->SubName = fields[10].GetString();
|
||||
cInfo->IconName = fields[11].GetString();
|
||||
cInfo->GossipMenuId = fields[12].GetUInt32();
|
||||
cInfo->minlevel = fields[13].GetUInt8();
|
||||
cInfo->maxlevel = fields[14].GetUInt8();
|
||||
cInfo->expansion = fields[15].GetUInt16();
|
||||
cInfo->faction = fields[16].GetUInt16();
|
||||
cInfo->npcflag = fields[17].GetUInt32();
|
||||
cInfo->speed_walk = fields[18].GetFloat();
|
||||
cInfo->speed_run = fields[19].GetFloat();
|
||||
cInfo->scale = fields[20].GetFloat();
|
||||
cInfo->rank = fields[21].GetUInt8();
|
||||
cInfo->dmgschool = fields[22].GetUInt8();
|
||||
cInfo->DamageModifier = fields[23].GetFloat();
|
||||
cInfo->BaseAttackTime = fields[24].GetUInt32();
|
||||
cInfo->RangeAttackTime = fields[25].GetUInt32();
|
||||
cInfo->BaseVariance = fields[26].GetFloat();
|
||||
cInfo->RangeVariance = fields[27].GetFloat();
|
||||
cInfo->unit_class = fields[28].GetUInt8();
|
||||
cInfo->unit_flags = fields[29].GetUInt32();
|
||||
cInfo->unit_flags2 = fields[30].GetUInt32();
|
||||
cInfo->dynamicflags = fields[31].GetUInt32();
|
||||
cInfo->family = fields[32].GetUInt8();
|
||||
cInfo->trainer_type = fields[33].GetUInt8();
|
||||
cInfo->trainer_spell = fields[34].GetUInt32();
|
||||
cInfo->trainer_class = fields[35].GetUInt8();
|
||||
cInfo->trainer_race = fields[36].GetUInt8();
|
||||
cInfo->type = fields[37].GetUInt8();
|
||||
cInfo->type_flags = fields[38].GetUInt32();
|
||||
cInfo->lootid = fields[39].GetUInt32();
|
||||
cInfo->pickpocketLootId = fields[40].GetUInt32();
|
||||
cInfo->SkinLootId = fields[41].GetUInt32();
|
||||
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
cInfo->resistance[i] = fields[42 + i - 1].GetUInt16();
|
||||
|
||||
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||
cInfo->spells[i] = fields[48 + i].GetUInt32();
|
||||
|
||||
cInfo->PetSpellDataId = fields[56].GetUInt32();
|
||||
cInfo->VehicleId = fields[57].GetUInt32();
|
||||
cInfo->mingold = fields[58].GetUInt32();
|
||||
cInfo->maxgold = fields[59].GetUInt32();
|
||||
cInfo->AIName = fields[60].GetString();
|
||||
cInfo->MovementType = fields[61].GetUInt8();
|
||||
cInfo->InhabitType = fields[62].GetUInt8();
|
||||
cInfo->HoverHeight = fields[63].GetFloat();
|
||||
cInfo->ModHealth = fields[64].GetFloat();
|
||||
cInfo->ModMana = fields[65].GetFloat();
|
||||
cInfo->ModArmor = fields[66].GetFloat();
|
||||
cInfo->RacialLeader = fields[67].GetBool();
|
||||
cInfo->movementId = fields[68].GetUInt32();
|
||||
cInfo->RegenHealth = fields[69].GetBool();
|
||||
cInfo->MechanicImmuneMask = fields[70].GetUInt32();
|
||||
cInfo->SpellSchoolImmuneMask = fields[71].GetUInt32();
|
||||
cInfo->flags_extra = fields[72].GetUInt32();
|
||||
cInfo->ScriptID = sObjectMgr->GetScriptId(fields[73].GetCString());
|
||||
|
||||
sObjectMgr->LoadCreatureTemplate(fields);
|
||||
sObjectMgr->CheckCreatureTemplate(cInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ EndScriptData */
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
|
||||
enum Muglash
|
||||
{
|
||||
FACTION_QUEST = 113,
|
||||
|
||||
@@ -17,7 +17,6 @@ npc_vekjik
|
||||
avatar_of_freya
|
||||
EndContentData */
|
||||
|
||||
|
||||
#include "CombatAI.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Player.h"
|
||||
|
||||
Reference in New Issue
Block a user