From cb6ce1302bfea74ffbc95da7283386fdafb89dae Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 7 Apr 2020 18:33:13 +0200 Subject: [PATCH] Core/Misc: Defined new summon properties titles --- src/server/game/AI/CreatureAI.cpp | 12 ++++---- src/server/game/DataStores/DBCEnums.h | 3 +- src/server/game/DataStores/DBCStructure.h | 2 +- .../Entities/Creature/TemporarySummon.cpp | 25 ++++++++-------- src/server/game/Entities/Object/Object.cpp | 18 +++++------ .../game/Entities/Transport/Transport.cpp | 18 +++++------ src/server/game/Entities/Unit/Unit.cpp | 4 +-- src/server/game/Miscellaneous/SharedDefines.h | 30 +++++++++---------- src/server/game/Spells/SpellEffects.cpp | 20 ++++++------- src/server/game/Spells/SpellMgr.cpp | 6 ++-- 10 files changed, 70 insertions(+), 68 deletions(-) diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 8ac0487590a..af4007fa6b4 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -208,13 +208,13 @@ static bool ShouldFollowOnSpawn(SummonPropertiesEntry const* properties) if (properties->Flags & SUMMON_PROP_FLAG_UNK14) return false; - switch (properties->Title) + switch (SummonTitle(properties->Title)) { - case SUMMON_TYPE_PET: - case SUMMON_TYPE_GUARDIAN: - case SUMMON_TYPE_GUARDIAN2: - case SUMMON_TYPE_MINION: - case SUMMON_TYPE_MINIPET: + case SummonTitle::Pet: + case SummonTitle::Guardian: + case SummonTitle::Runeblade: + case SummonTitle::Minion: + case SummonTitle::Companion: return true; default: return false; diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index c067d7befc1..c9203417680 100644 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -593,7 +593,8 @@ enum SummonPropFlags SUMMON_PROP_FLAG_UNK18 = 0x00020000, SUMMON_PROP_FLAG_UNK19 = 0x00040000, SUMMON_PROP_FLAG_UNK20 = 0x00080000, - SUMMON_PROP_FLAG_TOTEM = 0x00100000 // Totems + SUMMON_PROP_FLAG_TOTEM = 0x00100000, // Totems + SUMMON_PROP_FLAG_COMPANION = 0x00200000 }; enum VehicleSeatFlags diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 029ff2e3b3a..0f5c736a6a7 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -2386,7 +2386,7 @@ struct SummonPropertiesEntry uint32 ID; // 0 uint32 Control; // 1, 0 - can't be controlled?, 1 - something guardian?, 2 - pet?, 3 - something controllable?, 4 - taxi/mount? uint32 Faction; // 2, 14 rows > 0 - uint32 Title; // 3, see enum + int32 Title; // 3, see enum int32 Slot; // 4, 0-6 uint32 Flags; // 5 }; diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index e048f4fde9b..d9f33d3bb33 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -199,17 +199,18 @@ void TempSummon::InitStats(uint32 duration) if (!m_Properties->Faction) SetFaction(owner->GetFaction()); - switch (m_Properties->Title) + switch (SummonTitle(m_Properties->Title)) { - case SUMMON_TYPE_PET: - case SUMMON_TYPE_GUARDIAN: - case SUMMON_TYPE_GUARDIAN2: - case SUMMON_TYPE_MINION: - case SUMMON_TYPE_VEHICLE: - case SUMMON_TYPE_VEHICLE2: - case SUMMON_TYPE_LIGHTWELL: - case SUMMON_TYPE_TOTEM: - case SUMMON_TYPE_MINIPET: + + case SummonTitle::Pet: + case SummonTitle::Guardian: + case SummonTitle::Runeblade: + case SummonTitle::Minion: + case SummonTitle::Vehicle: + case SummonTitle::Mount: + case SummonTitle::Lightwell: + case SummonTitle::Totem: + case SummonTitle::Companion: break; default: SetOwnerGUID(owner->GetGUID()); @@ -303,7 +304,7 @@ Minion::Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorl m_unitTypeMask |= UNIT_MASK_MINION; m_followAngle = PET_FOLLOW_ANGLE; - if (properties && properties->Title == SUMMON_TYPE_MINIPET) + if (properties && SummonTitle(properties->Title) == SummonTitle::Companion) m_followAngle = COMPANION_FOLLOW_ANGLE; /// @todo: Find correct way @@ -356,7 +357,7 @@ Guardian::Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool is { memset(m_statFromOwner, 0, sizeof(float)*MAX_STATS); m_unitTypeMask |= UNIT_MASK_GUARDIAN; - if (properties && properties->Title == SUMMON_TYPE_PET) + if (properties && SummonTitle(properties->Title) == SummonTitle::Pet) { m_unitTypeMask |= UNIT_MASK_CONTROLABLE_GUARDIAN; InitCharmInfo(); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index c678e6f4ec3..3ada098954b 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2056,22 +2056,22 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert case SUMMON_CATEGORY_ALLY: case SUMMON_CATEGORY_UNK: { - switch (properties->Title) + switch (SummonTitle(properties->Title)) { - case SUMMON_TYPE_MINION: - case SUMMON_TYPE_GUARDIAN: - case SUMMON_TYPE_GUARDIAN2: + case SummonTitle::Minion: + case SummonTitle::Guardian: + case SummonTitle::Runeblade: mask = UNIT_MASK_GUARDIAN; break; - case SUMMON_TYPE_TOTEM: - case SUMMON_TYPE_LIGHTWELL: + case SummonTitle::Totem: + case SummonTitle::Lightwell: mask = UNIT_MASK_TOTEM; break; - case SUMMON_TYPE_VEHICLE: - case SUMMON_TYPE_VEHICLE2: + case SummonTitle::Vehicle: + case SummonTitle::Mount: mask = UNIT_MASK_SUMMON; break; - case SUMMON_TYPE_MINIPET: + case SummonTitle::Companion: mask = UNIT_MASK_MINION; break; default: diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 1d1389c9343..bb646645332 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -870,22 +870,22 @@ TempSummon* MapTransport::SummonPassenger(uint32 entry, Position const& pos, Tem case SUMMON_CATEGORY_ALLY: case SUMMON_CATEGORY_UNK: { - switch (properties->Title) + switch (SummonTitle(properties->Title)) { - case SUMMON_TYPE_MINION: - case SUMMON_TYPE_GUARDIAN: - case SUMMON_TYPE_GUARDIAN2: + case SummonTitle::Minion: + case SummonTitle::Guardian: + case SummonTitle::Runeblade: mask = UNIT_MASK_GUARDIAN; break; - case SUMMON_TYPE_TOTEM: - case SUMMON_TYPE_LIGHTWELL: + case SummonTitle::Totem: + case SummonTitle::Lightwell: mask = UNIT_MASK_TOTEM; break; - case SUMMON_TYPE_VEHICLE: - case SUMMON_TYPE_VEHICLE2: + case SummonTitle::Vehicle: + case SummonTitle::Mount: mask = UNIT_MASK_SUMMON; break; - case SUMMON_TYPE_MINIPET: + case SummonTitle::Companion: mask = UNIT_MASK_MINION; break; default: diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index dc5c64b72bc..52a33e33bf1 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6156,7 +6156,7 @@ void Unit::SetMinion(Minion* minion, bool apply) } } - if (minion->m_Properties && minion->m_Properties->Title == SUMMON_TYPE_MINIPET) + if (minion->m_Properties && SummonTitle(minion->m_Properties->Title) == SummonTitle::Companion) SetCritterGUID(minion->GetGUID()); // PvP, FFAPvP @@ -6187,7 +6187,7 @@ void Unit::SetMinion(Minion* minion, bool apply) m_Controlled.erase(minion); - if (minion->m_Properties && minion->m_Properties->Title == SUMMON_TYPE_MINIPET) + if (minion->m_Properties && SummonTitle(minion->m_Properties->Title) == SummonTitle::Companion) if (GetCritterGUID() == minion->GetGUID()) SetCritterGUID(ObjectGuid::Empty); diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 741074340a2..4aa46379a47 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -3776,22 +3776,22 @@ enum SummonCategory // uses this category }; -enum SummonType +enum class SummonTitle : int32 { - SUMMON_TYPE_NONE = 0, - SUMMON_TYPE_PET = 1, - SUMMON_TYPE_GUARDIAN = 2, - SUMMON_TYPE_MINION = 3, - SUMMON_TYPE_TOTEM = 4, - SUMMON_TYPE_MINIPET = 5, - SUMMON_TYPE_GUARDIAN2 = 6, - SUMMON_TYPE_WILD2 = 7, - SUMMON_TYPE_WILD3 = 8, // Related to phases and DK prequest line (3.3.5a) - SUMMON_TYPE_VEHICLE = 9, - SUMMON_TYPE_VEHICLE2 = 10, // Oculus and Argent Tournament vehicles (3.3.5a) - SUMMON_TYPE_LIGHTWELL = 11, - SUMMON_TYPE_JEEVES = 12, - SUMMON_TYPE_UNK13 = 13 + None = 0, + Pet = 1, + Guardian = 2, + Minion = 3, + Totem = 4, + Companion = 5, + Runeblade = 6, + Construct = 7, + Opponent = 8, // Related to phases and DK prequest line (3.3.5a) + Vehicle = 9, + Mount = 10, // Oculus and Argent Tournament vehicles (3.3.5a) + Lightwell = 11, + Butler = 12, + aka = 13 }; enum EventId diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 73664deacef..e164b62cdc7 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1875,21 +1875,21 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) SummonGuardian(effIndex, entry, properties, numSummons, personalSpawn); break; } - switch (properties->Title) + switch (SummonTitle(properties->Title)) { - case SUMMON_TYPE_PET: - case SUMMON_TYPE_GUARDIAN: - case SUMMON_TYPE_GUARDIAN2: - case SUMMON_TYPE_MINION: + case SummonTitle::Pet: + case SummonTitle::Guardian: + case SummonTitle::Runeblade: + case SummonTitle::Minion: SummonGuardian(effIndex, entry, properties, numSummons, personalSpawn); break; // Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE) - case SUMMON_TYPE_VEHICLE: - case SUMMON_TYPE_VEHICLE2: + case SummonTitle::Vehicle: + case SummonTitle::Mount: summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn); break; - case SUMMON_TYPE_LIGHTWELL: - case SUMMON_TYPE_TOTEM: + case SummonTitle::Lightwell: + case SummonTitle::Totem: { summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn); if (!summon || !summon->IsTotem()) @@ -1906,7 +1906,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) } break; } - case SUMMON_TYPE_MINIPET: + case SummonTitle::Companion: { summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn); if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION)) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index e9a99f80886..c678ba5b7f4 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -5743,11 +5743,11 @@ void SpellMgr::LoadSpellInfoCorrections() } if (SummonPropertiesEntry* properties = const_cast(sSummonPropertiesStore.LookupEntry(121))) - properties->Title = SUMMON_TYPE_TOTEM; + properties->Title = AsUnderlyingType(SummonTitle::Totem); if (SummonPropertiesEntry* properties = const_cast(sSummonPropertiesStore.LookupEntry(647))) // 52893 - properties->Title = SUMMON_TYPE_TOTEM; + properties->Title = AsUnderlyingType(SummonTitle::Totem); if (SummonPropertiesEntry* properties = const_cast(sSummonPropertiesStore.LookupEntry(3069))) // Wild Mushroom - properties->Title = SUMMON_TYPE_MINION; + properties->Title = AsUnderlyingType(SummonTitle::Minion); if (SummonPropertiesEntry* properties = const_cast(sSummonPropertiesStore.LookupEntry(628))) // Hungry Plaguehound properties->Control = SUMMON_CATEGORY_PET;