feat(Core/Creature): Implement c_t_r & c_t_s (#4359)
This commit is contained in:
@@ -0,0 +1,53 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1611776034016932100');
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `creature_template_resistance`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `creature_template_resistance` (
|
||||||
|
`CreatureID` MEDIUMINT UNSIGNED NOT NULL,
|
||||||
|
`School` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`Resistance` SMALLINT DEFAULT NULL,
|
||||||
|
`VerifiedBuild` SMALLINT DEFAULT 0,
|
||||||
|
CHECK (`School`>=1 AND `School`<=6),
|
||||||
|
PRIMARY KEY (`CreatureID`, `School`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `creature_template_spell`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `creature_template_spell` (
|
||||||
|
`CreatureID` MEDIUMINT UNSIGNED NOT NULL,
|
||||||
|
`Index` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`Spell` MEDIUMINT UNSIGNED DEFAULT NULL,
|
||||||
|
`VerifiedBuild` SMALLINT DEFAULT 0,
|
||||||
|
CHECK (`Index`>=0 AND `Index`<=7),
|
||||||
|
PRIMARY KEY (`CreatureID`, `Index`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
INSERT INTO `creature_template_resistance` SELECT `entry`, 1, `resistance1`, `VerifiedBuild` FROM `creature_template` WHERE `resistance1` <> 0;
|
||||||
|
INSERT INTO `creature_template_resistance` SELECT `entry`, 2, `resistance2`, `VerifiedBuild` FROM `creature_template` WHERE `resistance2` <> 0;
|
||||||
|
INSERT INTO `creature_template_resistance` SELECT `entry`, 3, `resistance3`, `VerifiedBuild` FROM `creature_template` WHERE `resistance3` <> 0;
|
||||||
|
INSERT INTO `creature_template_resistance` SELECT `entry`, 4, `resistance4`, `VerifiedBuild` FROM `creature_template` WHERE `resistance4` <> 0;
|
||||||
|
INSERT INTO `creature_template_resistance` SELECT `entry`, 5, `resistance5`, `VerifiedBuild` FROM `creature_template` WHERE `resistance5` <> 0;
|
||||||
|
INSERT INTO `creature_template_resistance` SELECT `entry`, 6, `resistance6`, `VerifiedBuild` FROM `creature_template` WHERE `resistance6` <> 0;
|
||||||
|
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 0, `spell1`, `VerifiedBuild` FROM `creature_template` WHERE `spell1` <> 0;
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 1, `spell2`, `VerifiedBuild` FROM `creature_template` WHERE `spell2` <> 0;
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 2, `spell3`, `VerifiedBuild` FROM `creature_template` WHERE `spell3` <> 0;
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 3, `spell4`, `VerifiedBuild` FROM `creature_template` WHERE `spell4` <> 0;
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 4, `spell5`, `VerifiedBuild` FROM `creature_template` WHERE `spell5` <> 0;
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 5, `spell6`, `VerifiedBuild` FROM `creature_template` WHERE `spell6` <> 0;
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 6, `spell7`, `VerifiedBuild` FROM `creature_template` WHERE `spell7` <> 0;
|
||||||
|
INSERT INTO `creature_template_spell` SELECT `entry`, 7, `spell8`, `VerifiedBuild` FROM `creature_template` WHERE `spell8` <> 0;
|
||||||
|
|
||||||
|
ALTER TABLE `creature_template`
|
||||||
|
DROP COLUMN `resistance1`,
|
||||||
|
DROP COLUMN `resistance2`,
|
||||||
|
DROP COLUMN `resistance3`,
|
||||||
|
DROP COLUMN `resistance4`,
|
||||||
|
DROP COLUMN `resistance5`,
|
||||||
|
DROP COLUMN `resistance6`,
|
||||||
|
DROP COLUMN `spell1`,
|
||||||
|
DROP COLUMN `spell2`,
|
||||||
|
DROP COLUMN `spell3`,
|
||||||
|
DROP COLUMN `spell4`,
|
||||||
|
DROP COLUMN `spell5`,
|
||||||
|
DROP COLUMN `spell6`,
|
||||||
|
DROP COLUMN `spell7`,
|
||||||
|
DROP COLUMN `spell8`;
|
||||||
@@ -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_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_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH);
|
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, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, 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 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_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_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);
|
PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void AggressorAI::UpdateAI(uint32 /*diff*/)
|
|||||||
|
|
||||||
void CombatAI::InitializeAI()
|
void CombatAI::InitializeAI()
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
if (me->m_spells[i] && sSpellMgr->GetSpellInfo(me->m_spells[i]))
|
if (me->m_spells[i] && sSpellMgr->GetSpellInfo(me->m_spells[i]))
|
||||||
spells.push_back(me->m_spells[i]);
|
spells.push_back(me->m_spells[i]);
|
||||||
|
|
||||||
|
|||||||
@@ -260,15 +260,15 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
//Using the extended script system we first create a list of viable spells
|
//Using the extended script system we first create a list of viable spells
|
||||||
SpellInfo const* apSpell[CREATURE_MAX_SPELLS];
|
SpellInfo const* apSpell[MAX_CREATURE_SPELLS];
|
||||||
memset(apSpell, 0, CREATURE_MAX_SPELLS * sizeof(SpellInfo*));
|
memset(apSpell, 0, MAX_CREATURE_SPELLS * sizeof(SpellInfo*));
|
||||||
|
|
||||||
uint32 spellCount = 0;
|
uint32 spellCount = 0;
|
||||||
|
|
||||||
SpellInfo const* tempSpell = nullptr;
|
SpellInfo const* tempSpell = nullptr;
|
||||||
|
|
||||||
//Check if each spell is viable(set it to null if not)
|
//Check if each spell is viable(set it to null if not)
|
||||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
|
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; i++)
|
||||||
{
|
{
|
||||||
tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i]);
|
tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i]);
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(),
|
|||||||
m_regenTimer = CREATURE_REGEN_INTERVAL;
|
m_regenTimer = CREATURE_REGEN_INTERVAL;
|
||||||
m_valuesCount = UNIT_END;
|
m_valuesCount = UNIT_END;
|
||||||
|
|
||||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
m_spells[i] = 0;
|
m_spells[i] = 0;
|
||||||
|
|
||||||
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||||
@@ -390,7 +390,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
|
|||||||
if (!m_wanderDistance && m_defaultMovementType == RANDOM_MOTION_TYPE)
|
if (!m_wanderDistance && m_defaultMovementType == RANDOM_MOTION_TYPE)
|
||||||
m_defaultMovementType = IDLE_MOTION_TYPE;
|
m_defaultMovementType = IDLE_MOTION_TYPE;
|
||||||
|
|
||||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
m_spells[i] = GetCreatureTemplate()->spells[i];
|
m_spells[i] = GetCreatureTemplate()->spells[i];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1868,7 +1868,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
|
|||||||
if (!victim)
|
if (!victim)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
{
|
{
|
||||||
if (!m_spells[i])
|
if (!m_spells[i])
|
||||||
continue;
|
continue;
|
||||||
@@ -1916,7 +1916,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
|
|||||||
if (!victim)
|
if (!victim)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
{
|
{
|
||||||
if (!m_spells[i])
|
if (!m_spells[i])
|
||||||
continue;
|
continue;
|
||||||
@@ -2497,10 +2497,10 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
|
|||||||
bool Creature::HasSpell(uint32 spellID) const
|
bool Creature::HasSpell(uint32 spellID) const
|
||||||
{
|
{
|
||||||
uint8 i;
|
uint8 i;
|
||||||
for (i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
if (spellID == m_spells[i])
|
if (spellID == m_spells[i])
|
||||||
break;
|
break;
|
||||||
return i < CREATURE_MAX_SPELLS; //broke before end of iteration of known spells
|
return i < MAX_CREATURE_SPELLS; //broke before end of iteration of known spells
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t Creature::GetRespawnTimeEx() const
|
time_t Creature::GetRespawnTimeEx() const
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ struct CreatureTemplate
|
|||||||
uint32 pickpocketLootId;
|
uint32 pickpocketLootId;
|
||||||
uint32 SkinLootId;
|
uint32 SkinLootId;
|
||||||
int32 resistance[MAX_SPELL_SCHOOL];
|
int32 resistance[MAX_SPELL_SCHOOL];
|
||||||
uint32 spells[CREATURE_MAX_SPELLS];
|
uint32 spells[MAX_CREATURE_SPELLS];
|
||||||
uint32 PetSpellDataId;
|
uint32 PetSpellDataId;
|
||||||
uint32 VehicleId;
|
uint32 VehicleId;
|
||||||
uint32 mingold;
|
uint32 mingold;
|
||||||
@@ -613,7 +613,7 @@ public:
|
|||||||
SpellInfo const* reachWithSpellAttack(Unit* victim);
|
SpellInfo const* reachWithSpellAttack(Unit* victim);
|
||||||
SpellInfo const* reachWithSpellCure(Unit* victim);
|
SpellInfo const* reachWithSpellCure(Unit* victim);
|
||||||
|
|
||||||
uint32 m_spells[CREATURE_MAX_SPELLS];
|
uint32 m_spells[MAX_CREATURE_SPELLS];
|
||||||
CreatureSpellCooldowns m_CreatureSpellCooldowns;
|
CreatureSpellCooldowns m_CreatureSpellCooldowns;
|
||||||
uint32 m_ProhibitSchoolTime[7];
|
uint32 m_ProhibitSchoolTime[7];
|
||||||
|
|
||||||
|
|||||||
@@ -21227,7 +21227,7 @@ void Player::VehicleSpellInitialize()
|
|||||||
data << uint8(0); // Command State
|
data << uint8(0); // Command State
|
||||||
data << uint16(0x800); // DisableActions (set for all vehicles)
|
data << uint16(0x800); // DisableActions (set for all vehicles)
|
||||||
|
|
||||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
{
|
{
|
||||||
uint32 spellId = vehicle->m_spells[i];
|
uint32 spellId = vehicle->m_spells[i];
|
||||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||||
@@ -21253,7 +21253,7 @@ void Player::VehicleSpellInitialize()
|
|||||||
data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i + 8));
|
data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i + 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32 i = CREATURE_MAX_SPELLS; i < MAX_SPELL_CONTROL_BAR; ++i)
|
for (uint32 i = MAX_CREATURE_SPELLS; i < MAX_SPELL_CONTROL_BAR; ++i)
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
|
|
||||||
data << uint8(0); // Auras?
|
data << uint8(0); // Auras?
|
||||||
|
|||||||
@@ -15011,7 +15011,7 @@ void CharmInfo::InitPossessCreateSpells()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
{
|
{
|
||||||
uint32 spellId = _unit->ToCreature()->m_spells[i];
|
uint32 spellId = _unit->ToCreature()->m_spells[i];
|
||||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ enum UnitRename
|
|||||||
UNIT_CAN_BE_ABANDONED = 0x02,
|
UNIT_CAN_BE_ABANDONED = 0x02,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CREATURE_MAX_SPELLS 8
|
static constexpr uint32 MAX_CREATURE_SPELLS = 8;
|
||||||
#define MAX_SPELL_CHARM 4
|
#define MAX_SPELL_CHARM 4
|
||||||
#define MAX_SPELL_VEHICLE 6
|
#define MAX_SPELL_VEHICLE 6
|
||||||
#define MAX_SPELL_POSSESS 8
|
#define MAX_SPELL_POSSESS 8
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "SpellScript.h"
|
#include "SpellScript.h"
|
||||||
#include "Transport.h"
|
#include "Transport.h"
|
||||||
|
#include "Unit.h"
|
||||||
#include "UpdateMask.h"
|
#include "UpdateMask.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
@@ -467,11 +468,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||||||
"scale, `rank`, dmgschool, DamageModifier, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, "
|
"scale, `rank`, dmgschool, DamageModifier, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, "
|
||||||
// 32 33 34 35 36 37 38
|
// 32 33 34 35 36 37 38
|
||||||
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, "
|
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, "
|
||||||
// 39 40 41 42 43 44 45 46 47 48 49
|
// 39 40 41 42 43 44 45 46 47 48
|
||||||
"type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
|
"type_flags, lootid, pickpocketloot, skinloot, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
|
||||||
// 50 51 52 53 54 55 56 57 58 59 60 61 62
|
// 49 50 51 52 53 54 55 56 57 58 59 60
|
||||||
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
|
|
||||||
// 63 64 65 66 67 68 69 70 71 72 73 74
|
|
||||||
"InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, ScriptName "
|
"InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, ScriptName "
|
||||||
"FROM creature_template;");
|
"FROM creature_template;");
|
||||||
|
|
||||||
@@ -538,29 +537,29 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||||||
creatureTemplate.SkinLootId = fields[42].GetUInt32();
|
creatureTemplate.SkinLootId = fields[42].GetUInt32();
|
||||||
|
|
||||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||||
creatureTemplate.resistance[i] = fields[43 + i - 1].GetInt16();
|
creatureTemplate.resistance[i] = 0;
|
||||||
|
|
||||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
creatureTemplate.spells[i] = fields[49 + i].GetUInt32();
|
creatureTemplate.spells[i] = 0;
|
||||||
|
|
||||||
creatureTemplate.PetSpellDataId = fields[57].GetUInt32();
|
creatureTemplate.PetSpellDataId = fields[43].GetUInt32();
|
||||||
creatureTemplate.VehicleId = fields[58].GetUInt32();
|
creatureTemplate.VehicleId = fields[44].GetUInt32();
|
||||||
creatureTemplate.mingold = fields[59].GetUInt32();
|
creatureTemplate.mingold = fields[45].GetUInt32();
|
||||||
creatureTemplate.maxgold = fields[60].GetUInt32();
|
creatureTemplate.maxgold = fields[46].GetUInt32();
|
||||||
creatureTemplate.AIName = fields[61].GetString();
|
creatureTemplate.AIName = fields[47].GetString();
|
||||||
creatureTemplate.MovementType = uint32(fields[62].GetUInt8());
|
creatureTemplate.MovementType = uint32(fields[48].GetUInt8());
|
||||||
creatureTemplate.InhabitType = uint32(fields[63].GetUInt8());
|
creatureTemplate.InhabitType = uint32(fields[49].GetUInt8());
|
||||||
creatureTemplate.HoverHeight = fields[64].GetFloat();
|
creatureTemplate.HoverHeight = fields[50].GetFloat();
|
||||||
creatureTemplate.ModHealth = fields[65].GetFloat();
|
creatureTemplate.ModHealth = fields[51].GetFloat();
|
||||||
creatureTemplate.ModMana = fields[66].GetFloat();
|
creatureTemplate.ModMana = fields[52].GetFloat();
|
||||||
creatureTemplate.ModArmor = fields[67].GetFloat();
|
creatureTemplate.ModArmor = fields[53].GetFloat();
|
||||||
creatureTemplate.RacialLeader = fields[68].GetBool();
|
creatureTemplate.RacialLeader = fields[54].GetBool();
|
||||||
creatureTemplate.movementId = fields[69].GetUInt32();
|
creatureTemplate.movementId = fields[55].GetUInt32();
|
||||||
creatureTemplate.RegenHealth = fields[70].GetBool();
|
creatureTemplate.RegenHealth = fields[56].GetBool();
|
||||||
creatureTemplate.MechanicImmuneMask = fields[71].GetUInt32();
|
creatureTemplate.MechanicImmuneMask = fields[57].GetUInt32();
|
||||||
creatureTemplate.SpellSchoolImmuneMask = fields[72].GetUInt8();
|
creatureTemplate.SpellSchoolImmuneMask = fields[58].GetUInt8();
|
||||||
creatureTemplate.flags_extra = fields[73].GetUInt32();
|
creatureTemplate.flags_extra = fields[59].GetUInt32();
|
||||||
creatureTemplate.ScriptID = GetScriptId(fields[74].GetCString());
|
creatureTemplate.ScriptID = GetScriptId(fields[60].GetCString());
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
@@ -580,6 +579,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadCreatureTemplateResistances();
|
||||||
|
LoadCreatureTemplateSpells();
|
||||||
|
|
||||||
// Checking needs to be done after loading because of the difficulty self referencing
|
// Checking needs to be done after loading because of the difficulty self referencing
|
||||||
for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
|
for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
|
||||||
{
|
{
|
||||||
@@ -591,6 +593,98 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||||||
sLog->outString();
|
sLog->outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectMgr::LoadCreatureTemplateResistances()
|
||||||
|
{
|
||||||
|
uint32 oldMSTime = getMSTime();
|
||||||
|
|
||||||
|
// 0 1 2
|
||||||
|
QueryResult result = WorldDatabase.Query("SELECT CreatureID, School, Resistance FROM creature_template_resistance");
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
sLog->outString(">> Loaded 0 creature template resistance definitions. DB table `creature_template_resistance` is empty.");
|
||||||
|
sLog->outString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 count = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
|
||||||
|
uint32 creatureID = fields[0].GetUInt32();
|
||||||
|
uint8 school = fields[1].GetUInt8();
|
||||||
|
|
||||||
|
if (school == SPELL_SCHOOL_NORMAL || school >= MAX_SPELL_SCHOOL)
|
||||||
|
{
|
||||||
|
sLog->outErrorDb("creature_template_resistance has resistance definitions for creature %u but this school %u doesn't exist", creatureID, school);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureTemplateContainer::iterator itr = _creatureTemplateStore.find(creatureID);
|
||||||
|
if (itr == _creatureTemplateStore.end())
|
||||||
|
{
|
||||||
|
sLog->outErrorDb("creature_template_resistance has resistance definitions for creature %u but this creature doesn't exist", creatureID);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureTemplate& creatureTemplate = itr->second;
|
||||||
|
creatureTemplate.resistance[school] = fields[2].GetInt16();
|
||||||
|
|
||||||
|
++count;
|
||||||
|
} while (result->NextRow());
|
||||||
|
|
||||||
|
sLog->outString(">> Loaded %u creature template resistances in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
sLog->outString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectMgr::LoadCreatureTemplateSpells()
|
||||||
|
{
|
||||||
|
uint32 oldMSTime = getMSTime();
|
||||||
|
|
||||||
|
// 0 1 2
|
||||||
|
QueryResult result = WorldDatabase.Query("SELECT CreatureID, `Index`, Spell FROM creature_template_spell");
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
sLog->outString(">> Loaded 0 creature template spell definitions. DB table `creature_template_spell` is empty.");
|
||||||
|
sLog->outString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 count = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
|
||||||
|
uint32 creatureID = fields[0].GetUInt32();
|
||||||
|
uint8 index = fields[1].GetUInt8();
|
||||||
|
|
||||||
|
if (index >= MAX_CREATURE_SPELLS)
|
||||||
|
{
|
||||||
|
sLog->outErrorDb("creature_template_spell has spell definitions for creature %u with a incorrect index %u", creatureID, index);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureTemplateContainer::iterator itr = _creatureTemplateStore.find(creatureID);
|
||||||
|
if (itr == _creatureTemplateStore.end())
|
||||||
|
{
|
||||||
|
sLog->outErrorDb("creature_template_spell has spell definitions for creature %u but this creature doesn't exist", creatureID);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureTemplate& creatureTemplate = itr->second;
|
||||||
|
creatureTemplate.spells[index] = fields[2].GetUInt32();;
|
||||||
|
|
||||||
|
++count;
|
||||||
|
} while (result->NextRow());
|
||||||
|
|
||||||
|
sLog->outString(">> Loaded %u creature template spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
sLog->outString();
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadCreatureTemplateAddons()
|
void ObjectMgr::LoadCreatureTemplateAddons()
|
||||||
{
|
{
|
||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
@@ -964,7 +1058,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
|
|||||||
sLog->outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId);
|
sLog->outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
|
for (uint8 j = 0; j < MAX_CREATURE_SPELLS; ++j)
|
||||||
{
|
{
|
||||||
if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
|
if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -972,6 +972,8 @@ public:
|
|||||||
void LoadCreatureLocales();
|
void LoadCreatureLocales();
|
||||||
void LoadCreatureTemplates();
|
void LoadCreatureTemplates();
|
||||||
void LoadCreatureTemplateAddons();
|
void LoadCreatureTemplateAddons();
|
||||||
|
void LoadCreatureTemplateResistances();
|
||||||
|
void LoadCreatureTemplateSpells();
|
||||||
void CheckCreatureTemplate(CreatureTemplate const* cInfo);
|
void CheckCreatureTemplate(CreatureTemplate const* cInfo);
|
||||||
void LoadGameObjectQuestItems();
|
void LoadGameObjectQuestItems();
|
||||||
void LoadCreatureQuestItems();
|
void LoadCreatureQuestItems();
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ public:
|
|||||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||||
cInfo->resistance[i] = fields[42 + i - 1].GetUInt16();
|
cInfo->resistance[i] = fields[42 + i - 1].GetUInt16();
|
||||||
|
|
||||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
cInfo->spells[i] = fields[48 + i].GetUInt32();
|
cInfo->spells[i] = fields[48 + i].GetUInt32();
|
||||||
|
|
||||||
cInfo->PetSpellDataId = fields[56].GetUInt32();
|
cInfo->PetSpellDataId = fields[56].GetUInt32();
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
{
|
{
|
||||||
player->KilledMonsterCredit(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? 29008 : 29009, 0);
|
player->KilledMonsterCredit(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? 29008 : 29009, 0);
|
||||||
CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(cr->GetDisplayId() == NPC_SOWAW_WIND_MODEL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL);
|
CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(cr->GetDisplayId() == NPC_SOWAW_WIND_MODEL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL);
|
||||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
cr->m_spells[i] = ct->spells[i];
|
cr->m_spells[i] = ct->spells[i];
|
||||||
|
|
||||||
player->VehicleSpellInitialize();
|
player->VehicleSpellInitialize();
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ public:
|
|||||||
caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, true);
|
caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, true);
|
||||||
caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
|
caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
|
||||||
caster->SetControlled(false, UNIT_STATE_ROOT);
|
caster->SetControlled(false, UNIT_STATE_ROOT);
|
||||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
caster->m_spells[i] = 0;
|
caster->m_spells[i] = 0;
|
||||||
|
|
||||||
caster->m_spells[0] = SPELL_JORMUNGAR_EMERGE;
|
caster->m_spells[0] = SPELL_JORMUNGAR_EMERGE;
|
||||||
@@ -663,7 +663,7 @@ public:
|
|||||||
caster->SetControlled(true, UNIT_STATE_ROOT);
|
caster->SetControlled(true, UNIT_STATE_ROOT);
|
||||||
|
|
||||||
if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(caster->GetEntry()))
|
if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(caster->GetEntry()))
|
||||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||||
caster->m_spells[i] = ct->spells[i];
|
caster->m_spells[i] = ct->spells[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user