private Task StartHealingSpot() { return(Task.Run(async() => { while (!State.Players.IsEmpty) { foreach (IFieldObject <HealingSpot> healingSpot in State.HealingSpots.Values) { CoordS healingCoord = healingSpot.Value.Coord; foreach (IFieldObject <Player> player in State.Players.Values) { if ((healingCoord - player.Coord.ToShort()).Length() < Block.BLOCK_SIZE * 2 && healingCoord.Z == player.Coord.ToShort().Z - 1) // 3x3x1 area { int healAmount = (int)(player.Value.Stats[PlayerStatId.Hp].Max * 0.03); Status status = new Status(new SkillCast(70000018, 1, 0, 1), owner: player.ObjectId, source: healingSpot.ObjectId, duration: 100, stacks: 1); player.Value.Session.Send(BuffPacket.SendBuff(0, status)); BroadcastPacket(SkillDamagePacket.ApplyHeal(status, healAmount)); player.Value.Session.Player.Stats.Increase(PlayerStatId.Hp, healAmount); player.Value.Session.Send(StatPacket.UpdateStats(player, PlayerStatId.Hp)); } } } await Task.Delay(1000); } })); }
private Task StartHealingSpot(GameSession session, IFieldObject <Player> player) { int healAmount = 30; Status status = new Status(new SkillCast(70000018, 1, 0, 1), player.ObjectId, player.ObjectId, 1, healAmount); return(Task.Run(async() => { while (!State.Players.IsEmpty) { CoordS healingCoord = MapEntityStorage.GetHealingSpot(MapId); if ((healingCoord - player.Coord.ToShort()).Length() < Block.BLOCK_SIZE * 2 && healingCoord.Z == player.Coord.ToShort().Z - 1) // 3x3x1 area { session.Send(BuffPacket.SendBuff(0, status)); session.Send(SkillDamagePacket.ApplyHeal(player, status)); session.Player.Stats.Increase(PlayerStatId.Hp, healAmount); session.Send(StatPacket.UpdateStats(player, PlayerStatId.Hp)); } await Task.Delay(1000); } })); }