From d044a9c1fde1e57ebd1339c663acaaec46abd995 Mon Sep 17 00:00:00 2001 From: Lucca Faria Ferri Date: Thu, 26 Jan 2023 07:59:35 -0800 Subject: [PATCH 1/6] Fixed issue while compiling GameCommands.cs --- src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs b/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs index 7e9a050..142226c 100644 --- a/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs +++ b/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs @@ -694,10 +694,6 @@ namespace DiIiS_NA.GameServer.CommandManager return String.Format("Message sended."); } - - return matches.Aggregate(matches.Count >= 1 ? "Actor Matches:\n" : "No match found.", - (current, match) => current + - $"[{match.SNOId.ToString("D6")}] {match.Name} ({(match.Data as DiIiS_NA.Core.MPQ.FileFormats.Actor).Type} {(((match.Data as DiIiS_NA.Core.MPQ.FileFormats.Actor).Type == ActorType.Gizmo) ? ((int)(match.Data as DiIiS_NA.Core.MPQ.FileFormats.Actor).TagMap[ActorKeys.GizmoGroup]).ToString() : "")})\n"); } [CommandGroup("lookup", From 9d046be1d1824b813d65eacdbbce51171b05e02c Mon Sep 17 00:00:00 2001 From: DeKaN Date: Thu, 26 Jan 2023 19:25:16 +0400 Subject: [PATCH 2/6] Revert all TagMap changes and fix some exceptions --- src/DiIiS-NA/Core/MPQ/FileFormats/AnimSet.cs | 6 +++--- .../GSSystem/ActorSystem/Implementations/CathedralLamp.cs | 4 ++-- .../GSSystem/ActorSystem/Implementations/CathedralWall.cs | 4 ++-- .../ActorSystem/Implementations/ChallengeObelisk.cs | 4 ++-- .../Implementations/DesctructibleLootContainer.cs | 4 ++-- .../GSSystem/ActorSystem/Implementations/Door.cs | 2 +- .../GSSystem/ActorSystem/Implementations/LootContainer.cs | 2 +- .../GSSystem/ActorSystem/Implementations/NephalemStone.cs | 3 ++- .../ActorSystem/Implementations/ProximityTriggeredGizmo.cs | 2 +- .../GSSystem/ActorSystem/Implementations/Readable.cs | 2 +- .../ActorSystem/Implementations/ScriptObjects/BelialRoom.cs | 2 +- .../ActorSystem/Implementations/ScriptObjects/CainBook.cs | 2 +- .../Implementations/ScriptObjects/SwordOfLeoric.cs | 2 +- .../Implementations/ScriptObjects/actIIICatapult.cs | 2 +- .../ActorSystem/Implementations/ScriptObjects/caOut_Cage.cs | 4 ++-- src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs | 2 +- .../D3-GameServer/GSSystem/GameSystem/QuestManager.cs | 2 +- src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs | 6 +++--- .../GSSystem/PlayerSystem/ConversationManager.cs | 4 ++-- src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs | 4 ++-- .../Implementations/MonsterSkills/SummoningSkill.cs | 4 ++-- .../GSSystem/PowerSystem/Payloads/DeathPayload.cs | 6 +++--- .../GSSystem/PowerSystem/Payloads/HitPayload.cs | 4 ++-- src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs | 6 ++---- .../QuestEvents/Implementations/Act I/DrownedTemple.cs | 2 +- .../QuestEvents/Implementations/Act I/SpawnSkeletons.cs | 2 +- src/DiIiS-NA/Program.cs | 2 +- 27 files changed, 44 insertions(+), 45 deletions(-) diff --git a/src/DiIiS-NA/Core/MPQ/FileFormats/AnimSet.cs b/src/DiIiS-NA/Core/MPQ/FileFormats/AnimSet.cs index fe269d3..2be3b10 100644 --- a/src/DiIiS-NA/Core/MPQ/FileFormats/AnimSet.cs +++ b/src/DiIiS-NA/Core/MPQ/FileFormats/AnimSet.cs @@ -42,8 +42,8 @@ namespace DiIiS_NA.Core.MPQ.FileFormats }; public Header Header { get; private set; } public int SNOParentAnimSet { get; private set; } - private TagMap TagMapAnimDefault; - private TagMap[] AnimSetTagMaps; + public TagMap TagMapAnimDefault { get; private set; } + public TagMap[] AnimSetTagMaps; private Dictionary _animations; @@ -63,7 +63,7 @@ namespace DiIiS_NA.Core.MPQ.FileFormats if (SNOParentAnimSet != -1) { var ani = (AnimSet)MPQStorage.Data.Assets[SNOGroup.AnimSet][SNOParentAnimSet].Data; - return defaultAnimations.Union(ani.Animations.Where(x => !defaultAnimations.ContainsKey(x.Key))).ToDictionary(x => x.Key, x => (AnimationSno)x.Value); + return defaultAnimations.Union(ani.Animations.Where(x => !defaultAnimations.ContainsKey(x.Key))).ToDictionary(x => x.Key, x => x.Value); } return defaultAnimations; } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralLamp.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralLamp.cs index ab23e4e..20f7d76 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralLamp.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralLamp.cs @@ -58,7 +58,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations Logger.Trace("Breaked barricade, id: {0}", SNO); - if (AnimationSet.Animations.ContainsKey(AnimationSetKeys.DeathDefault.ID)) + if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault)) World.BroadcastIfRevealed(plr => new PlayAnimationMessage { ActorID = DynamicID(plr), @@ -69,7 +69,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations new PlayAnimationMessageSpec() { Duration = 10, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID], //{DeathDefault = 10217} + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault], //{DeathDefault = 10217} PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralWall.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralWall.cs index 21eb7c8..7f1c35d 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralWall.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/CathedralWall.cs @@ -57,7 +57,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations Logger.Trace("Breaked barricade, id: {0}", SNO); - if (this.AnimationSet.Animations.ContainsKey(AnimationSetKeys.DeathDefault.ID)) + if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault)) World.BroadcastIfRevealed(plr => new PlayAnimationMessage { ActorID = DynamicID(plr), @@ -68,7 +68,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations new PlayAnimationMessageSpec() { Duration = 10, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ChallengeObelisk.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ChallengeObelisk.cs index 1ca3313..0f1edf2 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ChallengeObelisk.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ChallengeObelisk.cs @@ -41,7 +41,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations { bool Activated = false; - this.PlayAnimation(5, AnimationSet.Animations[AnimationSetKeys.Opening.ID]); + this.PlayAnimation(5, (AnimationSno)AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2); Attributes[GameAttribute.Untargetable] = !Activated; Attributes[GameAttribute.NPC_Is_Operatable] = Activated; @@ -81,7 +81,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations } else { - this.PlayAnimation(5, AnimationSet.Animations[AnimationSetKeys.Opening.ID]); + this.PlayAnimation(5, (AnimationSno)AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); } return true; } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/DesctructibleLootContainer.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/DesctructibleLootContainer.cs index d414494..fe658ff 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/DesctructibleLootContainer.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/DesctructibleLootContainer.cs @@ -106,7 +106,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations (source as Player).AddAchievementCounter(74987243307171, 1); } - if (this.AnimationSet.Animations.ContainsKey(AnimationSetKeys.DeathDefault.ID)) + if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault)) World.BroadcastIfRevealed(plr => new PlayAnimationMessage { ActorID = DynamicID(plr), @@ -117,7 +117,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations new PlayAnimationMessageSpec() { Duration = 10, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Door.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Door.cs index c8917dd..ea1ea4b 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Door.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Door.cs @@ -98,7 +98,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations new PlayAnimationMessageSpec() { Duration = 500, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/LootContainer.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/LootContainer.cs index 96e8fba..b3fa6db 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/LootContainer.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/LootContainer.cs @@ -159,7 +159,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations new PlayAnimationMessageSpec() { Duration = 50, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NephalemStone.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NephalemStone.cs index 8ca6eb9..f470a4e 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NephalemStone.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NephalemStone.cs @@ -37,7 +37,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations if (!base.Reveal(player)) return false; - var animation = Attributes[GameAttribute.Untargetable] ? AnimationSet.Animations[AnimationSetKeys.Open.ID] : AnimationSet.Animations[AnimationSetKeys.IdleDefault.ID]; + var animationTag = Attributes[GameAttribute.Untargetable] ? AnimationSetKeys.Open : AnimationSetKeys.IdleDefault; + var animation = (AnimationSno)AnimationSet.TagMapAnimDefault[animationTag]; PlayAnimation(5, animation); SetIdleAnimation(animation); diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ProximityTriggeredGizmo.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ProximityTriggeredGizmo.cs index e703065..b915edc 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ProximityTriggeredGizmo.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ProximityTriggeredGizmo.cs @@ -66,7 +66,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations new PlayAnimationMessageSpec() { Duration = duration, - AnimationSNO = (int)(ActorData.TagMap.ContainsKey(ActorKeys.DeathAnimationTag) ? AnimationSet.Animations[ActorData.TagMap[ActorKeys.DeathAnimationTag]] : AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID]) , + AnimationSNO = ActorData.TagMap.ContainsKey(ActorKeys.DeathAnimationTag) ? AnimationSet.TagMapAnimDefault[ActorData.TagMap[ActorKeys.DeathAnimationTag]].Int : AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Readable.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Readable.cs index 9dc4550..ec5e0cf 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Readable.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Readable.cs @@ -61,7 +61,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations new PlayAnimationMessageSpec() { Duration = 50, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/BelialRoom.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/BelialRoom.cs index da305fa..5497842 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/BelialRoom.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/BelialRoom.cs @@ -71,7 +71,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects new PlayAnimationMessageSpec() { Duration = 600, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/CainBook.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/CainBook.cs index 4ecb48f..58db544 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/CainBook.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/CainBook.cs @@ -81,7 +81,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects new PlayAnimationMessageSpec() { Duration = idDuration, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/SwordOfLeoric.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/SwordOfLeoric.cs index 8220019..3a48f2b 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/SwordOfLeoric.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/SwordOfLeoric.cs @@ -84,7 +84,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects new PlayAnimationMessageSpec() { Duration = 50, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/actIIICatapult.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/actIIICatapult.cs index 8231719..a0511e0 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/actIIICatapult.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/actIIICatapult.cs @@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects new PlayAnimationMessageSpec() { Duration = 1000, - AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID], + AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, AnimationTag = 0, Speed = 1 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/caOut_Cage.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/caOut_Cage.cs index 36508b3..62715fd 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/caOut_Cage.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/caOut_Cage.cs @@ -28,8 +28,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations if (Attributes[GameAttribute.Disabled]) return; - PlayAnimation(5, AnimationSet.Animations[AnimationSetKeys.Opening.ID]); - SetIdleAnimation(AnimationSet.Animations[AnimationSetKeys.Opening.ID]); + PlayAnimation(5, (AnimationSno)AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); + SetIdleAnimation((AnimationSno)AnimationSetKeys.Open.ID); Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true; Attributes.BroadcastChangedIfRevealed(); diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs index 566a38a..4914b42 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs @@ -1539,7 +1539,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem //{[1013103213, {[Actor] [Type: Gizmo] SNOId:78439 GlobalId: 1013103213 Position: x:119.54008 y:140.65799 z:-4.535186 Name: Test_CainIntro_greybox_bridge_trOut_TempWorking}]} //Обрушиваем мостик //EffectGroup "CainIntro_shake", 81546 var bridge = encWorld.GetActorBySNO(ActorSno._test_cainintro_greybox_bridge_trout_tempworking); - bridge.PlayAnimation(5, bridge.AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID]); + bridge.PlayAnimation(5, (AnimationSno)bridge.AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault]); //} foreach (var skeleton in Skeletons) { diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs index 8c650aa..39f8d8e 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs @@ -939,7 +939,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem { while (MonsterCount < AdditionalTargetCounter + 20) { - Core.Types.Math.Vector3D SSV = Scenes[RandomHelper.Next(0, Scenes.Count - 1)].Position; + Core.Types.Math.Vector3D SSV = Scenes[RandomHelper.Next(0, Scenes.Count)].Position; Core.Types.Math.Vector3D SP = null; while (true) { diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs index 98e0e72..f480e57 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs @@ -569,9 +569,9 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem monster.EnterWorld(position); if (monster.AnimationSet != null) { - var animationTag = new[] { AnimationSetKeys.Spawn.ID, AnimationSetKeys.Spawn2.ID }.FirstOrDefault(x => monster.AnimationSet.Animations.ContainsKey(x)); + var animationTag = new[] { AnimationSetKeys.Spawn, AnimationSetKeys.Spawn2 }.FirstOrDefault(x => monster.AnimationSet.TagMapAnimDefault.ContainsKey(x)); - if (animationTag > 0) + if (animationTag != null) { monster.World.BroadcastIfRevealed(plr => new PlayAnimationMessage { @@ -583,7 +583,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem new PlayAnimationMessageSpec() { Duration = 150, - AnimationSNO = (int)monster.AnimationSet.Animations[animationTag], + AnimationSNO = monster.AnimationSet.TagMapAnimDefault[animationTag], PermutationIndex = 0, Speed = 1 } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs index b2c8621..7701de2 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs @@ -530,8 +530,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem var HubWorld = player.InGameClient.Game.GetWorld(WorldSno.x1_tristram_adventure_mode_hub); var NStone = HubWorld.GetActorBySNO(ActorSno._x1_openworld_lootrunobelisk_b); bool Activated = true; - NStone.SetIdleAnimation(NStone.AnimationSet.Animations[AnimationSetKeys.IdleDefault.ID]); - NStone.PlayActionAnimation(NStone.AnimationSet.Animations[AnimationSetKeys.Closing.ID]); + NStone.SetIdleAnimation((AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.IdleDefault]); + NStone.PlayActionAnimation((AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Closing]); NStone.Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2); NStone.Attributes[GameAttribute.Untargetable] = !Activated; NStone.Attributes[GameAttribute.NPC_Is_Operatable] = Activated; diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs index 6f127aa..5c59b12 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs @@ -1715,7 +1715,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem #region Активация NStone = World.GetActorBySNO(ActorSno._x1_openworld_lootrunobelisk_b); - NStone.PlayAnimation(5, NStone.AnimationSet.Animations[AnimationSetKeys.Opening.ID]); + NStone.PlayAnimation(5, (AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); NStone.Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2); NStone.Attributes[GameAttribute.Untargetable] = !Activated; NStone.Attributes[GameAttribute.NPC_Is_Operatable] = Activated; @@ -1852,7 +1852,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem actor.Destroy(); #region Активация NStone = World.GetActorBySNO(ActorSno._x1_openworld_lootrunobelisk_b); - NStone.PlayAnimation(5, NStone.AnimationSet.Animations[AnimationSetKeys.Opening.ID]); + NStone.PlayAnimation(5, (AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); NStone.Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2); NStone.Attributes[GameAttribute.Untargetable] = !Activated; NStone.Attributes[GameAttribute.NPC_Is_Operatable] = Activated; diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/MonsterSkills/SummoningSkill.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/MonsterSkills/SummoningSkill.cs index 8aa08e7..240b730 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/MonsterSkills/SummoningSkill.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/MonsterSkills/SummoningSkill.cs @@ -119,7 +119,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations if (payload.Target == User && payload is DeathPayload) { if (User.GetActorsInRange(80f).Count > 100) return; - User.PlayAnimation(11, User.AnimationSet.Animations[AnimationSetKeys.Explode.ID]); + User.PlayAnimation(11, (AnimationSno)User.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Explode]); for (int i = 0; i < 3; i++) { var monster = ActorFactory.Create(User.World, (User as Monster).SNOSummons[0], new TagMap()); @@ -170,7 +170,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations SuicideTimer = null; var dmgTargets = GetEnemiesInRadius(User.Position, 6f); WeaponDamage(dmgTargets, 5.0f, DamageType.Physical); - User.PlayAnimation(11, User.AnimationSet.Animations[AnimationSetKeys.Attack.ID]); + User.PlayAnimation(11, (AnimationSno)User.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Attack]); WeaponDamage(User, 1000.0f, DamageType.Physical); //(User as Living).Kill(); //foreach (var anim in Target.AnimationSet.TagMapAnimDefault) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs index 3e53684..c6c68c3 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs @@ -1176,7 +1176,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads private AnimationSno FindBestDeathAnimationSNO() { - if (Context != null) + if (Context == null) return AnimationSno._NONE; // check if power has special death animation, and roll chance to use it @@ -1211,8 +1211,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads private AnimationSno GetSNOFromTag(TagKeyInt tag) { - if (Target.AnimationSet != null && Target.AnimationSet.Animations.ContainsKey(tag.ID)) - return (AnimationSno)Target.AnimationSet.Animations[tag.ID]; + if (Target.AnimationSet != null && Target.AnimationSet.TagMapAnimDefault.ContainsKey(tag)) + return (AnimationSno)Target.AnimationSet.TagMapAnimDefault[tag]; else return AnimationSno._NONE; } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/HitPayload.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/HitPayload.cs index 19962b0..64bf48f 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/HitPayload.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/HitPayload.cs @@ -821,9 +821,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads if (Target.World.BuffManager.GetFirstBuff(Target) == null && Target.AnimationSet != null) { - if (Target.AnimationSet.Animations.ContainsKey(AnimationSetKeys.GetHit.ID) && FastRandom.Instance.Next(100) < 33) + if (Target.AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.GetHit) && FastRandom.Instance.Next(100) < 33) { - var hitAni = Target.AnimationSet.Animations[AnimationSetKeys.GetHit.ID]; + var hitAni = (AnimationSno)Target.AnimationSet.TagMapAnimDefault[AnimationSetKeys.GetHit]; if (hitAni != AnimationSno._NONE) { // HACK: hardcoded animation speed/ticks, need to base those off hit recovery speed diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs index effd681..f741236 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs @@ -1220,8 +1220,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem ListenProximity(ActorSno._woodfencee_fields_trout, new Advance()); //if going through graveyard var Gate = world.GetActorBySNO(ActorSno._cemetary_gate_trout_wilderness_no_lock); Gate.Field2 = 16; - var animation = Gate.AnimationSet.Animations[AnimationSetKeys.Opening.ID]; - Gate.PlayAnimation(5, animation); + Gate.PlayAnimation(5, (AnimationSno)Gate.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); world.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDCollFlagsMessage { ActorID = Gate.DynamicID(plr), @@ -1896,8 +1895,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem var world = Game.GetWorld(WorldSno.trout_townattack_chapelcellar_a); foreach (var Table in world.GetActorsBySNO(ActorSno._trout_townattack_cellar_altar)) { Table.SetUsable(false); - var animation = Table.AnimationSet.Animations[AnimationSetKeys.Open.ID]; - Table.SetIdleAnimation(animation); + Table.SetIdleAnimation((AnimationSno)Table.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Open]); } foreach (var Maghda in world.GetActorsBySNO(ActorSno._maghda_a_tempprojection)) Maghda.Destroy(); }); diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/DrownedTemple.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/DrownedTemple.cs index ac57cb9..8c44dd3 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/DrownedTemple.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/DrownedTemple.cs @@ -172,7 +172,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents.Implementations var AllTablets = DrownedTempleWorld.GetActorsBySNO(ActorSno._a1dun_caves_nephalem_altar_tablet_a); foreach (var Tablet in AllTablets) { - Tablet.PlayAnimation(5, Tablet.AnimationSet.Animations[AnimationSetKeys.Opening.ID]); + Tablet.PlayAnimation(5, (AnimationSno)Tablet.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); DrownedTempleWorld.BroadcastIfRevealed(plr => new SetIdleAnimationMessage { ActorID = Tablet.DynamicID(plr), diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/SpawnSkeletons.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/SpawnSkeletons.cs index 29d9de3..11e8049 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/SpawnSkeletons.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/Implementations/Act I/SpawnSkeletons.cs @@ -65,7 +65,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents.Implementations StartConversation(world, 17923); - SkeletonKing_Bridge.PlayAnimation(5, SkeletonKing_Bridge.AnimationSet.Animations[AnimationSetKeys.Opening.ID], 1f); + SkeletonKing_Bridge.PlayAnimation(5, (AnimationSno)SkeletonKing_Bridge.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], 1f); world.BroadcastIfRevealed(plr => new SetIdleAnimationMessage { diff --git a/src/DiIiS-NA/Program.cs b/src/DiIiS-NA/Program.cs index 67c11da..e6e1457 100644 --- a/src/DiIiS-NA/Program.cs +++ b/src/DiIiS-NA/Program.cs @@ -126,7 +126,7 @@ namespace DiIiS_NA using var proc = Process.GetCurrentProcess(); var cpuTime = proc.TotalProcessorTime; var text = - $"{name} | {PlayerManager.OnlinePlayers.Count()} onlines in {PlayerManager.OnlinePlayers.Count(s => s.InGameClient.Player.World != null)} worlds | Memory: {totalMemory:0.000} GB | CPU Time: {cpuTime.ToSmallText()} | Uptime: {uptime}"; + $"{name} | {PlayerManager.OnlinePlayers.Count()} onlines in {PlayerManager.OnlinePlayers.Count(s => s.InGameClient?.Player?.World != null)} worlds | Memory: {totalMemory:0.000} GB | CPU Time: {cpuTime.ToSmallText()} | Uptime: {uptime}"; try { Console.Title = text; From 6c41dc4c6787faad317c573f9c16b632e5336050 Mon Sep 17 00:00:00 2001 From: Lucca Faria Ferri Date: Thu, 26 Jan 2023 08:10:13 -0800 Subject: [PATCH 3/6] Fixed #81 - A new bug appeared - on the first quest, talking with rumford doesn't spawn the monsters (advance quest) Also, renamed QuestSetuped to QuestSetup. --- src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs | 6 +++--- .../D3-GameServer/GSSystem/GameSystem/QuestManager.cs | 2 +- .../D3-GameServer/GSSystem/QuestSystem/ActI.cs | 10 +++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs index 566a38a..f5c64f8 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs @@ -86,7 +86,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem public List ConnectedPlayers = new List(); - public bool QuestSetuped = false; + public bool QuestSetup = false; public int LoadedPlayers = 0; @@ -931,7 +931,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem { if (PvP) return; - if (!QuestSetuped) + if (!QuestSetup) { QuestManager.SetQuests(); DestinationEnterQuest = currQuest; @@ -941,7 +941,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem CurrentQuest = QuestsOrder[0]; CurrentStep = -1; - if (CurrentAct == 3000) + if (CurrentAct is 3000 or 0) { QuestManager.Quests[CurrentQuest].Steps[-1].OnAdvance.Invoke(); return; diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs index 8c650aa..98e02d7 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs @@ -75,7 +75,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem { Game.QuestProgress.SetQuests(); Game.SideQuestProgress.SetQuests(); - Game.QuestSetuped = true; + Game.QuestSetup = true; } public void ClearQuests() diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs index effd681..96268db 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/ActI.cs @@ -85,12 +85,8 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem { if (Game.CurrentQuest == 87700 & Game.CurrentStep == -1) { - //Указывает куда идти - //ActiveArrow(this.Game.GetWorld(71150), 3739); - - //Убираем лишнюю Лею - var Leah = world.GetActorBySNO(ActorSno._leah, true); - if (Leah != null) Leah.Hidden = true; + var leah = world.GetActorBySNO(ActorSno._leah, true); + if (leah != null) leah.Hidden = true; } }); SetActorOperable(world, ActorSno._trout_newtristram_gate_town, false); @@ -139,7 +135,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem } catch { } UnlockTeleport(0); - if (world.GetActorsBySNO(ActorSno._trout_newtristram_gate_town).Where(d => d.Visible).FirstOrDefault() != null) + if (world.GetActorsBySNO(ActorSno._trout_newtristram_gate_town).FirstOrDefault(d => d.Visible) != null) Open(world, ActorSno._trout_newtristram_gate_town); ActiveArrow(world, ActorSno._g_portal_rectangle_orange_icondoor, WorldSno.trout_tristram_inn); ListenConversation(151123, new Advance()); From 98b6bf4d1304b84f7311559db2c9a155ee9fc3a8 Mon Sep 17 00:00:00 2001 From: Lucca Faria Ferri Date: Thu, 26 Jan 2023 08:20:55 -0800 Subject: [PATCH 4/6] quick (non-breaking) changes --- src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs | 2 +- src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs index f5c64f8..a22a53f 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs @@ -1068,7 +1068,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem { SyncedData = new GameSyncedData { - GameSyncedFlags = IsSeasoned == true ? IsHardcore == true ? 6 : 6 : IsHardcore == true ? 4 : 4, + GameSyncedFlags = IsSeasoned ? IsHardcore ? 6 : 4 : IsHardcore == true ? 4 : 6, Act = Math.Min(CurrentAct, 3000), //act id InitialMonsterLevel = InitialMonsterLevel, //InitialMonsterLevel MonsterLevel = 0x7044248F, //MonsterLevel diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs index 6f127aa..199e5bc 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs @@ -5129,7 +5129,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem } else { - Attributes[GameAttribute.Experience_Next_Lo] = Attributes[GameAttribute.Experience_Next_Lo] + (int)LevelBorders[Attributes[GameAttribute.Level]]; + Attributes[GameAttribute.Experience_Next_Lo] += (int)LevelBorders[Attributes[GameAttribute.Level]]; Toon.ExperienceNext = Attributes[GameAttribute.Experience_Next_Lo]; } From 5c2ae9e897ed4d8b8f9ef266b533221ea12e362c Mon Sep 17 00:00:00 2001 From: Lucca Faria Ferri Date: Thu, 26 Jan 2023 08:21:53 -0800 Subject: [PATCH 5/6] Compound assignment --- src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs index 199e5bc..8c0deae 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs @@ -5197,13 +5197,13 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem { GrantAchievement(74987243307039); if (!Toon.GameAccount.Flags.HasFlag(GameAccount.GameAccountFlags.HardcoreTormentUnlocked)) - Toon.GameAccount.Flags = Toon.GameAccount.Flags | GameAccount.GameAccountFlags.HardcoreTormentUnlocked; + Toon.GameAccount.Flags |= GameAccount.GameAccountFlags.HardcoreTormentUnlocked; } else { GrantAchievement(74987243307100); if (!Toon.GameAccount.Flags.HasFlag(GameAccount.GameAccountFlags.TormentUnlocked)) - Toon.GameAccount.Flags = Toon.GameAccount.Flags | GameAccount.GameAccountFlags.TormentUnlocked; + Toon.GameAccount.Flags |= GameAccount.GameAccountFlags.TormentUnlocked; } CheckLevelCap(); break; From 4043e013399cf66c2569cab42c64a29b5d16cb9e Mon Sep 17 00:00:00 2001 From: Lucca Faria Ferri Date: Thu, 26 Jan 2023 09:15:38 -0800 Subject: [PATCH 6/6] Added new commands, added option to spawnrandomequip to generate with a biased toonclass, added some minrank requirements to some commands --- .../CommandManager/GameCommands.cs | 88 ++++++++++++++++--- .../GSSystem/GameSystem/QuestManager.cs | 8 +- .../D3-GameServer/GSSystem/MapSystem/World.cs | 32 +++++-- .../GSSystem/PlayerSystem/Player.cs | 73 ++++++++------- src/DiIiS-NA/Program.cs | 2 +- 5 files changed, 145 insertions(+), 58 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs b/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs index 142226c..f1865d3 100644 --- a/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs +++ b/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs @@ -44,7 +44,22 @@ using static DiIiS_NA.Core.MPQ.FileFormats.GameBalance; namespace DiIiS_NA.GameServer.CommandManager { - [CommandGroup("invulnerable", "Makes you invulnerable")] + + [CommandGroup("heal", "Heals yourself", Account.UserLevels.Tester)] + public class HealCommand : CommandGroup + { + [DefaultCommand] + public string Heal(string[] @params, BattleClient invokerClient) + { + if (invokerClient?.InGameClient?.Player is not {} player) + return "You are not in game"; + + player.Heal(); + return "You have been healed"; + } + } + + [CommandGroup("invulnerable", "Makes you invulnerable", Account.UserLevels.GM)] public class InvulnerableCommand : CommandGroup { [DefaultCommand] @@ -68,7 +83,7 @@ namespace DiIiS_NA.GameServer.CommandManager } } - [CommandGroup("spawn", "Spawns a mob.\nUsage: spawn [actorSNO] [amount]")] + [CommandGroup("spawn", "Spawns a mob.\nUsage: spawn [actorSNO] [amount]", Account.UserLevels.GM)] public class SpawnCommand : CommandGroup { [DefaultCommand] @@ -124,7 +139,7 @@ namespace DiIiS_NA.GameServer.CommandManager } - [CommandGroup("levelup", "Levels your character.\nOptionally specify the number of levels: !levelup [count]")] + [CommandGroup("levelup", "Levels your character.\nOptionally specify the number of levels: !levelup [count]", Account.UserLevels.GM)] public class LevelUpCommand : CommandGroup { [DefaultCommand] @@ -172,7 +187,7 @@ namespace DiIiS_NA.GameServer.CommandManager } } - [CommandGroup("unlockart", "Unlock all artisans: !unlockart")] + [CommandGroup("unlockart", "Unlock all artisans: !unlockart", Account.UserLevels.Tester)] public class UnlockArtCommand : CommandGroup { [DefaultCommand] @@ -210,7 +225,7 @@ namespace DiIiS_NA.GameServer.CommandManager } [CommandGroup("platinum", - "Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")] + "Platinum for your character.\nOptionally specify the number of levels: !platinum [count]", Account.UserLevels.Tester)] public class PlatinumCommand : CommandGroup { [DefaultCommand] @@ -244,7 +259,7 @@ namespace DiIiS_NA.GameServer.CommandManager } } - [CommandGroup("stashup", "Upgrade Stash.\n !stashup")] + [CommandGroup("stashup", "Upgrade Stash.\n !stashup", Account.UserLevels.Tester)] public class StashUpCommand : CommandGroup { [DefaultCommand] @@ -264,7 +279,7 @@ namespace DiIiS_NA.GameServer.CommandManager } } - [CommandGroup("gold", "Gold for your character.\nOptionally specify the number of gold: !gold [count]")] + [CommandGroup("gold", "Gold for your character.\nOptionally specify the number of gold: !gold [count]", Account.UserLevels.GM)] public class GoldCommand : CommandGroup { [DefaultCommand] @@ -292,7 +307,7 @@ namespace DiIiS_NA.GameServer.CommandManager } [CommandGroup("achiplatinum", - "Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")] + "Platinum for your character.\nOptionally specify the number of levels: !platinum [count]", Account.UserLevels.GM)] public class PlatinumAchiCommand : CommandGroup { [DefaultCommand] @@ -330,7 +345,7 @@ namespace DiIiS_NA.GameServer.CommandManager } } - [CommandGroup("eff", "Platinum for your character.\nOptionally specify the number of levels: !eff [count]")] + [CommandGroup("eff", "Platinum for your character.\nOptionally specify the number of levels: !eff [count]", Account.UserLevels.GM)] public class PlayEffectGroup : CommandGroup { [DefaultCommand] @@ -357,7 +372,7 @@ namespace DiIiS_NA.GameServer.CommandManager } } - [CommandGroup("item", "Spawns an item (with a name or type).\nUsage: item [type |] [amount]")] + [CommandGroup("item", "Spawns an item (with a name or type).\nUsage: item [type |] [amount]", Account.UserLevels.GM)] public class ItemCommand : CommandGroup { [DefaultCommand] @@ -467,6 +482,41 @@ namespace DiIiS_NA.GameServer.CommandManager } } + [CommandGroup("drop", "Drops an epic item for your class.\nOptionally specify the number of items: !drop [1-20]", Account.UserLevels.Owner)] + public class DropCommand : CommandGroup + { + [DefaultCommand] + public string Drop(string[] @params, BattleClient invokerClient) + { + if (invokerClient?.InGameClient?.Player is not {} player) + return "You can only invoke from the client."; + + var amount = 1; + if (@params != null && @params.Any()) + if (!Int32.TryParse(@params[0], out amount)) amount = 1; + + amount = amount switch + { + < 1 => 1, + > 20 => 20, + _ => amount + }; + + try + { + for (int i = 0; i < amount; i++) + player.World.SpawnRandomEquip(player, player, 11, player.Level, toonClass: player.Toon.Class); + } + catch + { + for (int i = 0; i < amount; i++) + player.World.SpawnRandomEquip(player, player, 8, player.Level, toonClass: player.Toon.Class); + } + return $"Dropped {amount} random equipment."; + } + } + + [CommandGroup("tp", "Transfers your character to another world.")] public class TeleportCommand : CommandGroup { @@ -692,7 +742,23 @@ namespace DiIiS_NA.GameServer.CommandManager invokerClient.InGameClient.Game.QuestManager.LaunchQuestTimer(eventId, (float)duration, new Action((q) => { })); - return String.Format("Message sended."); + return String.Format("Message sent."); + } + + [Command("info", "Retrieves information about quest states.\n Usage: info")] + public string Info(string[] @params, BattleClient invokerClient) + { + var questManager = invokerClient.InGameClient.Game.QuestManager; + var act = questManager.CurrentAct; + var quest = questManager.Game.CurrentQuest; + var questStep = questManager.Game.CurrentStep; + var currentSideQuest = questManager.Game.CurrentSideQuest; + var currentSideQuestStep = questManager.Game.CurrentSideStep; + return $"Act: {act}\n" + + $"Quest: {quest}\n" + + $"Quest Step: {questStep}\n" + + $"Side Quest: {currentSideQuest}\n" + + $"Side Quest Step: {currentSideQuestStep}"; } } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs index 98e02d7..d44f687 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs @@ -51,13 +51,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem public Game Game { get; set; } - public int CurrentAct - { - get - { - return Game.CurrentAct; - } - } + public int CurrentAct => Game.CurrentAct; public delegate void QuestProgressDelegate(); public event QuestProgressDelegate OnQuestProgress = delegate { }; diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs index 98e0e72..d481e1e 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs @@ -6,7 +6,6 @@ using DiIiS_NA.D3_GameServer.Core.Types.SNO; //Blizzless Project 2022 using DiIiS_NA.GameServer.Core.Types.Math; //Blizzless Project 2022 -using DiIiS_NA.GameServer.Core.Types.Misc; //Blizzless Project 2022 using DiIiS_NA.GameServer.Core.Types.QuadTrees; //Blizzless Project 2022 @@ -50,6 +49,12 @@ using System.Linq; using System.Text; //Blizzless Project 2022 using System.Threading.Tasks; +using DiIiS_NA.Core.MPQ.FileFormats; +using DiIiS_NA.LoginServer.Toons; +using Actor = DiIiS_NA.GameServer.GSSystem.ActorSystem.Actor; +using Circle = DiIiS_NA.GameServer.Core.Types.Misc.Circle; +using Monster = DiIiS_NA.GameServer.GSSystem.ActorSystem.Monster; +using ResolvedPortalDestination = DiIiS_NA.GameServer.MessageSystem.Message.Fields.ResolvedPortalDestination; namespace DiIiS_NA.GameServer.GSSystem.MapSystem { @@ -790,18 +795,33 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem }, actor); } - public void SpawnRandomEquip(Actor source, Player player, int forceQuality = -1, int forceLevel = -1) + public Item SpawnRandomEquip(Actor source, Player player, int forceQuality = -1, int forceLevel = -1, GameBalance.ItemTypeTable type = null, ToonClass toonClass = ToonClass.Unknown) { //Logger.Debug("SpawnRandomEquip(): quality {0}", forceQuality); if (player != null) { int level = (forceLevel > 0 ? forceLevel : source.Attributes[GameAttribute.Level]); - var item = ItemGenerator.GenerateRandomEquip(player, level, forceQuality); - if (item == null) return; - player.GroundItems[item.GlobalID] = item; + if (toonClass == ToonClass.Unknown && type == null) + { + var item = ItemGenerator.GenerateRandomEquip(player, level, forceQuality, forceQuality); + if (item == null) return null; + player.GroundItems[item.GlobalID] = item; - DropItem(source, null, item); + DropItem(source, null, item); + return item; + } + else + { + var item = ItemGenerator.GenerateRandomEquip(player, level, forceQuality, forceQuality, type: type,owner_class: toonClass); + if (item == null) return null; + player.GroundItems[item.GlobalID] = item; + + DropItem(source, null, item); + return item; + } } + + return null; } public void SpawnRandomLegOrSetEquip(Actor source, Player player) { diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs index 8c0deae..b8a6da6 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs @@ -4896,86 +4896,86 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem }; public static void GeneratePLB() { - long PreviosExp = 7200000; + long previousExp = 7200000; ParagonLevelBorders.Add(7200000); for (int i = 0; i < 59; i++) { - PreviosExp += 1440000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 1440000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 10; i++) { - PreviosExp += 2880000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 2880000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 3; i++) { - PreviosExp += 5040000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 5040000; + ParagonLevelBorders.Add(previousExp); } - PreviosExp += 3660000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 3660000; + ParagonLevelBorders.Add(previousExp); for (int i = 0; i < 75; i++) { - PreviosExp += 1020000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 1020000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 101; i++) { - PreviosExp += 2040000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 2040000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 100; i++) { - PreviosExp += 4080000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 4080000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 99; i++) { - PreviosExp += 6120000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 6120000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 51; i++) { - PreviosExp += 8160000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 8160000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 50; i++) { - PreviosExp += 20400000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 20400000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 50; i++) { - PreviosExp += 40800000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 40800000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 50; i++) { - PreviosExp += 61200000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 61200000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 50; i++) { - PreviosExp += 81600000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 81600000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 50; i++) { - PreviosExp += 102000000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 102000000; + ParagonLevelBorders.Add(previousExp); } for (int i = 0; i < 1500; i++) { - PreviosExp += 122400000; - ParagonLevelBorders.Add(PreviosExp); + previousExp += 122400000; + ParagonLevelBorders.Add(previousExp); } long boosterofup = 229500000; for (int i = 0; i < 17750; i++) { boosterofup += 102000; - PreviosExp += boosterofup; - ParagonLevelBorders.Add(PreviosExp); + previousExp += boosterofup; + ParagonLevelBorders.Add(previousExp); } } //public static List ParagonLevelBorders = ((GameBalance)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.GameBalance][252616].Data).Experience.Select(row => row.DeltaXP).ToList(); @@ -6020,5 +6020,12 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem } #endregion + + public void Heal() + { + Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total]; + Attributes[GameAttribute.Hitpoints_Total_From_Level] = Attributes[GameAttribute.Hitpoints_Max_Total]; + Attributes.BroadcastChangedIfRevealed(); + } } } diff --git a/src/DiIiS-NA/Program.cs b/src/DiIiS-NA/Program.cs index 67c11da..883b1c1 100644 --- a/src/DiIiS-NA/Program.cs +++ b/src/DiIiS-NA/Program.cs @@ -118,7 +118,7 @@ namespace DiIiS_NA { try { - var uptime = (DateTime.Now - StartupTime).ToText(); + var uptime = (DateTime.Now - StartupTime).ToSmallText(); // get total memory from process var totalMemory = (double)((double)Process.GetCurrentProcess().WorkingSet64 / 1024 / 1024 / 1024);