Core/Battlegrounds: Made Battleground inherit ZoneScript
Port From (https://github.com/TrinityCore/TrinityCore/commit/21940405e009f5c1d201eb96d96ea251a3313af3)
This commit is contained in:
@@ -33,7 +33,7 @@ using System.Numerics;
|
||||
|
||||
namespace Game.BattleGrounds
|
||||
{
|
||||
public class Battleground : IDisposable
|
||||
public class Battleground : ZoneScript, IDisposable
|
||||
{
|
||||
public Battleground(BattlegroundTemplate battlegroundTemplate)
|
||||
{
|
||||
@@ -1836,9 +1836,10 @@ namespace Game.BattleGrounds
|
||||
return Global.ObjectMgr.GetClosestGraveYard(player, GetPlayerTeam(player.GetGUID()), player);
|
||||
}
|
||||
|
||||
public void TriggerGameEvent(uint gameEventId)
|
||||
public override void TriggerGameEvent(uint gameEventId, WorldObject source = null, WorldObject target = null)
|
||||
{
|
||||
GameEvents.TriggerForMap(gameEventId, GetBgMap());
|
||||
ProcessEvent(target, gameEventId, source);
|
||||
GameEvents.TriggerForMap(gameEventId, GetBgMap(), source, target);
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
@@ -2035,7 +2036,7 @@ namespace Game.BattleGrounds
|
||||
public virtual void EventPlayerDroppedFlag(Player player) { }
|
||||
public virtual void EventPlayerClickedOnFlag(Player player, GameObject target_obj) { }
|
||||
|
||||
public virtual void ProcessEvent(WorldObject obj, uint eventId, WorldObject invoker = null) { }
|
||||
public override void ProcessEvent(WorldObject obj, uint eventId, WorldObject invoker = null) { }
|
||||
|
||||
// this function can be used by spell to interact with the BG map
|
||||
public virtual void DoAction(uint action, ulong arg) { }
|
||||
|
||||
@@ -1494,13 +1494,18 @@ namespace Game.Entities
|
||||
InstanceMap instanceMap = map.ToInstanceMap();
|
||||
if (instanceMap != null)
|
||||
return (ZoneScript)instanceMap.GetInstanceScript();
|
||||
else if (!map.IsBattlegroundOrArena())
|
||||
|
||||
BattlegroundMap bgMap = map.ToBattlegroundMap();
|
||||
if (bgMap != null)
|
||||
return (ZoneScript)bgMap.GetBG();
|
||||
|
||||
if (!map.IsBattlegroundOrArena())
|
||||
{
|
||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(map, GetZoneId());
|
||||
if (bf != null)
|
||||
return bf;
|
||||
else
|
||||
return Global.OutdoorPvPMgr.GetOutdoorPvPToZoneId(map, GetZoneId());
|
||||
|
||||
return Global.OutdoorPvPMgr.GetOutdoorPvPToZoneId(map, GetZoneId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,9 +70,6 @@ namespace Game
|
||||
|
||||
public static void TriggerForMap(uint gameEventId, Map map, WorldObject source = null, WorldObject target = null)
|
||||
{
|
||||
BattlegroundMap bgMap = map.ToBattlegroundMap();
|
||||
if (bgMap != null)
|
||||
bgMap.GetBG().ProcessEvent(target, gameEventId, source);
|
||||
map.ScriptsStart(ScriptsType.Event, gameEventId, source, target);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user