Merge pull request #61 from Crypto137/master

Resurrection and potion fixes
This commit is contained in:
pr701 2023-01-13 12:26:51 +03:00 committed by GitHub
commit bf1a477e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 10 deletions

View File

@ -927,9 +927,9 @@ 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);
/* Potions are no longer consumable
if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
player.Inventory.DestroyInventoryItem(this); // No more potions!
else
@ -937,6 +937,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
this.UpdateStackCount(--this.Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one
this.Attributes.SendChangedMessage(player.InGameClient);
}
*/
return;
}

View File

@ -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;

View File

@ -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();
}

View File

@ -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<TickTimer> 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;
}
}
}

View File

@ -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);