public void Handle(WorldClient client, RebirthPacket packet) { var rebirthType = (RebirthType)packet.RebirthType; // TODO: implement other rebith types. (ushort MapId, float X, float Y, float Z)rebirthCoordinate = (0, 0, 0, 0); // Usual rebirth. if (rebirthType == RebirthType.KillSoul) { rebirthCoordinate = _mapProvider.Map.GetRebirthMap(_gameWorld.Players[_gameSession.CharId]); } // Rebirth with rune. Will rebirth at the same place. if (rebirthType == RebirthType.KillSoulByItem) { var rune = _inventoryManager.InventoryItems.Values.FirstOrDefault(x => x.Special == SpecialEffect.ResurrectionRune); if (rune != null) { _inventoryManager.TryUseItem(rune.Bag, rune.Slot, skillApplyingItemEffect: true); rebirthCoordinate.MapId = _mapProvider.Map.Id; rebirthCoordinate.X = _movementManager.PosX; rebirthCoordinate.Y = _movementManager.PosY; rebirthCoordinate.Z = _movementManager.PosZ; // Add untouchable buff for 6 secs. _definitionsPreloder.Skills.TryGetValue((199, 2), out var dbSkill); _buffsManager.AddBuff(new Skill(dbSkill, 0, 0), null); } else { rebirthCoordinate = _mapProvider.Map.GetRebirthMap(_gameWorld.Players[_gameSession.CharId]); } } if (_mapProvider.Map.Id != rebirthCoordinate.MapId) { _teleportationManager.Teleport(rebirthCoordinate.MapId, rebirthCoordinate.X, rebirthCoordinate.Y, rebirthCoordinate.Z); } else { _movementManager.PosX = rebirthCoordinate.X; _movementManager.PosY = rebirthCoordinate.Y; _movementManager.PosZ = rebirthCoordinate.Z; } _healthManager.Rebirth(); }
public void Init(int ownerId, IEnumerable <Skill> skills, ushort skillPoint = 0) { _ownerId = ownerId; SkillPoints = skillPoint; foreach (var skill in skills) { Skills.TryAdd(skill.Number, skill); } foreach (var skill in Skills.Values.Where(s => s.IsPassive && s.Type != TypeDetail.Stealth)) { _buffsManager.AddBuff(skill, null); } }