Core/Spells: Implemented SummonPropertiesFlags: UseSummonerFaction & IgnoreSummonerPhase

Port From (https://github.com/TrinityCore/TrinityCore/commit/a832435b9787c1997da87a124ff99bf06251aa07)
This commit is contained in:
hondacrx
2021-11-16 13:23:42 -05:00
parent a7936eb46c
commit 3ab092a655
7 changed files with 101 additions and 84 deletions
+13 -14
View File
@@ -1602,13 +1602,13 @@ namespace Game.Spells
caster = m_originalCaster;
ObjectGuid privateObjectOwner = caster.GetGUID();
if (!properties.Flags.HasAnyFlag(SummonPropFlags.PersonalSpawn | SummonPropFlags.PersonalGroupSpawn))
if (!properties.GetFlags().HasAnyFlag(SummonPropertiesFlags.OnlyVisibleToSummoner | SummonPropertiesFlags.OnlyVisibleToSummonerGroup))
privateObjectOwner = ObjectGuid.Empty;
if (caster.IsPrivateObject())
privateObjectOwner = caster.GetPrivateObjectOwner();
if (properties.Flags.HasAnyFlag(SummonPropFlags.PersonalGroupSpawn))
if (properties.GetFlags().HasFlag(SummonPropertiesFlags.OnlyVisibleToSummonerGroup))
if (caster.IsPlayer() && m_originalCaster.ToPlayer().GetGroup())
privateObjectOwner = caster.ToPlayer().GetGroup().GetGUID();
@@ -1652,7 +1652,7 @@ namespace Game.Spells
case SummonCategory.Wild:
case SummonCategory.Ally:
case SummonCategory.Unk:
if (Convert.ToBoolean(properties.Flags & SummonPropFlags.Unk10))
if (properties.GetFlags().HasFlag(SummonPropertiesFlags.JoinSummonerSpawnGroup))
{
SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
break;
@@ -1730,11 +1730,19 @@ namespace Game.Spells
continue;
if (properties.Control == SummonCategory.Ally)
{
summon.SetOwnerGUID(caster.GetGUID());
summon.SetFaction(caster.GetFaction());
uint faction = properties.Faction;
if (properties.GetFlags().HasFlag(SummonPropertiesFlags.UseSummonerFaction)) // TODO: Determine priority between faction and flag
{
Unit summoner = summon.GetSummoner();
if (summoner != null)
faction = summoner.GetFaction();
}
if (faction != 0)
summon.SetFaction(faction);
ExecuteLogEffectSummonObject(effectInfo.Effect, summon);
}
return;
@@ -1781,12 +1789,6 @@ namespace Game.Spells
args.AddSpellMod(SpellValueMod.BasePoint0, basePoints);
unitCaster.CastSpell(summon, spellId, args);
uint faction = properties.Faction;
if (faction == 0)
faction = unitCaster.GetFaction();
summon.SetFaction(faction);
break;
}
}
@@ -4873,9 +4875,6 @@ namespace Game.Spells
if (summon.HasUnitTypeMask(UnitTypeMask.Guardian))
((Guardian)summon).InitStatsForLevel(level);
if (properties != null && properties.Control == SummonCategory.Ally)
summon.SetFaction(unitCaster.GetFaction());
if (summon.HasUnitTypeMask(UnitTypeMask.Minion) && m_targets.HasDst())
((Minion)summon).SetFollowAngle(unitCaster.GetAbsoluteAngle(summon.GetPosition()));
+1 -1
View File
@@ -2191,7 +2191,7 @@ namespace Game.Entities
var summonProperties = CliDB.SummonPropertiesStorage.LookupByKey(effect.EffectMiscValue[1]);
if (summonProperties != null)
{
if (summonProperties.Slot == (int)SummonSlot.MiniPet && summonProperties.Flags.HasAnyFlag(SummonPropFlags.Companion))
if (summonProperties.Slot == (int)SummonSlot.MiniPet && summonProperties.GetFlags().HasFlag(SummonPropertiesFlags.SummonFromBattlePetJournal))
{
var battlePetSpecies = battlePetSpeciesByCreature.LookupByKey(effect.EffectMiscValue[0]);
if (battlePetSpecies != null)