-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAbyte0_ArdSmelter.java
More file actions
245 lines (226 loc) · 6.79 KB
/
Abyte0_ArdSmelter.java
File metadata and controls
245 lines (226 loc) · 6.79 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
public class Abyte0_ArdSmelter extends Abyte0_Script {
int[] mix;
//int[] barMith;
//int[] barAddy;
//int[] barRune;
int oreTin = 202;
int oreCopper = 150;
int oreIron = 151;// Iron ore
int oreMith = 153;// Mith ore
int oreAddy = 154;// Addy ore
int oreRune = 409;// Rune ore
int oreCoal = 155;// Coal ore
int oreGold = 152;
int gnomeBall = 981;
//int barSteel = 171;//Steel bars
int banker = 95; // Banker
String barType;
int[] doorObj;
public Abyte0_ArdSmelter(Extension e) {
super(e);
}
public void init(String params) {
print("Abyte0 : Ardougne Smelter...");
//print("No param = Steel Bars...");
print("Version 2.1 - Added Bronze and Gold");
if (params.equals("b"))
mix = new int[]{169, 14, oreTin, 14, oreCopper, 14};
else if (params.equals("i"))
mix = new int[]{170, -1, oreIron, 29, oreCoal, 0};
else if (params.equals("s"))
mix = new int[]{171, 9, oreIron, 9, oreCoal, 18};
else if (params.equals("g"))
mix = new int[]{172, -1, oreGold, 29, oreCoal, 0};
else if (params.equals("m"))
mix = new int[]{173, 5, oreMith, 5, oreCoal, 20};
else if (params.equals("a"))
mix = new int[]{174, 4, oreAddy, 4, oreCoal, 24};
else if (params.equals("r"))
mix = new int[]{408, 3, oreRune, 3, oreCoal, 24};
else {
print("Sorry Param B = bronze, I = Iron, S = steel, G = Gold, M = mith , A = addy, R = runite");
stopScript();
}
barType = params;
//Version 0
//Smelt Steel bars
//fix 0.1 : Door opening when only door 1 is close
//fix 0.2 : When stuck in bank
//if(params.equals(""))
// cptInventaireToBank = 30;
//else
// cptInventaireToBank = 60;
}
public int main() {
return Mine();
}
public int Mine() {
if (getFightMode() != 2) {
setFightMode(2);
}
if (getFatigue() > 70) {
useSleepingBag();
return 1000;
}
if (isBanking()) {
if (getInventoryCount(gnomeBall) > 0) {
print("We got trolled by " + getInventoryCount(gnomeBall) + "Gnome Ball! Banked!");
deposit(gnomeBall, getInventoryCount(gnomeBall));
return random(1111, 1500);
} else if (getInventoryCount(mix[0]) > 0) {
deposit(mix[0], getInventoryCount(mix[0]));
return 1000 + random(10, 500);
} else if (getInventoryCount(mix[2]) == 0) {
withdraw(mix[2], mix[3]);
return 1000 + random(10, 500);
} else if (getInventoryCount(mix[4]) == 0 && mix[0] != 170) {
withdraw(mix[4], mix[5]);
//withdraw(oreCoal,8);//18 only take out 10 so i try 10 then 8 after...
return 1000 + random(10, 500);
} else if (getInventoryCount(mix[2]) == mix[3] && getInventoryCount(mix[4]) == mix[5] && getInventoryCount(mix[0]) == 0)
closeBank();
else {
//Si les quantit sont buguer on depose tout et on recommence
deposit(mix[2], getInventoryCount(mix[2]));//ore 1
deposit(mix[4], getInventoryCount(mix[4]));//ore 2
deposit(mix[0], getInventoryCount(mix[0]));//bars
return 1000 + random(5, 500);
}
}
if (isQuestMenu()) {
answer(0);
return 1000 + random(300, 1200);
}
if (getX() >= 577 && getX() <= 585 && getY() >= 572 && getY() <= 576) {
//print("In Bank");
if (getInventoryCount(mix[2]) != mix[3] || getInventoryCount(mix[4]) != mix[5]) {
print("Talking to Banker");
if (!isBanking()) {
int[] banker = getNpcByIdNotTalk(95);
if (banker[0] != -1 && !isBanking()) {
print("Hello you Banker!");
talkToNpc(banker[0]);
return random(2000, 3000);
} else
print("No banker!");
} else {
print("I don't feel like talking to banker!");
}
}
}
if (getInventoryCount(mix[2]) == 0 || (getInventoryCount(mix[4]) == 0 && mix[0] != 170)) {
//si a coter de la porte a l'interieur on veut sortir
//if(getX() == 589 && getY() == 591)
//{
//print("Force Open");
//doorObj = getWallObjectById(2);
//if(doorObj[0] != -1)
//{
// if (isAtApproxCoords(doorObj[1], doorObj[2], 5));
// atWallObject(doorObj[1], doorObj[2]);
//}
//atWallObject(589,591);
//}
//si a coter de la porte a l'interieur on veut sortir
if (getX() == 589 && getY() == 591) {
print("Step OUTSIDE House");
doorObj = getWallObjectById(2);
if (doorObj[0] != -1) {
if (isAtApproxCoords(doorObj[1], doorObj[2], 5)) {
atWallObject(doorObj[1], doorObj[2]);
print("Door id 2 = position : " + doorObj[1] + "," + doorObj[2]);
return random(6000, 12000);
} else {
walkTo(588, 591);
//walk inside
return random(500, 1000);
}
} else {
walkTo(588, 591);
//walk inside
return random(500, 1000);
}
//atWallObject(589,591);
}
if (getX() >= 589 && getX() <= 592 && getY() >= 589 && getY() <= 594) {
//Si dans la room
walkTo(589, 591);
return random(240, 2500);
}
if (getX() == 588 && getY() == 591) {
walkTo(586, 581);
return random(100, 1500);
}
if (getY() > 576) {
//Si avant banque on veut entrer....
walkTo(581, 573);
return 1000 + random(300, 1200);
}
walkTo(581, 573);//Bank
return 1000 + random(300, 1200);
} else {
if (getX() == 588 && getY() == 591) {
print("Step INSIDE House");
doorObj = getWallObjectById(2);
if (doorObj[0] != -1) {
if (isAtApproxCoords(doorObj[1], doorObj[2], 5)) {
atWallObject(doorObj[1], doorObj[2]);
print("Door id 2 = position : " + doorObj[1] + "," + doorObj[2]);
return random(6000, 12000);
} else {
walkTo(589, 591);
return random(500, 2000);
//walk outside
}
} else {
walkTo(589, 591);
return random(500, 2000);
//walk outside
}
}
//if(getX() == 588 && getY() == 591)
//{
// print("Force Open");
//doorObj = getWallObjectById(2);
//if(doorObj[0] != -1)
//{
// if (isAtApproxCoords(doorObj[1], doorObj[2], 5));
// atWallObject(doorObj[1], doorObj[2]);
//}
// atWallObject(589,591);
//}
if (getX() >= 577 && getX() <= 585 && getY() >= 572 && getY() <= 576) {
walkTo(586, 581);
return random(240, 2500);
}
if (getY() < 581) {
//On marche vers la petite porte des nats
walkTo(586, 581);
return 1000 + random(300, 1200);
}
//if(getX() == 588 && getY() == 591)
//{
// print("Step Inside House");
//doorObj = getWallObjectById(2);
//if(doorObj[0] != -1)
//{
// if (isAtApproxCoords(doorObj[1], doorObj[2], 5));
// atWallObject(doorObj[1], doorObj[2]);
//}
//print("Wall door id before opening"+getWallObjectIdFromCoords(589,591));
// atWallObject(589,591);
// walkTo(589,591);
//print("Wall door id after opening"+getWallObjectIdFromCoords(589,591));
// return random(2000, 3500);
//}
if (getX() >= 589 && getX() <= 592 && getY() >= 589 && getY() <= 594) {
//Si dans la room
useItemOnObject(mix[2], 118);
return random(640, 1809);
}
//SINON On marche jusqua la porte du smelting room
walkTo(588, 591);
return random(400, 1103);
}
}
}