Scripts/AreaTrigger: Added CanCaptureFlag and CaptureFlag hooks

Port From (https://github.com/TrinityCore/TrinityCore/commit/30f57de184fb96dfb6c548201e7717fa293682e1)
This commit is contained in:
hondacrx
2023-09-14 04:53:47 -04:00
parent 3c28432a49
commit 967624c664
2 changed files with 23 additions and 2 deletions
+20 -2
View File
@@ -2,12 +2,13 @@
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
using Game.AI;
using Game.DataStorage;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using System.Collections.Generic;
using Game.AI;
using System;
using System.Collections.Generic;
namespace Scripts.World.Areatriggers
{
@@ -433,4 +434,21 @@ namespace Scripts.World.Areatriggers
return true;
}
}
[Script]
class areatrigger_action_capture_flag : AreaTriggerAI
{
public areatrigger_action_capture_flag(AreaTrigger areatrigger) : base(areatrigger) { }
public override void OnUnitEnter(Unit unit)
{
if (!unit.IsPlayer())
return;
Player player = unit.ToPlayer();
ZoneScript zoneScript = at.GetZoneScript();
if (zoneScript != null && zoneScript.CanCaptureFlag(at, player))
zoneScript.OnCaptureFlag(at, player);
}
}
}