Skip to content

Commit 7886368

Browse files
committed
Rifting and Server dmg mitigation (buff)
1 parent 13629c4 commit 7886368

File tree

16 files changed

+526
-60
lines changed

16 files changed

+526
-60
lines changed
0 Bytes
Binary file not shown.

Zolian.GameServer/Zolian.GameServer.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@
3939
</PropertyGroup>
4040

4141
<ItemGroup>
42-
<PackageReference Include="Chaos-Networking" Version="2.3.1" />
42+
<PackageReference Include="Chaos-Networking" Version="2.3.3" />
4343
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.0-preview3.24332.3" />
4444
<PackageReference Include="Microsoft.DependencyValidation.Analyzers" Version="0.11.0" />
4545
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0">
4646
<TreatAsUsed>true</TreatAsUsed>
4747
</PackageReference>
48-
<PackageReference Include="Sentry" Version="5.0.0-alpha.1" />
49-
<PackageReference Include="Sentry.Extensions.Logging" Version="5.0.0-alpha.1" />
50-
<PackageReference Include="Sentry.Profiling" Version="5.0.0-alpha.1" />
51-
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.0-dev-02305" />
48+
<PackageReference Include="Sentry" Version="5.0.0" />
49+
<PackageReference Include="Sentry.Extensions.Logging" Version="5.0.0" />
50+
<PackageReference Include="Sentry.Profiling" Version="5.0.0" />
51+
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.1-dev-02308" />
5252
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
5353
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
5454
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />

Zolian.Server.Base/Enums/MonsterEnums.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public enum MonsterType
5353

5454
/// <summary>
5555
/// Common - 75% AC & Will Save
56-
/// Tank - 100% AC & 30% Will Save
57-
/// Caster - 30% AC & 100% Will Save
56+
/// Tank - 98% AC & 50% Will Save
57+
/// Caster - 50% AC & 98% Will Save
5858
/// </summary>
5959
public enum MonsterArmorType
6060
{

Zolian.Server.Base/GameScripts/Areas/Generic/Rift.cs

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,27 @@
55
using Darkages.Types;
66

77
using System.Collections.Concurrent;
8+
using Darkages.Enums;
89
using Darkages.Object;
910
using Darkages.Sprites.Entity;
11+
using Darkages.Templates;
1012

1113
namespace Darkages.GameScripts.Areas.Generic;
1214

1315
[Script("Rift")]
1416
public class Rift : AreaScript
1517
{
18+
private int _monstersOnMap;
1619
private readonly ConcurrentDictionary<long, Aisling> _playersOnMap = [];
1720
private WorldServerTimer AnimTimer { get; }
21+
private WorldServerTimer BossTimer { get; }
1822
private bool _animate;
1923

2024
public Rift(Area area) : base(area)
2125
{
2226
Area = area;
23-
AnimTimer = new WorldServerTimer(TimeSpan.FromMilliseconds(1 + 2000));
27+
AnimTimer = new WorldServerTimer(TimeSpan.FromMilliseconds(2000));
28+
BossTimer = new WorldServerTimer(TimeSpan.FromMilliseconds(1000));
2429
}
2530

2631
public override void Update(TimeSpan elapsedTime)
@@ -30,6 +35,33 @@ public override void Update(TimeSpan elapsedTime)
3035

3136
if (_animate)
3237
HandleMapAnimations(elapsedTime);
38+
39+
var a = BossTimer.Update(elapsedTime);
40+
if (!a) return;
41+
if (_playersOnMap.IsEmpty) return;
42+
_monstersOnMap = ObjectManager.GetObjects<Monster>(Area, p => p is { Alive: true }).Count;
43+
if (_monstersOnMap != 0) return;
44+
45+
var riftBossKilled = _playersOnMap.Values.FirstOrDefault(p => p.MonsterKillCounters["Rift Boss"].TotalKills >= 1);
46+
if (riftBossKilled is not null)
47+
{
48+
// ToDo: Create rewards for main player who killed the boss
49+
50+
foreach (var player in _playersOnMap.Values)
51+
{
52+
player.Client.TransitionToMap(188, new Position(12, 22));
53+
}
54+
55+
return;
56+
}
57+
58+
var topKiller = _playersOnMap.Values.OrderByDescending(p => p.MonsterKillCounters["Rift Mob"].TotalKills).FirstOrDefault();
59+
if (topKiller is null) return;
60+
if (topKiller.MonsterKillCounters["Rift Mob"].TotalKills >= 20 && !topKiller.Client.SummonRiftBoss)
61+
{
62+
topKiller.SendTargetedClientMethod(PlayerScope.NearbyAislings, c => c.SendSound(114, true));
63+
SummonRiftBoss(topKiller.Client);
64+
}
3365
}
3466

3567
public override void OnMapEnter(WorldClient client)
@@ -39,20 +71,25 @@ public override void OnMapEnter(WorldClient client)
3971
client.SendSound((byte)Random.Shared.Next(119), true);
4072
if (!_playersOnMap.IsEmpty)
4173
_animate = true;
74+
client.Aisling.MonsterKillCounters.Clear();
4275
}
4376

