Skip to content

Commit

Permalink
Rifting Pre-Release
Browse files Browse the repository at this point in the history
  • Loading branch information
FallenDev committed Dec 19, 2024
1 parent a23fca7 commit f8a70e1
Show file tree
Hide file tree
Showing 14 changed files with 767 additions and 17 deletions.
Binary file modified Server.Configurations/ZolianDB/ZolianMaps.sql
Binary file not shown.
Binary file modified Server.Configurations/ZolianDB/ZolianMundanes.sql
Binary file not shown.
11 changes: 9 additions & 2 deletions Zolian.Server.Base/GameScripts/Affects/DebuffAffects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,14 @@ public class DebuffReaping : Debuff
public override void OnApplied(Sprite affected, Debuff debuff)
{
if (affected is Aisling { GameMaster: true }) return;

if (affected is Aisling mapCheck && mapCheck.Map.ID is >= 800 and <= 810)
{
mapCheck.Client.TransitionToMap(188, new Position(12, 22));
mapCheck.CurrentHp = 1;
mapCheck.Client.SendAttributes(StatUpdateType.Full);
return;
}

if (affected.Debuffs.TryAdd(debuff.Name, debuff))
{
DebuffSpell = debuff;
Expand Down Expand Up @@ -1495,7 +1502,7 @@ public override void OnEnded(Sprite affected, Debuff debuff)

aisling.Client.SendServerMessage(ServerMessageType.OrangeBar1, "Your soul has been ripped from your mortal coil.");
aisling.SendTargetedClientMethod(PlayerScope.AislingsOnSameMap, client => client.SendSound(5, false));

aisling.PrepareForHell();
aisling.CastDeath();
aisling.Resting = Enums.RestPosition.Standing;
Expand Down
59 changes: 47 additions & 12 deletions Zolian.Server.Base/GameScripts/Areas/Abel/Atlantis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Numerics;
using Darkages.Enums;
using Darkages.Sprites.Entity;
using Darkages.GameScripts.Affects;
using Darkages.Network.Server;

namespace Darkages.GameScripts.Areas.Abel;

Expand All @@ -20,21 +22,54 @@ public override void OnPlayerWalk(WorldClient client, Position oldLocation, Posi
var vectorMap = new Vector2(newLocation.X, newLocation.Y);
if (client.Aisling.Pos != vectorMap) return;

switch (newLocation.X)
if (client.Aisling.Pos == new Vector2(31, 29) ||
client.Aisling.Pos == new Vector2(30, 29) ||
client.Aisling.Pos == new Vector2(30, 28) ||
client.Aisling.Pos == new Vector2(31, 28))
{
case 15 when newLocation.Y == 14:
if (client.Aisling.QuestManager.ScubaGearCrafted && client.Aisling.EquipmentManager.Equipment[16]?.Item?.Template.Name == "Scuba Gear"
|| client.Aisling.Race.RaceFlagIsSet(Race.Merfolk))
{
client.TransitionToMap(188, new Position(2, 19));
return;
}

client.SendServerMessage(ServerMessageType.ActiveMessage, "I'm afraid I'll drown if I slip under this rock! I need to find some Scuba Gear.");
foreach (var npc in ServerSetup.Instance.GlobalMundaneCache)
{
if (npc.Value.Scripts is null) continue;
if (!npc.Value.Scripts.TryGetValue("Rifting Warden", out var scriptObj)) continue;
scriptObj.OnClick(client, npc.Value.Serial);
break;
}
}

if (client.Aisling.EquipmentManager.Equipment[16]?.Item?.Template.Name == "Scuba Gear") return;
if (client.Aisling.Race.RaceFlagIsSet(Race.Merfolk)) return;
var drownTick = client.Aisling.MaximumHp * 0.05;
client.Aisling.CurrentHp -= (long)drownTick;
client.SendAttributes(StatUpdateType.Vitality);

if (!(client.Aisling.CurrentHp <= client.Aisling.MaximumHp * 0.10)) return;
var drown = new DebuffReaping();
drown.OnApplied(client.Aisling, drown);
}

public override void OnItemDropped(WorldClient client, Item itemDropped, Position locationDropped) { }
public override void OnGossip(WorldClient client, string message) { }
public override void OnItemDropped(WorldClient client, Item itemDropped, Position locationDropped)
{
if (client.Aisling.EquipmentManager.Equipment[16]?.Item?.Template.Name == "Scuba Gear") return;
if (client.Aisling.Race.RaceFlagIsSet(Race.Merfolk)) return;
var drownTick = client.Aisling.MaximumHp * 0.05;
client.Aisling.CurrentHp -= (long)drownTick;
client.SendAttributes(StatUpdateType.Vitality);

if (!(client.Aisling.CurrentHp <= client.Aisling.MaximumHp * 0.10)) return;
var drown = new DebuffReaping();
drown.OnApplied(client.Aisling, drown);
}

public override void OnGossip(WorldClient client, string message)
{
if (client.Aisling.EquipmentManager.Equipment[16]?.Item?.Template.Name == "Scuba Gear") return;
if (client.Aisling.Race.RaceFlagIsSet(Race.Merfolk)) return;
var drownTick = client.Aisling.MaximumHp * 0.05;
client.Aisling.CurrentHp -= (long)drownTick;
client.SendAttributes(StatUpdateType.Vitality);

if (!(client.Aisling.CurrentHp <= client.Aisling.MaximumHp * 0.10)) return;
var drown = new DebuffReaping();
drown.OnApplied(client.Aisling, drown);
}
}
40 changes: 40 additions & 0 deletions Zolian.Server.Base/GameScripts/Areas/Abel/AtlantisEntrance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Darkages.Network.Client;
using Darkages.ScriptingBase;
using Darkages.Types;
using System.Numerics;
using Darkages.Enums;
using Darkages.Sprites.Entity;

namespace Darkages.GameScripts.Areas.Abel;

[Script("AtlantisEntrance")]
public class AtlantisEntrance : AreaScript
{
public AtlantisEntrance(Area area) : base(area) => Area = area;
public override void Update(TimeSpan elapsedTime) { }
public override void OnMapEnter(WorldClient client) { }
public override void OnMapExit(WorldClient client) { }

public override void OnPlayerWalk(WorldClient client, Position oldLocation, Position newLocation)
{
var vectorMap = new Vector2(newLocation.X, newLocation.Y);
if (client.Aisling.Pos != vectorMap) return;

switch (newLocation.X)
{
case 15 when newLocation.Y == 14:
if (client.Aisling.QuestManager.ScubaGearCrafted && client.Aisling.EquipmentManager.Equipment[16]?.Item?.Template.Name == "Scuba Gear"
|| client.Aisling.Race.RaceFlagIsSet(Race.Merfolk))
{
client.TransitionToMap(188, new Position(2, 19));
return;
}

client.SendServerMessage(ServerMessageType.ActiveMessage, "I'm afraid I'll drown if I slip under this rock! I need to find some Scuba Gear.");
break;
}
}

public override void OnItemDropped(WorldClient client, Item itemDropped, Position locationDropped) { }
public override void OnGossip(WorldClient client, string message) { }
}
66 changes: 66 additions & 0 deletions Zolian.Server.Base/GameScripts/Areas/Generic/Rift.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Darkages.Common;
using Darkages.Network.Client;
using Darkages.ScriptingBase;
using Darkages.Sprites;
using Darkages.Types;

using System.Collections.Concurrent;
using System.Security.Cryptography;

namespace Darkages.GameScripts.Areas.Generic;

[Script("Rift")]
public class Rift : AreaScript
{
private readonly ConcurrentDictionary<long, Aisling> _playersOnMap = [];
private WorldServerTimer AnimTimer { get; }
private bool _animate;

public Rift(Area area) : base(area)
{
Area = area;
AnimTimer = new WorldServerTimer(TimeSpan.FromMilliseconds(1 + 2000));
}

public override void Update(TimeSpan elapsedTime)
{
if (_playersOnMap.IsEmpty)
_animate = false;

if (_animate)
HandleMapAnimations(elapsedTime);
}

public override void OnMapEnter(WorldClient client)
{
_playersOnMap.TryAdd(client.Aisling.Serial, client.Aisling);
client.SendServerMessage(ServerMessageType.ActiveMessage, "Strong one, temper your will!");
client.SendSound((byte)Random.Shared.Next(119), true);
if (!_playersOnMap.IsEmpty)
_animate = true;
}

public override void OnMapExit(WorldClient client)
{
_playersOnMap.TryRemove(client.Aisling.Serial, out _);

if (_playersOnMap.IsEmpty)
_animate = false;
}

public override void OnPlayerWalk(WorldClient client, Position oldLocation, Position newLocation) => _playersOnMap.TryAdd(client.Aisling.Serial, client.Aisling);

private void HandleMapAnimations(TimeSpan elapsedTime)
{
var a = AnimTimer.Update(elapsedTime);
if (!a) return;
if (_playersOnMap.IsEmpty) return;

for (var i = 0; i < 6; i++)
{
var randA = Random.Shared.Next(0, 40);
var randB = Random.Shared.Next(80, 119);
_playersOnMap.Values.FirstOrDefault()?.SendAnimationNearby(384, new Position(randA, randB));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public static Item.Quality DetermineHighQuality()
> .77 and <= .89 => Item.Quality.Epic,
> .89 and <= .99 => Item.Quality.Legendary,
> .99 and <= .997 => Item.Quality.Forsaken,
> .997 => Item.Quality.Mythic,
> .997 and <= .999 => Item.Quality.Mythic,
> 1 => Item.Quality.Primordial,
_ => Item.Quality.Rare
};
}
Expand Down
Loading

0 comments on commit f8a70e1

Please sign in to comment.