using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using LavishScriptAPI; using MRBot.IsxEq2.CharacterActor; using MRBot.IsxEq2.Helpers; namespace MRBot.IsxEq2.Utility { /// /// This DataType includes miscellaneous data that is available to ISXEQ2 that does not fit into any other ISXEQ2 DataType /// public class EQ2 : LavishScriptObject { #region Constructor /// /// Constructor /// public EQ2() : base(LavishScript.Objects.GetObject("EQ2")) { } /// /// Constructor /// /// LS Object public EQ2(LavishScriptObject copy) : base(copy) { } #endregion #region Members /// /// Returns a boolean stating whether or not two points (1 and 2) have Line of Sight. /// Please note that this checks a direct line between two points for a collision. /// This is subject to false positives or negativesdue to railings (seeing between the rails, /// false negative) or staircases (top to bottom, false positive). /// /// x-coordinate of 1 /// y-coordinate of 1 /// z-coordinate of 1 /// x-coordinate of 2 /// y-coordinate of 2 /// z-coordinate of 2 public bool CheckCollision(float x1, float y1, float z1, float x2, float y2, float z2) { Trace.WriteLine(String.Format("EQ2:CheckCollision({0}, {1}, {2}, {3}, {4}, {5})", x1.ToString(CultureInfo.InvariantCulture), y1.ToString(CultureInfo.InvariantCulture), z1.ToString(CultureInfo.InvariantCulture), x2.ToString(CultureInfo.InvariantCulture), y2.ToString(CultureInfo.InvariantCulture), z2.ToString(CultureInfo.InvariantCulture))); return this.GetBoolFromLSO("CheckCollision", x1.ToString(CultureInfo.InvariantCulture), y1.ToString(CultureInfo.InvariantCulture), z1.ToString(CultureInfo.InvariantCulture), x2.ToString(CultureInfo.InvariantCulture), y2.ToString(CultureInfo.InvariantCulture), z2.ToString(CultureInfo.InvariantCulture)); } /// /// Returns the size of the custom actor array. /// public int CustomActorArraySize { get { Trace.WriteLine(String.Format("EQ2:CustomActorArraySize")); return this.GetIntFromLSO("CustomActorArraySize"); } } /// /// Returns the true heading from the "from" point (1) to the "to" point (2). /// /// x-coordinate of 1 /// y-coordinate of 1 /// z-coordinate of 1 /// x-coordinate of 2 /// y-coordinate of 2 /// z-coordinate of 2 public float HeadingTo(float fromX, float fromY, float fromZ, float toX, float toY, float toZ) { Trace.WriteLine(String.Format("EQ2:HeadingTo({0}, {1}, {2}, {3}, {4}, {5})", fromX.ToString(CultureInfo.InvariantCulture), fromY.ToString(CultureInfo.InvariantCulture), fromZ.ToString(CultureInfo.InvariantCulture), toX.ToString(CultureInfo.InvariantCulture), toY.ToString(CultureInfo.InvariantCulture), toZ.ToString(CultureInfo.InvariantCulture))); return this.GetFloatFromLSO("HeadingTo", fromX.ToString(CultureInfo.InvariantCulture), fromY.ToString(CultureInfo.InvariantCulture), fromZ.ToString(CultureInfo.InvariantCulture), toX.ToString(CultureInfo.InvariantCulture), toY.ToString(CultureInfo.InvariantCulture), toZ.ToString(CultureInfo.InvariantCulture)); } /// /// Returns the last known active Heroic Opportunity wheel slot /// public int HOCurrentWheelSlot { get { Trace.WriteLine(String.Format("EQ2:HOCurrentWheelSlot")); return this.GetIntFromLSO("HOCurrentWheelSlot"); } } /// /// Returns the description of the Heroic Opportunity /// public string HODescription { get { Trace.WriteLine(String.Format("EQ2:HODescription")); return this.GetStringFromLSO("HODescription"); } } /// /// Returns the IconID of slot 1 /// public int HOIconID1 { get { Trace.WriteLine(String.Format("EQ2:HOIconID1")); return this.GetIntFromLSO("HOIconID1"); } } /// /// Returns the IconID of slot 2 /// public int HOIconID2 { get { Trace.WriteLine(String.Format("EQ2:HOIconID2")); return this.GetIntFromLSO("HOIconID2"); } } /// /// Returns the IconID of slot 3 /// public int HOIconID3 { get { Trace.WriteLine(String.Format("EQ2:HOIconID3")); return this.GetIntFromLSO("HOIconID3"); } } /// /// Returns the IconID of slot 4 /// public int HOIconID4 { get { Trace.WriteLine(String.Format("EQ2:HOIconID1")); return this.GetIntFromLSO("HOIconID4"); } } /// /// Returns the IconID of slot 5 /// public int HOIconID5 { get { Trace.WriteLine(String.Format("EQ2:HOIconID5")); return this.GetIntFromLSO("HOIconID5"); } } /// /// Returns the IconID of slot 6 /// public int HOIconID6 { get { Trace.WriteLine(String.Format("EQ2:HOIconID6")); return this.GetIntFromLSO("HOIconID6"); } } /// /// Returns the last actor to initialize/manipulate the Heroic Opportunity window/wheel /// public Actor HOLastManipulator { get { Trace.WriteLine(String.Format("EQ2:HOLastManipulator")); return new Actor(this.GetMember("HOLastManipulator")); } } /// /// Returns the name of the Heroic Opportunity /// public string HOName { get { Trace.WriteLine(String.Format("EQ2:HOName")); return this.GetStringFromLSO("HOName"); } } /// /// Returns the total time elapsed on the current Heroic Opportunity /// public float HOTimeElapsed { get { Trace.WriteLine(String.Format("EQ2:HOTimeElapsed")); return this.GetFloatFromLSO("HOTimeElapsed"); } } /// /// Returns the total time allowed for the cuurent Heroic Opportunity /// public float HOTimeLimit { get { Trace.WriteLine(String.Format("EQ2:HOTimeLimit")); return this.GetFloatFromLSO("HOTimeLimit"); } } /// /// Returns the time remaining on the current Heroic Opportunity /// public float HOTimeRemaining { get { Trace.WriteLine(String.Format("EQ2:HOTimeRemaining")); return this.GetFloatFromLSO("HOTimeRemaining"); } } /// /// Returns the ID# of the wheel /// public int HOWheelID { get { Trace.WriteLine(String.Format("EQ2:HOWheelID")); return this.GetIntFromLSO("HOWheelID"); } } /// /// Returns the last known state of the Heroic Opportunity wheel /// public int HOWheelState { get { Trace.WriteLine(String.Format("EQ2:HOWheelState")); return this.GetIntFromLSO("HOWheelState"); } } /// /// Returns a boolean indicating whether or not the Heroic Opportunity window is active /// public bool HOWindowActive { get { Trace.WriteLine(String.Format("EQ2:HOWindowActive")); return this.GetBoolFromLSO("HOWindowActive"); } } /// /// Current state of the Heroic Opportunity window /// public int HOWindowState { get { Trace.WriteLine(String.Format("EQ2:HOWindowState")); return this.GetIntFromLSO("HOWindowState"); } } /// /// Returns the number of mail items in the character's inbox. /// The mailbox must have been opened at least once. /// public int InboxMailCount { get { Trace.WriteLine(String.Format("EQ2:InboxMailCount")); return this.GetIntFromLSO("InboxMailCount"); } } /// /// Returns the current master volume as a percentage /// public float MasterVolume { get { Trace.WriteLine(String.Format("EQ2:MasterVolume")); return this.GetFloatFromLSO("MasterVolume"); } } /// /// Returns the number of active radars /// public int NumRadars { get { Trace.WriteLine(String.Format("EQ2:NumRadars")); return this.GetIntFromLSO("NumRadars"); } } /// /// Returns the description of the quest currently being offered /// public string PendingQuestDescription { get { Trace.WriteLine(String.Format("EQ2:PendingQuestDescription")); return this.GetStringFromLSO("PendingQuestDescription"); } } /// /// Returns the name of the quest currently being offered. /// Returns "none" if no quest is currently being offered. /// public string PendingQuestName { get { Trace.WriteLine(String.Format("EQ2:PendingQuestName")); return this.GetStringFromLSO("PendingQuestName"); } } /// /// Returns the Persistent Zone ID for a given zone name /// /// zone name /// zone id public uint PersistentZoneID(string zoneName) { Trace.WriteLine(String.Format("EQ2:PersistentZoneID({0})", zoneName)); return this.GetUIntFromLSO("PersistentZoneID", zoneName); } /// /// Returns a boolean identifying whether or not a reward is pending /// public bool RewardPending { get { Trace.WriteLine(String.Format("EQ2:RewardPending")); return this.GetBoolFromLSO("RewardPending"); } } /// /// Returns the name of the server. This is only available when in the game proper. /// public string ServerName { get { Trace.WriteLine(String.Format("EQ2:ServerName")); return this.GetStringFromLSO("ServerName"); } } /// /// Returns an integer indicating the zoning status of the character. -1 = unsure, 0 = not zoning, 1 = zoning /// public int Zoning { get { Trace.WriteLine(String.Format("EQ2:Zoning")); return this.GetIntFromLSO("Zoning"); } } #endregion #region Methods /// /// Accepts the pending quest /// /// call success public bool AcceptPendingQuest() { Trace.WriteLine(String.Format("ISXEQ2:AcceptPendingQuest()")); return this.ExecuteMethod("AcceptPendingQuest"); } /// /// Accepts the current reward /// /// call success public bool AcceptReward() { Trace.WriteLine(String.Format("EQ2:AcceptReward()")); return this.ExecuteMethod("AcceptReward"); } /// /// Confirms the highlighted teleporter destination. /// NOTE: This should be used after selecting the appropriate /// destination using the 'HighlightRow' method of the /// EQ2UIElement datatype. /// /// call success public bool ConfirmZoneTeleporterDestination() { Trace.WriteLine(String.Format("EQ2:ConfirmZoneTeleporterDestination")); return this.ExecuteMethod("ConfirmZoneTeleporterDestination"); } /// /// Creates an array of actors based on the sort criteria submitted /// /// sort method, radius, type /// call success /// /// Sort Methods: /// byDist, byLevel, byType, byName (byDist is defualt) /// Type refers to npc, etc. /// public bool CreateCustomActorArray(params string[] args) { Trace.WriteLine(String.Format("EQ2:CreateCustomActorArray({0})", String.Join(", ", args))); return this.ExecuteMethod("CreateCustomActorArray", args); } /// /// Declines the pending quest /// /// call success public bool DeclinePendingQuest() { Trace.WriteLine(String.Format("EQ2:DeclinePendingQuest()")); return this.ExecuteMethod("DeclinePendingQuest"); } /// /// Gets all actors in range /// /// Enumerable sorted by distance public IEnumerable GetActors() { Trace.WriteLine(String.Format("EQ2:GetActors()")); return Util.GetListFromMethod(this, "GetActors", "actor"); } /// /// Gets all actors in range that meet the search criteria /// /// /// Enumerable /// /// Search Options: /// pc - nearest pc /// npc - nearest npc /// NamedNPC - nearest named npc /// guild, "guild" - nearest actor with that guild tag /// pet - nearest pet that is not your own /// mypet - your pet, or NULL /// tsunit - nearest trade skill unit /// resource - nearest resource node /// nokillnpc - nearest no kill npc /// special - nearest special actor /// corpse - nearest corpse /// me - me as actor /// chest - nearest chest /// door - nearest door /// level, # - nearest actor of that level /// levels, #, # - nearest actor between the two levels given /// id, # - returns the actor with the id given /// notid, # - excludes the actor with the id given /// class, "class" - nearest actor with class given /// race, "race" - nearest actor with race given /// radius, # - nearest actor within the radius given (you are the center) /// radiusr, #, # - nearest actor between the two radii (you are the center) /// xzrange, # - nearest actor within the 2 dimmensional range /// yrange, # - nearest actor within the supplied y range (vertical) /// nopcnear [, #] - nearest actor for which there is no PC within the given radius from it. If no argument is given, then it defaults to a range of 100 /// loc,#,# [,#] - actor at the location provided X, Z, or X, Z, Y if third parameter provided /// "string" - nearest actor with that string in their name /// public IEnumerable GetActors(params string[] args) { Trace.WriteLine(String.Format("EQ2:GetActors({0})", String.Join(", ", args))); return Util.GetListFromMethod(this, "GetActors", "actor", args); } /// /// Returns a list of Persistent Zones /// /// Enumerable public IEnumerable GetPersistentZones() { Trace.WriteLine(String.Format("EQ2:GetPersistentZones()")); return Util.GetListFromMethod(this, "GetPersistentZones", "string"); } /// /// Sets the ambient light to the requested amount /// /// float value between 0 and 100 /// call success /// /// It should be noted that the EQ2 in-game ambient light controls /// ..when at maximum...are only at 50%, by this setting. /// public bool SetAmbientLight(float ambientPct) { Trace.WriteLine(String.Format("EQ2:SetAmbientLight({0})", ambientPct.ToString(CultureInfo.InvariantCulture))); return this.ExecuteMethod("SetAmbientLight", ambientPct.ToString(CultureInfo.InvariantCulture)); } /// /// Sets the master sound volume /// /// float value between 0 and 100 /// call success public bool SetMasterVolume(float volPct) { Trace.WriteLine(String.Format("EQ2:SetMasterVolume({0})", volPct.ToString(CultureInfo.InvariantCulture))); return this.ExecuteMethod("SetMasterVolume", volPct.ToString(CultureInfo.InvariantCulture)); } /// /// Toggles the onscreen announcment that combat xp is disabled (if it is disabled) /// public bool ShowAllOnScreenAnnouncements() { Trace.WriteLine(String.Format("EQ2:ShowAllOnScreenAnnouncements()")); return this.ExecuteMethod("ShowAllOnScreenAnnouncements"); } #endregion } }