4477
public override void OnMapExit(WorldClient client)
4578
{
4679
_playersOnMap.TryRemove(client.Aisling.Serial, out _);
80+
client.SummonRiftBoss = false;
81+
client.Aisling.MonsterKillCounters.Clear();
82+
83+
if (!_playersOnMap.IsEmpty) return;
4784

48-
if (!_playersOnMap.IsEmpty) return;
4985
_animate = false;
5086
var monsters = ObjectManager.GetObjects<Monster>(Area, p => p is { Alive: true });
5187
foreach (var monster in monsters)
5288
monster.Value.Remove();
5389
}
5490

55-
public override void OnPlayerWalk(WorldClient client, Position oldLocation, Position newLocation) => _playersOnMap.TryAdd(client.Aisling.Serial, client.Aisling);
91+
public override void OnPlayerWalk(WorldClient client, Position oldLocation, Position newLocation) =>
92+
_playersOnMap.TryAdd(client.Aisling.Serial, client.Aisling);
5693

5794
private void HandleMapAnimations(TimeSpan elapsedTime)
5895
{
@@ -67,4 +104,54 @@ private void HandleMapAnimations(TimeSpan elapsedTime)
67104
_playersOnMap.Values.FirstOrDefault()?.SendAnimationNearby(384, new Position(randA, randB));
68105
}
69106
}
107+
108+
private void SummonRiftBoss(WorldClient client)
109+
{
110+
var sprites = new List<int>
111+
{
112+
12, 376, 377, 379, 380, 397, 402, 403, 404, 411, 417
113+
};
114+
115+
var boss = new MonsterTemplate
116+
{
117+
ScriptName = "Rift",
118+
BaseName = "Rift Boss",
119+
Name = $"{Random.Shared.NextInt64()}RiftBoss",
120+
AreaID = Area.ID,
121+
Image = (ushort)sprites.RandomIEnum(),
122+
ElementType = ElementQualifer.Defined,
123+
OffenseElement = ElementManager.Element.Terror,
124+
DefenseElement = ElementManager.Element.Terror,
125+
PathQualifer = PathQualifer.Wander,
126+
SpawnType = SpawnQualifer.Defined,
127+
DefinedX = (ushort)client.Aisling.X,
128+
DefinedY = (ushort)client.Aisling.Y,
129+
SpawnSize = 1,
130+
MoodType = MoodQualifer.Aggressive,
131+
MonsterType = MonsterType.Boss,
132+
MonsterArmorType = Enum.GetValues<MonsterArmorType>().RandomIEnum(),
133+
MonsterRace = MonsterRace.Demon,
134+
IgnoreCollision = true,
135+
Waypoints = [],
136+
MovementSpeed = 800,
137+
EngagedWalkingSpeed = Random.Shared.Next(800, 1400),
138+
AttackSpeed = Random.Shared.Next(500, 1000),
139+
CastSpeed = Random.Shared.Next(3000, 6000),
140+
LootType = LootQualifer.RandomGold,
141+
Level = (ushort)(client.Aisling.ExpLevel + client.Aisling.AbpLevel + Random.Shared.Next(1, 15)),
142+
SkillScripts = [],
143+
AbilityScripts = [],
144+
SpellScripts = []
145+
};
146+
147+
var monster = Monster.Create(boss, Area);
148+
if (monster == null) return;
149+
ObjectManager.AddObject(monster);
150+
151+
foreach (var (serial, players) in _playersOnMap)
152+
{
153+
players.Client.SendServerMessage(ServerMessageType.ActiveMessage, "{=bYou have proven yourself worthy.");
154+
players.Client.SummonRiftBoss = true;
155+
}
156+
}
70157
}

