Core/Creatures:

- Renamed creature_template.exp_unk to RequiredExpansion
- Added creature_template.HealthScalingExpansion
- Added creature_template.VignetteID
This commit is contained in:
Vincent-Michael
2016-08-13 21:55:39 +02:00
parent e6ddb9f222
commit f94339271e
6 changed files with 95 additions and 78 deletions
@@ -0,0 +1,4 @@
ALTER TABLE `creature_template`
CHANGE `exp_unk` `RequiredExpansion` MEDIUMINT(5) DEFAULT 0 NOT NULL,
ADD COLUMN `HealthScalingExpansion` MEDIUMINT(5) DEFAULT 0 NOT NULL AFTER `exp`,
ADD COLUMN `VignetteID` MEDIUMINT(5) DEFAULT 0 NOT NULL AFTER `RequiredExpansion`;
@@ -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_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, permission, help FROM command", CONNECTION_SYNCH); 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, 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, HealthScalingExpansion, RequiredExpansion, VignetteID, 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_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_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); 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);
+3 -1
View File
@@ -92,7 +92,9 @@ struct TC_GAME_API CreatureTemplate
int16 minlevel; int16 minlevel;
int16 maxlevel; int16 maxlevel;
int32 expansion; int32 expansion;
uint32 expansionUnknown; // either 0 or 3, sent to the client / wdb uint32 HealthScalingExpansion;
uint32 RequiredExpansion;
uint32 VignetteID; /// @todo Read Vignette.db2
uint32 faction; uint32 faction;
uint64 npcflag; uint64 npcflag;
float speed_walk; float speed_walk;
+82 -75
View File
@@ -413,19 +413,19 @@ void ObjectMgr::LoadCreatureTemplates()
// 0 1 2 3 4 5 6 7 8 // 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, " 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 22 // 9 10 11 12 13 14 15 16 17 18 19 20
"modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, speed_walk, speed_run, " "modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, HealthScalingExpansion, RequiredExpansion, VignetteID, "
// 23 24 25 26 27 28 29 30 31 32 // 21 22 23 24 25 26 27 28 29 30 31
"scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, " "faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, "
// 33 34 35 36 37 38 // 32 33 34 35 36 37 38 39 40
"dynamicflags, family, trainer_type, trainer_class, trainer_race, type, " "unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, "
// 39 40 41 42 43 44 45 46 47 48 49 // 41 42 43 44 45 46 47 48 49 50 51
"type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, " "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 // 52 53 54 55 56 57 58 59 60 61 62 63 64
"spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, " "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, "
// 63 64 65 66 67 68 69 70 71 // 65 66 67 68 69 70 71 72 73
"InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, " "InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, "
// 72 73 74 75 76 77 // 74 75 76 77 78 79
"RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template"); "RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template");
if (!result) if (!result)
@@ -463,74 +463,75 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32(); creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32();
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i) for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
creatureTemplate.KillCredit[i] = fields[4 + i].GetUInt32(); creatureTemplate.KillCredit[i] = fields[4 + i].GetUInt32();
creatureTemplate.Modelid1 = fields[6].GetUInt32(); creatureTemplate.Modelid1 = fields[6].GetUInt32();
creatureTemplate.Modelid2 = fields[7].GetUInt32(); creatureTemplate.Modelid2 = fields[7].GetUInt32();
creatureTemplate.Modelid3 = fields[8].GetUInt32(); creatureTemplate.Modelid3 = fields[8].GetUInt32();
creatureTemplate.Modelid4 = fields[9].GetUInt32(); creatureTemplate.Modelid4 = fields[9].GetUInt32();
creatureTemplate.Name = fields[10].GetString(); creatureTemplate.Name = fields[10].GetString();
creatureTemplate.FemaleName = fields[11].GetString(); creatureTemplate.FemaleName = fields[11].GetString();
creatureTemplate.SubName = fields[12].GetString(); creatureTemplate.SubName = fields[12].GetString();
creatureTemplate.IconName = fields[13].GetString(); creatureTemplate.IconName = fields[13].GetString();
creatureTemplate.GossipMenuId = fields[14].GetUInt32(); creatureTemplate.GossipMenuId = fields[14].GetUInt32();
creatureTemplate.minlevel = fields[15].GetInt16(); creatureTemplate.minlevel = fields[15].GetInt16();
creatureTemplate.maxlevel = fields[16].GetInt16(); creatureTemplate.maxlevel = fields[16].GetInt16();
creatureTemplate.expansion = fields[17].GetInt16(); creatureTemplate.expansion = fields[17].GetInt16();
creatureTemplate.expansionUnknown = fields[18].GetUInt16(); creatureTemplate.HealthScalingExpansion = fields[18].GetUInt32();
creatureTemplate.faction = fields[19].GetUInt16(); creatureTemplate.RequiredExpansion = fields[19].GetUInt32();
creatureTemplate.npcflag = fields[20].GetUInt64(); creatureTemplate.VignetteID = fields[20].GetUInt32();
creatureTemplate.speed_walk = fields[21].GetFloat(); creatureTemplate.faction = fields[21].GetUInt16();
creatureTemplate.speed_run = fields[22].GetFloat(); creatureTemplate.npcflag = fields[22].GetUInt64();
creatureTemplate.scale = fields[23].GetFloat(); creatureTemplate.speed_walk = fields[23].GetFloat();
creatureTemplate.rank = uint32(fields[24].GetUInt8()); creatureTemplate.speed_run = fields[24].GetFloat();
creatureTemplate.dmgschool = uint32(fields[25].GetInt8()); creatureTemplate.scale = fields[25].GetFloat();
creatureTemplate.BaseAttackTime = fields[26].GetUInt32(); creatureTemplate.rank = uint32(fields[26].GetUInt8());
creatureTemplate.RangeAttackTime = fields[27].GetUInt32(); creatureTemplate.dmgschool = uint32(fields[27].GetInt8());
creatureTemplate.BaseVariance = fields[28].GetFloat(); creatureTemplate.BaseAttackTime = fields[28].GetUInt32();
creatureTemplate.RangeVariance = fields[29].GetFloat(); creatureTemplate.RangeAttackTime = fields[29].GetUInt32();
creatureTemplate.unit_class = uint32(fields[30].GetUInt8()); creatureTemplate.BaseVariance = fields[30].GetFloat();
creatureTemplate.unit_flags = fields[31].GetUInt32(); creatureTemplate.RangeVariance = fields[31].GetFloat();
creatureTemplate.unit_flags2 = fields[32].GetUInt32(); creatureTemplate.unit_class = uint32(fields[32].GetUInt8());
creatureTemplate.dynamicflags = fields[33].GetUInt32(); creatureTemplate.unit_flags = fields[33].GetUInt32();
creatureTemplate.family = uint32(fields[34].GetUInt8()); creatureTemplate.unit_flags2 = fields[34].GetUInt32();
creatureTemplate.trainer_type = uint32(fields[35].GetUInt8()); creatureTemplate.dynamicflags = fields[35].GetUInt32();
creatureTemplate.trainer_class = uint32(fields[36].GetUInt8()); creatureTemplate.family = uint32(fields[36].GetUInt8());
creatureTemplate.trainer_race = uint32(fields[37].GetUInt8()); creatureTemplate.trainer_type = uint32(fields[37].GetUInt8());
creatureTemplate.type = uint32(fields[38].GetUInt8()); creatureTemplate.trainer_class = uint32(fields[38].GetUInt8());
creatureTemplate.type_flags = fields[39].GetUInt32(); creatureTemplate.trainer_race = uint32(fields[39].GetUInt8());
creatureTemplate.type_flags2 = fields[40].GetUInt32(); creatureTemplate.type = uint32(fields[40].GetUInt8());
creatureTemplate.lootid = fields[41].GetUInt32(); creatureTemplate.type_flags = fields[42].GetUInt32();
creatureTemplate.pickpocketLootId = fields[42].GetUInt32(); creatureTemplate.type_flags2 = fields[43].GetUInt32();
creatureTemplate.SkinLootId = 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) for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
creatureTemplate.resistance[i] = fields[44 + i - 1].GetInt16(); creatureTemplate.resistance[i] = fields[47 + i - 1].GetInt16();
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
creatureTemplate.spells[i] = fields[50 + i].GetUInt32(); creatureTemplate.spells[i] = fields[52 + i].GetUInt32();
creatureTemplate.VehicleId = fields[58].GetUInt32(); creatureTemplate.VehicleId = fields[60].GetUInt32();
creatureTemplate.mingold = fields[59].GetUInt32(); creatureTemplate.mingold = fields[61].GetUInt32();
creatureTemplate.maxgold = fields[60].GetUInt32(); creatureTemplate.maxgold = fields[62].GetUInt32();
creatureTemplate.AIName = fields[61].GetString(); creatureTemplate.AIName = fields[63].GetString();
creatureTemplate.MovementType = uint32(fields[62].GetUInt8()); creatureTemplate.MovementType = uint32(fields[64].GetUInt8());
creatureTemplate.InhabitType = uint32(fields[63].GetUInt8()); creatureTemplate.InhabitType = uint32(fields[65].GetUInt8());
creatureTemplate.HoverHeight = fields[64].GetFloat(); creatureTemplate.HoverHeight = fields[66].GetFloat();
creatureTemplate.ModHealth = fields[65].GetFloat(); creatureTemplate.ModHealth = fields[67].GetFloat();
creatureTemplate.ModHealthExtra = fields[66].GetFloat(); creatureTemplate.ModHealthExtra = fields[68].GetFloat();
creatureTemplate.ModMana = fields[67].GetFloat(); creatureTemplate.ModMana = fields[69].GetFloat();
creatureTemplate.ModManaExtra = fields[68].GetFloat(); creatureTemplate.ModManaExtra = fields[70].GetFloat();
creatureTemplate.ModArmor = fields[69].GetFloat(); creatureTemplate.ModArmor = fields[71].GetFloat();
creatureTemplate.ModDamage = fields[70].GetFloat(); creatureTemplate.ModDamage = fields[72].GetFloat();
creatureTemplate.ModExperience = fields[71].GetFloat(); creatureTemplate.ModExperience = fields[73].GetFloat();
creatureTemplate.RacialLeader = fields[72].GetBool(); creatureTemplate.RacialLeader = fields[74].GetBool();
creatureTemplate.movementId = fields[75].GetUInt32();
creatureTemplate.movementId = fields[73].GetUInt32(); creatureTemplate.RegenHealth = fields[76].GetBool();
creatureTemplate.RegenHealth = fields[74].GetBool(); creatureTemplate.MechanicImmuneMask = fields[77].GetUInt32();
creatureTemplate.MechanicImmuneMask = fields[75].GetUInt32(); creatureTemplate.flags_extra = fields[78].GetUInt32();
creatureTemplate.flags_extra = fields[76].GetUInt32(); creatureTemplate.ScriptID = GetScriptId(fields[79].GetString());
creatureTemplate.ScriptID = GetScriptId(fields[77].GetString());
} }
void ObjectMgr::LoadCreatureTemplateAddons() void ObjectMgr::LoadCreatureTemplateAddons()
@@ -947,10 +948,16 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
const_cast<CreatureTemplate*>(cInfo)->expansion = 0; const_cast<CreatureTemplate*>(cInfo)->expansion = 0;
} }
if (cInfo->expansionUnknown > MAX_EXPANSIONS) if (cInfo->HealthScalingExpansion > MAX_EXPANSIONS)
{ {
TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with `exp_unk` %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansionUnknown); TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with `HealthScalingExpansion` %u. Ignored and set to 0.", cInfo->Entry, cInfo->RequiredExpansion);
const_cast<CreatureTemplate*>(cInfo)->expansionUnknown = 0; const_cast<CreatureTemplate*>(cInfo)->RequiredExpansion = 0;
}
if (cInfo->RequiredExpansion > MAX_EXPANSIONS)
{
TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with `RequiredExpansion` %u. Ignored and set to 0.", cInfo->Entry, cInfo->RequiredExpansion);
const_cast<CreatureTemplate*>(cInfo)->RequiredExpansion = 0;
} }
if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED)) if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
+3 -1
View File
@@ -99,7 +99,9 @@ void WorldSession::HandleCreatureQuery(WorldPackets::Query::QueryCreature& packe
stats.EnergyMulti = creatureInfo->ModMana; stats.EnergyMulti = creatureInfo->ModMana;
stats.CreatureMovementInfoID = creatureInfo->movementId; stats.CreatureMovementInfoID = creatureInfo->movementId;
stats.RequiredExpansion = creatureInfo->expansionUnknown; stats.RequiredExpansion = creatureInfo->RequiredExpansion;
stats.RequiredExpansion = creatureInfo->HealthScalingExpansion;
stats.VignetteID = creatureInfo->VignetteID;
stats.Title = creatureInfo->SubName; stats.Title = creatureInfo->SubName;
//stats.TitleAlt = ; //stats.TitleAlt = ;
@@ -53,7 +53,9 @@ namespace WorldPackets
bool Leader = false; bool Leader = false;
std::vector<int32> QuestItems; std::vector<int32> QuestItems;
uint32 CreatureMovementInfoID = 0; uint32 CreatureMovementInfoID = 0;
uint32 HealthScalingExpansion = 0;
uint32 RequiredExpansion = 0; uint32 RequiredExpansion = 0;
uint32 VignetteID = 0;
uint32 Flags[2]; uint32 Flags[2];
uint32 ProxyCreatureID[MAX_KILL_CREDIT]; uint32 ProxyCreatureID[MAX_KILL_CREDIT];
uint32 CreatureDisplayID[MAX_CREATURE_MODELS]; uint32 CreatureDisplayID[MAX_CREATURE_MODELS];