mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Implemented SummonPropertiesFlags: UseSummonerFaction & IgnoreSummonerPhase (#27273)
This commit is contained in:
@@ -3582,6 +3582,8 @@ struct SummonPropertiesEntry
|
||||
int32 Title;
|
||||
int32 Slot;
|
||||
int32 Flags;
|
||||
|
||||
EnumFlag<SummonPropertiesFlags> GetFlags() const { return static_cast<SummonPropertiesFlags>(Flags); }
|
||||
};
|
||||
|
||||
#define TACTKEY_SIZE 16
|
||||
|
||||
@@ -1536,34 +1536,45 @@ enum SummonPropType
|
||||
SUMMON_PROP_TYPE_LASHTAIL = 13 // Lashtail Hatchling, 1 spell in 4.2.2
|
||||
};
|
||||
|
||||
// SummonProperties.dbc, col 5
|
||||
enum SummonPropFlags
|
||||
enum class SummonPropertiesFlags : uint32
|
||||
{
|
||||
SUMMON_PROP_FLAG_NONE = 0x00000000, // 1342 spells in 3.0.3
|
||||
SUMMON_PROP_FLAG_UNK1 = 0x00000001, // 75 spells in 3.0.3, something unfriendly
|
||||
SUMMON_PROP_FLAG_UNK2 = 0x00000002, // 616 spells in 3.0.3, something friendly
|
||||
SUMMON_PROP_FLAG_UNK3 = 0x00000004, // 22 spells in 3.0.3, no idea...
|
||||
SUMMON_PROP_FLAG_UNK4 = 0x00000008, // 49 spells in 3.0.3, some mounts
|
||||
SUMMON_PROP_FLAG_PERSONAL_SPAWN = 0x00000010, // Only Visible to Summoner
|
||||
SUMMON_PROP_FLAG_UNK6 = 0x00000020, // 0 spells in 3.3.5, unused
|
||||
SUMMON_PROP_FLAG_UNK7 = 0x00000040, // 12 spells in 3.0.3, no idea
|
||||
SUMMON_PROP_FLAG_UNK8 = 0x00000080, // 4 spells in 3.0.3, no idea
|
||||
SUMMON_PROP_FLAG_UNK9 = 0x00000100, // 51 spells in 3.0.3, no idea, many quest related
|
||||
SUMMON_PROP_FLAG_UNK10 = 0x00000200, // 51 spells in 3.0.3, something defensive
|
||||
SUMMON_PROP_FLAG_UNK11 = 0x00000400, // 3 spells, requires something near?
|
||||
SUMMON_PROP_FLAG_UNK12 = 0x00000800, // 30 spells in 3.0.3, no idea
|
||||
SUMMON_PROP_FLAG_UNK13 = 0x00001000, // Lightwell, Jeeves, Gnomish Alarm-o-bot, Build vehicles(wintergrasp)
|
||||
SUMMON_PROP_FLAG_UNK14 = 0x00002000, // Guides, player follows
|
||||
SUMMON_PROP_FLAG_UNK15 = 0x00004000, // Force of Nature, Shadowfiend, Feral Spirit, Summon Water Elemental
|
||||
SUMMON_PROP_FLAG_UNK16 = 0x00008000, // Light/Dark Bullet, Soul/Fiery Consumption, Twisted Visage, Twilight Whelp. Phase related?
|
||||
SUMMON_PROP_FLAG_PERSONAL_GROUP_SPAWN = 0x00010000, // Only Visible to Summoner's Group
|
||||
SUMMON_PROP_FLAG_UNK18 = 0x00020000,
|
||||
SUMMON_PROP_FLAG_UNK19 = 0x00040000,
|
||||
SUMMON_PROP_FLAG_UNK20 = 0x00080000,
|
||||
SUMMON_PROP_FLAG_UNK21 = 0x00100000, // Totems
|
||||
SUMMON_PROP_FLAG_COMPANION = 0x00200000
|
||||
None = 0x00000000,
|
||||
AttackSummoner = 0x00000001, // NYI
|
||||
HelpWhenSummonedInCombat = 0x00000002, // NYI
|
||||
UseLevelOffset = 0x00000004, // NYI
|
||||
DespawnOnSummonerDeath = 0x00000008, // NYI
|
||||
OnlyVisibleToSummoner = 0x00000010,
|
||||
CannotDismissPet = 0x00000020, // NYI
|
||||
UseDemonTimeout = 0x00000040, // NYI
|
||||
UnlimitedSummons = 0x00000080, // NYI
|
||||
UseCreatureLevel = 0x00000100, // NYI
|
||||
JoinSummonerSpawnGroup = 0x00000200, // NYI
|
||||
DoNotToggle = 0x00000400, // NYI
|
||||
DespawnWhenExpired = 0x00000800, // NYI
|
||||
UseSummonerFaction = 0x00001000,
|
||||
DoNotFollowMountedSummoner = 0x00002000, // NYI
|
||||
SavePetAutocast = 0x00004000, // NYI
|
||||
IgnoreSummonerPhase = 0x00008000, // Wild Only
|
||||
OnlyVisibleToSummonerGroup = 0x00010000,
|
||||
DespawnOnSummonerLogout = 0x00020000, // NYI
|
||||
CastRideVehicleSpellOnSummoner = 0x00040000, // NYI
|
||||
GuardianActsLikePet = 0x00080000, // NYI
|
||||
DontSnapSessileToGround = 0x00100000, // NYI
|
||||
SummonFromBattlePetJournal = 0x00200000, // NYI
|
||||
UnitClutter = 0x00400000, // NYI
|
||||
DefaultNameColor = 0x00800000, // NYI
|
||||
UseOwnInvisibilityDetection = 0x01000000, // NYI. Ignore Owner's Invisibility Detection
|
||||
DespawnWhenReplaced = 0x02000000, // NYI. Totem Slots Only
|
||||
DespawnWhenTeleportingOutOfRange = 0x04000000, // NYI
|
||||
SummonedAtGroupFormationPosition = 0x08000000, // NYI
|
||||
DontDespawnOnSummonerDeath = 0x10000000, // NYI
|
||||
UseTitleAsCreatureName = 0x20000000, // NYI
|
||||
AttackableBySummoner = 0x40000000, // NYI
|
||||
DontDismissWhenEncounterIsAborted = 0x80000000 // NYI
|
||||
};
|
||||
|
||||
DEFINE_ENUM_FLAG(SummonPropertiesFlags);
|
||||
|
||||
#define MAX_TALENT_TIERS 7
|
||||
#define MAX_TALENT_COLUMNS 3
|
||||
#define MAX_PVP_TALENT_SLOTS 4
|
||||
|
||||
@@ -171,7 +171,6 @@ void TempSummon::InitStats(uint32 duration)
|
||||
|
||||
if (owner && IsTrigger() && m_spells[0])
|
||||
{
|
||||
SetFaction(owner->GetFaction());
|
||||
SetLevel(owner->getLevel());
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
m_ControlledByPlayer = true;
|
||||
@@ -195,10 +194,13 @@ void TempSummon::InitStats(uint32 duration)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Properties->Faction)
|
||||
SetFaction(m_Properties->Faction);
|
||||
else if (IsVehicle() && owner) // properties should be vehicle
|
||||
SetFaction(owner->GetFaction());
|
||||
uint32 faction = m_Properties->Faction;
|
||||
if (m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::UseSummonerFaction)) // TODO: Determine priority between faction and flag
|
||||
if (owner)
|
||||
faction = owner->GetFaction();
|
||||
|
||||
if (faction)
|
||||
SetFaction(faction);
|
||||
}
|
||||
|
||||
void TempSummon::InitSummon()
|
||||
@@ -291,7 +293,7 @@ void Minion::InitStats(uint32 duration)
|
||||
SetReactState(REACT_PASSIVE);
|
||||
|
||||
SetCreatorGUID(GetOwner()->GetGUID());
|
||||
SetFaction(GetOwner()->GetFaction());
|
||||
SetFaction(GetOwner()->GetFaction()); // TODO: Is this correct? Overwrite the use of SummonPropertiesFlags::UseSummonerFaction
|
||||
|
||||
GetOwner()->SetMinion(this, true);
|
||||
}
|
||||
|
||||
@@ -1703,7 +1703,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
mask = UNIT_MASK_MINION;
|
||||
break;
|
||||
default:
|
||||
if (properties->Flags & 512) // Mirror Image, Summon Gargoyle
|
||||
if (properties->GetFlags().HasFlag(SummonPropertiesFlags::JoinSummonerSpawnGroup))
|
||||
mask = UNIT_MASK_GUARDIAN;
|
||||
break;
|
||||
}
|
||||
@@ -1740,8 +1740,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Set the summon to the summoner's phase
|
||||
if (summoner)
|
||||
if (summoner && !(properties && properties->GetFlags().HasFlag(SummonPropertiesFlags::IgnoreSummonerPhase)))
|
||||
PhasingHandler::InheritPhaseShift(summon, summoner);
|
||||
|
||||
summon->SetCreatedBySpell(spellId);
|
||||
|
||||
@@ -431,7 +431,7 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu
|
||||
mask = UNIT_MASK_MINION;
|
||||
break;
|
||||
default:
|
||||
if (properties->Flags & 512) // Mirror Image, Summon Gargoyle
|
||||
if (properties->GetFlags().HasFlag(SummonPropertiesFlags::JoinSummonerSpawnGroup)) // Mirror Image, Summon Gargoyle
|
||||
mask = UNIT_MASK_GUARDIAN;
|
||||
break;
|
||||
}
|
||||
@@ -472,7 +472,11 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PhasingHandler::InheritPhaseShift(summon, summoner ? static_cast<WorldObject*>(summoner) : static_cast<WorldObject*>(this));
|
||||
WorldObject* phaseShiftOwner = this;
|
||||
if (summoner && !(properties && properties->GetFlags().HasFlag(SummonPropertiesFlags::IgnoreSummonerPhase)))
|
||||
phaseShiftOwner = summoner;
|
||||
|
||||
PhasingHandler::InheritPhaseShift(summon, phaseShiftOwner);
|
||||
|
||||
summon->SetCreatedBySpell(spellId);
|
||||
|
||||
|
||||
@@ -1922,13 +1922,13 @@ void Spell::EffectSummonType()
|
||||
|
||||
ObjectGuid privateObjectOwner = [&]()
|
||||
{
|
||||
if (!(properties->Flags & (SUMMON_PROP_FLAG_PERSONAL_SPAWN | SUMMON_PROP_FLAG_PERSONAL_GROUP_SPAWN)))
|
||||
if (!(properties->GetFlags().HasFlag(SummonPropertiesFlags::OnlyVisibleToSummoner | SummonPropertiesFlags::OnlyVisibleToSummonerGroup)))
|
||||
return ObjectGuid::Empty;
|
||||
|
||||
if (caster->IsPrivateObject())
|
||||
return caster->GetPrivateObjectOwner();
|
||||
|
||||
if (properties->Flags & SUMMON_PROP_FLAG_PERSONAL_GROUP_SPAWN)
|
||||
if (properties->GetFlags().HasFlag(SummonPropertiesFlags::OnlyVisibleToSummonerGroup))
|
||||
if (caster->IsPlayer() && m_originalCaster->ToPlayer()->GetGroup())
|
||||
return caster->ToPlayer()->GetGroup()->GetGUID();
|
||||
|
||||
@@ -1976,7 +1976,7 @@ void Spell::EffectSummonType()
|
||||
case SUMMON_CATEGORY_ALLY:
|
||||
case SUMMON_CATEGORY_UNK:
|
||||
{
|
||||
if (properties->Flags & 512)
|
||||
if (properties->GetFlags().HasFlag(SummonPropertiesFlags::JoinSummonerSpawnGroup))
|
||||
{
|
||||
SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
|
||||
break;
|
||||
@@ -2054,10 +2054,15 @@ void Spell::EffectSummonType()
|
||||
continue;
|
||||
|
||||
if (properties->Control == SUMMON_CATEGORY_ALLY)
|
||||
{
|
||||
summon->SetOwnerGUID(caster->GetGUID());
|
||||
summon->SetFaction(caster->GetFaction());
|
||||
}
|
||||
|
||||
uint32 faction = properties->Faction;
|
||||
if (properties->GetFlags().HasFlag(SummonPropertiesFlags::UseSummonerFaction)) // TODO: Determine priority between faction and flag
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
faction = summoner->GetFaction();
|
||||
|
||||
if (faction)
|
||||
summon->SetFaction(faction);
|
||||
|
||||
ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), summon);
|
||||
}
|
||||
@@ -2106,12 +2111,6 @@ void Spell::EffectSummonType()
|
||||
args.AddSpellMod(SPELLVALUE_BASE_POINT0, basePoints);
|
||||
|
||||
unitCaster->CastSpell(summon, spellId, args);
|
||||
|
||||
uint32 faction = properties->Faction;
|
||||
if (!faction)
|
||||
faction = unitCaster->GetFaction();
|
||||
|
||||
summon->SetFaction(faction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5134,9 +5133,6 @@ void Spell::SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPr
|
||||
if (summon->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
||||
((Guardian*)summon)->InitStatsForLevel(level);
|
||||
|
||||
if (properties && properties->Control == SUMMON_CATEGORY_ALLY)
|
||||
summon->SetFaction(unitCaster->GetFaction());
|
||||
|
||||
if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && m_targets.HasDst())
|
||||
((Minion*)summon)->SetFollowAngle(unitCaster->GetAbsoluteAngle(summon));
|
||||
|
||||
|
||||
@@ -2501,7 +2501,7 @@ void SpellMgr::LoadSpellInfoStore()
|
||||
|
||||
if (effect->Effect == SPELL_EFFECT_SUMMON)
|
||||
if (SummonPropertiesEntry const* summonProperties = sSummonPropertiesStore.LookupEntry(effect->EffectMiscValue[1]))
|
||||
if (summonProperties->Slot == SUMMON_SLOT_MINIPET && summonProperties->Flags & SUMMON_PROP_FLAG_COMPANION)
|
||||
if (summonProperties->Slot == SUMMON_SLOT_MINIPET && summonProperties->GetFlags().HasFlag(SummonPropertiesFlags::SummonFromBattlePetJournal))
|
||||
if (BattlePetSpeciesEntry const* battlePetSpecies = Trinity::Containers::MapGetValuePtr(battlePetSpeciesByCreature, effect->EffectMiscValue[0]))
|
||||
mBattlePets[effect->SpellID] = battlePetSpecies;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user