Core/Battlegrounds: Move to scripts And a lot of misc commits i couldn't recover.
Port From (https://github.com/TrinityCore/TrinityCore/commit/d0d5d309bb5877dc2fcb27f6cb123707a31ec1e8)
This commit is contained in:
@@ -102,7 +102,7 @@ namespace Game.Arenas
|
||||
{
|
||||
// if the player was a match participant, calculate rating
|
||||
|
||||
ArenaTeam winnerArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(bgPlayer.Team)));
|
||||
ArenaTeam winnerArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(SharedConst.GetOtherTeam(bgPlayer.Team)));
|
||||
ArenaTeam loserArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(bgPlayer.Team));
|
||||
|
||||
// left a rated match while the encounter was in progress, consider as loser
|
||||
@@ -110,9 +110,9 @@ namespace Game.Arenas
|
||||
{
|
||||
Player player = _GetPlayer(guid, bgPlayer.OfflineRemoveTime != 0, "Arena.RemovePlayerAtLeave");
|
||||
if (player != null)
|
||||
loserArenaTeam.MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(bgPlayer.Team)));
|
||||
loserArenaTeam.MemberLost(player, GetArenaMatchmakerRating(SharedConst.GetOtherTeam(bgPlayer.Team)));
|
||||
else
|
||||
loserArenaTeam.OfflineMemberLost(guid, GetArenaMatchmakerRating(GetOtherTeam(bgPlayer.Team)));
|
||||
loserArenaTeam.OfflineMemberLost(guid, GetArenaMatchmakerRating(SharedConst.GetOtherTeam(bgPlayer.Team)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,14 +147,14 @@ namespace Game.Arenas
|
||||
// In case of arena draw, follow this logic:
|
||||
// winnerArenaTeam => ALLIANCE, loserArenaTeam => HORDE
|
||||
ArenaTeam winnerArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner == Team.Other ? Team.Alliance : winner));
|
||||
ArenaTeam loserArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner == Team.Other ? Team.Horde : GetOtherTeam(winner)));
|
||||
ArenaTeam loserArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner == Team.Other ? Team.Horde : SharedConst.GetOtherTeam(winner)));
|
||||
|
||||
if (winnerArenaTeam != null && loserArenaTeam != null && winnerArenaTeam != loserArenaTeam)
|
||||
{
|
||||
// In case of arena draw, follow this logic:
|
||||
// winnerMatchmakerRating => ALLIANCE, loserMatchmakerRating => HORDE
|
||||
loserTeamRating = loserArenaTeam.GetRating();
|
||||
loserMatchmakerRating = GetArenaMatchmakerRating(winner == Team.Other ? Team.Horde : GetOtherTeam(winner));
|
||||
loserMatchmakerRating = GetArenaMatchmakerRating(winner == Team.Other ? Team.Horde : SharedConst.GetOtherTeam(winner));
|
||||
winnerTeamRating = winnerArenaTeam.GetRating();
|
||||
winnerMatchmakerRating = GetArenaMatchmakerRating(winner == Team.Other ? Team.Alliance : winner);
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Game.Arenas
|
||||
loserTeamRating, loserChange, loserMatchmakerRating, loserMatchmakerChange);
|
||||
|
||||
SetArenaMatchmakerRating(winner, (uint)(winnerMatchmakerRating + winnerMatchmakerChange));
|
||||
SetArenaMatchmakerRating(GetOtherTeam(winner), (uint)(loserMatchmakerRating + loserMatchmakerChange));
|
||||
SetArenaMatchmakerRating(SharedConst.GetOtherTeam(winner), (uint)(loserMatchmakerRating + loserMatchmakerChange));
|
||||
|
||||
// bg team that the client expects is different to TeamId
|
||||
// alliance 1, horde 0
|
||||
@@ -176,7 +176,7 @@ namespace Game.Arenas
|
||||
byte loserTeam = (byte)(winner == Team.Alliance ? PvPTeamId.Horde : PvPTeamId.Alliance);
|
||||
|
||||
_arenaTeamScores[winnerTeam].Assign(winnerTeamRating, (uint)(winnerTeamRating + winnerChange), winnerMatchmakerRating, GetArenaMatchmakerRating(winner));
|
||||
_arenaTeamScores[loserTeam].Assign(loserTeamRating, (uint)(loserTeamRating + loserChange), loserMatchmakerRating, GetArenaMatchmakerRating(GetOtherTeam(winner)));
|
||||
_arenaTeamScores[loserTeam].Assign(loserTeamRating, (uint)(loserTeamRating + loserChange), loserMatchmakerRating, GetArenaMatchmakerRating(SharedConst.GetOtherTeam(winner)));
|
||||
|
||||
Log.outDebug(LogFilter.Arena, "Arena match Type: {0} for Team1Id: {1} - Team2Id: {2} ended. WinnerTeamId: {3}. Winner rating: +{4}, Loser rating: {5}",
|
||||
GetArenaType(), GetArenaTeamIdByIndex(BattleGroundTeamId.Alliance), GetArenaTeamIdByIndex(BattleGroundTeamId.Horde), winnerArenaTeam.GetId(), winnerChange, loserChange);
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
|
||||
namespace Game.Arenas
|
||||
{
|
||||
public class BladesEdgeArena : Arena
|
||||
{
|
||||
public BladesEdgeArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { }
|
||||
|
||||
public override void PostUpdateImpl(uint diff)
|
||||
{
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
return;
|
||||
|
||||
taskScheduler.Update(diff);
|
||||
}
|
||||
|
||||
public override void StartingEventCloseDoors()
|
||||
{
|
||||
for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door4; ++i)
|
||||
SpawnBGObject(i, BattlegroundConst.RespawnImmediately);
|
||||
|
||||
for (int i = BladeEdgeObjectTypes.Buff1; i <= BladeEdgeObjectTypes.Buff2; ++i)
|
||||
SpawnBGObject(i, BattlegroundConst.RespawnOneDay);
|
||||
}
|
||||
|
||||
public override void StartingEventOpenDoors()
|
||||
{
|
||||
for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door4; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
taskScheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door2; ++i)
|
||||
DelObject(i);
|
||||
});
|
||||
|
||||
for (int i = BladeEdgeObjectTypes.Buff1; i <= BladeEdgeObjectTypes.Buff2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
public override bool SetupBattleground()
|
||||
{
|
||||
bool result = true;
|
||||
result &= AddObject(BladeEdgeObjectTypes.Door1, BladeEfgeGameObjects.Door1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, BattlegroundConst.RespawnImmediately);
|
||||
result &= AddObject(BladeEdgeObjectTypes.Door2, BladeEfgeGameObjects.Door2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, BattlegroundConst.RespawnImmediately);
|
||||
result &= AddObject(BladeEdgeObjectTypes.Door3, BladeEfgeGameObjects.Door3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, BattlegroundConst.RespawnImmediately);
|
||||
result &= AddObject(BladeEdgeObjectTypes.Door4, BladeEfgeGameObjects.Door4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, BattlegroundConst.RespawnImmediately);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BatteGroundBE: Failed to spawn door object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(BladeEdgeObjectTypes.Buff1, BladeEfgeGameObjects.Buff1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120);
|
||||
result &= AddObject(BladeEdgeObjectTypes.Buff2, BladeEfgeGameObjects.Buff2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BladesEdgeArena: Failed to spawn buff object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
struct BladeEdgeObjectTypes
|
||||
{
|
||||
public const int Door1 = 0;
|
||||
public const int Door2 = 1;
|
||||
public const int Door3 = 2;
|
||||
public const int Door4 = 3;
|
||||
public const int Buff1 = 4;
|
||||
public const int Buff2 = 5;
|
||||
public const int Max = 6;
|
||||
}
|
||||
|
||||
struct BladeEfgeGameObjects
|
||||
{
|
||||
public const uint Door1 = 183971;
|
||||
public const uint Door2 = 183973;
|
||||
public const uint Door3 = 183970;
|
||||
public const uint Door4 = 183972;
|
||||
public const uint Buff1 = 184663;
|
||||
public const uint Buff2 = 184664;
|
||||
}
|
||||
}
|
||||
@@ -1,239 +0,0 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
|
||||
namespace Game.Arenas
|
||||
{
|
||||
class DalaranSewersArena : Arena
|
||||
{
|
||||
uint _pipeKnockBackTimer;
|
||||
uint _pipeKnockBackCount;
|
||||
|
||||
public DalaranSewersArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||
{
|
||||
_events = new EventMap();
|
||||
}
|
||||
|
||||
public override void StartingEventCloseDoors()
|
||||
{
|
||||
for (int i = DalaranSewersObjectTypes.Door1; i <= DalaranSewersObjectTypes.Door2; ++i)
|
||||
SpawnBGObject(i, BattlegroundConst.RespawnImmediately);
|
||||
}
|
||||
|
||||
public override void StartingEventOpenDoors()
|
||||
{
|
||||
for (int i = DalaranSewersObjectTypes.Door1; i <= DalaranSewersObjectTypes.Door2; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
for (int i = DalaranSewersObjectTypes.Buff1; i <= DalaranSewersObjectTypes.Buff2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
|
||||
_events.ScheduleEvent(DalaranSewersEvents.WaterfallWarning, DalaranSewersData.WaterfallTimerMin, DalaranSewersData.WaterfallTimerMax);
|
||||
//_events.ScheduleEvent(DalaranSewersEvents.PipeKnockback, DalaranSewersData.PipeKnockbackFirstDelay);
|
||||
|
||||
_pipeKnockBackCount = 0;
|
||||
_pipeKnockBackTimer = DalaranSewersData.PipeKnockbackFirstDelay;
|
||||
|
||||
SpawnBGObject(DalaranSewersObjectTypes.Water2, BattlegroundConst.RespawnImmediately);
|
||||
|
||||
DoorOpen(DalaranSewersObjectTypes.Water1); // Turn off collision
|
||||
DoorOpen(DalaranSewersObjectTypes.Water2);
|
||||
|
||||
// Remove effects of Demonic Circle Summon
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player player = _GetPlayer(pair, "BattlegroundDS::StartingEventOpenDoors");
|
||||
if (player != null)
|
||||
player.RemoveAurasDueToSpell(DalaranSewersSpells.DemonicCircle);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool SetupBattleground()
|
||||
{
|
||||
bool result = true;
|
||||
result &= AddObject(DalaranSewersObjectTypes.Door1, DalaranSewersGameObjects.Door1, 1350.95f, 817.2f, 20.8096f, 3.15f, 0, 0, 0.99627f, 0.0862864f, BattlegroundConst.RespawnImmediately);
|
||||
result &= AddObject(DalaranSewersObjectTypes.Door2, DalaranSewersGameObjects.Door2, 1232.65f, 764.913f, 20.0729f, 6.3f, 0, 0, 0.0310211f, -0.999519f, BattlegroundConst.RespawnImmediately);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn door object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// buffs
|
||||
result &= AddObject(DalaranSewersObjectTypes.Buff1, DalaranSewersGameObjects.Buff1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f, 120);
|
||||
result &= AddObject(DalaranSewersObjectTypes.Buff2, DalaranSewersGameObjects.Buff2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn buff object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(DalaranSewersObjectTypes.Water1, DalaranSewersGameObjects.Water1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120);
|
||||
result &= AddObject(DalaranSewersObjectTypes.Water2, DalaranSewersGameObjects.Water2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120);
|
||||
result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.WaterfallKnockback, 1292.587f, 790.2205f, 7.19796f, 3.054326f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
|
||||
result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
|
||||
result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback2, 1212.833f, 765.3871f, 16.09484f, 0.0f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn collision object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void PostUpdateImpl(uint diff)
|
||||
{
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
return;
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case DalaranSewersEvents.WaterfallWarning:
|
||||
// Add the water
|
||||
DoorClose(DalaranSewersObjectTypes.Water2);
|
||||
_events.ScheduleEvent(DalaranSewersEvents.WaterfallOn, DalaranSewersData.WaterWarningDuration);
|
||||
break;
|
||||
case DalaranSewersEvents.WaterfallOn:
|
||||
// Active collision and start knockback timer
|
||||
DoorClose(DalaranSewersObjectTypes.Water1);
|
||||
_events.ScheduleEvent(DalaranSewersEvents.WaterfallOff, DalaranSewersData.WaterfallDuration);
|
||||
_events.ScheduleEvent(DalaranSewersEvents.WaterfallKnockback, DalaranSewersData.WaterfallKnockbackTimer);
|
||||
break;
|
||||
case DalaranSewersEvents.WaterfallOff:
|
||||
// Remove collision and water
|
||||
DoorOpen(DalaranSewersObjectTypes.Water1);
|
||||
DoorOpen(DalaranSewersObjectTypes.Water2);
|
||||
_events.CancelEvent(DalaranSewersEvents.WaterfallKnockback);
|
||||
_events.ScheduleEvent(DalaranSewersEvents.WaterfallWarning, DalaranSewersData.WaterfallTimerMin, DalaranSewersData.WaterfallTimerMax);
|
||||
break;
|
||||
case DalaranSewersEvents.WaterfallKnockback:
|
||||
{
|
||||
// Repeat knockback while the waterfall still active
|
||||
Creature waterSpout = GetBGCreature(DalaranSewersCreatureTypes.WaterfallKnockback);
|
||||
if (waterSpout != null)
|
||||
waterSpout.CastSpell(waterSpout, DalaranSewersSpells.WaterSpout, true);
|
||||
_events.ScheduleEvent(eventId, DalaranSewersData.WaterfallKnockbackTimer);
|
||||
}
|
||||
break;
|
||||
case DalaranSewersEvents.PipeKnockback:
|
||||
{
|
||||
for (uint i = DalaranSewersCreatureTypes.PipeKnockback1; i <= DalaranSewersCreatureTypes.PipeKnockback2; ++i)
|
||||
{
|
||||
Creature waterSpout = GetBGCreature(i);
|
||||
if (waterSpout != null)
|
||||
waterSpout.CastSpell(waterSpout, DalaranSewersSpells.Flush, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
if (_pipeKnockBackCount < DalaranSewersData.PipeKnockbackTotalCount)
|
||||
{
|
||||
if (_pipeKnockBackTimer < diff)
|
||||
{
|
||||
for (uint i = DalaranSewersCreatureTypes.PipeKnockback1; i <= DalaranSewersCreatureTypes.PipeKnockback2; ++i)
|
||||
{
|
||||
Creature waterSpout = GetBGCreature(i);
|
||||
if (waterSpout != null)
|
||||
waterSpout.CastSpell(waterSpout, DalaranSewersSpells.Flush, true);
|
||||
}
|
||||
|
||||
++_pipeKnockBackCount;
|
||||
_pipeKnockBackTimer = DalaranSewersData.PipeKnockbackDelay;
|
||||
}
|
||||
else
|
||||
_pipeKnockBackTimer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetData(uint dataId, uint value)
|
||||
{
|
||||
base.SetData(dataId, value);
|
||||
if (dataId == DalaranSewersData.PipeKnockbackCount)
|
||||
_pipeKnockBackCount = value;
|
||||
}
|
||||
|
||||
public override uint GetData(uint dataId)
|
||||
{
|
||||
if (dataId == DalaranSewersData.PipeKnockbackCount)
|
||||
return _pipeKnockBackCount;
|
||||
|
||||
return base.GetData(dataId);
|
||||
}
|
||||
}
|
||||
|
||||
struct DalaranSewersEvents
|
||||
{
|
||||
public const int WaterfallWarning = 1; // Water starting to fall, but no LoS Blocking nor movement blocking
|
||||
public const uint WaterfallOn = 2; // LoS and Movement blocking active
|
||||
public const uint WaterfallOff = 3;
|
||||
public const uint WaterfallKnockback = 4;
|
||||
|
||||
public const uint PipeKnockback = 5;
|
||||
}
|
||||
|
||||
struct DalaranSewersObjectTypes
|
||||
{
|
||||
public const int Door1 = 0;
|
||||
public const int Door2 = 1;
|
||||
public const int Water1 = 2; // Collision
|
||||
public const int Water2 = 3;
|
||||
public const int Buff1 = 4;
|
||||
public const int Buff2 = 5;
|
||||
public const int Max = 6;
|
||||
}
|
||||
|
||||
struct DalaranSewersGameObjects
|
||||
{
|
||||
public const uint Door1 = 192642;
|
||||
public const uint Door2 = 192643;
|
||||
public const uint Water1 = 194395; // Collision
|
||||
public const uint Water2 = 191877;
|
||||
public const uint Buff1 = 184663;
|
||||
public const uint Buff2 = 184664;
|
||||
}
|
||||
|
||||
struct DalaranSewersCreatureTypes
|
||||
{
|
||||
public const int WaterfallKnockback = 0;
|
||||
public const int PipeKnockback1 = 1;
|
||||
public const int PipeKnockback2 = 2;
|
||||
public const int Max = 3;
|
||||
}
|
||||
|
||||
struct DalaranSewersData
|
||||
{
|
||||
// These values are NOT blizzlike... need the correct data!
|
||||
public static TimeSpan WaterfallTimerMin = TimeSpan.FromSeconds(30);
|
||||
public static TimeSpan WaterfallTimerMax = TimeSpan.FromSeconds(60);
|
||||
public static TimeSpan WaterWarningDuration = TimeSpan.FromSeconds(5);
|
||||
public static TimeSpan WaterfallDuration = TimeSpan.FromSeconds(30);
|
||||
public static TimeSpan WaterfallKnockbackTimer = TimeSpan.FromSeconds(1.5);
|
||||
|
||||
public static uint PipeKnockbackFirstDelay = 5000;
|
||||
public static uint PipeKnockbackDelay = 3000;
|
||||
public const uint PipeKnockbackTotalCount = 2;
|
||||
public const uint PipeKnockbackCount = 1;
|
||||
|
||||
public const uint NpcWaterSpout = 28567;
|
||||
}
|
||||
|
||||
struct DalaranSewersSpells
|
||||
{
|
||||
public const uint Flush = 57405; // Visual And Target Selector For The Starting Knockback From The Pipe
|
||||
public const uint FlushKnockback = 61698; // Knockback Effect For Previous Spell (Triggered, Not Needed To Be Cast)
|
||||
public const uint WaterSpout = 58873; // Knockback Effect Of The Central Waterfall
|
||||
|
||||
public const uint DemonicCircle = 48018; // Demonic Circle Summon
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
|
||||
namespace Game.Arenas
|
||||
{
|
||||
public class NagrandArena : Arena
|
||||
{
|
||||
public NagrandArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { }
|
||||
|
||||
public override void PostUpdateImpl(uint diff)
|
||||
{
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
return;
|
||||
|
||||
taskScheduler.Update(diff);
|
||||
}
|
||||
|
||||
public override void StartingEventCloseDoors()
|
||||
{
|
||||
for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door4; ++i)
|
||||
SpawnBGObject(i, BattlegroundConst.RespawnImmediately);
|
||||
}
|
||||
|
||||
public override void StartingEventOpenDoors()
|
||||
{
|
||||
for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door4; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
taskScheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door2; ++i)
|
||||
DelObject(i);
|
||||
});
|
||||
|
||||
for (int i = NagrandArenaObjectTypes.Buff1; i <= NagrandArenaObjectTypes.Buff2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
public override bool SetupBattleground()
|
||||
{
|
||||
bool result = true;
|
||||
result &= AddObject(NagrandArenaObjectTypes.Door1, NagrandArenaObjects.Door1, 4031.854f, 2966.833f, 12.6462f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f, BattlegroundConst.RespawnImmediately);
|
||||
result &= AddObject(NagrandArenaObjectTypes.Door2, NagrandArenaObjects.Door2, 4081.179f, 2874.97f, 12.39171f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f, BattlegroundConst.RespawnImmediately);
|
||||
result &= AddObject(NagrandArenaObjectTypes.Door3, NagrandArenaObjects.Door3, 4023.709f, 2981.777f, 10.70117f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f, BattlegroundConst.RespawnImmediately);
|
||||
result &= AddObject(NagrandArenaObjectTypes.Door4, NagrandArenaObjects.Door4, 4090.064f, 2858.438f, 10.23631f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f, BattlegroundConst.RespawnImmediately);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "NagrandArena: Failed to spawn door object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(NagrandArenaObjectTypes.Buff1, NagrandArenaObjects.Buff1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120);
|
||||
result &= AddObject(NagrandArenaObjectTypes.Buff2, NagrandArenaObjects.Buff2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "NagrandArena: Failed to spawn buff object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
struct NagrandArenaObjectTypes
|
||||
{
|
||||
public const int Door1 = 0;
|
||||
public const int Door2 = 1;
|
||||
public const int Door3 = 2;
|
||||
public const int Door4 = 3;
|
||||
public const int Buff1 = 4;
|
||||
public const int Buff2 = 5;
|
||||
public const int Max = 6;
|
||||
}
|
||||
|
||||
struct NagrandArenaObjects
|
||||
{
|
||||
public const uint Door1 = 183978;
|
||||
public const uint Door2 = 183980;
|
||||
public const uint Door3 = 183977;
|
||||
public const uint Door4 = 183979;
|
||||
public const uint Buff1 = 184663;
|
||||
public const uint Buff2 = 184664;
|
||||
}
|
||||
}
|
||||
@@ -1,225 +0,0 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
|
||||
namespace Game.Arenas
|
||||
{
|
||||
class RingofValorArena : Arena
|
||||
{
|
||||
public RingofValorArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||
{
|
||||
_events = new EventMap();
|
||||
}
|
||||
|
||||
public override bool SetupBattleground()
|
||||
{
|
||||
bool result = true;
|
||||
result &= AddObject(RingofValorObjectTypes.Elevator1, RingofValorGameObjects.Elevator1, 763.536377f, -294.535767f, 0.505383f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Elevator2, RingofValorGameObjects.Elevator2, 763.506348f, -273.873352f, 0.505383f, 0.000000f, 0, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "RingofValorArena: Failed to spawn elevator object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(RingofValorObjectTypes.Buff1, RingofValorGameObjects.Buff1, 735.551819f, -284.794678f, 28.276682f, 0.034906f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Buff2, RingofValorGameObjects.Buff2, 791.224487f, -284.794464f, 28.276682f, 2.600535f, 0, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "RingofValorArena: Failed to spawn buff object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(RingofValorObjectTypes.Fire1, RingofValorGameObjects.Fire1, 743.543457f, -283.799469f, 28.286655f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Fire2, RingofValorGameObjects.Fire2, 782.971802f, -283.799469f, 28.286655f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Firedoor1, RingofValorGameObjects.Firedoor1, 743.711060f, -284.099609f, 27.542587f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Firedoor2, RingofValorGameObjects.Firedoor2, 783.221252f, -284.133362f, 27.535686f, 0.000000f, 0, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "RingofValorArena: Failed to spawn fire/firedoor object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(RingofValorObjectTypes.Gear1, RingofValorGameObjects.Gear1, 763.664551f, -261.872986f, 26.686588f, 0.000000f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Gear2, RingofValorGameObjects.Gear2, 763.578979f, -306.146149f, 26.665222f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Pulley1, RingofValorGameObjects.Pulley1, 700.722290f, -283.990662f, 39.517582f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Pulley2, RingofValorGameObjects.Pulley2, 826.303833f, -283.996429f, 39.517582f, 0.000000f, 0, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "RingofValorArena: Failed to spawn gear/pully object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(RingofValorObjectTypes.Pilar1, RingofValorGameObjects.Pilar1, 763.632385f, -306.162384f, 25.909504f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Pilar2, RingofValorGameObjects.Pilar2, 723.644287f, -284.493256f, 24.648525f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Pilar3, RingofValorGameObjects.Pilar3, 763.611145f, -261.856750f, 25.909504f, 0.000000f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.Pilar4, RingofValorGameObjects.Pilar4, 802.211609f, -284.493256f, 24.648525f, 0.000000f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.PilarCollision1, RingofValorGameObjects.PilarCollision1, 763.632385f, -306.162384f, 30.639660f, 3.141593f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.PilarCollision2, RingofValorGameObjects.PilarCollision2, 723.644287f, -284.493256f, 32.382710f, 0.000000f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.PilarCollision3, RingofValorGameObjects.PilarCollision3, 763.611145f, -261.856750f, 30.639660f, 0.000000f, 0, 0, 0, 0);
|
||||
result &= AddObject(RingofValorObjectTypes.PilarCollision4, RingofValorGameObjects.PilarCollision4, 802.211609f, -284.493256f, 32.382710f, 3.141593f, 0, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "RingofValorArena: Failed to spawn pilar object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void StartingEventOpenDoors()
|
||||
{
|
||||
// Buff respawn
|
||||
SpawnBGObject(RingofValorObjectTypes.Buff1, 90);
|
||||
SpawnBGObject(RingofValorObjectTypes.Buff2, 90);
|
||||
// Elevators
|
||||
DoorOpen(RingofValorObjectTypes.Elevator1);
|
||||
DoorOpen(RingofValorObjectTypes.Elevator2);
|
||||
|
||||
_events.ScheduleEvent(RingofValorEvents.OpenFences, TimeSpan.FromSeconds(20));
|
||||
|
||||
// Should be false at first, TogglePillarCollision will do it.
|
||||
TogglePillarCollision(true);
|
||||
}
|
||||
|
||||
public override void PostUpdateImpl(uint diff)
|
||||
{
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case RingofValorEvents.OpenFences:
|
||||
// Open fire (only at game start)
|
||||
for (byte i = RingofValorObjectTypes.Fire1; i <= RingofValorObjectTypes.Firedoor2; ++i)
|
||||
DoorOpen(i);
|
||||
_events.ScheduleEvent(RingofValorEvents.CloseFire, TimeSpan.FromSeconds(5));
|
||||
break;
|
||||
case RingofValorEvents.CloseFire:
|
||||
for (byte i = RingofValorObjectTypes.Fire1; i <= RingofValorObjectTypes.Firedoor2; ++i)
|
||||
DoorClose(i);
|
||||
// Fire got closed after five seconds, leaves twenty seconds before toggling pillars
|
||||
_events.ScheduleEvent(RingofValorEvents.SwitchPillars, TimeSpan.FromSeconds(20));
|
||||
break;
|
||||
case RingofValorEvents.SwitchPillars:
|
||||
TogglePillarCollision(true);
|
||||
_events.Repeat(TimeSpan.FromSeconds(25));
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TogglePillarCollision(bool enable)
|
||||
{
|
||||
// Toggle visual pillars, pulley, gear, and collision based on previous state
|
||||
for (int i = RingofValorObjectTypes.Pilar1; i <= RingofValorObjectTypes.Gear2; ++i)
|
||||
{
|
||||
if (enable)
|
||||
DoorOpen(i);
|
||||
else
|
||||
DoorClose(i);
|
||||
}
|
||||
|
||||
for (byte i = RingofValorObjectTypes.Pilar2; i <= RingofValorObjectTypes.Pulley2; ++i)
|
||||
{
|
||||
if (enable)
|
||||
DoorClose(i);
|
||||
else
|
||||
DoorOpen(i);
|
||||
}
|
||||
|
||||
for (byte i = RingofValorObjectTypes.Pilar1; i <= RingofValorObjectTypes.PilarCollision4; ++i)
|
||||
{
|
||||
GameObject go = GetBGObject(i);
|
||||
if (go != null)
|
||||
{
|
||||
if (i >= RingofValorObjectTypes.PilarCollision1)
|
||||
{
|
||||
GameObjectState state = ((go.GetGoInfo().Door.startOpen != 0) == enable) ? GameObjectState.Active : GameObjectState.Ready;
|
||||
go.SetGoState(state);
|
||||
}
|
||||
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player != null)
|
||||
go.SendUpdateToPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RingofValorEvents
|
||||
{
|
||||
public const int OpenFences = 0;
|
||||
public const int SwitchPillars = 1;
|
||||
public const int CloseFire = 2;
|
||||
}
|
||||
|
||||
struct RingofValorObjectTypes
|
||||
{
|
||||
public const int Buff1 = 1;
|
||||
public const int Buff2 = 2;
|
||||
public const int Fire1 = 3;
|
||||
public const int Fire2 = 4;
|
||||
public const int Firedoor1 = 5;
|
||||
public const int Firedoor2 = 6;
|
||||
|
||||
public const int Pilar1 = 7;
|
||||
public const int Pilar3 = 8;
|
||||
public const int Gear1 = 9;
|
||||
public const int Gear2 = 10;
|
||||
|
||||
public const int Pilar2 = 11;
|
||||
public const int Pilar4 = 12;
|
||||
public const int Pulley1 = 13;
|
||||
public const int Pulley2 = 14;
|
||||
|
||||
public const int PilarCollision1 = 15;
|
||||
public const int PilarCollision2 = 16;
|
||||
public const int PilarCollision3 = 17;
|
||||
public const int PilarCollision4 = 18;
|
||||
|
||||
public const int Elevator1 = 19;
|
||||
public const int Elevator2= 20;
|
||||
public const int Max = 21;
|
||||
}
|
||||
|
||||
struct RingofValorGameObjects
|
||||
{
|
||||
public const uint Buff1 = 184663;
|
||||
public const uint Buff2 = 184664;
|
||||
public const uint Fire1 = 192704;
|
||||
public const uint Fire2 = 192705;
|
||||
|
||||
public const uint Firedoor2 = 192387;
|
||||
public const uint Firedoor1 = 192388;
|
||||
public const uint Pulley1 = 192389;
|
||||
public const uint Pulley2 = 192390;
|
||||
public const uint Gear1 = 192393;
|
||||
public const uint Gear2 = 192394;
|
||||
public const uint Elevator1 = 194582;
|
||||
public const uint Elevator2 = 194586;
|
||||
|
||||
public const uint PilarCollision1 = 194580; // Axe
|
||||
public const uint PilarCollision2 = 194579; // Arena
|
||||
public const uint PilarCollision3 = 194581; // Lightning
|
||||
public const uint PilarCollision4 = 194578; // Ivory
|
||||
|
||||
public const uint Pilar1 = 194583; // Axe
|
||||
public const uint Pilar2 = 194584; // Arena
|
||||
public const uint Pilar3 = 194585; // Lightning
|
||||
public const uint Pilar4 = 194587; // Ivory
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
|
||||
namespace Game.Arenas
|
||||
{
|
||||
class RuinsofLordaeronArena : Arena
|
||||
{
|
||||
public RuinsofLordaeronArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { }
|
||||
|
||||
public override void PostUpdateImpl(uint diff)
|
||||
{
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
return;
|
||||
|
||||
taskScheduler.Update(diff);
|
||||
}
|
||||
|
||||
public override bool SetupBattleground()
|
||||
{
|
||||
bool result = true;
|
||||
result &= AddObject(RuinsofLordaeronObjectTypes.Door1, RuinsofLordaeronObjectTypes.Door1, 1293.561f, 1601.938f, 31.60557f, -1.457349f, 0, 0, -0.6658813f, 0.7460576f);
|
||||
result &= AddObject(RuinsofLordaeronObjectTypes.Door2, RuinsofLordaeronObjectTypes.Door2, 1278.648f, 1730.557f, 31.60557f, 1.684245f, 0, 0, 0.7460582f, 0.6658807f);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "RuinsofLordaeronArena: Failed to spawn door object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
result &= AddObject(RuinsofLordaeronObjectTypes.Buff1, RuinsofLordaeronObjectTypes.Buff1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120);
|
||||
result &= AddObject(RuinsofLordaeronObjectTypes.Buff2, RuinsofLordaeronObjectTypes.Buff2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120);
|
||||
if (!result)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "RuinsofLordaeronArena: Failed to spawn buff object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void StartingEventCloseDoors()
|
||||
{
|
||||
for (int i = RuinsofLordaeronObjectTypes.Door1; i <= RuinsofLordaeronObjectTypes.Door2; ++i)
|
||||
SpawnBGObject(i, BattlegroundConst.RespawnImmediately);
|
||||
}
|
||||
|
||||
public override void StartingEventOpenDoors()
|
||||
{
|
||||
for (int i = RuinsofLordaeronObjectTypes.Door1; i <= RuinsofLordaeronObjectTypes.Door2; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
taskScheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
for (int i = RuinsofLordaeronObjectTypes.Door1; i <= RuinsofLordaeronObjectTypes.Door2; ++i)
|
||||
DelObject(i);
|
||||
});
|
||||
|
||||
for (int i = RuinsofLordaeronObjectTypes.Buff1; i <= RuinsofLordaeronObjectTypes.Buff2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
}
|
||||
|
||||
struct RuinsofLordaeronObjectTypes
|
||||
{
|
||||
public const int Door1 = 0;
|
||||
public const int Door2 = 1;
|
||||
public const int Buff1 = 2;
|
||||
public const int Buff2 = 3;
|
||||
public const int Max = 4;
|
||||
}
|
||||
|
||||
struct RuinsofLordaeronGameObjects
|
||||
{
|
||||
public const uint Door1 = 185918;
|
||||
public const uint Door2 = 185917;
|
||||
public const uint Buff1 = 184663;
|
||||
public const uint Buff2 = 184664;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Game.Arenas
|
||||
{
|
||||
class TigersPeak
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Game.Arenas
|
||||
{
|
||||
class TolvironArena
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user