public async Task <SaltyCommandResult> HealAsync( [Description("Player you want to heal")] IPlayerEntity player = null) { if (player == null) { player = Context.Player; } player.Hp = player.HpMax; player.Mp = player.MpMax; await player.ActualizeUiHpBar(); return(new SaltyCommandResult(true, $"{player.Character.Name}'s HP & MP has been fully restored.")); }
public static async Task ChangeClass(this IPlayerEntity player, CharacterClassType type) { player.JobLevel = 1; player.JobLevelXp = 0; await player.SendPacketAsync(new NpInfoPacket { UnKnow = 0 }); await player.SendPacketAsync(new PClearPacket()); if (type == CharacterClassType.Adventurer) { player.Character.HairStyle = player.Character.HairStyle > HairStyleType.HairStyleB ? HairStyleType.HairStyleA : player.Character.HairStyle; } player.Character.Class = type; player.HpMax = Algorithm.GetHpMax(type, player.Level); player.MpMax = Algorithm.GetMpMax(type, player.Level); player.Hp = player.HpMax; player.Mp = player.MpMax; await player.SendPacketAsync(player.GenerateTitPacket()); await player.ActualizeUiHpBar(); await player.SendPacketAsync(player.GenerateEqPacket()); await player.SendPacketAsync(player.GenerateEffectPacket(8)); await player.SendPacketAsync(player.GenerateEffectPacket(196)); await player.SendPacketAsync(player.GenerateScrPacket()); await player.SendChatMessageFormat(PlayerMessages.CHARACTER_YOUR_CLASS_CHANGED_TO_X, SayColorType.Blue, type); player.Character.Faction = player.Family?.FamilyFaction ?? (FactionType)(1 + _randomGenerator.Next(0, 2)); await player.SendChatMessageFormat(PlayerMessages.CHARACTER_YOUR_FACTION_CHANGED_TO_X, SayColorType.Blue, player.Character.Faction); await player.ActualizeUiFaction(); await player.ActualizeUiStatChar(); await player.SendPacketAsync(player.GenerateEffectPacket(4799 + (byte)player.Character.Faction)); await player.ActualizePlayerCondition(); await player.ActualizeUiExpBar(); await player.BroadcastAsync(player.GenerateCModePacket()); await player.BroadcastAsync(player.GenerateInPacket()); await player.BroadcastAsync(player.GenerateGidxPacket()); await player.BroadcastAsync(player.GenerateEffectPacket(6)); await player.BroadcastAsync(player.GenerateEffectPacket(196)); SkillComponent component = player.SkillComponent; foreach (SkillDto skill in component.Skills.Values) { if (skill.Id >= 200) { component.Skills.Remove(skill.Id); } } // TODO : LATER ADD SKILL await player.ActualizeUiSkillList(); // Later too /* foreach (QuicklistEntryDTO quicklists in DAOFactory.QuicklistEntryDAO.LoadByCharacterId(CharacterId).Where(quicklists => QuicklistEntries.Any(qle => qle.Id == quicklists.Id))) * { * DAOFactory.QuicklistEntryDAO.Delete(quicklists.Id); * } * * QuicklistEntries = new List<QuicklistEntryDTO> * { * new QuicklistEntryDTO * { * CharacterId = CharacterId, * Q1 = 0, * Q2 = 9, * Type = 1, * Slot = 3, * Pos = 1 * } * }; * if (ServerManager.Instance.Groups.Any(s => s.IsMemberOfGroup(Session) && s.GroupType == GroupType.Group)) * { * Session.CurrentMapInstance?.Broadcast(Session, $"pidx 1 1.{CharacterId}", ReceiverType.AllExceptMe); * }*/ }