blizzless-diiis/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ChallengeObelisk.cs
2023-01-21 17:52:11 -08:00

99 lines
3.4 KiB
C#

//Blizzless Project 2022
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
using DiIiS_NA.GameServer.Core.Types.TagMap;
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.MapSystem;
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PlayerSystem;
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.TickerSystem;
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem;
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.ACD;
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.World;
//Blizzless Project 2022
using System;
//Blizzless Project 2022
using System.Collections.Generic;
//Blizzless Project 2022
using System.Linq;
//Blizzless Project 2022
using System.Text;
//Blizzless Project 2022
using System.Threading.Tasks;
namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{
[HandledSNO(ActorSno._p2_weeklychallenge_obelisk /* x1_OpenWorld_LootRunObelisk_B.acr */)]
public sealed class ChallengeObelisk : Gizmo
{
public ChallengeObelisk(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags)
{
Attributes[GameAttribute.TeamID] = 2;
Attributes[GameAttribute.MinimapActive] = true;
Attributes.BroadcastChangedIfRevealed();
}
public override void OnTargeted(Player player, TargetMessage message)
{
bool Activated = false;
PlayAnimation(5, AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2);
Attributes[GameAttribute.Untargetable] = !Activated;
Attributes[GameAttribute.NPC_Is_Operatable] = Activated;
Attributes[GameAttribute.Operatable] = Activated;
Attributes[GameAttribute.Operatable_Story_Gizmo] = Activated;
Attributes[GameAttribute.Disabled] = !Activated;
Attributes[GameAttribute.Immunity] = !Activated;
Attributes.BroadcastChangedIfRevealed();
CollFlags = 0;
TickTimer Timeout = new SecondsTickTimer(World.Game, 3.5f);
var Boom = Task<bool>.Factory.StartNew(() => WaitToSpawn(Timeout));
Boom.ContinueWith(delegate
{
var actor = World.GetActorBySNO(ActorSno._x1_openworld_challenge_rifts_portal);
actor.SetVisible(true);
actor.Reveal(player);
World.BroadcastIfRevealed(plr => new ACDCollFlagsMessage()
{
ActorID = DynamicID(plr),
CollFlags = 0
}, this);
});
}
public override bool Reveal(Player player)
{
if (!base.Reveal(player))
return false;
if (!Attributes[GameAttribute.Operatable])
{
var actor = World.GetActorBySNO(ActorSno._x1_openworld_challenge_rifts_portal);
actor.SetVisible(false);
actor.Unreveal(player);
}
else
{
PlayAnimation(5, AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
}
return true;
}
private bool WaitToSpawn(TickTimer timer)
{
while (timer.TimedOut != true)
{
}
return true;
}
}
}