@deafwave/osrs-botmaker-types 0.7.32 → 0.7.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,12 @@
1
1
 
2
2
 
3
+ /// <reference path="../../../runelite/index.d.ts" />
4
+
3
5
  declare namespace bot {
4
6
  /**
5
7
  * Interface for interacting with the player's equipped items
6
8
  * Provides methods to check and manage equipment
7
9
  */
8
- type Item = {
9
- id: number;
10
- quantity: number;
11
- };
12
-
13
10
  interface equipment {
14
11
  /**
15
12
  * Checks if the player has all the specified items equipped by their IDs
@@ -54,9 +51,16 @@ declare namespace bot {
54
51
  containsName: (name: string) => boolean;
55
52
 
56
53
  /**
57
- * Gets an array of all currently equipped items
58
- * @returns Array of equipped items
54
+ * Returns an array of all equipped items
55
+ * @returns Array of equipped items (net.runelite.api.Item)
56
+ */
57
+ getEquipment: () => net.runelite.api.Item[];
58
+
59
+ /**
60
+ * Unequips an item with the given ID from the equipment
61
+ * @param id The item ID to unequip
62
+ * @returns True if the item was unequipped, false otherwise
59
63
  */
60
- getEquipment: () => Item[];
64
+ unequip: (id: number) => boolean;
61
65
  }
62
66
  }
@@ -12,7 +12,7 @@ declare namespace bot {
12
12
  /** Gets the quantity of the item being bought or sold */
13
13
  getQuantity(): number;
14
14
  /** Gets the slot number used for this exchange request */
15
- getSlot(): GrandExchangeOffer;
15
+ getSlot(): net.runelite.api.GrandExchangeOffer;
16
16
  /** Checks if the request has been aborted */
17
17
  isAborted(): boolean;
18
18
  /** Checks if the request is in the process of being aborted */
@@ -25,6 +25,7 @@ declare namespace bot {
25
25
  setMaxAttempts(maxAttempts: number): void;
26
26
  }
27
27
 
28
+
28
29
  /**
29
30
  * Interface for interacting with the Grand Exchange
30
31
  * Provides methods to buy/sell items and check GE status
@@ -38,7 +39,7 @@ declare namespace bot {
38
39
  * @param walkToAndOpenGE Whether to automatically walk to and open the GE
39
40
  * @returns An ExchangeRequest object representing the buy order
40
41
  */
41
- addBuyToQueue: (itemId: number, quantity: number, walkToAndOpenGE: boolean) => net.runelite.api.GrandExchangeOffer;
42
+ addBuyToQueue: (itemId: number, quantity: number, walkToAndOpenGE: boolean) => bot.ExchangeRequest;
42
43
 
43
44
  /**
44
45
  * Gets the current size of the Grand Exchange queue
@@ -61,6 +61,7 @@ declare namespace bot {
61
61
  shop: bot.shop;
62
62
  task: bot.task;
63
63
  tileItems: bot.tileItems;
64
+ types: bot.types;
64
65
  variables: bot.variables;
65
66
  walking: bot.walking;
66
67
  web: bot.web;
@@ -172,12 +173,6 @@ declare namespace bot {
172
173
  bounds: java.awt.Rectangle
173
174
  ): void;
174
175
 
175
- /**
176
- * Prints a message in the bm logger
177
- * @param message The message to print
178
- */
179
- printLogMessage: (message: string) => void;
180
-
181
176
  /**
182
177
  * Returns true if the local player has an animation of -1 and is not moving for a given number of ticks
183
178
  * @param ticks The number of ticks to check
@@ -186,19 +181,23 @@ declare namespace bot {
186
181
  localPlayerIdleFor: (ticks: number) => boolean;
187
182
 
188
183
  /**
189
- * Clears the in game chat
184
+ * Runs a client script
185
+ * @param ints The integer parameters for the script
186
+ */
187
+ runClientScript: (ints: number[]) => void;
188
+
189
+ /**
190
+ @deprecated use log.clearGameChat()
190
191
  */
191
192
  clearGameChat: () => void;
192
193
 
193
194
  /**
194
- * Runs a client script
195
- * @param ints The integer parameters for the script
195
+ @deprecated use log.print()
196
196
  */
197
- runClientScript: (ints: number[]) => void;
197
+ printLogMessage: (message: string) => void;
198
198
 
199
199
  /**
200
- * Prints a message in game
201
- * @param message The message to print
200
+ @deprecated use log.printGameMessage()
202
201
  */
203
202
  printGameMessage: (message: string) => void;
204
203
  }
