public static GetSkill ( uint skillid ) : |
||
skillid | uint | |
return |
/// <summary> /// Check if the player has enough sp to cast skill, and decrease SP by the required amount /// </summary> /// <param name="pc">Player</param> /// <param name="skillid">Skill ID</param> /// <returns></returns> public static bool CheckSkillSP(ActorPC pc, SkillIDs skillid) { ActorEventHandlers.PC_EventHandler eh = (ActorEventHandlers.PC_EventHandler)pc.e; Skill skill = SkillFactory.GetSkill((uint)skillid); if (pc.SP < skill.sp) { return(false); } pc.SP -= (ushort)skill.sp; eh.C.SendCharStatus(0); return(true); }
/// <summary> /// Increase Players LP /// </summary> /// <param name="pc">Player</param> /// <param name="skillID">ID of the skill that caused the increasement of LP</param> /// <param name="point">Amount</param> public static void GainLP(ActorPC pc, SkillIDs skillID, byte point) { ActorEventHandlers.PC_EventHandler eh = (ActorEventHandlers.PC_EventHandler)pc.e; pc.LP += point; if (pc.LP > 5) { pc.LP = 5; } else { eh.C.SendSkillEffect(SkillFactory.GetSkill((uint)skillID).addition, SkillEffects.LP, point); } eh.C.SendCharStatus(0); }
/// <summary> /// Add EXP to a skill of a player /// </summary> /// <param name="pc">Player</param> /// <param name="skillid">Skill ID</param> /// <param name="exp">Maximum of exp to add</param> public static void AddSkillEXP(ref ActorPC pc, uint skillid, uint exp) { if (pc.BattleSkills.ContainsKey(skillid)) { SkillInfo info = pc.BattleSkills[skillid]; info.exp += (uint)Global.Random.Next(0, (int)exp); if (info.exp > SkillFactory.GetSkill(skillid).maxsxp) { info.exp = (uint)SkillFactory.GetSkill(skillid).maxsxp; } MapServer.charDB.UpdateSkill(pc, SkillType.Battle, info); ActorEventHandlers.PC_EventHandler eh = (ActorEventHandlers.PC_EventHandler)pc.e; eh.C.UpdateSkillEXP(skillid, info.exp); } }
public static void CastPassivSkill(ref ActorPC pc) { SkillCommand command; byte skilltype; Actor target = (Actor)pc; CalcBattleStatus(ref target); foreach (uint id in pc.BattleSkills.Keys) { skilltype = SkillFactory.GetSkill(id).skilltype; if (skilltype != 2) { continue; } if (SkillCommands.ContainsKey((SkillIDs)id) == true) { Map.SkillArgs args = new Map.SkillArgs(skilltype, 0, id, 0, 0); command = SkillCommands[(SkillIDs)id]; command.Invoke(ref target, ref target, ref args); } } }
/// <summary> /// Reset skills of a PC on job change. /// Move all skills into Inactive Skill table and get all skills in inactive skill table for current job /// </summary> /// <param name="pc">target PC</param> public static void SkillResetOnJobChange(ActorPC pc) { List <uint> tmptable = new List <uint>(); byte job = (byte)(pc.job - 1); foreach (uint i in pc.BattleSkills.Keys) { if (SkillFactory.GetSkill(i).reqjob[job] == 255 || SkillFactory.GetSkill(i).reqjob[job] == 0) { tmptable.Add(i); } } foreach (uint i in tmptable) { if (!pc.InactiveSkills.ContainsKey(i)) { pc.InactiveSkills.Add(i, pc.BattleSkills[i]); } MapServer.charDB.UpdateSkill(pc, SkillType.Inactive, pc.BattleSkills[i]); SendDeleteSkill(pc, i); pc.BattleSkills.Remove(i); } tmptable.Clear(); foreach (uint i in pc.SpecialSkills.Keys) { tmptable.Add(i); } foreach (uint i in tmptable) { if (!pc.InactiveSkills.ContainsKey(i)) { pc.InactiveSkills.Add(i, pc.SpecialSkills[i]); } MapServer.charDB.UpdateSkill(pc, SkillType.Inactive, pc.SpecialSkills[i]); SendDeleteSpecial(pc, i); SendDeleteSkill(pc, i); pc.SpecialSkills.Remove(i); } tmptable.Clear(); foreach (uint i in pc.InactiveSkills.Keys) { if (SkillFactory.GetSkill(i).reqjob[job] != 255 && SkillFactory.GetSkill(i).reqjob[job] != 0) { tmptable.Add(i); } } foreach (uint i in tmptable) { if (!pc.BattleSkills.ContainsKey(i)) { pc.BattleSkills.Add(i, pc.InactiveSkills[i]); } MapServer.charDB.UpdateSkill(pc, SkillType.Battle, pc.InactiveSkills[i]); SendAddSkill(pc, i, 0); pc.InactiveSkills.Remove(i); } SkillInfo info = new SkillInfo(); switch (pc.job) { case JobType.NOVICE: if (!CheckSkill(pc, 1406901, 11)) { info.ID = 1406901; pc.BattleSkills.Add(1406901, info); MapServer.charDB.NewSkill(pc, SkillType.Battle, info); SendAddSkill(pc, 1406901, 0); } break; case JobType.SWORDMAN: if (!CheckSkill(pc, 1416901, 11)) { info.ID = 1416901; pc.BattleSkills.Add(1416901, info); MapServer.charDB.NewSkill(pc, SkillType.Battle, info); SendAddSkill(pc, 1416901, 0); } break; case JobType.RECRUIT: if (!CheckSkill(pc, 1426901, 11)) { info.ID = 1426901; pc.BattleSkills.Add(1426901, info); MapServer.charDB.NewSkill(pc, SkillType.Battle, info); SendAddSkill(pc, 1426901, 0); } break; case JobType.THIEF: if (!CheckSkill(pc, 1406901, 11)) { info.ID = 1406901; pc.BattleSkills.Add(1406901, info); MapServer.charDB.NewSkill(pc, SkillType.Battle, info); SendAddSkill(pc, 1406901, 0); } break; case JobType.ENCHANTER: if (!CheckSkill(pc, 1446901, 11)) { info.ID = 1446901; pc.BattleSkills.Add(1446901, info); MapServer.charDB.NewSkill(pc, SkillType.Battle, info); SendAddSkill(pc, 1446901, 0); } break; case JobType.CLOWN: if (!CheckSkill(pc, 1406901, 11)) { info.ID = 1406901; pc.BattleSkills.Add(1406901, info); MapServer.charDB.NewSkill(pc, SkillType.Battle, info); SendAddSkill(pc, 1406901, 0); } break; } CastPassivSkill(ref pc); }