Core/Creatures: Added db fields to hold creature static flags
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
ALTER TABLE `creature_template_difficulty`
|
||||
ADD `StaticFlags1` int unsigned NOT NULL DEFAULT 0 AFTER `GoldMax`,
|
||||
ADD `StaticFlags2` int unsigned NOT NULL DEFAULT 0 AFTER `StaticFlags1`,
|
||||
ADD `StaticFlags3` int unsigned NOT NULL DEFAULT 0 AFTER `StaticFlags2`,
|
||||
ADD `StaticFlags4` int unsigned NOT NULL DEFAULT 0 AFTER `StaticFlags3`,
|
||||
ADD `StaticFlags5` int unsigned NOT NULL DEFAULT 0 AFTER `StaticFlags4`,
|
||||
ADD `StaticFlags6` int unsigned NOT NULL DEFAULT 0 AFTER `StaticFlags5`,
|
||||
ADD `StaticFlags7` int unsigned NOT NULL DEFAULT 0 AFTER `StaticFlags6`,
|
||||
ADD `StaticFlags8` int unsigned NOT NULL DEFAULT 0 AFTER `StaticFlags7`;
|
||||
@@ -560,6 +560,8 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
|
||||
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||
m_spells[i] = GetCreatureTemplate()->spells[i];
|
||||
|
||||
ApplyAllStaticFlags(m_creatureDifficulty->StaticFlags);
|
||||
|
||||
_staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_NO_XP, creatureInfo->type == CREATURE_TYPE_CRITTER
|
||||
|| IsPet()
|
||||
|| IsTotem()
|
||||
@@ -683,6 +685,12 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
|
||||
return true;
|
||||
}
|
||||
|
||||
void Creature::ApplyAllStaticFlags(CreatureStaticFlagsHolder const& flags)
|
||||
{
|
||||
// Apply all other side effects of flag changes
|
||||
SetTemplateRooted(flags.HasFlag(CREATURE_STATIC_FLAG_SESSILE));
|
||||
}
|
||||
|
||||
void Creature::Update(uint32 diff)
|
||||
{
|
||||
if (IsAIEnabled() && m_triggerJustAppeared && m_deathState != DEAD)
|
||||
|
||||
@@ -511,6 +511,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
time_t _lastDamagedTime; // Part of Evade mechanics
|
||||
CreatureTextRepeatGroup m_textRepeat;
|
||||
|
||||
void ApplyAllStaticFlags(CreatureStaticFlagsHolder const& flags);
|
||||
|
||||
CreatureStaticFlagsHolder _staticFlags;
|
||||
|
||||
// Regenerate health
|
||||
|
||||
@@ -477,6 +477,8 @@ struct CreatureDifficulty
|
||||
uint32 GoldMin;
|
||||
uint32 GoldMax;
|
||||
|
||||
CreatureStaticFlagsHolder StaticFlags;
|
||||
|
||||
// Helpers
|
||||
int32 GetHealthScalingExpansion() const
|
||||
{
|
||||
|
||||
@@ -922,8 +922,15 @@ void ObjectMgr::LoadCreatureTemplateDifficulty()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
QueryResult result = WorldDatabase.Query("SELECT Entry, DifficultyID, LevelScalingDeltaMin, LevelScalingDeltaMax, ContentTuningID, HealthScalingExpansion, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, CreatureDifficultyID, TypeFlags, TypeFlags2, LootID, PickPocketLootID, SkinLootID, GoldMin, GoldMax FROM creature_template_difficulty ORDER BY Entry");
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult result = WorldDatabase.Query("SELECT Entry, DifficultyID, LevelScalingDeltaMin, LevelScalingDeltaMax, ContentTuningID, HealthScalingExpansion, "
|
||||
// 6 7 8 9 10 11 12
|
||||
"HealthModifier, ManaModifier, ArmorModifier, DamageModifier, CreatureDifficultyID, TypeFlags, TypeFlags2, "
|
||||
// 13 14 15 16 17
|
||||
"LootID, PickPocketLootID, SkinLootID, GoldMin, GoldMax,"
|
||||
// 18 19 20 21 22 23 24 25
|
||||
"StaticFlags1, StaticFlags2, StaticFlags3, StaticFlags4, StaticFlags5, StaticFlags6, StaticFlags7, StaticFlags8 "
|
||||
"FROM creature_template_difficulty ORDER BY Entry");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -963,6 +970,9 @@ void ObjectMgr::LoadCreatureTemplateDifficulty()
|
||||
creatureDifficulty.SkinLootID = fields[15].GetUInt32();
|
||||
creatureDifficulty.GoldMin = fields[16].GetUInt32();
|
||||
creatureDifficulty.GoldMax = fields[17].GetUInt32();
|
||||
creatureDifficulty.StaticFlags = { CreatureStaticFlags(fields[18].GetUInt32()), CreatureStaticFlags2(fields[19].GetUInt32()),
|
||||
CreatureStaticFlags3(fields[20].GetUInt32()), CreatureStaticFlags4(fields[21].GetUInt32()), CreatureStaticFlags5(fields[22].GetUInt32()),
|
||||
CreatureStaticFlags6(fields[23].GetUInt32()), CreatureStaticFlags7(fields[24].GetUInt32()), CreatureStaticFlags8(fields[25].GetUInt32()) };
|
||||
|
||||
// TODO: Check if this still applies
|
||||
creatureDifficulty.DamageModifier *= Creature::_GetDamageMod(itr->second.rank);
|
||||
|
||||
Reference in New Issue
Block a user