@@ -107,7 +107,7 @@ declare namespace bot {
107
107
  * @param spellName The name of the spell to cast
108
108
  * @param tileItem The tile item to cast the spell on
109
109
  */
110
- castOnTileItem: (spellName: SpellName, tileItem: bot.TileItemInfo) => void;
110
+ castOnTileItem: (spellName: SpellName, tileItem: net.runelite.api.TileItem) => void;
111
111
 
112
112
  /**
113
113
  * Casts a magic spell on a tile object (game object in the world)
@@ -7,15 +7,23 @@ declare namespace bot {
7
7
  */
8
8
  interface net {
9
9
  /**
10
- * Sends a message to specified targets via the network
11
- * @param targetIds Array of target IDs to send the message to
10
+ * Sends a BotMaker message to the specified Discord IDs via the socket server
11
+ * @param targetIds Array of Discord IDs to send the message to
12
12
  * @param message The message content to send
13
13
  * @param includeSelf Whether to include the sender in the recipients
14
14
  */
15
15
  sendMessage: (targetIds: string[], message: string, includeSelf: boolean) => void;
16
16
 
17
17
  /**
18
- * Sends a message to local players
18
+ * Sends a BotMaker message to the specified RuneScape names via the socket server
19
+ * @param rsNames Array of RuneScape display names to send the message to
20
+ * @param message The message content to send
21
+ * @param includeSelf Whether to include the sender in the recipients
22
+ */
23
+ sendMessageToRsns: (rsNames: string[], message: string, includeSelf: boolean) => void;
24
+
25
+ /**
26
+ * Sends a BotMaker message to all nearby local players via the socket server
19
27
  * @param message The message content to send
20
28
  * @param includeSelf Whether to include the sender in the recipients
21
29
  */
@@ -7,9 +7,9 @@ declare namespace bot {
7
7
  */
8
8
  interface prayer {
9
9
  /**
10
- * Toggles a prayer on or off
11
- * @param prayer The Prayer enum value to toggle
12
- * @param bypassMouseClicks Whether to bypass using mouse clicks and toggle directly (true) or use mouse clicks (false)
10
+ * Enables the specified prayer. Use bypassMouseClicks to send the action without a click.
11
+ * @param prayer The Prayer enum value to enable
12
+ * @param bypassMouseClicks True to toggle without mouse clicks, false to use mouse clicks
13
13
  */
14
14
  togglePrayer: (prayer: net.runelite.api.Prayer, bypassMouseClicks: boolean) => void;
15
15
  }
@@ -2,8 +2,17 @@
2
2
 
3
3
  declare namespace bot {
4
4
  /**
5
- * Information about a tile item (ground item)
5
+ * Result of finding the nearest reachable point (e.g. from findNearestPointAsync).
6
6
  */
7
+ interface NearestPointResult {
8
+ /** The nearest reachable world point */
9
+ getDestination: () => net.runelite.api.coords.WorldPoint;
10
+ getPathCost: () => number;
11
+ getPathDistance: () => number;
12
+ getStartPoint: () => net.runelite.api.coords.WorldPoint;
13
+ isFound: () => boolean;
14
+ }
15
+
7
16
  interface TileItemInfo {
8
17
  /** The tile where the item is located */
9
18
  tile: net.runelite.api.Tile;
@@ -65,4 +74,35 @@ declare namespace bot {
65
74
  */
66
75
  stop: () => void;
67
76
  }
77
+
78
+ interface types {
79
+ asActor: (obj: unknown) => net.runelite.api.Actor;
80
+ asExchangeRequest: (obj: unknown) => bot.ExchangeRequest;
81
+ asGraphicsObject: (obj: unknown) => net.runelite.api.GraphicsObject;
82
+ asGraphicsObjectArray: (obj: unknown) => net.runelite.api.GraphicsObject[];
83
+ asGrandExchangeOffer: (obj: unknown) => net.runelite.api.GrandExchangeOffer;
84
+ asHeadIcon: (obj: unknown) => net.runelite.api.HeadIcon;
85
+ asItem: (obj: unknown) => net.runelite.api.Item;
86
+ asItemArray: (obj: unknown) => net.runelite.api.Item[];
87
+ asNearestPointResult: (obj: unknown) => bot.NearestPointResult;
88
+ asNPC: (obj: unknown) => net.runelite.api.NPC;
89
+ asNPCArray: (obj: unknown) => net.runelite.api.NPC[];
90
+ asObjectComposition: (obj: unknown) => net.runelite.api.ObjectComposition;
91
+ asPlayer: (obj: unknown) => net.runelite.api.Player;
92
+ asPlayerArray: (obj: unknown) => net.runelite.api.Player[];
93
+ asPrayer: (obj: unknown) => net.runelite.api.Prayer;
94
+ asProjectile: (obj: unknown) => net.runelite.api.Projectile;
95
+ asProjectileArray: (obj: unknown) => net.runelite.api.Projectile[];
96
+ asTile: (obj: unknown) => net.runelite.api.Tile;
97
+ asTileItem: (obj: unknown) => net.runelite.api.TileItem;
98
+ asTileItemInfo: (obj: unknown) => bot.TileItemInfo;
99
+ asTileItemInfoArray: (obj: unknown) => bot.TileItemInfo[];
100
+ asTileObject: (obj: unknown) => net.runelite.api.TileObject;
101
+ asTileObjectArray: (obj: unknown) => net.runelite.api.TileObject[];
102
+ asWidget: (obj: unknown) => net.runelite.api.widgets.Widget;
103
+ asWidgetArray: (obj: unknown) => net.runelite.api.widgets.Widget[];
104
+ asWorldPoint: (obj: unknown) => net.runelite.api.coords.WorldPoint;
105
+ asWorldPointArray: (obj: unknown) => net.runelite.api.coords.WorldPoint[];
106
+ createWorldPoint: (x: number, y: number, plane: number) => net.runelite.api.coords.WorldPoint;
107
+ }
68
108
  }
@@ -9,43 +9,43 @@ declare namespace bot {
9
9
  /**
10
10
  * Gets a boolean variable by name
11
11
  * @param variableName The name of the variable to retrieve
12
- * @returns The boolean value of the variable
12
+ * @returns The boolean value
13
13
  */
14
14
  getBooleanVariable: (variableName: string) => boolean;
15
15
 
16
16
  /**
17
17
  * Gets an array of integers variable by name
18
18
  * @param variableName The name of the variable to retrieve
19
- * @returns The array of integers value of the variable
19
+ * @returns The integer array
20
20
  */
21
21
  getIntArrayVariable: (variableName: string) => number[];
22
22
 
23
23
  /**
24
24
  * Gets an integer variable by name
25
25
  * @param variableName The name of the variable to retrieve
26
- * @returns The integer value of the variable
26
+ * @returns The integer value
27
27
  */
28
28
  getIntVariable: (variableName: string) => number;
29
29
 
30
30
  /**
31
31
  * Gets an array of strings variable by name
32
32
  * @param variableName The name of the variable to retrieve
33
- * @returns The array of strings value of the variable
33
+ * @returns The string array
34
34
  */
35
35
  getStringArrayVariable: (variableName: string) => string[];
36
36
 
37
37
  /**
38
38
  * Gets a string variable by name
39
39
  * @param variableName The name of the variable to retrieve
40
- * @returns The string value of the variable
40
+ * @returns The string value
41
41
  */
42
42
  getStringVariable: (variableName: string) => string;
43
43
 
44
44
  /**
45
45
  * Sets a variable of any type by name
46
46
  * @param variableName The name of the variable to set
47
- * @param value The value to set the variable to
47
+ * @param value The value to set
48
48
  */
49
- setVariable: (variableName: string, value: any) => void;
49
+ setVariable: (variableName: string, value: number | number[] | string | string[] | boolean) => void;
50
50
  }
51
51
  }
@@ -1,4 +1,5 @@
1
1
  /// <reference path="../../../runelite/index.d.ts" />
2
+ /// <reference path="./types.d.ts" />
2
3
 
3
4
  declare namespace bot {
4
5
  /**
@@ -67,6 +68,22 @@ declare namespace bot {
67
68
  */
68
69
  webWalkToNearestBank: () => void;
69
70
 
71
+ /**
72
+ * Web walks to the nearest point from an array of destinations
73
+ * @param destinations Array of WorldPoint destinations to choose from
74
+ */
75
+ webWalkToNearest: (destinations: net.runelite.api.coords.WorldPoint[]) => void;
76
+
77
+ /**
78
+ * Finds the nearest reachable point from an array of destinations. Callback receives NearestPointResult (or null on error).
79
+ * @param destinations Array of WorldPoint destinations to choose from
80
+ * @param callback Called with the result or null on error
81
+ */
82
+ findNearestPointAsync: (
83
+ destinations: net.runelite.api.coords.WorldPoint[],
84
+ callback: (result: bot.NearestPointResult | null) => void
85
+ ) => void;
86
+
70
87
  /**
71
88
  * Starts web walking with full configuration options for food, stamina, teleports, and more
72
89
  * @param worldPoint The WorldPoint destination to walk to
@@ -1,15 +1,21 @@
1
1
 
2
2
 
3
- declare namespace bot {
3
+ /// <reference path="../../../java/BufferedImage.d.ts" />
4
4
 
5
+ declare namespace bot {
5
6
  interface web {
7
+ /**
8
+ * Fetches the content of the given URL as a string. Only allows http/https URLs from whitelisted domains. Returns an empty string on error.
9
+ * @param requestURL The URL to fetch
10
+ * @returns The response body as a string, or empty string on error
11
+ */
12
+ readString: (requestURL: string) => string;
6
13
 
7
14
  /**
8
- * Reads a string from the web
9
- * Whitelisted URLs: github.com, pastebin
10
- * @param requestURL The URL to read the string from
11
- * @returns The string read from the web
15
+ * Fetches an image from a whitelisted URL. Returns null on error.
16
+ * @param requestURL The URL to fetch the image from
17
+ * @returns The image as a BufferedImage, or null on error
12
18
  */
13
- readString(requestURL: string): string;
19
+ readImage: (requestURL: string) => BufferedImage | null;
14
20
  }
15
21
  }
@@ -7,31 +7,41 @@ declare namespace bot {
7
7
  */
8
8
  interface widgets {
9
9
  /**
10
- * Handles dialogue interactions
10
+ * Handles dialogue options by clicking continue or selecting from the provided dialogue options
11
+ * @param dialogues Array of dialogue option texts to select (for continue-only use e.g. [] or ["Continue"])
12
+ * @returns True if dialogue was handled, false otherwise
11
13
  */
12
- handleDialogue: (dialogues: []) => boolean;
14
+ handleDialogue: (dialogues: string[]) => boolean;
13
15
 
14
16
  /**
15
- * Interacts with a specified widget using its ID and parameters
16
- * @param packedWidgetId The packed ID of the widget to interact with
17
- * @param identifier The identifier for the interaction
18
- * @param opcode The operation code for the interaction
19
- * @param p0 The first parameter for the interaction
20
- * @param p1 The second parameter for the interaction (optional)
17
+ * Interacts with a widget using packed widget ID, identifier, opcode, param0, and param1
21
18
  */
22
-
23
- interactSpecifiedWidget: (
19
+ /**
20
+ * Interacts with a widget using packed widget ID, identifier, opcode, param0, and optionally param1.
21
+ *
22
+ * @param packedWidgetId The packed widget ID
23
+ * @param identifier The identifier for the widget action
24
+ * @param opcode The opcode specifying the action
25
+ * @param param0 The first parameter for the action
26
+ * @param param1 (Optional) The second parameter for the action
27
+ */
28
+ interactSpecifiedWidget(
24
29
  packedWidgetId: number,
25
30
  identifier: number,
26
31
  opcode: number,
27
- p0: number,
28
- p1?: number
29
- ) => void;
32
+ param0: number,
33
+ param1?: number
34
+ ): void;
30
35
 
31
36
  /**
32
- * Interacts with a widget by matching its text content
37
+ * Interacts with a widget by matching its text content.
33
38
  * @param text The text to search for in widgets
34
39
  */
35
40
  interactWidgetText: (text: string) => void;
41
+
42
+ /**
43
+ * Enables special attack
44
+ */
45
+ enableSpecialAttack: () => void;
36
46
  }
37
47
  }
@@ -0,0 +1,35 @@
1
+ interface SoxLogApi {
2
+ /**
3
+ * Clears the in-game chat
4
+ */
5
+ clearGameChat: () => void;
6
+
7
+ /**
8
+ * Prints a message
9
+ * @param message The message to print
10
+ */
11
+ print: (message: string) => void;
12
+
13
+ /**
14
+ * Prints a message with a specified color
15
+ * @param message The message to print
16
+ * @param color The color to use
17
+ */
18
+ printColor: (message: string, color: java.awt.Color) => void;
19
+
20
+ /**
21
+ * Prints a message in the game chat
22
+ * @param message The message to print
23
+ */
24
+ printGameMessage: (message: string) => void;
25
+
26
+ /**
27
+ * Prints a message with RGB color values
28
+ * @param message The message to print
29
+ * @param r Red value (0-255)
30
+ * @param g Green value (0-255)
31
+ * @param b Blue value (0-255)
32
+ */
33
+ printRGB: (message: string, r: number, g: number, b: number) => void;
34
+ }
35
+ declare const log: SoxLogApi;
@@ -1,5 +1,5 @@
1
- /// <reference path="./api/api.d.ts" />
2
1
  /// <reference path="./api/bot.d.ts" />
3
2
  /// <reference path="./api/client.d.ts" />
4
3
  /// <reference path="./api/clientThread.d.ts" />
5
4
  /// <reference path="./api/configManager.d.ts" />
5
+ /// <reference path="./api/log.d.ts" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deafwave/osrs-botmaker-types",
3
- "version": "0.7.32",
3
+ "version": "0.7.34",
4
4
  "author": {
5
5
  "name": "Chandler Ferry",
6
6
  "url": "https://github.com/ChandlerFerry"
@@ -1,115 +0,0 @@
1
- /// <reference path="../../runelite/index.d.ts" />
2
-
3
- /** @deprecated Use bot */
4
- declare const api: SoxApi;
5
-
6
- interface SoxApi {
7
- /** @deprecated */
8
- attackPlayer: (names: string[]) => void;
9
- /** @deprecated */
10
- clearGameChat: () => void;
11
- /** @deprecated */
12
- depositAllToBankWithId: (id: number) => void;
13
- /** @deprecated */
14
- depositAllToBankWithName: (name: string) => void;
15
- /** @deprecated */
16
- depositToBankWithId: (id: number) => void;
17
- /** @deprecated */
18
- depositToBankWithName: (name: string) => void;
19
- /** @deprecated */
20
- followPlayer: (names: string[]) => void;
21
- /** @deprecated */
22
- getBooleanVariable: (variableName: string) => boolean;
23
- /** @deprecated */
24
- getCounter: (name: string) => number;
25
- /** @deprecated */
26
- getGraphicsObjectsWithIds: (ids: number[]) => net.runelite.api.GraphicsObject[];
27
- /** @deprecated */
28
- getIntArrayVariable: (variableName: string) => number[];
29
- /** @deprecated */
30
- getIntVariable: (variableName: string) => number;
31
- /** @deprecated */
32
- getNpcAttackSpeed: (npcId: number) => number;
33
- /** @deprecated */
34
- getNpcsWithIds: (ids: number[]) => net.runelite.api.NPC[];
35
- /** @deprecated */
36
- getNpcsWithNames: (names: string[]) => net.runelite.api.NPC[];
37
- /** @deprecated */
38
- getProjectilesWithIds: (ids: number[]) => net.runelite.api.Projectile[];
39
- /** @deprecated */
40
- getStringArrayVariable: (variableName: string) => string[];
41
- /** @deprecated */
42
- getStringVariable: (variableName: string) => string;
43
- /** @deprecated */
44
- getTileObjectComposition: (objectId: number) => net.runelite.api.ObjectComposition;
45
- /** @deprecated */
46
- getTileObjectsWithIds: (ids: number[]) => net.runelite.api.TileObject[];
47
- /** @deprecated */
48
- getTileObjectsWithNames: (names: string[]) => net.runelite.api.TileObject[];
49
- /** @deprecated */
50
- interactInventoryItemOnNpcWithIds(itemId: number, npc: net.runelite.api.NPC): void;
51
- /** @deprecated */
52
- interactInventoryItemOnObjectWithIds(itemId: number, tileObject: net.runelite.api.TileObject): void;
53
- /** @deprecated */
54
- interactInventoryWithIds: (itemIds: number[], options: string[]) => void;
55
- /** @deprecated */
56
- interactInventoryWithNames: (itemNames: string[], options: string[]) => void;
57
- /** @deprecated */
58
- interactNpc: (npcName: string, action: string) => void;
59
- /** @deprecated */
60
- interactObject: (objectName: string, action: string) => void;
61
- /** @deprecated */
62
- interactObjects: (objectName: string[], action: string[]) => void;
63
- /** @deprecated */
64
- interactSpecifiedWidget(pid: number, id: number, opcode: number, param0: number, param1?: number): void;
65
- /** @deprecated */
66
- interactSuppliedNpc: (target: net.runelite.api.NPC, action: string) => void;
67
- /** @deprecated */
68
- interactSuppliedObject: (target: net.runelite.api.TileObject, action: string) => void;
69
- /** @deprecated */
70
- interactWidgetText(text: string): void;
71
- /** @deprecated */
72
- isBankOpen: () => boolean;
73
- /** @deprecated */
74
- isNearPlayer: (radius: number, names: string[]) => boolean;
75
- /** @deprecated */
76
- isWebWalking: () => boolean;
77
- /** @deprecated */
78
- localPlayerIdle: () => boolean;
79
- /** @deprecated */
80
- localPlayerMoving: () => boolean;
81
- /** @deprecated */
82
- lootItemsWithIds: (lootIds: number[], maxDistance: number) => void;
83
- /** @deprecated */
84
- lootItemsWithNames: (lootNames: string[], maxDistance: number) => void;
85
- /** @deprecated */
86
- printGameMessage: (message: string) => void;
87
- /** @deprecated */
88
- runClientScript(params: any[]): void;
89
- /** @deprecated */
90
- setCounter: (name: string, value: number) => void;
91
- /** @deprecated */
92
- setVariable: (variableName: string, value: string | number | boolean | string[] | number[]) => void;
93
- /** @deprecated */
94
- togglePrayer: (prayer: net.runelite.api.Prayer, bypassMouseClicks: boolean) => void;
95
- /** @deprecated */
96
- tradePlayer: (names: string[]) => void;
97
- /** Use if you're using a World point provided by the Bot Makers World Point true tile debug */
98
- /** @deprecated */
99
- walkToTrueWorldPoint: (x: number, y: number) => void;
100
- /** Use if you're walking to a world point thats already provided by the RL API such as localPlayer.getWorldLocation */
101
- /** @deprecated */
102
- walkToWorldPoint: (x: number, y: number) => void;
103
- /** @deprecated */
104
- webWalkCancel: () => void;
105
- /** @deprecated */
106
- webWalkStart: (point: net.runelite.api.coords.WorldPoint) => void;
107
- /** @deprecated */
108
- withdrawAllFromBankWithId: (id: number) => void;
109
- /** @deprecated */
110
- withdrawAllFromBankWithName: (name: string) => void;
111
- /** @deprecated */
112
- withdrawFromBankWithId: (id: number) => void;
113
- /** @deprecated */
114
- withdrawFromBankWithName: (name: string) => void;
115
- }