Zolian.Server.Base/GameScripts/Creations/CreateMonster.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,12 +1127,12 @@ private static void MonsterStatBoostOnType(Monster obj)
11271127
},
11281128
[MonsterType.Rift] = monster =>
11291129
{
1130-
monster.BonusStr += monster._Str * 25;
1131-
monster.BonusInt += monster._Int * 25;
1132-
monster.BonusDex += monster._Dex * 25;
1133-
monster.BonusMr += monster._Mr * 25;
1134-
monster.BonusHit += monster._Hit * 25;
1135-
monster.BonusDmg += monster._Dmg * 25;
1130+
monster.BonusStr += monster._Str * 22;
1131+
monster.BonusInt += monster._Int * 22;
1132+
monster.BonusDex += monster._Dex * 22;
1133+
monster.BonusMr += monster._Mr * 22;
1134+
monster.BonusHit += monster._Hit * 22;
1135+
monster.BonusDmg += monster._Dmg * 22;
11361136
},
11371137
[MonsterType.Boss] = monster =>
11381138
{

Zolian.Server.Base/GameScripts/Creations/RewardScript.cs

Lines changed: 110 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ public abstract class RewardScript
3232
[(300, 349)] = null,
3333
[(350, 399)] = ["Folt Demon Band"],
3434
[(400, 449)] = ["Neart Fire Ring", "Fios Ice Ring"],
35-
[(450, 500)] = ["Rioga Kings Ring"]
35+
[(450, 500)] = ["Rioga Kings Ring"],
36+
[(501, 550)] = null,
37+
[(551, 600)] = null,
38+
[(601, 650)] = null,
39+
[(651, 700)] = null,
40+
[(701, 750)] = null,
41+
[(751, 800)] = null,
42+
[(801, 850)] = null,
43+
[(851, 900)] = null,
44+
[(901, 950)] = null,
45+
[(951, 1000)] = null
3646
};
3747

3848
protected internal static readonly Dictionary<(int, int), List<string>> BeltDrops = new()
@@ -80,7 +90,17 @@ public abstract class RewardScript
8090
[(300, 349)] = null,
8191
[(350, 399)] = null,
8292
[(400, 449)] = null,
83-
[(450, 500)] = null
93+
[(450, 500)] = null,
94+
[(501, 550)] = null,
95+
[(551, 600)] = null,
96+
[(601, 650)] = null,
97+
[(651, 700)] = null,
98+
[(701, 750)] = null,
99+
[(751, 800)] = null,
100+
[(801, 850)] = null,
101+
[(851, 900)] = null,
102+
[(901, 950)] = null,
103+
[(951, 1000)] = null
84104
};
85105

86106
protected static readonly Dictionary<(int, int), List<string>> BootDrops = new()
@@ -106,7 +126,17 @@ public abstract class RewardScript
106126
[(300, 349)] = null,
107127
[(350, 399)] = null,
108128
[(400, 449)] = null,
109-
[(450, 500)] = null
129+
[(450, 500)] = null,
130+
[(501, 550)] = null,
131+
[(551, 600)] = null,
132+
[(601, 650)] = null,
133+
[(651, 700)] = null,
134+
[(701, 750)] = null,
135+
[(751, 800)] = null,
136+
[(801, 850)] = null,
137+
[(851, 900)] = null,
138+
[(901, 950)] = null,
139+
[(951, 1000)] = null
110140
};
111141

112142
protected static readonly Dictionary<(int, int), List<string>> EarringDrops = new()
@@ -146,7 +176,17 @@ public abstract class RewardScript
146176
[(300, 349)] = ["Ruby Triforce Earrings", "Empowered Ruby Triforce Earrings"],
147177
[(350, 399)] = ["Gold Triforce Earrings", "Empowered Gold Triforce Earrings"],
148178
[(400, 449)] = ["Stone Studded Clips"],
149-
[(450, 500)] = ["Rioga Orb Earrings"]
179+
[(450, 500)] = ["Rioga Orb Earrings"],
180+
[(501, 550)] = null,
181+
[(551, 600)] = null,
182+
[(601, 650)] = null,
183+
[(651, 700)] = null,
184+
[(701, 750)] = null,
185+
[(751, 800)] = null,
186+
[(801, 850)] = null,
187+
[(851, 900)] = null,
188+
[(901, 950)] = null,
189+
[(951, 1000)] = null
150190
};
151191

152192
protected static readonly Dictionary<(int, int), List<string>> GreaveDrops = new()
@@ -172,7 +212,17 @@ public abstract class RewardScript
172212
[(300, 349)] = ["Fios Poleyns", "Dith Poleyns", "Gnimh Poleyns", "Neart Poleyns"],
173213
[(350, 399)] = ["Fios Poleyns", "Dith Poleyns", "Gnimh Poleyns", "Neart Poleyns"],
174214
[(400, 449)] = ["Sacra Poleyns"],
175-
[(450, 500)] = ["Gaeth Poleyns"]
215+
[(450, 500)] = ["Gaeth Poleyns"],
216+
[(501, 550)] = null,
217+
[(551, 600)] = null,
218+
[(601, 650)] = null,
219+
[(651, 700)] = null,
220+
[(701, 750)] = null,
221+
[(751, 800)] = null,
222+
[(801, 850)] = null,
223+
[(851, 900)] = null,
224+
[(901, 950)] = null,
225+
[(951, 1000)] = null
176226
};
177227

