Core/Creatures: Allow toggling CREATURE_STATIC_FLAG_4_TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS
Port From (https://github.com/TrinityCore/TrinityCore/commit/0139ec41bb3e2348b56fad2b4182b4a7a0494ac9)
This commit is contained in:
@@ -286,7 +286,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
// TODO: migrate these in DB
|
// TODO: migrate these in DB
|
||||||
_staticFlags.ApplyFlag(CreatureStaticFlags2.AllowMountedCombat, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.AllowMountedCombat));
|
_staticFlags.ApplyFlag(CreatureStaticFlags2.AllowMountedCombat, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.AllowMountedCombat));
|
||||||
_staticFlags.ApplyFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.TreatAsRaidUnit));
|
SetTreatAsRaidUnit(GetCreatureDifficulty().TypeFlags.HasAnyFlag(CreatureTypeFlags.TreatAsRaidUnit));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3398,6 +3398,9 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool CanIgnoreLineOfSightWhenCastingOnMe() { return _staticFlags.HasFlag(CreatureStaticFlags4.IgnoreLosWhenCastingOnMe); }
|
public bool CanIgnoreLineOfSightWhenCastingOnMe() { return _staticFlags.HasFlag(CreatureStaticFlags4.IgnoreLosWhenCastingOnMe); }
|
||||||
|
|
||||||
|
public bool IsTreatedAsRaidUnit() { return _staticFlags.HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells); }
|
||||||
|
public void SetTreatAsRaidUnit(bool treatAsRaidUnit) { _staticFlags.ApplyFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells, treatAsRaidUnit); }
|
||||||
|
|
||||||
public sbyte GetOriginalEquipmentId() { return m_originalEquipmentId; }
|
public sbyte GetOriginalEquipmentId() { return m_originalEquipmentId; }
|
||||||
public byte GetCurrentEquipmentId() { return m_equipmentId; }
|
public byte GetCurrentEquipmentId() { return m_equipmentId; }
|
||||||
public void SetCurrentEquipmentId(byte id) { m_equipmentId = id; }
|
public void SetCurrentEquipmentId(byte id) { m_equipmentId = id; }
|
||||||
|
|||||||
@@ -2773,7 +2773,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// can't assist non-friendly targets
|
// can't assist non-friendly targets
|
||||||
if (GetReactionTo(target) < ReputationRank.Neutral && target.GetReactionTo(this) < ReputationRank.Neutral && (!IsCreature() || !ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)))
|
if (GetReactionTo(target) < ReputationRank.Neutral && target.GetReactionTo(this) < ReputationRank.Neutral && (!IsCreature() || !ToCreature().IsTreatedAsRaidUnit()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// PvP case
|
// PvP case
|
||||||
@@ -2809,7 +2809,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
Creature creatureTarget = target.ToCreature();
|
Creature creatureTarget = target.ToCreature();
|
||||||
if (creatureTarget != null)
|
if (creatureTarget != null)
|
||||||
return creatureTarget.HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells) || creatureTarget.GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.CanAssist);
|
return creatureTarget.IsTreatedAsRaidUnit() || creatureTarget.GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.CanAssist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2316,8 +2316,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Player))
|
if (u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Player))
|
||||||
return u1.ToPlayer().IsInSameGroupWith(u2.ToPlayer());
|
return u1.ToPlayer().IsInSameGroupWith(u2.ToPlayer());
|
||||||
else if ((u2.IsTypeId(TypeId.Player) && u1.IsTypeId(TypeId.Unit) && u1.ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)) ||
|
else if ((u2.IsTypeId(TypeId.Player) && u1.IsTypeId(TypeId.Unit) && u1.ToCreature().IsTreatedAsRaidUnit()) ||
|
||||||
(u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Unit) && u2.ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)))
|
(u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Unit) && u2.ToCreature().IsTreatedAsRaidUnit()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return u1.GetTypeId() == TypeId.Unit && u2.GetTypeId() == TypeId.Unit && u1.GetFaction() == u2.GetFaction();
|
return u1.GetTypeId() == TypeId.Unit && u2.GetTypeId() == TypeId.Unit && u1.GetFaction() == u2.GetFaction();
|
||||||
@@ -2335,8 +2335,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Player))
|
if (u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Player))
|
||||||
return u1.ToPlayer().IsInSameRaidWith(u2.ToPlayer());
|
return u1.ToPlayer().IsInSameRaidWith(u2.ToPlayer());
|
||||||
else if ((u2.IsTypeId(TypeId.Player) && u1.IsTypeId(TypeId.Unit) && u1.ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)) ||
|
else if ((u2.IsTypeId(TypeId.Player) && u1.IsTypeId(TypeId.Unit) && u1.ToCreature().IsTreatedAsRaidUnit()) ||
|
||||||
(u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Unit) && u2.ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)))
|
(u1.IsTypeId(TypeId.Player) && u2.IsTypeId(TypeId.Unit) && u2.ToCreature().IsTreatedAsRaidUnit()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// else u1.GetTypeId() == u2.GetTypeId() == TYPEID_UNIT
|
// else u1.GetTypeId() == u2.GetTypeId() == TYPEID_UNIT
|
||||||
|
|||||||
@@ -1055,7 +1055,7 @@ namespace Game.Scripting
|
|||||||
if (prioritizeGroupMembersOf != null && (!target.IsUnit() || target.ToUnit().IsInRaidWith(prioritizeGroupMembersOf)))
|
if (prioritizeGroupMembersOf != null && (!target.IsUnit() || target.ToUnit().IsInRaidWith(prioritizeGroupMembersOf)))
|
||||||
negativePoints |= 1 << NOT_GROUPED;
|
negativePoints |= 1 << NOT_GROUPED;
|
||||||
|
|
||||||
if (prioritizePlayers && !target.IsPlayer() && (!target.IsCreature() || !target.ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)))
|
if (prioritizePlayers && !target.IsPlayer() && (!target.IsCreature() || !target.ToCreature().IsTreatedAsRaidUnit()))
|
||||||
negativePoints |= 1 << NOT_PLAYER;
|
negativePoints |= 1 << NOT_PLAYER;
|
||||||
|
|
||||||
if (!target.IsUnit() || target.ToUnit().IsFullHealth())
|
if (!target.IsUnit() || target.ToUnit().IsFullHealth())
|
||||||
|
|||||||
Reference in New Issue
Block a user