forked from runelite/runelite
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMenuOpcode.java
310 lines (288 loc) · 6.69 KB
/
MenuOpcode.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/*
* Copyright (c) 2017, Adam <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api;
import java.util.HashMap;
import java.util.Map;
/**
* An enumeration of right-click menu actions.
*/
public enum MenuOpcode
{
/**
* Menu action for using an item in your inventory on a tile object (GameObject or GroundObject).
*/
ITEM_USE_ON_GAME_OBJECT(1),
/**
* Menu action for casting a spell on a tile object (GameObject or GroundObject).
*/
SPELL_CAST_ON_GAME_OBJECT(2),
/**
* First menu action for a game object.
*/
GAME_OBJECT_FIRST_OPTION(3),
/**
* Second menu action for a game object.
*/
GAME_OBJECT_SECOND_OPTION(4),
/**
* Third menu action for a game object.
*/
GAME_OBJECT_THIRD_OPTION(5),
/**
* Fourth menu action for a game object.
*/
GAME_OBJECT_FOURTH_OPTION(6),
/**
* Fifth menu action for a game object.
*/
GAME_OBJECT_FIFTH_OPTION(1001),
/**
* Menu action for using an item in your inventory on an NPC.
*/
ITEM_USE_ON_NPC(7),
/**
* Menu action for casting a spell on an NPC.
*/
SPELL_CAST_ON_NPC(8),
/**
* First menu action for an NPC.
*/
NPC_FIRST_OPTION(9),
/**
* Second menu action for an NPC.
*/
NPC_SECOND_OPTION(10),
/**
* Third menu action for an NPC.
*/
NPC_THIRD_OPTION(11),
/**
* Fourth menu action for an NPC.
*/
NPC_FOURTH_OPTION(12),
/**
* Fifth menu action for an NPC.
*/
NPC_FIFTH_OPTION(13),
/**
* Menu action for using an item on a player.
*/
ITEM_USE_ON_PLAYER(14),
/**
* Menu action for casting a spell on a player.
*/
SPELL_CAST_ON_PLAYER(15),
/**
* Menu action for using an item on an item on the ground.
*/
ITEM_USE_ON_GROUND_ITEM(16),
/**
* Menu action for casting a spell on an item on the ground.
*/
SPELL_CAST_ON_GROUND_ITEM(17),
/**
* First menu action for an item on the ground.
*/
GROUND_ITEM_FIRST_OPTION(18),
/**
* Second menu action for an item on the ground.
*/
GROUND_ITEM_SECOND_OPTION(19),
/**
* Third menu action for an item on the ground.
*/
GROUND_ITEM_THIRD_OPTION(20),
/**
* Fourth menu action for an item on the ground.
*/
GROUND_ITEM_FOURTH_OPTION(21),
/**
* Fifth menu action for an item on the ground.
*/
GROUND_ITEM_FIFTH_OPTION(22),
/**
* Menu action for walking.
*/
WALK(23),
/**
* Interaction with widget (type 1).
*/
WIDGET_TYPE_1(24),
/**
* Interaction with widget (type 2).
*/
WIDGET_TYPE_2(25),
/**
* Interaction with widget (type 3).
*/
WIDGET_TYPE_3(26),
/**
* Interaction with widget (type 4).
*/
WIDGET_TYPE_4(28),
/**
* Interaction with widget (type 5).
*/
WIDGET_TYPE_5(29),
/**
* Interaction with widget (type 6).
*
* This is the continue button on message boxes
*/
WIDGET_TYPE_6(30),
/**
* Menu action when using an item on another item inside a widget (inventory).
*/
ITEM_USE_ON_WIDGET_ITEM(31),
/**
* Menu action when using an item on a widget.
*/
ITEM_USE_ON_WIDGET(32),
/**
* First menu action for an item.
*/
ITEM_FIRST_OPTION(33),
/**
* Second menu action for an item.
*/
ITEM_SECOND_OPTION(34),
/**
* Third menu action for an item.
*/
ITEM_THIRD_OPTION(35),
/**
* Fourth menu action for an item.
*/
ITEM_FOURTH_OPTION(36),
/**
* Fifth menu action for an item.
*/
ITEM_FIFTH_OPTION(37),
/**
* Menu action to drop an item (identical to ITEM_FIFTH_OPTION).
*/
ITEM_DROP(37),
/**
* Menu action to use an item.
*/
ITEM_USE(38),
/**
* First menu action for a widget.
*/
WIDGET_FIRST_OPTION(39),
/**
* Second menu action for a widget.
*/
WIDGET_SECOND_OPTION(40),
/**
* Third menu action for a widget.
*/
WIDGET_THIRD_OPTION(41),
/**
* Fourth menu action for a widget.
*/
WIDGET_FOURTH_OPTION(42),
/**
* Fifth menu action for a widget.
*/
WIDGET_FIFTH_OPTION(43),
PLAYER_FIRST_OPTION(44),
PLAYER_SECOND_OPTION(45),
PLAYER_THIRD_OPTION(46),
PLAYER_FOURTH_OPTION(47),
PLAYER_FIFTH_OPTION(48),
PLAYER_SIXTH_OPTION(49),
PLAYER_SEVENTH_OPTION(50),
PLAYER_EIGTH_OPTION(51),
/**
* Default menu action for a widget.
*/
WIDGET_DEFAULT(57),
/**
* Menu action triggered by examining an object.
*/
EXAMINE_OBJECT(1002),
/**
* Menu action triggered by examining an NPC.
*/
EXAMINE_NPC(1003),
/**
* Menu action triggered by examining item on ground.
*/
EXAMINE_ITEM_GROUND(1004),
/**
* Menu action triggered by examining item in inventory.
*/
EXAMINE_ITEM(1005),
/**
* Menu action triggered by canceling a menu.
*/
CANCEL(1006),
/**
* Menu action triggered by either examining item in bank, examining
* item in inventory while having bank open, or examining equipped item.
*/
EXAMINE_ITEM_BANK_EQ(1007),
/**
* Menu action injected by runelite for its menu items.
*/
RUNELITE(1500),
/**
* Menu action injected by runelite for overlay menu items.
*/
RUNELITE_OVERLAY(1501),
/**
* Menu action for configuring runelite overlays.
*/
RUNELITE_OVERLAY_CONFIG(1502),
FOLLOW(2046),
TRADE(2047),
/**
* Menu action triggered when the id is not defined in this class.
*/
UNKNOWN(-1);
public static final int MENU_ACTION_DEPRIORITIZE_OFFSET = 2000;
private static final Map<Integer, MenuOpcode> map = new HashMap<>();
static
{
for (MenuOpcode menuOpcode : values())
{
map.put(menuOpcode.getId(), menuOpcode);
}
}
private final int id;
MenuOpcode(int id)
{
this.id = id;
}
public int getId()
{
return id;
}
public static MenuOpcode of(int id)
{
return map.getOrDefault(id, UNKNOWN);
}
}