/// <summary> /// Tries to learn the given tier for the given skill (if allowed) /// </summary> /// <returns>Whether it succeeded</returns> public bool TryLearn(SkillId id, SkillTierId tier) { Skill skill; if (!m_skills.TryGetValue(id, out skill)) { SkillRaceClassInfo skillRaceClassInfo; if (!AvailableSkills.TryGetValue(id, out skillRaceClassInfo) || m_owner.Level < skillRaceClassInfo.MinimumLevel) { return(false); } skill = Add(skillRaceClassInfo.SkillLine, false); } if (skill.CanLearnTier(tier)) { skill.MaxValue = (ushort)skill.SkillLine.Tiers.GetMaxValue(tier); if (id == SkillId.Riding) { skill.CurrentValue = skill.MaxValue; } } return(true); }
public bool HasTier(SkillTierId tier) { if (Tiers.MaxValues != null) { return((int)tier < Tiers.MaxValues.Length); } return(false); }
public Skill GetOrCreate(SkillId id, SkillTierId tier, bool ignoreRestrictions) { Skill skill = GetOrCreate(id, ignoreRestrictions); if (skill != null && skill.SkillLine.HasTier(tier)) { skill.MaxValue = (ushort)skill.SkillLine.Tiers.GetMaxValue(tier); } return(skill); }
protected override void Apply(WorldObject target, ref DamageAction[] actions) { SkillId miscValue = (SkillId)Effect.MiscValue; SkillTierId basePoints = (SkillTierId)Effect.BasePoints; if (((Character)target).Skills.TryLearn(miscValue, basePoints)) { return; } m_cast.Cancel(SpellFailedReason.MinSkill); }
/// <summary> /// Checks whether the given tier can be learned /// </summary> public bool CanLearnTier(SkillTierId tier) { if (SkillLine.HasTier(tier)) { uint tierLimit = SkillLine.Tiers.GetMaxValue(tier); if (CurrentValue >= (int)tierLimit - 100) { // cannot be learnt if we have less than max - 100 in that skill return(true); } } return(false); }
/// <summary> /// If this char is allowed to learn this skill (matching Race, Class and Level) on the given tier, /// the correspdonding SkillLine will be returned. Returns null if skill cannot be learnt. /// </summary> public SkillLine GetLineIfLearnable(SkillId id, SkillTierId tier) { SkillRaceClassInfo skillRaceClassInfo; if (!AvailableSkills.TryGetValue(id, out skillRaceClassInfo) || m_owner.Level < skillRaceClassInfo.MinimumLevel) { return(null); } Skill skill; if ((tier == SkillTierId.Apprentice || skillRaceClassInfo.SkillLine.Tiers.MaxValues.Length >= (long)tier) && (m_skills.TryGetValue(id, out skill) && skill.CanLearnTier(tier))) { return(null); } return(skillRaceClassInfo.SkillLine); }
/// <summary> /// If this char is allowed to learn this skill (matching Race, Class and Level) on the given tier, /// the correspdonding SkillLine will be returned. Returns null if skill cannot be learnt. /// </summary> public SkillLine GetLineIfLearnable(SkillId id, SkillTierId tier) { SkillRaceClassInfo info; if (!AvailableSkills.TryGetValue(id, out info) || m_owner.Level < info.MinimumLevel) { return(null); } if (tier == 0 || (info.SkillLine.Tiers.MaxValues.Length >= (uint)tier)) { Skill skill; if (m_skills.TryGetValue(id, out skill)) { if (skill.CanLearnTier(tier)) { return(null); } } } return(info.SkillLine); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { SkillId id = trigger.Text.NextEnum <SkillId>(SkillId.None); if (trigger.Text.HasNext) { SkillTierId tier = trigger.Text.NextEnum <SkillTierId>(SkillTierId.GrandMaster); if (SkillHandler.Get(id) != null) { Skill skill = ((Character)trigger.Args.Target).Skills.GetOrCreate(id, tier, true); trigger.Reply(RealmLangKey.CmdSkillTierResponse, (object)skill, (object)skill.CurrentValue, (object)skill.MaxValue); } else { trigger.Reply(RealmLangKey.CmdSkillTierError1, (object)id); } } else { trigger.Reply(RealmLangKey.CmdSkillTierError2); } }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { SkillId id = trigger.Text.NextEnum <SkillId>(SkillId.None); SkillLine skillLine = SkillHandler.Get(id); if (skillLine != null) { Character target = (Character)trigger.Args.Target; int num = trigger.Text.NextInt(1); SkillTierId tierForLevel = skillLine.GetTierForLevel(num); target.Skills.GetOrCreate(id, true).CurrentValue = (ushort)num; Spell spellForTier = skillLine.GetSpellForTier(tierForLevel); if (spellForTier != null) { target.Spells.AddSpell(spellForTier); } trigger.Reply(RealmLangKey.CmdSkillSetResponse, (object)skillLine, (object)num, (object)tierForLevel); } else { trigger.Reply(RealmLangKey.CmdSkillSetError, (object)id); } }
/// <summary>Checks whether the given tier can be learned</summary> public bool CanLearnTier(SkillTierId tier) { return(this.SkillLine.HasTier(tier) && (int)this.CurrentValue >= (int)this.SkillLine.Tiers.GetMaxValue(tier) - 100); }
/// <summary> /// Checks whether the given tier can be learned /// </summary> public bool CanLearnTier(SkillTierId tier) { if (SkillLine.HasTier(tier)) { uint tierLimit = SkillLine.Tiers.GetMaxValue(tier); if (CurrentValue >= (int)tierLimit - 100) { // cannot be learnt if we have less than max - 100 in that skill return true; } } return false; }
public Spell GetSpellForTier(SkillTierId tier) { return TeachingSpells.FirstOrDefault(spell => spell.GetEffect(SpellEffectType.Skill).BasePoints == (int)tier); }
public bool HasTier(SkillTierId tier) { return Tiers.MaxValues != null && (int)tier < Tiers.MaxValues.Length; }
public Skill GetOrCreate(SkillId id, SkillTierId tier, bool ignoreRestrictions) { Skill skill = GetOrCreate(id, ignoreRestrictions); if (skill != null) { if (skill.SkillLine.HasTier(tier)) { skill.MaxValue = (ushort)skill.SkillLine.Tiers.GetMaxValue(tier); } } return skill; }
/// <summary> /// Tries to learn the given tier for the given skill (if allowed) /// </summary> /// <returns>Whether it succeeded</returns> public bool TryLearn(SkillId id, SkillTierId tier) { Skill skill; if (!m_skills.TryGetValue(id, out skill)) { SkillRaceClassInfo info; if (!AvailableSkills.TryGetValue(id, out info) || m_owner.Level < info.MinimumLevel) { return false; } skill = Add(info.SkillLine, false); } if (skill.CanLearnTier(tier)) { skill.MaxValue = (ushort)skill.SkillLine.Tiers.GetMaxValue(tier); if (id == SkillId.Riding) { skill.CurrentValue = skill.MaxValue; } } return true; }
/// <summary> /// If this char is allowed to learn this skill (matching Race, Class and Level) on the given tier, /// the correspdonding SkillLine will be returned. Returns null if skill cannot be learnt. /// </summary> public SkillLine GetLineIfLearnable(SkillId id, SkillTierId tier) { SkillRaceClassInfo info; if (!AvailableSkills.TryGetValue(id, out info) || m_owner.Level < info.MinimumLevel) { return null; } if (tier == 0 || (info.SkillLine.Tiers.MaxValues.Length >= (uint)tier)) { Skill skill; if (m_skills.TryGetValue(id, out skill)) { if (skill.CanLearnTier(tier)) { return null; } } } return info.SkillLine; }
public uint GetMaxValue(SkillTierId id) { return MaxValues[(uint)id]; }
public uint GetCost(SkillTierId id) { return Costs[(uint)id]; }
public uint GetCost(SkillTierId id) { return(Costs[(uint)id]); }
public bool HasTier(SkillTierId tier) { return(Tiers.MaxValues != null && (int)tier < Tiers.MaxValues.Length); }
public Spell GetSpellForTier(SkillTierId tier) { return(TeachingSpells.FirstOrDefault(spell => (SkillTierId)spell.GetEffect(SpellEffectType.Skill).BasePoints == tier)); }
public uint GetMaxValue(SkillTierId id) { return(MaxValues[(uint)id]); }
public Spell GetSpellForTier(SkillTierId tier) { return(this.TeachingSpells.FirstOrDefault <Spell>((Func <Spell, bool>)(spell => (SkillTierId)spell.GetEffect(SpellEffectType.Skill).BasePoints == tier))); }