Core/GameObject: Added additional checks for GAMEOBJECT_TYPE_NEW_FLAG and GAMEOBJECT_TYPE_NEW_FLAG_DROP for potential exploits / lag issues

Port From (https://github.com/TrinityCore/TrinityCore/commit/28c5d71b284a19657a602590cc6fcc2f1746b124)
This commit is contained in:
hondacrx
2023-09-14 04:43:15 -04:00
parent 7e4c0f3aa3
commit 165f2d7f9b
@@ -2364,6 +2364,13 @@ namespace Game.Entities
if (!user.IsPlayer())
return;
GameObjectType.NewFlag newFlag = (GameObjectType.NewFlag)m_goTypeImpl;
if (newFlag == null)
return;
if (newFlag.GetState() != FlagState.InBase)
return;
spellId = info.NewFlag.pickupSpell;
spellCaster = null;
break;
@@ -2382,6 +2389,13 @@ namespace Game.Entities
{
if (owner.GetGoType() == GameObjectTypes.NewFlag)
{
GameObjectType.NewFlag newFlag = (GameObjectType.NewFlag)m_goTypeImpl;
if (newFlag == null)
return;
if (newFlag.GetState() != FlagState.Dropped)
return;
// friendly with enemy flag means you're taking it
bool defenderInteract = !owner.IsFriendlyTo(user);
if (defenderInteract && owner.GetGoInfo().NewFlag.ReturnonDefenderInteract != 0)
@@ -4373,6 +4387,8 @@ namespace Game.Entities
{
return _state != FlagState.InBase;
}
public FlagState GetState() { return _state; }
}
class SetNewFlagState : GameObjectTypeBase.CustomCommand