using System; using System.Diagnostics; using System.Globalization; using LavishScriptAPI; using MRBot.IsxEq2.Helpers; namespace MRBot.IsxEq2.InventoryConsignment { /// /// This DataType includes all of the data available to ISXEQ2 that is related to /// containers/vending machines/actors that are held within the consignment system. /// public class VendingContainer : LavishScriptObject { #region Constructor /// /// Constructor /// /// LS Object public VendingContainer(LavishScriptObject copy) : base(copy) { } #endregion #region Members /// /// Retrieves the consignment matching the supplied name /// /// name /// Consignment public Consignment Consignment(string name) { Trace.WriteLine(String.Format("VendingContainer:Consignment({0})", name)); return new Consignment(this.GetMember("Consignment", name)); } /// /// Retrieves the consignment at the specified index (1 to NumItems) /// /// index /// Consignment public Consignment Consignment(int index) { Trace.WriteLine(String.Format("VendingContainer:Consignment({0})", index.ToString(CultureInfo.InvariantCulture))); return new Consignment(this.GetMember("Consignment", index.ToString(CultureInfo.InvariantCulture))); } /// /// Current value in silver pieces on container /// public float CurrentCoin { get { Trace.WriteLine(String.Format("VendingContainer:CurrentCoin")); return this.GetFloatFromLSO("CurrentCoin"); } } /// /// Possible values: "Qeynos" "Freeport" "Kelethin" "Haven" "Neriak" (or "Unknown" which should not be possible) /// public string Market { get { Trace.WriteLine(String.Format("VendingContainer:Market")); return this.GetStringFromLSO("Market"); } } /// /// Cache of Name /// private string _name; /// /// Container Name /// public string Name { get { Trace.WriteLine(String.Format("VendingContainer:Name")); return _name ?? (_name = this.GetStringFromLSO("Name")); } } /// /// Number of Consignments in container /// public int NumItems { get { Trace.WriteLine(String.Format("VendingContainer:NumItems")); return this.GetIntFromLSO("NumItems"); } } /// /// Cache of SerialNumber /// private long? _serialNumber; /// /// Container Serial Number /// public long SerialNumber { get { Trace.WriteLine(String.Format("VendingContainer:SerialNumber")); if(!_serialNumber.HasValue) _serialNumber = this.GetInt64FromLSO("SerialNumber"); return _serialNumber.Value; } } /// /// Cache of TotalCapacity /// private int? _totalCapacity; /// /// Total Capacity of the container /// public int TotalCapacity { get { Trace.WriteLine(String.Format("VendingContainer:TotalCapacity")); if(!_totalCapacity.HasValue) _totalCapacity = this.GetIntFromLSO("TotalCapacity"); return _totalCapacity.Value; } } /// /// All time value in silver pieces /// public float TotalCoin { get { Trace.WriteLine(String.Format("VendingContainer:TotalCoin")); return this.GetFloatFromLSO("TotalCoin"); } } /// /// Used Capacity (Free slots = Total - Used) /// public int UsedCapacity { get { Trace.WriteLine(String.Format("VendingContainer:UsedCapacity")); return this.GetIntFromLSO("UsedCapacity"); } } #endregion #region Methods /// /// Selects this vending container /// /// call success public bool ChangeTo() { Trace.WriteLine(String.Format("VendingContainer:ChangeTo()")); return this.ExecuteMethod("ChangeTo"); } /// /// Removes this vending container from the consignment system. /// /// call success public bool Remove() { Trace.WriteLine(String.Format("VendingContainer:Remove()")); return this.ExecuteMethod("Remove"); } /// /// Retrieves all of the money currently housed in that vendor. /// /// call success public bool TakeCoin() { Trace.WriteLine(String.Format("VendingContainer:TakeCoin()")); return this.ExecuteMethod("TakeCoin"); } /// /// Retrieves the amount of coin specified (in silver pieces) from the vending container. /// /// quantity /// call success public bool TakeCoin(int quantity) { Trace.WriteLine(String.Format("VendingContainer:TakeCoin({0})", quantity.ToString(CultureInfo.InvariantCulture))); return this.ExecuteMethod("TakeCoin", quantity.ToString(CultureInfo.InvariantCulture)); } #endregion } }