public void AddSkill(uint skillId) { var template = SkillManager.Instance.GetSkillTemplate(skillId); if (template.AbilityId > 0 && template.AbilityId != (byte)Owner.Ability1 && template.AbilityId != (byte)Owner.Ability2 && template.AbilityId != (byte)Owner.Ability3) { return; } var points = ExpirienceManager.Instance.GetSkillPointsForLevel(Owner.Level); points -= GetUsedSkillPoints(); if (template.SkillPoints > points) { return; } if (Skills.ContainsKey(skillId)) { Skills[skillId].Level++; Owner.SendPacket(new SCSkillUpgradedPacket(Skills[skillId])); } else { AddSkill(template, 1, true); } }
public void AddExperience(SkillType skill_type, long amount) { if (skill_type == SkillType.Unknown) { Console.WriteLine("Gained " + amount + " experience in unfound skill."); return; } if (amount <= 0 || !Skills.ContainsKey(skill_type)) { return; } Skill skill = Skills[skill_type]; if (!LastLevelledSkillLocked) { LastLevelledSkill = skill.SkillType; } else { skill.Experience += (long)(amount * GetExperienceGainBonus(skill)); } SkillExperienceAdd?.Invoke(this, new SkillExperienceAddedEventArgs(skill, amount)); skill.TryIncreaseLevels(); }
// ~CreatureId() // { // OnLocationChanged -= CheckAutoAttack; // Are we in range with our target now/still? // OnLocationChanged -= CheckPendingActions; // Are we in range with any of our pending actions? // //OnTargetChanged -= CheckAutoAttack; // Are we attacking someone new / not attacking anymore? // //OnInventoryChanged -= Mind.AttackConditionsChanged; // Equipped / DeEquiped something? // } public void IncreaseSkillCounter(SkillType skill, ushort value) { if (!Skills.ContainsKey(skill)) { // TODO: proper logging. Console.WriteLine($"CreatureId {Name} does not have the skill {skill} in it's skill set."); } Skills[skill].IncreaseCounter(value); }
public float GetGatherSpeed(SkillType skillType) { float totalBonus = 1; if (!Skills.ContainsKey(skillType)) { Skill skill = Skills[skillType]; foreach (GameItem item in Player.EquippedItems) { if (item.ActionsEnabled != null && item.ActionsEnabled.Contains(skill.Name)) { if (item.GatherSpeedBonus > 0) { totalBonus *= 1 - item.GatherSpeedBonus; } } else if (item.ActionRequired != null && item.ActionRequired.Contains(skill.Name)) { if (item.GatherSpeedBonus > 0) { totalBonus *= 1 - item.GatherSpeedBonus; } } } int level = skill.Level; if (level < 100) { totalBonus *= 1 - (level * 0.005f); } else if (level < 200) { totalBonus *= 1 - (100 * 0.005f); totalBonus *= 1 - (level * 0.002f); } else if (level < 300) { totalBonus *= 1 - (100 * 0.005f); totalBonus *= 1 - (200 * 0.002f); totalBonus *= 1 - (level * 0.001f); } else { totalBonus *= 1 - (100 * 0.005f); totalBonus *= 1 - (200 * 0.002f); totalBonus *= 1 - (300 * 0.001f); totalBonus *= 1 - (level * 0.0005f); } //totalBonus -= GetLevel(skill) * 0.005f; totalBonus = Math.Max(totalBonus, 0.01f); } return(totalBonus); }
private void AddSkill(Skill skill) { if (!Skills.ContainsKey(skill.Name)) { Skills.Add(skill.Name, skill.Clone()); } else { Skills[skill.Name].Level += skill.Level; } }
public void AddSkill(Skill skill) { Journal.Add(string.Format(Properties.Resources.Msg_ReceivedSkill, skill.Name, skill.Level)); if (!Skills.ContainsKey(skill.Name)) { Skills.Add(skill.Name, skill); } else { Skills[skill.Name].Level += skill.Level; } }
/// <summary> /// Method that executes a <see cref="SkillBase"/> of the resource /// </summary> /// <param name="s">The <see cref="SkillBase"/> by name to execute</param> /// <param name="execParams">The parameters used for the Execution</param> /// <returns></returns> public Task ExecuteSkill(string s, object execParams = null) { if (!Skills.ContainsKey(s)) { Logger.Log($"Could not execute Skill {s}, since it was not in list"); return(null); } else { return(Skills[s].Execute(execParams)); } }
/// <summary> /// Method that executes a <see cref="SkillBase"/> of the resource /// </summary> /// <param name="s">The <see cref="SkillBase"/> to execute</param> /// <param name="execParams">The parameters used for the Execution</param> /// <returns></returns> public Task ExecuteSkill(SkillBase s, object execParams = null) { string key = $"{s.ExecutingResource.Name}.{s.Name}"; if (Skills.ContainsKey(key)) { Logger.Log($"Could not execute Skill {s.Name}, since it was not in list"); return(null); } else { return(ExecuteSkill(key, execParams)); } }
public static Skill GetSkill(string path) { Skill skill = null; if (Skills.ContainsKey(path)) { skill = Skills[path]; } else { skill = Logic.Skill.SkillUtility.GetTimelineGroup <Skill>(path); Skills[path] = skill; } return(skill); }
public bool FromJObject(JObject obj, IGameEngine engine) { string name = obj[GcConstants.General.NAME].ToObject <string>(); int level = obj[GcConstants.General.LEVEL].ToObject <int>(); double currentExp = obj[GcConstants.General.CURRENT_EXP].ToObject <double>(); int attributePoints = obj[GcConstants.General.ATTRIBUTE_POINTS].ToObject <int>(); bool isDead = obj[GcConstants.General.DEAD].ToObject <bool>(); long reviveTime = obj[GcConstants.General.REVIVE_TIME].ToObject <long>(); IsDead = isDead; ReviveTime = reviveTime; Name = name; Level = level; CurrentExp = currentExp; AttributePoints = attributePoints; JToken[] attributesArray = obj[GcConstants.Classes.ATTRIBUTES].ToArray(); foreach (JToken attribute in attributesArray) { string key = attribute[GcConstants.General.KEY].ToObject <string>(); if (Attributes.ContainsKey(key)) { Attributes[key].FromJObject(attribute.ToObject <JObject>(), Engine); } } JToken[] resourcesArray = obj[GcConstants.Classes.RESOURCES].ToArray(); foreach (JToken resource in resourcesArray) { string key = resource[GcConstants.General.KEY].ToObject <string>(); if (ResourceMap.ContainsKey(key)) { ResourceMap[key].FromJObject(resource.ToObject <JObject>(), Engine); } } JToken[] skillsArray = obj[GcConstants.Classes.SKILLS].ToArray(); foreach (JToken skill in skillsArray) { string key = skill[GcConstants.General.KEY].ToObject <string>(); if (Skills.ContainsKey(key)) { Skills[key].FromJObject(skill.ToObject <JObject>(), Engine); } } return(true); }
public bool Add(Skill skill, Entity source) { if (skill.ShortName != Name) { return(false); } if (Skills.Any(sk => skill.Id == sk.Key.Id && skill.IsHotDot == sk.Key.IsHotDot && sk.Value.Contains(source))) { return(false); } if (Skills.ContainsKey(skill)) { Skills[skill].Add(source); _playerDealtUnrelieable = true; } else { Skills.Add(skill, new List <Entity> { source }); } return(true); }
public Skill Get(int skillId) { return(Skills.ContainsKey(skillId) ? Skills[skillId] : null); }
public Skill Get(int id, int lvl) { long hash = (id * 65536) + lvl; return(Skills.ContainsKey(hash) ? Skills[hash] : null); }
public SkillTemplate GetSkill(string key) { return(Skills.ContainsKey(key) ? Skills[key] : null); }
public Skill this[SkillType skillType] => Skills.ContainsKey(skillType) ? Skills[skillType] : null;