using System;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Runtime.InteropServices;
using Decal.Interop.Core;
namespace Decal.Adapter.Wrappers;
///
/// Provides direct access to functions and properties in the AC client.
///
[CLSCompliant(true)]
public sealed class HooksWrapper : MarshalByRefObject, IIndexedValueProvider, IDisposable
{
private IACHooks myHooks;
private bool isDisposed;
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public IACHooks Underlying => myHooks;
///
/// Gets a value indicating how the player is moving an item, or 0
/// if the player is not moving an item. There are different values
/// for moving an item, combining/splitting a stack, picking
/// up/dropping an item, etc.
///
///
/// Here are some known values for BusyState:
/// 0: Idle.
/// 1: Combining a stack.
/// 2: Splitting a stack.
/// 3: ???
/// 4: Picking up an item from the ground.
/// 5: Moving or unequipping an item.
/// 6: Dropping an item to the ground.
/// 7: Equipping an item.
///
public int BusyState => myHooks.BusyState;
///
/// Gets the GUID of the object that the player is moving, or 0 if the
/// player is not currently moving any object.
///
public int BusyStateId => myHooks.BusyStateID;
///
/// Returns true if the chat bar at the bottom of the screen
/// currently has keyboard focus. Doesn't apply to floating chat
/// windows.
///
public bool ChatState => myHooks.ChatState;
///
/// Gets a value indicating the player's combat stance.
/// 1 is out of combat mode;
/// 2 is melee attack mode;
/// 4 is missile attack mode;
/// 8 is magic casting mode.
///
public CombatState CombatMode => (CombatState)myHooks.CombatMode;
///
/// Returns a pointer to the CommandInterpreter object
///
public int CommandInterpreter => myHooks.CommandInterpreter;
///
/// Gets or sets the GUID of the selected item. A GUID of 0 indicates
/// no item selected.
///
public int CurrentSelection
{
get
{
return myHooks.CurrentSelection;
}
set
{
myHooks.CurrentSelection = value;
}
}
///
/// Gets or sets the compass heading of the player (in degrees).
/// North is 0, East is 90, etc. Setting the heading will cause the
/// player to turn.
///
public double Heading
{
get
{
return myHooks.HeadingDegrees;
}
set
{
FaceHeading(value, bUnknown: true);
}
}
///
/// Gets or sets the compass heading of the player (in radians).
/// North is 0, East is pi/2, etc. Setting the heading will cause the
/// player to turn.
///
public double HeadingRadians
{
get
{
return myHooks.HeadingRadians;
}
set
{
RadianFaceHeading(value, bUnknown: true);
}
}
///
/// Gets the ID of the player's current landcell (a.k.a. landblock).
///
///
/// Here is a description of landblocks from
/// David Simpson's
/// Dereth Cartography, from the header comment in his mapac.c
///
/// The map in Asheron's Call is 254 by 254 landblocks. Each landblock contains
/// a 9 by 9 grid of data points which makes for an 8 by 8 group of land squares
/// in game. Each landblock has a unique id, which is a word in length, and
/// has the format xxyyFFFF. In game, xx is the east-west position, and yy is the
/// north-south position. Landblock 0000FFFF is located in the southwest corner of
/// the map. Use /loc to find out which landblock you are on. Each square in a
/// landblock is 0.1 wide and tall, making each landblock 0.8 by 0.8. Although
/// each landblock contains 9 by 9 points, the points on the edges are redundant
/// with adjacent landblocks. The entire map is 2041 by 2041 data points, making
/// 2040 by 2040 squares. Lastly, each square is 24.0 by 24.0 units, whatever
/// they may be.
///
///
///
/// This example shows how to calculate coordinates from
/// , , and
/// . North and east are positive, south and
/// west are negative. Round the result to one decimal place to get
/// identical coordinates to the ones AC reports.
/// = 0 ? "N" : "S") + ", " + Math.Abs(EW).ToString("0.0") + (EW >= 0 ? "E" : "W");
/// ]]>
///
///
public int Landcell => myHooks.Landcell;
///
/// Gets the player's X-offset within the current landcell, measured in
/// meters. On the landscape, values range from 0 (west side of
/// landcell) to 192 (east side). In dungeons, values are unbounded.
///
public double LocationX => myHooks.LocationX;
///
/// Gets the player's Y-offset within the current landcell, measured in
/// meters. On the landscape, values range from 0 (south side of
/// landcell) to 192 (north side). In dungeons, values are unbounded.
///
public double LocationY => myHooks.LocationY;
///
/// Gets the player's altitude, measured in meters. 0 is sea-level.
///
public double LocationZ => myHooks.LocationZ;
///
/// Gets the total number of items in the currently selected stack.
///
public int MaxSelectedStackCount => myHooks.MaxSelectedStackCount;
///
/// Gets the GUID of the currently opened container, such as a chest or
/// corpse. Returns 0 if no container is currently opened.
///
public int OpenedContainer => myHooks.OpenedContainer;
///
/// Gets the ID of the current mouse pointer graphics. This number
/// corresponds to an image in client_portal.dat.
///
///
/// Here are some known values of PointerState:
/// 0x6004D68: Brown idle cursor.
/// 0x6004D69: Brown idle cursor with yellow outline.
/// 0x6004D6A: Red combat mode cursor.
/// 0x6004D6B: Red combat mode cursor with yellow outline.
/// 0x6004D6C: Blue magic mode cursor.
/// 0x6004D6D: Blue magic mode cursor with yellow outline.
/// 0x6004D71: Magnifying glass cursor.
/// 0x6004D72: Hand cursor.
/// 0x6004D74: Hour glass cursor.
/// 0x6004D75: Hour glass cursor with yellow outline.
///
public int PointerState => myHooks.PointerState;
///
/// Gets or sets the GUID of the previously-selected item. Setting
/// this will cause the given GUID to be selected when the user
/// presses the "select previous item" key.
///
public int PreviousSelection
{
get
{
return myHooks.PreviousSelection;
}
set
{
myHooks.PreviousSelection = value;
}
}
///
/// Gets the bounding box of the 3D region in the AC window. The 3D
/// region is the area of the window where landscape and characters
/// are visible.
///
public Rectangle Region3D
{
get
{
tagRECT aC3DRegionRect = myHooks.AC3DRegionRect;
return new Rectangle(aC3DRegionRect.left, aC3DRegionRect.top, aC3DRegionRect.right, aC3DRegionRect.bottom);
}
}
///
/// Gets the bounding box of the entire AC window, including the 2D
/// parts of the GUI. This is the resolution set on the settings tab
/// in AC.
///
public Rectangle RegionWindow
{
get
{
tagRECT aCWindowRect = myHooks.ACWindowRect;
return new Rectangle(aCWindowRect.left, aCWindowRect.top, aCWindowRect.right, aCWindowRect.bottom);
}
}
///
/// Gets or sets the number of items in the currently selected stack.
/// Must be between 1 and . If
/// this is less than , then
/// moving the current selection will split the stack.
///
public int SelectedStackCount
{
get
{
return myHooks.SelectedStackCount;
}
set
{
myHooks.SelectedStackCount = value;
}
}
///
/// Gets the GUID of the currently open vendor, or 0 if no vendor is
/// open.
///
public int VendorId => myHooks.VendorID;
///
/// Gets the level an attribute. "Current" values include buffs,
/// vitae, etc.
///
[CLSCompliant(false)]
public HookIndexer Attribute => new HookIndexer(this, hookIndexType.Attribute);
///
/// Gets the number of times a attribute has been raised above its
/// starting (innate) level.
///
[CLSCompliant(false)]
public HookIndexer AttributeClicks => new HookIndexer(this, hookIndexType.AttributeClicks);
///
/// Gets the starting (innate) level of an attribute.
///
[CLSCompliant(false)]
public HookIndexer AttributeStart => new HookIndexer(this, hookIndexType.AttributeStart);
///
/// Gets the total amount of XP spent on an attribute.
///
[CLSCompliant(false)]
public HookIndexer AttributeTotalXP => new HookIndexer(this, hookIndexType.AttributeTotalXP);
///
/// Gets the value of a hook by its ID.
///
[CLSCompliant(false)]
public HookIndexer Misc => new HookIndexer(this, hookIndexType.Misc);
///
/// Gets the level a skill. "Current" values include buffs, vitae, etc.
///
[CLSCompliant(false)]
public HookIndexer Skill => new HookIndexer(this, hookIndexType.Skill);
///
/// Gets the number of times a skill has been raised above the level
/// calculated from the skill's attribute formula plus free points.
///
[CLSCompliant(false)]
public HookIndexer SkillClicks => new HookIndexer(this, hookIndexType.SkillClicks);
///
/// Gets the number of free points for a skill. Specialized skills
/// have 10 free points.
///
[CLSCompliant(false)]
public HookIndexer SkillFreePoints => new HookIndexer(this, hookIndexType.SkillFreePoints);
///
/// Gets the total amount of XP spent on a skill.
///
[CLSCompliant(false)]
public HookIndexer SkillTotalXP => new HookIndexer(this, hookIndexType.SkillTotalXP);
///
/// Gets the level to which a skill is trained.
/// 0 is untrained; 1 is trained; 2 is specialized.
///
[CLSCompliant(false)]
public HookIndexer SkillTrainLevel => new HookIndexer(this, hookIndexType.SkillTrainLevel);
///
/// Gets the level a vital. "Current" values include buffs, vitae, etc.
///
[CLSCompliant(false)]
public HookIndexer Vital => new HookIndexer(this, hookIndexType.Vital);
///
/// Gets the number of times a vital has been raised above the level
/// calculated from the vital's attribute formula.
///
[CLSCompliant(false)]
public HookIndexer VitalClicks => new HookIndexer(this, hookIndexType.VitalClicks);
///
/// Gets the total amount of XP spent on a vital.
///
[CLSCompliant(false)]
public HookIndexer VitalTotalXP => new HookIndexer(this, hookIndexType.VitalTotalXP);
internal HooksWrapper(ACHooks hooks)
{
myHooks = hooks;
}
~HooksWrapper()
{
Dispose(disposing: false);
}
///
/// Releases the resources used by this HooksWrapper. No plugin or
/// filter should use this function!
///
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myHooks != null)
{
Marshal.ReleaseComObject(myHooks);
myHooks = null;
}
isDisposed = true;
}
///
/// Adds a line of text to the default chat window for the specified
/// text color.
///
/// The text to add to the chat window.
/// The color ID of the text to add. This also
/// determines in which chat window the text will appear, as per the
/// user's chat settings.
public void AddChatText(string text, int color)
{
AddChatText(text, color, 0);
}
///
/// Adds a line of text to the specified chat window.
///
/// The text to add to the chat window.
/// The color ID of the text to add.
/// The chat window where the text will appear.
/// 0 is the default chat window for the given color, 1 is main
/// chat, and 2-5 are chat tabs #1-4, respectively.
public void AddChatText(string text, int color, int target)
{
myHooks.AddChatText(text, color, target);
}
///
/// Adds text to the default chat window for the specified text color.
///
/// The text to add to the chat window.
/// The color ID of the text to add. This also
/// determines in which chat window the text will appear, as per the
/// user's chat settings.
public void AddChatTextRaw(string text, int color)
{
AddChatTextRaw(text, color, 0);
}
///
/// Adds text to the specified chat window.
///
/// The text to add to the chat window.
/// The color ID of the text to add.
/// The chat window where the text will appear.
/// 0 is the default chat window for the given color, 1 is main
/// chat, and 2-5 are chat tabs #1-4, respectively.
public void AddChatTextRaw(string text, int color, int target)
{
myHooks.AddChatTextRaw(text, color, target);
}
///
/// Adds a red status message to the status area at the top of the
/// screen.
///
/// The status message.
public void AddStatusText(string text)
{
myHooks.AddStatusText(text);
}
///
/// Uses one item on another (for crafting, etc.)
/// This command will fail if the player is busy using an item,
/// casting a spell, etc. If you are using multiple items, you must
/// wait until the previous action is complete before attempting to
/// use the next item.
///
/// The GUID of the item to use.
/// The GUID of the target.
///
public void ApplyItem(int useThis, int onThis)
{
myHooks.ApplyItem(useThis, onThis);
}
///
/// Attempts to wield an item
/// This command will fail if the player is busy using an item,
/// casting a spell, etc. If you are using multiple items, you must
/// wait until the previous action is complete before attempting to
/// use the next item.
///
/// The GUID of the item to use.
///
public void AutoWield(int item)
{
myHooks.AutoWield(item);
}
///
/// Attempts to wield an item
/// This command will fail if the player is busy using an item,
/// casting a spell, etc. If you are using multiple items, you must
/// wait until the previous action is complete before attempting to
/// use the next item.
///
/// The GUID of the item to use.
/// The slot to use
/// 1 if explicit placement, 0 if automatic placement
/// 0 if explic is 1, 1 if explic is 0
///
public void AutoWield(int item, int slot, int explic, int notexplic)
{
myHooks.AutoWieldEx(item, slot, explic, notexplic);
}
///
/// Attempts to wield an item
/// This command will fail if the player is busy using an item,
/// casting a spell, etc. If you are using multiple items, you must
/// wait until the previous action is complete before attempting to
/// use the next item.
///
/// The GUID of the item to use.
/// The slot to use
/// 1 if explicit placement, 0 if automatic placement
/// 0 if explic is 1, 1 if explic is 0
/// Zero
/// Zero
///
public void AutoWield(int item, int slot, int explic, int notexplic, int zero1, int zero2)
{
myHooks.AutoWieldRaw(item, slot, explic, notexplic, zero1, zero2);
}
///
/// Causes the player to attempt to cast a spell. The player must be
/// in spellcasting mode and the spell must be in his spellbook.
///
/// The ID of the spell to cast.
/// The GUID of the target. This is ignored for
/// non-targeted spells, such as self spells and ring spells.
public void CastSpell(int spellId, int objectId)
{
myHooks.CastSpell(spellId, objectId);
}
///
/// Drop an item from the player's inventory onto the ground.
///
/// The GUID of the item to drop.
public void DropItem(int objectId)
{
myHooks.DropItem(objectId);
}
///
/// Causes the player to turn to the specified heading.
///
/// The desired heading (in degrees).
/// Unknown.
/// Always returns true.
public bool FaceHeading(double heading, bool bUnknown)
{
return myHooks.FaceHeading((float)heading, bUnknown);
}
///
/// Causes the player to turn to the specified heading.
///
/// The desired heading (in radians).
/// Unknown
///
public bool RadianFaceHeading(double heading, bool bUnknown)
{
if (heading < 0.0)
{
throw new ArgumentOutOfRangeException("heading");
}
if (heading > Math.PI * 10.0)
{
throw new ArgumentOutOfRangeException("heading");
}
double num = heading * 180.0 / Math.PI;
return myHooks.FaceHeading((float)num, bUnknown);
}
///
/// Recruit someone to your fellowship.
///
/// The GUID of the character to recruit.
public void FellowshipRecruit(int lObjectID)
{
myHooks.FellowshipRecruit(lObjectID);
}
///
/// Give fellowship leadership to a player.
///
/// The GUID of the character to become the leader.
public void FellowshipGrantLeader(int lObjectID)
{
myHooks.FellowshipGrantLeader(lObjectID);
}
///
/// Opens or closes the fellowship.
///
/// True if the fellowship should be made open, false if it should be made closed.
public void FellowshipSetOpen(bool IsOpen)
{
myHooks.FellowshipSetOpen(IsOpen);
}
///
/// Quits the current fellowship.
///
public void FellowshipQuit()
{
myHooks.FellowshipQuit();
}
///
/// Disbands the current fellowship.
///
public void FellowshipDisband()
{
myHooks.FellowshipDisband();
}
///
/// Dismisses another player from the fellowship.
///
/// The GUID of the character to remove from the fellowship.
public void FellowshipDismiss(int lObjectID)
{
myHooks.FellowshipDismiss(lObjectID);
}
///
/// Gives an object from the player's inventory to another player or
/// NPC.
///
/// The GUID of the object to give.
/// The GUID of the player or NPC to receive
/// the object.
public void GiveItem(int lObject, int lDestination)
{
myHooks.GiveItem(lObject, lDestination);
}
///
/// Adds an identify-request to the end of the request queue.
///
/// The GUID of the object to request an ID for.
public void RequestId(int objectId)
{
CoreManager.Current.IDQueue.AddToQueueForCaller(objectId, Assembly.GetCallingAssembly(), DateTime.MaxValue);
}
///
/// Sends text to AC's chat parser as if the user had typed the text
/// into the chat bar. This text will not be sent to other
/// plugins via the
/// event, so
/// this function cannot be used to send chat commands to other plugins.
///
/// The text to send.
public void InvokeChatParser(string text)
{
myHooks.InvokeChatParser(text);
}
///
/// Checks if the AC client knows about an object GUID. The client
/// must know about an object for it to be used in other HooksWrapper
/// functions.
///
/// The GUID of the object to check.
/// true if the client knows about an object, or
/// false if not.
public bool IsValidObject(int objectId)
{
return myHooks.IsValidObject(objectId);
}
///
/// Logs out the current character and returns to the character
/// selection screen.
///
public void Logout()
{
myHooks.Logout();
}
///
/// Moves an item to the specified pack in the player's inventory.
/// This command will fail if the player is busy moving an item,
/// casting a spell, etc. If you are moving multiple items, you must
/// wait until the previous action is complete before attempting to
/// move the next item.
///
/// The GUID of the object to move.
/// The GUID of the destination container.
/// The slot within the pack, where 0 is the first
/// slot. If this number is greater than the number of items in the
/// pack, the object will be placed in the first unused slot in the
/// pack.
/// A flag indicating whether to add the object to
/// a stack in the pack, if one exists.
public void MoveItem(int objectId, int packId, int slot, bool stack)
{
myHooks.MoveItem(objectId, packId, slot, stack);
}
///
/// Moves an item to the front of the specified container. If the item
/// is not in the player's inventory, the destination must be the
/// player's main pack (the GUID of the player), or one of his side
/// packs.
/// This command will fail if the player is busy moving an item,
/// casting a spell, etc. If you are moving multiple items, you must
/// wait until the previous action is complete before attempting to
/// move the next item.
///
/// The GUID of the item to move.
/// The GUID of the destination container.
public void MoveItem(int objectId, int destinationId)
{
myHooks.MoveItemEx(objectId, destinationId);
}
///
/// Moves an item to the specified container, with flags indicating
/// how the move should be performed.
/// This command will fail if the player is busy moving an item,
/// casting a spell, etc. If you are moving multiple items, you must
/// wait until the previous action is complete before attempting to
/// move the next item.
///
/// The GUID of the object to move.
/// The GUID of the destination container.
/// Flags indicating how the move should be
/// performed.
public void MoveItem(int objectId, int destinationId, int moveFlags)
{
myHooks.MoveItemExRaw(objectId, destinationId, moveFlags);
}
///
/// Adds a salvagable item to the salvage panel.
/// The salvage panel does not need to be open for this command,
/// but it does need to be open for
/// , and opening the salvage panel
/// after adding items to it will clear the panel.
///
/// The GUID of the object to add.
public void SalvagePanelAdd(int objectId)
{
myHooks.SalvagePanelAdd(objectId);
}
///
/// Salvages the items in the salvage panel. The salvage panel must
/// be open.
///
public void SalvagePanelSalvage()
{
myHooks.SalvagePanelSalvage();
}
///
/// Selects an item.
///
/// The GUID of the object to select, or 0 to
/// clear the current selection.
public void SelectItem(int objectId)
{
myHooks.SelectItem(objectId);
}
///
/// Turns player's autorun on or off.
///
/// true to turn on autorun;
/// false to turn it off.
public void SetAutorun(bool on)
{
myHooks.SetAutorun(on);
}
///
/// Attempts to put the player in the specified combat stance. The
/// player must be wielding the proper weapon type (melee, bow,
/// magic caster) for the given combat stance.
///
/// The desired combat stance.
/// 1 is out of combat mode;
/// 2 is melee attack mode;
/// 4 is missile attack mode;
/// 8 is magic casting mode.
public void SetCombatMode(CombatState newMode)
{
myHooks.SetCombatMode((int)newMode);
}
///
/// Moves the mouse cursor to the given coordinates, relative to the
/// AC window.
///
/// The X-coordinate.
/// The Y-coordinate.
public void SetCursorPosition(int x, int y)
{
myHooks.SetCursorPosition(x, y);
}
///
/// Sets the amount of time that the player can be idle (no mouse or
/// keyboard input) before AC automatically logs out. The default
/// value is 1200 seconds (20 minutes).
///
/// The idle timeout (in seconds).
public void SetIdleTime(double timeout)
{
myHooks.SetIdleTime(timeout);
}
///
/// Adds a spell to the specified tab on the player's spell bar. The
/// spell must be in the player's spell book. Each spell tab can
/// contain only one copy of each spell. Putting a spell onto a tab
/// that already contains that spell will just move the spell to the
/// new index.
///
///
/// This function does not always work if you call it multiple times
/// in a loop. Consider putting the loop in the
/// event of a
/// , and then running the
/// timer for one tick.
///
/// The zero-based tab index to add the spell.
/// The zero-based slot on the tab to add the spell.
/// If this index is greater than the number of spells on the tab, the
/// spell will be added to the first unused slot.
/// The ID of the spell to be added.
public void SpellTabAdd(int tab, int index, int spellId)
{
myHooks.SpellTabAdd(tab, index, spellId);
}
///
/// Removes a spell from the specified tab on the player's spell bar.
/// This function can safely be called multiple times in a row with no
/// time delay between calls.
///
/// The tab from which to remove the spell.
/// The ID of the spell to be removed.
public void SpellTabDelete(int tab, int spellId)
{
myHooks.SpellTabDelete(tab, spellId);
}
///
/// Accepts a trade with another player.
///
public void TradeAccept()
{
myHooks.TradeAccept();
}
///
/// Adds an object to the trade window with another player. The object
/// must be in the player's inventory.
///
/// The GUID of the object to add.
public void TradeAdd(int objectId)
{
myHooks.TradeAdd(objectId);
}
///
/// Gets a physics object.
///
/// The ID of the physics object.
/// A pointer to a physics object.
public IntPtr PhysicsObject(int objectId)
{
return new IntPtr(myHooks.GetPhysicsObjectPtr(objectId));
}
///
/// Gets a weenie object.
///
/// The ID of the weenie object.
/// A pointer to the weenie object.
public IntPtr WeenieObject(int objectId)
{
return new IntPtr(myHooks.GetWeenieObjectPtr(objectId));
}
///
/// Declines (un-accepts) a trade with another player.
///
public void TradeDecline()
{
myHooks.TradeDecline();
}
///
/// Clears the contents of the trade window.
///
public void TradeReset()
{
myHooks.TradeReset();
}
///
/// Ends the current trade, leaving the trade window open.
///
public void TradeEnd()
{
myHooks.TradeEnd();
}
///
/// Gets a UIElement instance.
///
/// The TypeID of the UIElement instance.
/// A pointer to the UIElement instance.
public IntPtr UIElementLookup(UIElementType pUIElementType)
{
return new IntPtr(myHooks.UIElementLookup((int)pUIElementType));
}
///
/// Sets the position of a UIElement region in the AC window.
///
/// The TypeID of the UIElement instance.
/// The x-axis position the UIElement instance.
/// The y-axis position of the UIElement instance.
public void UIElementMove(UIElementType pUIElementType, int x, int y)
{
myHooks.UIElementMove((int)pUIElementType, x, y);
}
///
/// Sets the position of a UIElement region in the AC window.
///
/// The TypeID of the UIElement instance.
/// The width of the UIElement instance.
/// The height of the UIElement instance.
public void UIElementResize(UIElementType pUIElementType, int width, int height)
{
myHooks.UIElementResize((int)pUIElementType, width, height);
}
///
/// Gets the bounding box of a UIElement region in the AC window.
///
public Rectangle UIElementRegion(UIElementType pUIElementType)
{
tagRECT tagRECT = myHooks.UIElementRegionRect((int)pUIElementType);
return new Rectangle(tagRECT.left, tagRECT.top, 1 + tagRECT.right - tagRECT.left, 1 + tagRECT.bottom - tagRECT.top);
}
///
/// Uses an item, such as a potion, healing kit, etc.
///
///
/// This command will fail if the player is busy using an item,
/// casting a spell, etc. If you are using multiple items, you must
/// wait until the previous action is complete before attempting to
/// use the next item.
///
/// The GUID of the item to use.
/// The purpose of this argument is not
/// entirely known. Valid values appear to be 0 and 1: 0 uses
/// an item by itself (like a potion); 1 uses an item on the current
/// selection.
public void UseItem(int objectId, int useState)
{
myHooks.UseItem(objectId, useState);
}
///
/// Uses an item, such as a potion, healing kit, casts the spell on a
/// wand/orb, etc.
///
///
/// This command will fail if the player is busy using an item,
/// casting a spell, etc. If you are using multiple items, you must
/// wait until the previous action is complete before attempting to
/// use the next item.
///
/// The GUID of the item to use.
/// The purpose of this argument is not
/// entirely known. Valid values appear to be 0 and 1: 0 uses
/// an item by itself (like a potion); 1 uses an item on the current
/// selection.
/// The purpose of this argument is not
/// entirely known. It may be a target GUID for wand/orb spells, or
/// some other flag
public void UseItem(int objectId, int useState, int useMethod)
{
myHooks.UseItemRaw(objectId, useState, useMethod);
}
///
/// Buys all of the items in the buy-list. The player must have
/// enough pyreals and slots in the main pack to hold all of the items
/// being bought.
///
public void VendorBuyAll()
{
myHooks.VendorBuyAll();
}
///
/// Adds an item to the list of things to buy from a vendor. A vendor
/// window must be open to use this command.
///
/// The GUID of the item template or item in
/// the vendor's inventory. Templates are the generic items sold by
/// vendors, such as spell components or trade notes.
/// The number of the specified item to add to the
/// buy-list.
public void VendorAddBuyList(int templateId, int count)
{
myHooks.VendorBuyListAdd(templateId, count);
}
///
/// Clears the buy-list.
///
public void VendorClearBuyList()
{
myHooks.VendorBuyListClear();
}
///
/// Sells all of the items in the sell-list. The player must have
/// enough slots in the main pack to hold all of the stacks of pyreals
/// obtained from the sale.
///
public void VendorSellAll()
{
myHooks.VendorSellAll();
}
///
/// Adds an item to the list of things to sell to a vendor. A vendor
/// window must be open, and the item must be in the player's inventory.
///
/// The GUID of the item to add to the sell-list.
public void VendorAddSellList(int itemId)
{
myHooks.VendorSellListAdd(itemId);
}
///
/// Clears the sell-list.
///
public void VendorClearSellList()
{
myHooks.VendorSellListClear();
}
///
/// Spends experience points on a skill.
///
/// The skill to raise.
/// The number of experience points to spend.
/// Cannot be more than the player's unspent experience.
///
///
public void AddSkillExperience(SkillType skill, int experience)
{
myHooks.AddSkillExp((eSkill)skill, experience);
}
///
/// Spends experience points on an attribute.
///
/// The attribute to raise.
/// The number of experience points to spend.
/// Cannot be more than the player's unspent experience.
///
///
public void AddAttributeExperience(AttributeType attrib, int experience)
{
myHooks.AddAttributeExp((eAttribute)attrib, experience);
}
///
/// Spends experience points on a vital.
///
/// The vital to raise.
/// The number of experience points to spend.
/// Cannot be more than the player's unspent experience.
///
///
public void AddVitalExperience(VitalType vital, int experience)
{
myHooks.AddVitalExp((eVital)vital, experience);
}
int IIndexedValueProvider.GetIndexedObject(hookIndexType index, int item)
{
int result = 0;
switch (index)
{
case hookIndexType.Attribute:
result = myHooks.get_Attribute(item);
break;
case hookIndexType.AttributeClicks:
result = myHooks.get_AttributeClicks((eAttribute)item);
break;
case hookIndexType.AttributeStart:
result = myHooks.get_AttributeStart((eAttribute)item);
break;
case hookIndexType.AttributeTotalXP:
result = myHooks.get_AttributeTotalXP((eAttribute)item);
break;
case hookIndexType.Skill:
result = myHooks.get_Skill(item);
break;
case hookIndexType.SkillClicks:
result = myHooks.get_SkillClicks((eSkill)item);
break;
case hookIndexType.SkillFreePoints:
result = myHooks.get_SkillFreePoints((eSkill)item);
break;
case hookIndexType.SkillTotalXP:
result = myHooks.get_SkillTotalXP((eSkill)item);
break;
case hookIndexType.SkillTrainLevel:
result = (int)myHooks.get_SkillTrainLevel((eSkill)item);
break;
case hookIndexType.Vital:
result = myHooks.get_Vital(item);
break;
case hookIndexType.VitalClicks:
result = myHooks.get_VitalClicks((eVital)item);
break;
case hookIndexType.VitalTotalXP:
result = myHooks.get_VitalTotalXP((eVital)item);
break;
case hookIndexType.Misc:
result = myHooks.get_Misc(item);
break;
}
return result;
}
}