-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAbyte0_DarkWizard.java
More file actions
342 lines (297 loc) · 7.54 KB
/
Abyte0_DarkWizard.java
File metadata and controls
342 lines (297 loc) · 7.54 KB
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
import java.io.*;
import java.util.Scanner;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.*;
import javax.swing.*;
/*
By: Abyte0
Date: 2012-03-30
Private Release: 2012-04-03
Public Release: 2012-04-10
Use: Go to Wizard Tower north from Make Over Mage
2022-01-12 2.0 [Require Abyte_Script 1.6 ] Talk and only open door sometime to get stuck + stats added on #' keypress
*/
public class Abyte0_DarkWizard extends Abyte0_Script
{
public String SCRIPT_VERSION = "2.0";
int fMode = 2; //default attack
int Darkwizard[] = {60,57}; //60 = lvl25; 57 = lvl13
int[] room0 = {362,570};
int[] room1 = {362,1514};
int[] room2 = {362,2458};
int initialXp = 0;
long initialTime = 0;
//------------- ITEMS
int halfKey1 = 526;
int halfKey2 = 527;
int FireRune = 31;
int WaterRune = 32;
int AirRune = 33;
int EarthRune = 34;
int mindRunes = 35;
int deathRunes = 38;
int blood = 619;
int nature = 40;
int chaosRunes = 41;
int law = 42;
int CosmicRune = 46;
//-------------------------
int[] items = {halfKey1,halfKey2,law,deathRunes,CosmicRune,chaosRunes,FireRune,AirRune,EarthRune,nature,blood,WaterRune,mindRunes};
int side = 0;
String[] fModeName = {"Attack","Defence","Strength", "Controlled"};
int[] fModeIdList = {2,3,1,0};
@Override
public String[] getRandomQuotes()
{
String[] result = {
"How many Law you got?",
"Die!",
"...and he think he is a wizard...",
"That's some serious ladder trainning",
"Legs day!",
"Let call it a legs day",
"I wish there was a lift",
"fking bots!",
"This guy is stuck outside",
"Keep the door open, we nbeed fresh air...",
"Open the door! @red@Let him out!",
"@whi@I saw a ghost upstair!",
"don't go upstair, there is a dead body...",
"bones down the ladder, I guess someone falled after all those up and down"};
return result;
}
public Abyte0_DarkWizard(Extension e) { super(e); }
public void init(String params)
{
Frame frame = new Frame("Select Fighting Mode");
String choiceF = (String)JOptionPane.showInputDialog(frame, "Items:\n", "Fighting Mode Selection", JOptionPane.PLAIN_MESSAGE, null, fModeName, null);
for(int i = 0; i < fModeName.length; i++)
{
if (fModeName[i].equals(choiceF))
{
fMode = fModeIdList[i];
break;
}
}
print("--");
print("fMode = " + choiceF);
print("--");
print("DarkWizard killer by: Abyte0");
print("Version " + SCRIPT_VERSION);
print("--");
initialXp = getFmodeXp();
initialTime = System.currentTimeMillis();
}
public int main()
{
SayRandomQuote();
if(getFightMode() != fMode)
setFightMode(fMode);
if(getFatigue() > 90)
{
useSleepingBag();
return 3000;
}
if(isAtApproxCoords(room0[0],room0[1], 30))
side = 2;
else if(isAtApproxCoords(room2[0],room2[1], 30))
side = 0;
//if we are low life
if(getHpPercent() < 20)
{
if(inCombat())
{
RunFromCombat();
return random(200,400);
}
stopScript();
return random(600,1000);
}
if(!inCombat())
{
// If we see closed door we must open
int[] door = getWallObjectById(2);
if(door[0] != -1)
{
boolean ignoreOrNotDice = random(0,5) > 2;
if(isAtApproxCoords(door[1], door[2], 4) && ignoreOrNotDice)
{
//print("Open Door");
atWallObject(door[1], door[2]);
return 1000;
}
}
//We need to Pick Up the Item if any on floor
for(int h = 0; h < items.length; h++)
{
int[] groundItems = getItemById(items[h]);
if(groundItems[0] != -1)
{
//if in combat we run else we pickup
if(inCombat())
{
RunFromCombat();
return random(500,800);
}
if(isAtApproxCoords(room0[0],room0[1],15) || isAtApproxCoords(room1[0],room1[1],15) || isAtApproxCoords(room2[0],room2[1],15)) //If near tower to avoid getting lured
{
if(isAtApproxCoords(groundItems[1], groundItems[2], 15))
{
//print("PickUp");
pickupItem(groundItems[0], groundItems[1], groundItems[2]);
return random(1000, 1500);
}
}
}
}
//we need ot fight the npc
int[] npc = getNpcById(Darkwizard[0]);
if(npc[0] != -1)
{
//print("Attack level 25");
attackNpc(npc[0]);
return random(400,700);
}
npc = getNpcById(Darkwizard[1]);
if(npc[0] != -1)
{
//print("Attack level 13");
attackNpc(npc[0]);
return random(400,700);
}
//if no monster when we may want to use ladder
//if we in on floor 0, we want to go to floor 2
if(isAtApproxCoords(room0[0],room0[1], 30))
{
//print("Floor 0 to 1");
int i = goFloor0to1();
if(i != 0)
return i;
}
//if we in on floor 1 AND want to go to floor 2
if(isAtApproxCoords(room1[0],room1[1], 30) && side == 2)
{
//print("Floor 1 to 2");
int i = goFloor1to2();
if(i != 0)
return i;
}
//if we in on floor 2, we want to go to floor 1
if(isAtApproxCoords(room2[0],room2[1], 30))
{
//print("Floor 2 to 1");
int i = goFloor2to1();
if(i != 0)
return i;
}
//if we in on floor 1 AND want to go to floor 0
if(isAtApproxCoords(room1[0],room1[1], 30) && side == 0)
{
//print("Floor 1 to 0");
int i = goFloor1to0();
if(i != 0)
return i;
}
print("Not in combat waitting");
return random(1400,2000);
}
//if(getX() >= MIN && getX() <= MAX && getY() >= MIN && getY() <= MAX)
return random(1500, 2000);
}
public int goFloor0to1()
{
int[] ladder = getObjectById(5);
if(ladder[0] != -1)
{
atObject(ladder[1], ladder[2]);
return random(900,1400);
}
return 0;
}
public int goFloor1to2()
{
int[] ladder = getObjectById(5);
if(ladder[0] != -1)
{
atObject(ladder[1], ladder[2]);
return random(900,1400);
}
return 0;
}
public int goFloor2to1()
{
int[] ladder = getObjectById(6);
if(ladder[0] != -1)
{
atObject(ladder[1], ladder[2]);
return random(900,1400);
}
return 0;
}
public int goFloor1to0()
{
int[] ladder = getObjectById(6);
if(ladder[0] != -1)
{
atObject(ladder[1], ladder[2]);
return random(900,1400);
}
return 0;
}
public void RunFromCombat()
{
walkTo(getX(),getY());
}
public void onKeyPress(int keyCode) {
if (keyCode == 192 || keyCode == 128) { //# or '
reportXpChange();
}
//if (keyCode == 107) { //+
// increaseDelay();
//}
//if (keyCode == 109) { //-
// decreaseDelay();
//}
if (keyCode == 113) { //F2
resetCounters();
}
//print(""+keyCode);
}
private void resetCounters()
{
initialXp = getFmodeXp();
initialTime = System.currentTimeMillis();
}
protected void reportXpChange()
{
int xpDifference = getFmodeXp() - initialXp;
long timeSpan = System.currentTimeMillis() - initialTime;
long secondSpan = timeSpan / 1000;
long xpRatio = xpDifference * 3600L / secondSpan; //The L set 3600 as long variable Forcing to calculate as long to avoid overflow
print("=================================");
print("initialXp: " + initialXp);
print("initialTime: " + initialTime);
print("total fMode xp gained: " + xpDifference);
print("time running: " + secondSpan + " s");
print("xpRatio: " + xpRatio + "/h");
print("=================================");
}
private int getFmodeXp()
{
if(fMode == 1)
return getXpForLevel(2);
if(fMode == 2)
return getXpForLevel(0);
if(fMode == 3)
return getXpForLevel(1);
return getXpForLevel(0) + getXpForLevel(1) + getXpForLevel(2);
}
@Override
public String getSctiptVersion()
{
return SCRIPT_VERSION;
}
}