using System; using System.Diagnostics; using System.Globalization; using LavishScriptAPI; using MRBot.IsxEq2.AbilityEffect; using MRBot.IsxEq2.Helpers; namespace MRBot.IsxEq2.Recipe { /// /// This DataType includes all of the data available to ISXEQ2 that is related to tradeskill recipes. /// public class Recipe : LavishScriptObject { #region Constructor /// /// Constructor /// /// LS Object public Recipe(LavishScriptObject copy) : base(copy) { } #endregion #region Members /// /// A recipe component /// public Component BuildComponent1 { get { Trace.WriteLine(String.Format("Recipe:BuildComponent1")); return new Component(this.GetMember("BuildComponent1")); } } /// /// A recipe component /// public Component BuildComponent2 { get { Trace.WriteLine(String.Format("Recipe:BuildComponent2")); return new Component(this.GetMember("BuildComponent2")); } } /// /// A recipe component /// public Component BuildComponent3 { get { Trace.WriteLine(String.Format("Recipe:BuildComponent3")); return new Component(this.GetMember("BuildComponent3")); } } /// /// A recipe component /// public Component BuildComponent4 { get { Trace.WriteLine(String.Format("Recipe:BuildComponent4")); return new Component(this.GetMember("BuildComponent4")); } } /// /// Returns the class at the specified index /// /// index /// Class public Class Class(int index) { Trace.WriteLine(String.Format("Recipe:Class({0})", index.ToString(CultureInfo.InvariantCulture))); return new Class(this.GetMember("Class", index.ToString(CultureInfo.InvariantCulture))); } /// /// Cache of description /// private string _description; /// /// Recipe Description /// public string Description { get { Trace.WriteLine(String.Format("Recipe:Description")); return _description ?? (_description = this.GetStringFromLSO("Description")); } } /// /// Cache of Device /// private string _device; /// /// Tradeskill device to craft /// public string Device { get { Trace.WriteLine(String.Format("Recipe:Device")); return _device ?? (_device = this.GetStringFromLSO("Device")); } } /// /// Fuel Component /// public Component Fuel { get { Trace.WriteLine(String.Format("Recipe:Fuel")); return new Component(this.GetMember("Fuel")); } } /// /// Cache of ID /// private uint? _iD; /// /// Recipe ID /// public uint ID { get { Trace.WriteLine(String.Format("Recipe:ID")); if (!_iD.HasValue) _iD = this.GetUIntFromLSO("ID"); return _iD.Value; } } /// /// Cache of Knowledge /// private string _knowledge; /// /// Recipe knowledge /// public string Knowledge { get { Trace.WriteLine(String.Format("Recipe:Knowledge")); return _knowledge ?? (_knowledge = this.GetStringFromLSO("Knowledge")); } } /// /// Cache of level /// private int? _level; /// /// Recipe level /// public int Level { get { Trace.WriteLine(String.Format("Recipe:Level")); if(!_level.HasValue) _level = this.GetIntFromLSO("Level"); return _level.Value; } } /// /// Cache of Name /// private string _name; /// /// Recipe name /// public string Name { get { Trace.WriteLine(String.Format("Recipe:Name")); return _name ?? (_name = this.GetStringFromLSO("Name")); } } /// /// Cache of NumClasses /// private int? _numClasses; /// /// The number of classes that can use (used in Class(int index)) /// public int NumClasses { get { Trace.WriteLine(String.Format("Recipe:NumClasses")); if(!_numClasses.HasValue) _numClasses = this.GetIntFromLSO("NumClasses"); return _numClasses.Value; } } /// /// Cache of PrimaryComponent /// private string _primaryComponent; /// /// The name of the primary component of the recipe /// public string PrimaryComponent { get { Trace.WriteLine(String.Format("Recipe:PrimaryComponent")); return _primaryComponent ?? (_primaryComponent = this.GetStringFromLSO("PrimaryComponent")); } } /// /// Then quantity of primary component on hand /// public int PrimaryComponentQuantityOnHand { get { Trace.WriteLine(String.Format("Recipe:PrimaryComponentOnHand")); return this.GetIntFromLSO("PrimaryComponentQuantityOnHand"); } } /// /// Cache of RecipeBook /// private string _recipeBook; /// /// The name of the recipe book for the recipe /// public string RecipeBook { get { Trace.WriteLine(String.Format("Recipe:RecipeBook")); return _recipeBook ?? (_recipeBook = this.GetStringFromLSO("RecipeBook")); } } /// /// Cache of Technique /// private string _technique; /// /// Tradeskill technique needed /// public string Technique { get { Trace.WriteLine(String.Format("Recipe:Technique")); return _technique ?? (_technique = this.GetStringFromLSO("Technique")); } } #endregion #region Methods /// /// Begins creation of the recipe /// /// call success public bool Create() { Trace.WriteLine(String.Format("Recipe:Create()")); return this.ExecuteMethod("Create"); } /// /// Examines the recipe /// /// call success public bool Examine() { Trace.WriteLine(String.Format("Recipe:Examine()")); return this.ExecuteMethod("Examine"); } #endregion } }