forked from rotmg-tools/Realm-Relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_help.txt
501 lines (391 loc) · 8.81 KB
/
script_help.txt
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
Realm Relay v1.0.0 Script Documentation
designed for ROTMG v17.2
________________________________________________________________
:INDEX
- General script info - GENERAL
- Event handler info - EVENTS
- Event function info - FUNCTIONS
- Object data info - OBJECTS
- Packet data info - PACKETS
________________________________________________________________
:GENERAL
- Realm Relay hacks are coded with JavaScript.
- A new instance of each script is created for each relay user.
- All information is lost when the user disconnects from the relay.
- A few variable names may unusual, because they were obfuscated in the decompiled rotmg code.
- Some variable names in packets or data objects may change later.
- Not all RotMG packets are included because more insight into the rotmg code is necessary.
________________________________________________________________
:EVENTS
- All event handlers have one or more parameters.
- The first parameter is always the event object.
- There are two types of event objects: ScheduledScriptEvent and PacketScriptEvent
- The event object is necessary to perform many tasks (see FUNCTIONS).
onEnable(ScheduledScriptEvent)
fired when there is a new user connected to the relay
onConnect(ScheduledScriptEvent)
fired when the relay connects to the remote host successfully
onConnectFail(ScheduledScriptEvent)
fired when the relay failed to connect to the remote host
onDisconnect(ScheduledScriptEvent)
fired when the relay disconnects from the remote host
onClientPacket(PacketScriptEvent)
fired when the relay recieves a packet from the client
onServerPacket(PacketScriptEvent)
fired when the relay recieves a packet from the server
________________________________________________________________
:FUNCTIONS
- All Realm Relay default functions are defined in event objects.
boolean connect(int gameId)
- asynchronously (not blocking the current thread) tries a connection attempt
- uses the gameId to determine what remote host:port to connect to
- if gameId is not known, uses the remote host:port in the settings.properties file
- returns true if the relay was not already connected to a remote host
BitmapData createBitmapData()
- creates a BitmapData object
Item createItem()
- creates an Item object
Location createLocation()
- creates a Location object
LocationRecord createLocationRecord()
- creates a LocationRecord object
ObjectData createObjectData()
- creates an ObjectData object
Packet createPacket(byte id)
- using the packet id provided, creates the correct type of Packet
SlotObject createSlotObject()
- creates a SlotObject object
StatData createStatData()
- creates a StatData object
Status createStatus()
- creates a Status object
Tile createTile()
- creates a Tile object
void disconnect()
- disconnects the relay from the remote host
void echo(String message)
- echo a message to the console
string getRemoteHost()
- gets the current remote host name
int getRemotePort()
- gets the current remote host port
boolean isConnected()
- returns true if the relay is connected to a remote host
void kickUser()
- disconnects from remote host and disconnects the relay user
void scheduleEvent(double seconds, string eventMethod, object... arguments)
- schedules eventMethod to be fired after seconds have passed
- arguments are passed, but the first argument of the eventMethod is always the event object
void sendToClient(Packet packet)
- sends the packet to the client
void sendToServer(Packet packet)
- sends the packet to the server
void setGameIdSocketAddress(int gameId, string host, int port)
- configures realm relay to correctly connect to the host:port when using the connect(gameId) function
!!! The following functions are only available in a PacketScriptEvent !!!
void cancel()
- cancels the event, causing the packet to not be sent
Packet getPacket()
- gets the Packet object involved in the event
boolean isCancelled()
- returns true if the event has been cancelled
________________________________________________________________
:OBJECTS
BitmapData
int width
int height;
byte[] bytes;
Item
int item
int slotType
boolean tradeable
boolean included
Location
float x
float y
float distanceSquaredTo(Location location)
float distanceTo(Location location)
LocationRecord
int time
float x
float y
float distanceSquaredTo(Location location)
float distanceTo(Location location)
ObjectData
short objectType
Status status
Packet
byte id()
string toString()
SlotObject
int objectId
int slotId
int objectType
StatData
int obf0
int obf1
string obf2
Status
int objectId
Location pos
StatData[] data
Tile
short x
short y
int type
________________________________________________________________
:PACKETS
- All packet objects implement the id() function
AcceptTradePacket 63
boolean[] myOffer
boolean[] yourOffer
AccountListPacket 81
int accountListId
string[] accountIds
AllyShootPacket 92
int bulletId
int ownerId
short containerId
float angle
AOEAckPacket 37
int time
Location position
AOEPacket 24
Location pos
float radius
int damage
int effect
float duration
int origType
BuyPacket 40
int objectId
BuyResultPacket 16
int result
string resultString
CancelTradePacket 25
ChangeGuildRankPacket 36
string name
int guildRank
ChangeTradePacket 12
boolean[] offer
CheckCreditsPacket 33
ChooseNamePacket 57
string name
ClientStatPacket 8
string name
int value
Create_SuccessPacket 47
int objectId
int charId
CreateGuildPacket 23
string name
CreatePacket 49
int classType
int skinType
DamagePacket 21
int targetId
int[] effects
int damageAmount
boolean kill
int bulletId
int objectId
DeathPacket 34
string accountId
int charId
string killedBy
int obf0
int obf1
EditAccountListPacket 31
int accountListId
boolean add
int objectId
EnemyHitPacket 58
int time
int bulletId
int targetId
boolean kill
EscapePacket 69
FailurePacket 0
int errorId
string errorDescription
Global_NotificationPacket 45
int type
string text
GoToAckPacket 61
int time
GoToPacket 14
int objectId
Location pos
GroundDamagePacket 52
int time
Location position
GuildInvitePacket 39
string name
GuildRemovePacket 19
string name
HelloPacket 51
string buildVersion
int gameId
string guid
string password
string secret
int keyTime
byte[] key
byte[] obf0
string obf1
string obf2
string obf3
string obf4
string obf5
InvDropPacket 38
SlotObject slotObject
InvitedToGuildPacket 85
string name
string guildName
InvResultPacket 53
int result
InvSwapPacket 6
int time
Location position
SlotObject slotObject1
SlotObject slotObject2
JoinGuildPacket 27
string guildName
LoadPacket 17
int charId
boolean isFromArena
MapInfoPacket 76
int width
int height
string name
string obf0
int obf1
int fp
int background
boolean allowPlayerTeleport
boolean showDisplays
string[] clientXML
string[] extraXML
MovePacket 74
int tickId
int time
Location newPosition
LocationRecord[] records
NameResultPacket 22
boolean success
string errorText
New_TickPacket 50
int tickId
int tickTime
Status[] statuses
NotificationPacket 91
int objectId
string message
int color
OtherHitPacket 89
int time
int bulletId
int objectId
int targetId
PicPacket 5
BitmapData bitmapData
PingPacket 1
int serial
PlayerHitPacket 26
int bulletId
int objectId
PlayerShootPacket 90
int time
int bulletId
int containerType
Location startingPos
float angle
PlayerTextPacket 80
string text
PlaySoundPacket 60
int ownerId
int soundId
PongPacket 9
int serial
int time
QuestObjIdPacket 48
int objectId
ReconnectPacket 15
string name
string host
int port
int gameId
int keyTime
boolean isFromArena
byte[] key
RequestTradePacket 4
string name
ReskinPacket 56
int skinID
SetConditionPacket 7
int conditionEffect
float conditionDuration
Shoot2Packet 59
int bulletId
int ownerId
int containerId
Location startingPos
float angle
short damage
ShootAckPacket 11
int time
ShootPacket 10
int bulletId
int ownerId
int bulletType
Location startingPos
float angle
short damage
int numShots
float angleInc
Show_EffectPacket 83
int effectType
int targetObjectId
Location pos1
Location pos2
int color
SquareHitPacket 41
int time
int bulletId
int objectId
TeleportPacket 67
int objectId
TextPacket 20
string name
int objectId
int numStars
int bubbleTime
string recipient
string text
string cleanText
TradeAcceptedPacket 86
boolean[] myOffer
boolean[] yourOffer
TradeChangedPacket 65
boolean[] offer
TradeDonePacket 13
int code
string description
TradeRequestedPacket 78
string name
TradeStartPacket 77
Item[] myItems
string yourName
Item[] yourItems
UpdateAckPacket 42
UpdatePacket 66
Tile[] tiles
ObjectData[] newObjs
int[] drops
UseItemPacket 35
int time
SlotObject slotObject
Location itemUsePos
int useType
UsePortalPacket 55
int objectId