From c7da2775b2b53997990efc2ad79ac690147be773 Mon Sep 17 00:00:00 2001 From: Crypto137 Date: Fri, 13 Jan 2023 09:38:52 +0300 Subject: [PATCH 1/5] Fix resurrection time attribute encoding --- .../D3-GameServer/MessageSystem/GameAttirbute.List.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/MessageSystem/GameAttirbute.List.cs b/src/DiIiS-NA/D3-GameServer/MessageSystem/GameAttirbute.List.cs index fbd7aff..99c9605 100644 --- a/src/DiIiS-NA/D3-GameServer/MessageSystem/GameAttirbute.List.cs +++ b/src/DiIiS-NA/D3-GameServer/MessageSystem/GameAttirbute.List.cs @@ -375,9 +375,9 @@ namespace DiIiS_NA.GameServer.MessageSystem public static readonly GameAttributeF World_Seed = new GameAttributeF(758, 0, -1, 0, 0, "", "", "World_Seed", GameAttributeEncoding.Float32, 0, 0, 0, 32); public static readonly GameAttributeF Combo_Time_Last_Move = new GameAttributeF(802, 0, -1, 0, 0, "", "", "Combo_Time_Last_Move", GameAttributeEncoding.Float32, 0, 0, 0, 32); public static readonly GameAttributeF Death_Replacement_Effect_Group_SNO = new GameAttributeF(804, -1, -1, 0, 0, "", "", "Death_Replacement_Effect_Group_SNO", GameAttributeEncoding.Float32, 0, 0, 0, 32); - public static readonly GameAttributeF Checkpoint_Resurrection_Allowed_Game_Time = new GameAttributeF(805, 0, -1, 0, 0, "", "", "Checkpoint_Resurrection_Allowed_Game_Time", GameAttributeEncoding.Float32, 0, 0, 0, 32); - public static readonly GameAttributeF Checkpoint_Resurrection_Forced_Game_Time = new GameAttributeF(806, 0, -1, 0, 0, "", "", "Checkpoint_Resurrection_Forced_Game_Time", GameAttributeEncoding.Float32, 0, 0, 0, 32); - public static readonly GameAttributeF Corpse_Resurrection_Allowed_Game_Time = new GameAttributeF(807, 0, -1, 0, 0, "", "", "Corpse_Resurrection_Allowed_Game_Time", GameAttributeEncoding.Float32, 0, 0, 0, 32); + public static readonly GameAttributeI Checkpoint_Resurrection_Allowed_Game_Time = new GameAttributeI(805, 0, -1, 0, 0, "", "", "Checkpoint_Resurrection_Allowed_Game_Time", GameAttributeEncoding.Int, 0, 0, 0, 32); + public static readonly GameAttributeI Checkpoint_Resurrection_Forced_Game_Time = new GameAttributeI(806, 0, -1, 0, 0, "", "", "Checkpoint_Resurrection_Forced_Game_Time", GameAttributeEncoding.Int, 0, 0, 0, 32); + public static readonly GameAttributeI Corpse_Resurrection_Allowed_Game_Time = new GameAttributeI(807, 0, -1, 0, 0, "", "", "Corpse_Resurrection_Allowed_Game_Time", GameAttributeEncoding.Int, 0, 0, 0, 32); public static readonly GameAttributeF Controlling_TimedEvent_SNO = new GameAttributeF(810, -1, -1, 0, 0, "", "", "Controlling_TimedEvent_SNO", GameAttributeEncoding.Float32, 0, 0, 0, 32); public static readonly GameAttributeF Spawner_Concurrent_Count_ID = new GameAttributeF(855, -1, -1, 0, 0, "", "", "Spawner_Concurrent_Count_ID", GameAttributeEncoding.Float32, 0, 0, 0, 32); public static readonly GameAttributeI Skill_Override = new GameAttributeI(857, -1, -1, 0, 0, "", "", "Skill_Override", GameAttributeEncoding.Int, 136, 0, 0, 32); From 1babc5cfd4e18c756f0a6e67463b8e8f4c86a176 Mon Sep 17 00:00:00 2001 From: Crypto137 Date: Fri, 13 Jan 2023 09:48:21 +0300 Subject: [PATCH 2/5] Fix resurrection at corpse --- .../D3-GameServer/GSSystem/PlayerSystem/Player.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs index da6ef2c..9a3fa30 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs @@ -2461,8 +2461,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem } } } + + this.Attributes[GameAttribute.Corpse_Resurrection_Charges] = 3; // Reset resurrection charges on zone change (TODO: do not reset charges on reentering the same zone) + #if DEBUG - Logger.Warn("Местополежение игрока {0}, Scene: {1} SNO: {2} LevelArea: {3}", this.Toon.Name, this.CurrentScene.SceneSNO.Name, this.CurrentScene.SceneSNO.Id, this.CurrentScene.Specification.SNOLevelAreas[0]); + Logger.Warn("Местоположение игрока {0}, Scene: {1} SNO: {2} LevelArea: {3}", this.Toon.Name, this.CurrentScene.SceneSNO.Name, this.CurrentScene.SceneSNO.Id, this.CurrentScene.Specification.SNOLevelAreas[0]); #else #endif @@ -2653,7 +2656,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem this.Revive(this.CheckPointPosition); break; case 2: - //this.Revive(this.Position); + if (this.Attributes[GameAttribute.Corpse_Resurrection_Charges] > 0) + { + this.Revive(this.Position); + this.Attributes[GameAttribute.Corpse_Resurrection_Charges]--; + } break; } } @@ -3811,8 +3818,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem this.Attributes[GameAttribute.Resurrect_As_Observer] = state; //this.Attributes[GameAttribute.Observer] = !state; } - //this.Attributes[GameAttribute.Corpse_Resurrection_Charges] = 1; //enable that to allow resurrecting at corpse - //this.Attributes[GameAttribute.Corpse_Resurrection_Allowed_Game_Time] = this.World.Game.TickCounter + 300; //timer for auto-revive + //this.Attributes[GameAttribute.Corpse_Resurrection_Charges] = 1; // Enable this to allow unlimited resurrection at corpse + //this.Attributes[GameAttribute.Corpse_Resurrection_Allowed_Game_Time] = this.World.Game.TickCounter + 300; // Timer for auto-revive (seems to be broken?) this.Attributes.BroadcastChangedIfRevealed(); } From e65446a73466c8be93260de34d1b36d1c95e0b25 Mon Sep 17 00:00:00 2001 From: Crypto137 Date: Fri, 13 Jan 2023 10:14:03 +0300 Subject: [PATCH 3/5] Move health potion implementation to a power --- .../GSSystem/ItemsSystem/Item.cs | 3 +-- .../General/DrinkHealthPotion.cs | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/General/DrinkHealthPotion.cs diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs index 84d2885..85c3faa 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs @@ -927,8 +927,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem if (player.Attributes[GameAttribute.Hitpoints_Cur] == player.Attributes[GameAttribute.Hitpoints_Max]) return; - player.AddPercentageHP(60); - player.World.BuffManager.AddBuff(this, player, new PowerSystem.Implementations.CooldownBuff(30211, TickTimer.WaitSeconds(player.World.Game, 30f))); + player.World.PowerManager.RunPower(player, 30211); if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1) player.Inventory.DestroyInventoryItem(this); // No more potions! diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/General/DrinkHealthPotion.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/General/DrinkHealthPotion.cs new file mode 100644 index 0000000..b517f22 --- /dev/null +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/General/DrinkHealthPotion.cs @@ -0,0 +1,24 @@ +//Blizzless Project 2022 +using System.Collections.Generic; +using DiIiS_NA.GameServer.GSSystem.PlayerSystem; +using DiIiS_NA.GameServer.GSSystem.TickerSystem; + +namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations.General +{ + //30211 class DrinkHealthPotion + [ImplementsPowerSNO(30211)] + public class DrinkHealthPotion : PowerScript + { + public override IEnumerable Run() + { + if (User is Player) + { + Player player = (Player)User; + player.AddPercentageHP(60); + AddBuff(player, player, new CooldownBuff(30211, TickTimer.WaitSeconds(player.World.Game, 30f))); + } + + yield break; + } + } +} From a489b22d686f1e29fee09ecc26807d5715e6af4a Mon Sep 17 00:00:00 2001 From: Crypto137 Date: Fri, 13 Jan 2023 10:15:00 +0300 Subject: [PATCH 4/5] Disable potion consumption on use --- src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs index 85c3faa..366072f 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs @@ -929,6 +929,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem player.World.PowerManager.RunPower(player, 30211); + /* Potions are no longer consumable if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1) player.Inventory.DestroyInventoryItem(this); // No more potions! else @@ -936,6 +937,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem this.UpdateStackCount(--this.Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one this.Attributes.SendChangedMessage(player.InGameClient); } + */ + return; } From ba3cd35ae617483954f84ad7e26f9d2ccdf0b596 Mon Sep 17 00:00:00 2001 From: Crypto137 Date: Fri, 13 Jan 2023 10:22:13 +0300 Subject: [PATCH 5/5] Disable potion drops when player has one in their inventory already --- src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs index 096fbae..ddf6290 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/World.cs @@ -875,7 +875,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem } public void SpawnRandomPotion(Actor source, Player player) { - if (player != null && !player.Inventory.HaveEnough(DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("HealthPotionBottomless"), 100)) + if (player != null && !player.Inventory.HaveEnough(DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("HealthPotionBottomless"), 1)) { var item = ItemGenerator.GenerateRandomPotion(player); if (item == null) return;