Core/Creatures: Drop dynamic flags from creature and creature_template

This commit is contained in:
Meji authored and Ovahlord committed 2025-03-11 21:29:30 +01:00
1 parent 55318b76b6
commit d0c902ce1f
6 files changed
+73 -78

No files matched your search

@@ -0,0 +1,5 @@
ALTER TABLE `creature_template`
DROP COLUMN `dynamicflags`;
ALTER TABLE `creature`
DROP COLUMN `dynamicflags`;
@@ -76,12 +76,12 @@ 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_class, 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, ctm.HoverInitiallyEnabled, ctm.Random, ctm.InteractionPauseTimer, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, StaticFlags, StaticFlags2, StaticFlags3, StaticFlags4, StaticFlags5, ScriptName FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId 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, family, trainer_class, 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, ctm.HoverInitiallyEnabled, ctm.Random, ctm.InteractionPauseTimer, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, StaticFlags, StaticFlags2, StaticFlags3, StaticFlags4, StaticFlags5, ScriptName FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId 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);
PrepareStatement(WORLD_SEL_CREATURE_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 creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_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 creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH);
PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, wander_distance, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, wander_distance, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, unit_flags2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+12 -12
View File
@@ -582,8 +582,8 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
SetFaction(cInfo->faction); SetFaction(cInfo->faction);
uint32 npcflags, unitFlags, unitFlags2, dynamicFlags; uint32 npcflags, unitFlags, unitFlags2;
ObjectMgr::ChooseCreatureFlags(cInfo, &npcflags, &unitFlags, &unitFlags2, &dynamicFlags, _staticFlags, data); ObjectMgr::ChooseCreatureFlags(cInfo, &npcflags, &unitFlags, &unitFlags2, _staticFlags, data);
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT)
npcflags |= sGameEventMgr->GetNPCFlag(this); npcflags |= sGameEventMgr->GetNPCFlag(this);
@@ -598,7 +598,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags); SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags);
SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2); SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicFlags); SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
SetCanDualWield(cInfo->flags_extra & CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK); SetCanDualWield(cInfo->flags_extra & CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK);
@@ -1307,7 +1307,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask)
uint32 displayId = GetNativeDisplayId(); uint32 displayId = GetNativeDisplayId();
uint32 npcflag = GetUInt32Value(UNIT_NPC_FLAGS); uint32 npcflag = GetUInt32Value(UNIT_NPC_FLAGS);
uint32 unit_flags = GetUInt32Value(UNIT_FIELD_FLAGS); uint32 unit_flags = GetUInt32Value(UNIT_FIELD_FLAGS);
uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS); uint32 unit_flags2 = GetUInt32Value(UNIT_FIELD_FLAGS_2);
// check if it's a custom model and if not, use 0 for displayId // check if it's a custom model and if not, use 0 for displayId
CreatureTemplate const* cinfo = GetCreatureTemplate(); CreatureTemplate const* cinfo = GetCreatureTemplate();
@@ -1323,8 +1323,8 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask)
if (unit_flags == cinfo->unit_flags) if (unit_flags == cinfo->unit_flags)
unit_flags = 0; unit_flags = 0;
if (dynamicflags == cinfo->dynamicflags) if (unit_flags2 == cinfo->unit_flags2)
dynamicflags = 0; unit_flags2 = 0;
} }
if (!data.spawnId) if (!data.spawnId)
@@ -1355,7 +1355,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask)
data.spawnMask = spawnMask; data.spawnMask = spawnMask;
data.npcflag = npcflag; data.npcflag = npcflag;
data.unit_flags = unit_flags; data.unit_flags = unit_flags;
data.dynamicflags = dynamicflags; data.unit_flags2 = unit_flags2;
if (!data.spawnGroupData) if (!data.spawnGroupData)
data.spawnGroupData = sObjectMgr->GetDefaultSpawnGroup(); data.spawnGroupData = sObjectMgr->GetDefaultSpawnGroup();
@@ -1393,7 +1393,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask)
stmt->setUInt8(index++, uint8(GetDefaultMovementType())); stmt->setUInt8(index++, uint8(GetDefaultMovementType()));
stmt->setUInt32(index++, npcflag); stmt->setUInt32(index++, npcflag);
stmt->setUInt32(index++, unit_flags); stmt->setUInt32(index++, unit_flags);
stmt->setUInt32(index++, dynamicflags); stmt->setUInt32(index++, unit_flags2);
trans->Append(stmt); trans->Append(stmt);
WorldDatabase.CommitTransaction(trans); WorldDatabase.CommitTransaction(trans);
@@ -1991,13 +1991,13 @@ void Creature::setDeathState(DeathState s)
CreatureData const* creatureData = GetCreatureData(); CreatureData const* creatureData = GetCreatureData();
CreatureTemplate const* cinfo = GetCreatureTemplate(); CreatureTemplate const* cinfo = GetCreatureTemplate();
uint32 npcflag, unitFlags, unitFlags2, dynamicFlags; uint32 npcflag, unitFlags, unitFlags2;
ObjectMgr::ChooseCreatureFlags(cinfo, &npcflag, &unitFlags, &unitFlags2, &dynamicFlags, _staticFlags, creatureData); ObjectMgr::ChooseCreatureFlags(cinfo, &npcflag, &unitFlags, &unitFlags2, _staticFlags, creatureData);
SetUInt32Value(UNIT_NPC_FLAGS, npcflag); SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags); SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags);
SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2); SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicFlags); SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
@@ -3265,7 +3265,7 @@ void Creature::AtDisengage()
ClearUnitState(UNIT_STATE_ATTACK_PLAYER); ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
if (IsAlive() && HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED)) if (IsAlive() && HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
SetUInt32Value(UNIT_DYNAMIC_FLAGS, GetCreatureTemplate()->dynamicflags); RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED);
} }
void Creature::ForcePartyMembersIntoCombat() void Creature::ForcePartyMembersIntoCombat()
@@ -381,7 +381,6 @@ struct TC_GAME_API CreatureTemplate
uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures. uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
uint32 unit_flags; // enum UnitFlags mask values uint32 unit_flags; // enum UnitFlags mask values
uint32 unit_flags2; // enum UnitFlags2 mask values uint32 unit_flags2; // enum UnitFlags2 mask values
uint32 dynamicflags;
CreatureFamily family; // enum CreatureFamily values (optional) CreatureFamily family; // enum CreatureFamily values (optional)
uint32 trainer_class; uint32 trainer_class;
uint32 type; // enum CreatureType values uint32 type; // enum CreatureType values
@@ -511,7 +510,6 @@ struct CreatureData : public SpawnData
uint32 curhealth = 0; uint32 curhealth = 0;
uint32 curmana = 0; uint32 curmana = 0;
uint8 movementType = 0; uint8 movementType = 0;
Optional<uint32> dynamicflags;
Optional<uint32> npcflag; Optional<uint32> npcflag;
Optional<uint32> unit_flags; // enum UnitFlags mask values Optional<uint32> unit_flags; // enum UnitFlags mask values
Optional<uint32> unit_flags2; // enum UnitFlags2 mask values Optional<uint32> unit_flags2; // enum UnitFlags2 mask values
+53 -61
View File
@@ -429,15 +429,15 @@ void ObjectMgr::LoadCreatureTemplates()
"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, exp_unk, faction, npcflag, speed_walk, speed_run, "
// 23 24 25 26 27 28 29 30 31 32 // 23 24 25 26 27 28 29 30 31 32
"scale, `rank`, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, " "scale, `rank`, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, "
// 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 // 33 34 35 36 37 38 39 40 41 42 43 44 45 46
"dynamicflags, family, trainer_class, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, " "family, trainer_class, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, "
// 48 49 50 51 52 53 54 55 56 57 58 59 60 61 // 47 48 49 50 51 52 53 54 55 56 57 58 59 60
"spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, " "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
// 62 63 64 65 66 67 68 69 // 61 62 63 64 65 66 67 68
"ctm.HoverInitiallyEnabled, ctm.Random, ctm.InteractionPauseTimer, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, " "ctm.HoverInitiallyEnabled, ctm.Random, ctm.InteractionPauseTimer, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, "
// 70 71 72 73 74 75 76 77 // 69 70 71 72 73 74 75 76
"ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, " "ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, "
// 78 79 80 81 82 83 84 // 77 78 79 80 81 82 83
"flags_extra, StaticFlags, StaticFlags2, StaticFlags3, StaticFlags4, StaticFlags5, ScriptName FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId"); "flags_extra, StaticFlags, StaticFlags2, StaticFlags3, StaticFlags4, StaticFlags5, ScriptName FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId");
if (!result) if (!result)
@@ -505,55 +505,54 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
creatureTemplate.unit_class = uint32(fields[30].GetUInt8()); creatureTemplate.unit_class = uint32(fields[30].GetUInt8());
creatureTemplate.unit_flags = fields[31].GetUInt32(); creatureTemplate.unit_flags = fields[31].GetUInt32();
creatureTemplate.unit_flags2 = fields[32].GetUInt32(); creatureTemplate.unit_flags2 = fields[32].GetUInt32();
creatureTemplate.dynamicflags = fields[33].GetUInt32(); creatureTemplate.family = CreatureFamily(uint32(fields[33].GetUInt8()));
creatureTemplate.family = CreatureFamily(uint32(fields[34].GetUInt8())); creatureTemplate.trainer_class = fields[34].GetUInt32();
creatureTemplate.trainer_class = fields[35].GetUInt32(); creatureTemplate.type = uint32(fields[35].GetUInt8());
creatureTemplate.type = uint32(fields[36].GetUInt8()); creatureTemplate.type_flags = fields[36].GetUInt32();
creatureTemplate.type_flags = fields[37].GetUInt32(); creatureTemplate.type_flags2 = fields[37].GetUInt32();
creatureTemplate.type_flags2 = fields[38].GetUInt32(); creatureTemplate.lootid = fields[38].GetUInt32();
creatureTemplate.lootid = fields[39].GetUInt32(); creatureTemplate.pickpocketLootId = fields[39].GetUInt32();
creatureTemplate.pickpocketLootId = fields[40].GetUInt32(); creatureTemplate.SkinLootId = fields[40].GetUInt32();
creatureTemplate.SkinLootId = fields[41].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[42 + i - 1].GetInt16(); creatureTemplate.resistance[i] = fields[41 + i - 1].GetInt16();
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i) for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
creatureTemplate.spells[i] = fields[48 + i].GetUInt32(); creatureTemplate.spells[i] = fields[47 + i].GetUInt32();
creatureTemplate.PetSpellDataId = fields[55].GetUInt32();
creatureTemplate.VehicleId = fields[56].GetUInt32();
creatureTemplate.mingold = fields[57].GetUInt32();
creatureTemplate.maxgold = fields[58].GetUInt32();
creatureTemplate.AIName = fields[59].GetString();
creatureTemplate.MovementType = uint32(fields[60].GetUInt8());
if (!fields[61].IsNull())
creatureTemplate.Movement.HoverInitiallyEnabled = fields[61].GetBool();
creatureTemplate.PetSpellDataId = fields[56].GetUInt32();
creatureTemplate.VehicleId = fields[57].GetUInt32();
creatureTemplate.mingold = fields[58].GetUInt32();
creatureTemplate.maxgold = fields[59].GetUInt32();
creatureTemplate.AIName = fields[60].GetString();
creatureTemplate.MovementType = uint32(fields[61].GetUInt8());
if (!fields[62].IsNull()) if (!fields[62].IsNull())
creatureTemplate.Movement.HoverInitiallyEnabled = fields[62].GetBool(); creatureTemplate.Movement.Random = static_cast<CreatureRandomMovementType>(fields[62].GetUInt8());
if (!fields[63].IsNull()) if (!fields[63].IsNull())
creatureTemplate.Movement.Random = static_cast<CreatureRandomMovementType>(fields[63].GetUInt8()); creatureTemplate.Movement.InteractionPauseTimer = fields[63].GetUInt32();
if (!fields[64].IsNull()) creatureTemplate.HoverHeight = fields[64].GetFloat();
creatureTemplate.Movement.InteractionPauseTimer = fields[64].GetUInt32(); 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.HoverHeight = fields[65].GetFloat(); creatureTemplate.RacialLeader = fields[72].GetBool();
creatureTemplate.ModHealth = fields[66].GetFloat(); creatureTemplate.movementId = fields[73].GetUInt32();
creatureTemplate.ModHealthExtra = fields[67].GetFloat(); creatureTemplate.RegenHealth = fields[74].GetBool();
creatureTemplate.ModMana = fields[68].GetFloat(); creatureTemplate.MechanicImmuneMask = fields[75].GetUInt32();
creatureTemplate.ModManaExtra = fields[69].GetFloat(); creatureTemplate.SpellSchoolImmuneMask = fields[76].GetUInt32();
creatureTemplate.ModArmor = fields[70].GetFloat(); creatureTemplate.flags_extra = fields[77].GetUInt32();
creatureTemplate.ModDamage = fields[71].GetFloat(); creatureTemplate.StaticFlags = CreatureStaticFlagsHolder(CreatureStaticFlags(fields[78].GetUInt32()), CreatureStaticFlags2(fields[79].GetUInt32()),
creatureTemplate.ModExperience = fields[72].GetFloat(); CreatureStaticFlags3(fields[80].GetUInt32()), CreatureStaticFlags4(fields[81].GetUInt32()), CreatureStaticFlags5(fields[82].GetUInt32()));
creatureTemplate.ScriptID = GetScriptId(fields[83].GetCString());
creatureTemplate.RacialLeader = fields[73].GetBool();
creatureTemplate.movementId = fields[74].GetUInt32();
creatureTemplate.RegenHealth = fields[75].GetBool();
creatureTemplate.MechanicImmuneMask = fields[76].GetUInt32();
creatureTemplate.SpellSchoolImmuneMask = fields[77].GetUInt32();
creatureTemplate.flags_extra = fields[78].GetUInt32();
creatureTemplate.StaticFlags = CreatureStaticFlagsHolder(CreatureStaticFlags(fields[79].GetUInt32()), CreatureStaticFlags2(fields[80].GetUInt32()),
CreatureStaticFlags3(fields[81].GetUInt32()), CreatureStaticFlags4(fields[82].GetUInt32()), CreatureStaticFlags5(fields[83].GetUInt32()));
creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString());
} }
void ObjectMgr::LoadCreatureTemplateModels() void ObjectMgr::LoadCreatureTemplateModels()
@@ -1597,7 +1596,7 @@ CreatureModel const* ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, C
return cinfo->GetFirstInvisibleModel(); return cinfo->GetFirstInvisibleModel();
} }
void ObjectMgr::ChooseCreatureFlags(CreatureTemplate const* cInfo, uint32* npcFlags, uint32* unitFlags, uint32* unitFlags2, uint32* dynamicFlags, CreatureStaticFlagsHolder const& staticFlags, CreatureData const* data /*= nullptr*/) void ObjectMgr::ChooseCreatureFlags(CreatureTemplate const* cInfo, uint32* npcFlags, uint32* unitFlags, uint32* unitFlags2, CreatureStaticFlagsHolder const& staticFlags, CreatureData const* data /*= nullptr*/)
{ {
#define ChooseCreatureFlagSource(field) ((data && data->field.has_value()) ? *data->field : cInfo->field) #define ChooseCreatureFlagSource(field) ((data && data->field.has_value()) ? *data->field : cInfo->field)
@@ -1627,11 +1626,6 @@ void ObjectMgr::ChooseCreatureFlags(CreatureTemplate const* cInfo, uint32* npcFl
if (staticFlags.HasFlag(CREATURE_STATIC_FLAG_4_PREVENT_SWIM)) if (staticFlags.HasFlag(CREATURE_STATIC_FLAG_4_PREVENT_SWIM))
*unitFlags2 |= UNIT_FLAG2_AI_WILL_ONLY_SWIM_IF_TARGET_SWIMS; *unitFlags2 |= UNIT_FLAG2_AI_WILL_ONLY_SWIM_IF_TARGET_SWIMS;
} }
if (dynamicFlags)
{
*dynamicFlags = ChooseCreatureFlagSource(dynamicflags);
}
} }
@@ -2056,9 +2050,9 @@ void ObjectMgr::LoadCreatures()
// 0 1 2 3 4 5 6 7 8 9 10 // 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, position_x, position_y, position_z, orientation, modelid, equipment_id, spawntimesecs, wander_distance, " QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, position_x, position_y, position_z, orientation, modelid, equipment_id, spawntimesecs, wander_distance, "
// 11 12 13 14 15 16 17 18 19 20 21 22 // 11 12 13 14 15 16 17 18 19 20 21
"currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, poolSpawnId, creature.npcflag, creature.unit_flags, creature.unit_flags2, creature.dynamicflags, creature.phaseUseFlags, " "currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, poolSpawnId, creature.npcflag, creature.unit_flags, creature.unit_flags2, creature.phaseUseFlags, "
// 23 24 25 26 // 22 23 24 25
"creature.PhaseId, creature.PhaseGroup, creature.terrainSwapMap, creature.ScriptName " "creature.PhaseId, creature.PhaseGroup, creature.terrainSwapMap, creature.ScriptName "
"FROM creature " "FROM creature "
"LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
@@ -2118,13 +2112,11 @@ void ObjectMgr::LoadCreatures()
data.unit_flags = fields[19].GetUInt32(); data.unit_flags = fields[19].GetUInt32();
if (!fields[20].IsNull()) if (!fields[20].IsNull())
data.unit_flags2 = fields[20].GetUInt32(); data.unit_flags2 = fields[20].GetUInt32();
if (!fields[21].IsNull()) data.phaseUseFlags = fields[21].GetUInt8();
data.dynamicflags = fields[21].GetUInt32(); data.phaseId = fields[22].GetUInt32();
data.phaseUseFlags = fields[22].GetUInt8(); data.phaseGroup = fields[23].GetUInt32();
data.phaseId = fields[23].GetUInt32(); data.terrainSwapMap = fields[24].GetInt32();
data.phaseGroup = fields[24].GetUInt32(); data.scriptId = GetScriptId(fields[25].GetString());
data.terrainSwapMap = fields[25].GetInt32();
data.scriptId = GetScriptId(fields[26].GetString());
data.spawnGroupData = GetDefaultSpawnGroup(); data.spawnGroupData = GetDefaultSpawnGroup();
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapId); MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapId);
+1 -1
View File
@@ -1014,7 +1014,7 @@ class TC_GAME_API ObjectMgr
CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId) const; CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId) const;
CreatureModelInfo const* GetCreatureModelRandomGender(CreatureModel* model, CreatureTemplate const* creatureTemplate) const; CreatureModelInfo const* GetCreatureModelRandomGender(CreatureModel* model, CreatureTemplate const* creatureTemplate) const;
static CreatureModel const* ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = nullptr); static CreatureModel const* ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = nullptr);
static void ChooseCreatureFlags(CreatureTemplate const* cInfo, uint32* npcFlags, uint32* unitFlags, uint32* unitFlags2, uint32* dynamicFlags, CreatureStaticFlagsHolder const& staticFlags, CreatureData const* data /*= nullptr*/); static void ChooseCreatureFlags(CreatureTemplate const* cInfo, uint32* npcFlags, uint32* unitFlags, uint32* unitFlags2, CreatureStaticFlagsHolder const& staticFlags, CreatureData const* data /*= nullptr*/);
EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id) const; EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id) const;
CreatureAddon const* GetCreatureAddon(ObjectGuid::LowType lowguid) const; CreatureAddon const* GetCreatureAddon(ObjectGuid::LowType lowguid) const;
GameObjectAddon const* GetGameObjectAddon(ObjectGuid::LowType lowguid) const; GameObjectAddon const* GetGameObjectAddon(ObjectGuid::LowType lowguid) const;