/// <summary> /// Creates a new expenditure, uses it, and - if successful - appends the expenditure to the player's EoCLedger /// </summary> public static bool Use <T>(Player pl, EoCExpenditureType type, T state) { EoCExpenditure exp = Create(pl, type); if (exp.Use <T>(state)) { pl.EoCLedger.Append(exp); return(true); } return(false); }
public static void OnCommand(CommandEventArgs args) { if (args.Arguments.Length != 1) { args.Mobile.SendMessage("Format: SkillInc <SkillName | undo>"); return; } string arg = (string)args.Arguments[0]; Player pl = args.Mobile as Player; if (arg == "undo") { pl.EoCLedger.Undo(); } else { SkillName sn = (SkillName)System.Enum.Parse(typeof(SkillName), arg, true); EoCExpenditure.Use <Skill>(pl, EoCExpenditureType.SkillIncrease, pl.Skills[sn]); } }
/// <summary> /// Create an expenditure of the given type /// </summary> public static EoCExpenditure Create(Player pl, EoCExpenditureType type) { EoCExpenditure exp = (EoCExpenditure)Activator.CreateInstance(ExpenseTypes[(int)type], pl); return(exp); }
/// <summary> /// Adds an expenditure to this ledger /// </summary> public virtual void Append(EoCExpenditure exp) { Expenditures.Push(exp); }