public static ExpTargetType TargetType(this ExpTarget target) { var enumVal = (int)target; if (enumVal >= ExpHelper.VITAL_OFFSET) { return(ExpTargetType.Vital); } if (enumVal >= ExpHelper.ATTRIBUTE_OFFSET) { return(ExpTargetType.Attribute); } //Determine skill train status switch (Globals.Host.Actions.SkillTrainLevel[target.AsSkill()]) { case 3: return(ExpTargetType.Specialized); case 2: return(ExpTargetType.Trained); case 1: return(ExpTargetType.Untrained); case 0: return(ExpTargetType.Unusable); } //Globals.Core.CharacterFilter.Skills[(CharFilterSkillType)target].Training; -- Throws errors with summoning throw new Exception("Unknown experience target type encountered."); }
public static void AddExp(this ExpTarget target, int exp) { switch (target.TargetType()) { case ExpTargetType.Attribute: //Util.WriteToChat($"Add experience to attribute {target}"); Globals.Host.Actions.AddAttributeExperience(target.AsAttribute(), exp); break; case ExpTargetType.Vital: //Util.WriteToChat($"Add experience to vital {target}"); Globals.Host.Actions.AddVitalExperience(target.AsVital(), exp); break; case ExpTargetType.Specialized: case ExpTargetType.Trained: //Util.WriteToChat($"Add experience to skill {target}"); Globals.Host.Actions.AddSkillExperience(target.AsSkill(), exp); break; default: Util.WriteToChat($"Failed to add {exp} exp to {target.GetName()}"); break; } }
public static int GetTimesLeveled(this ExpTarget target) { switch (target.TargetType()) { case ExpTargetType.Attribute: return(Globals.Host.Actions.AttributeClicks[target.AsAttribute()]); // // Globals.Host.Actions.VitalClicks case ExpTargetType.Vital: return(Globals.Host.Actions.VitalClicks[target.AsVital()]); break; case ExpTargetType.Trained: case ExpTargetType.Specialized: return(Globals.Host.Actions.SkillClicks[target.AsSkill()]); break; } return(-1); }
public static int?CostToLevel(this ExpTarget target, int offset = 0) { var targetLevel = offset + target.GetTimesLeveled(); switch (target.TargetType()) { case ExpTargetType.Attribute: if (ATTRIBUTE_COSTS.Length > targetLevel) { return(ATTRIBUTE_COSTS[targetLevel]); } break; case ExpTargetType.Vital: if (VITAL_COSTS.Length > targetLevel) { return(VITAL_COSTS[targetLevel]); } break; case ExpTargetType.Trained: if (TRAINED_COSTS.Length > targetLevel) { return(TRAINED_COSTS[targetLevel]); } break; case ExpTargetType.Specialized: if (SPECIALIZED_COSTS.Length > targetLevel) { return(SPECIALIZED_COSTS[targetLevel]); } break; } return(null); }
public static SkillType AsSkill(this ExpTarget target) { return((SkillType)(target)); }
public static VitalType AsVital(this ExpTarget target) { return((VitalType)(target - VITAL_OFFSET)); }
public static AttributeType AsAttribute(this ExpTarget target) { return((AttributeType)(target - ATTRIBUTE_OFFSET)); }
public static string GetName(this ExpTarget target) { return(Enum.GetName(typeof(ExpTarget), target)); }
/// <summary> /// Tries to increase the level of the /// </summary> /// <param name="target"></param> public static void IncreaseLevel(this ExpTarget target) { var cost = target.CostToLevel() ?? 0; target.AddExp(cost); }