178228
protected static readonly Dictionary<(int, int), List<string>> HandDrops = new()
@@ -198,7 +248,17 @@ public abstract class RewardScript
198248
[(300, 349)] = ["Encrusted Graspers"],
199249
[(350, 399)] = ["Depth Encrusted Graspers"],
200250
[(400, 449)] = ["Heavy Depth Encrusted Graspers"],
201-
[(450, 500)] = ["Flawless Depth Graspers"]
251+
[(450, 500)] = ["Flawless Depth Graspers"],
252+
[(501, 550)] = null,
253+
[(551, 600)] = null,
254+
[(601, 650)] = null,
255+
[(651, 700)] = null,
256+
[(701, 750)] = null,
257+
[(751, 800)] = null,
258+
[(801, 850)] = null,
259+
[(851, 900)] = null,
260+
[(901, 950)] = null,
261+
[(951, 1000)] = null
202262
};
203263

204264
protected static readonly Dictionary<(int, int), List<string>> NecklaceDrops = new()
@@ -256,7 +316,17 @@ public abstract class RewardScript
256316
[(300, 349)] = null,
257317
[(350, 399)] = null,
258318
[(400, 449)] = null,
259-
[(450, 500)] = null
319+
[(450, 500)] = null,
320+
[(501, 550)] = null,
321+
[(551, 600)] = null,
322+
[(601, 650)] = null,
323+
[(651, 700)] = null,
324+
[(701, 750)] = null,
325+
[(751, 800)] = null,
326+
[(801, 850)] = null,
327+
[(851, 900)] = null,
328+
[(901, 950)] = null,
329+
[(951, 1000)] = null
260330
};
261331

262332
protected static readonly Dictionary<(int, int), List<string>> OffHandDrops = new()
@@ -282,7 +352,17 @@ public abstract class RewardScript
282352
[(300, 349)] = null,
283353
[(350, 399)] = null,
284354
[(400, 449)] = null,
285-
[(450, 500)] = null
355+
[(450, 500)] = null,
356+
[(501, 550)] = null,
357+
[(551, 600)] = null,
358+
[(601, 650)] = null,
359+
[(651, 700)] = null,
360+
[(701, 750)] = null,
361+
[(751, 800)] = null,
362+
[(801, 850)] = null,
363+
[(851, 900)] = null,
364+
[(901, 950)] = null,
365+
[(951, 1000)] = null
286366
};
287367

288368
protected internal static readonly Dictionary<(int, int), List<string>> ShieldDrops = new()
@@ -344,7 +424,17 @@ public abstract class RewardScript
344424
[(300, 349)] = null,
345425
[(350, 399)] = null,
346426
[(400, 449)] = null,
347-
[(450, 500)] = null
427+
[(450, 500)] = null,
428+
[(501, 550)] = null,
429+
[(551, 600)] = null,
430+
[(601, 650)] = null,
431+
[(651, 700)] = null,
432+
[(701, 750)] = null,
433+
[(751, 800)] = null,
434+
[(801, 850)] = null,
435+
[(851, 900)] = null,
436+
[(901, 950)] = null,
437+
[(951, 1000)] = null
348438
};
349439

350440
protected static readonly Dictionary<(int, int), List<string>> WristDrops = new()
@@ -370,7 +460,17 @@ public abstract class RewardScript
370460
[(300, 349)] = ["Golden Talon Gauntlet"],
371461
[(350, 399)] = null,
372462
[(400, 449)] = null,
373-
[(450, 500)] = null
463+
[(450, 500)] = null,
464+
[(501, 550)] = null,
465+
[(551, 600)] = null,
466+
[(601, 650)] = null,
467+
[(651, 700)] = null,
468+
[(701, 750)] = null,
469+
[(751, 800)] = null,
470+
[(801, 850)] = null,
471+
[(851, 900)] = null,
472+
[(901, 950)] = null,
473+
[(951, 1000)] = null
374474
};
375475

376476
// Reward based on Monster level

Zolian.Server.Base/GameScripts/Formulas/Ac.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public override long Calculate(Sprite obj, long value)
4040
{
4141
dmgMitigation = monster.Template.MonsterArmorType switch
4242
{
43-
MonsterArmorType.Caster when dmgMitigation >= 0.90f => 0.90f,
44-
MonsterArmorType.Common when dmgMitigation >= 0.95f => 0.95f,
43+
MonsterArmorType.Caster when dmgMitigation >= 0.50f => 0.50f,
44+
MonsterArmorType.Common when dmgMitigation >= 0.75f => 0.75f,
4545
MonsterArmorType.Tank when dmgMitigation >= 0.98f => 0.98f,
4646
_ => dmgMitigation
4747
};

0 commit comments

Comments
 (0)