-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAbyte0_Flax.java
More file actions
214 lines (190 loc) · 4.3 KB
/
Abyte0_Flax.java
File metadata and controls
214 lines (190 loc) · 4.3 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
//Abyte0
//2012-01-18
//Gnome City Bow String Maker
//2021-07-06 1.0 Tested with OpenRSC
//2022-03-28 2.0 Support Tasking
public class Abyte0_Flax extends Abyte0_Script implements ITaskScript
{
private final String SCRIPT_VERSION = "2.1";
int idFlax = 675;
int idString = 676;
int idBanker = 540;
boolean power = false;
boolean isDroppingNow = false;
public Abyte0_Flax(Extension e)
{ super(e); }
public void init(String params)
{
print("USAGE Abyte0_Flax nothing = banking OR power = powerflax");
print("String Maker for Gnome City");
print("Version " + SCRIPT_VERSION);
print("Make sure you are strong to fight a gnome level 23 bare, or get 47 cb");
print("Do not wear armor/weapon, only sleeping bag must be in your inv.");
if(params.contains(TaskParameters.TASKING_HEADER))
{
isRunningAsTask = true;
print("Abyte0_Flax [Running as task]");
taskingDetails = TaskParameters.buildFromString(params);
params = taskingDetails.TaskInputParams;
print("param left:"+params);
}
if(params.toLowerCase().contains("power"))
power = true;
}
public int main()
{
if(isBanking())
{
//On Depose les FLAX
if(getInventoryCount(idString) > 0)
{
deposit(idString,getInventoryCount(idString));
return 500;
}
if(getInventoryCount(1263) < 1)
{
withdraw(1263,1);
return 1000;
}
//Si il reste uniquement le Bag
if(getInventoryCount() == 1)
{
closeBank();
return 1000;
}
else
{
depositAll();
return 5000;
}
}
if(isQuestMenu())
{
answer(0);
return random(3500, 3600);
}
if(isDroppingNow)
{
if(getInventoryCount(idString) != 0)
dropItem(getInventoryIndex(idString));
else
isDroppingNow = false;
return random(300,400);
}
//Si plein de String
if(getInventoryCount() == 30 && getInventoryCount(idFlax) == 0)
{
if(power)
{
isDroppingNow = true;
return random(300,400);
}
//si pres des bankers
if(isAtApproxCoords(715,1452,16))
{
int banker[] = getNpcByIdNotTalk(idBanker);
if(banker[0] != -1)
{
talkToNpc(banker[0]);
return random(2400,2600);
}
return 500;
}
//si Pres du Spinner
if(isAtApproxCoords(692,1468,16))
{
atObject(692, 1469);
return random(500, 600);
}
//si sur le chemin public
if(isAtApproxCoords(702,522,30))
{
if(getX() < 702)
walkTo(702,522);
else
atObject(714,516);
return 500;
}
//print("lost FULL");
return random(100,200);
}
//Si PAS PLEIN
if(getInventoryCount() < 30)
{
//si pres des bankers
if(isAtApproxCoords(715,1452,16))
{
atObject(714,1460);
return random(400,600);
}
//si Pres du Spinner
if(isAtApproxCoords(692,1468,16))
{
atObject(692, 1469);
return random(500, 600);
}
//si sur le chemin public
if(isAtApproxCoords(702,522,35))///was 30 trying 35 to fix bug
{
if(isRunningAsTask && hasCompleted()) { endTask(); return 666;}
//print("if i dont move its cause i cant reach 693 524, im at "+getX() + ","+ getY());
atObject2(698, 521);
return random(300,400);
}
print("lost EMPTY");
return random(100,200);
}
//Si plein de Flax
if(getInventoryCount(idFlax) > 0 || getInventoryCount() == 30)
{
//si pres des bankers
if(isAtApproxCoords(715,1452,16))
{
atObject(714,1460);
return random(400,600);
}
//si Pres du Spinner
if(isAtApproxCoords(692,1468,16))
{
if(getFatigue() > 90)
{
useSleepingBag();
return 1000;
}
useItemOnObject(675, 121);
return random(555, 666);
}
//si sur le chemin public
if(isAtApproxCoords(702,522,30))
{
if(getX() > 702)
walkTo(701,522);
else
atObject(692, 525);
return 500;
}
return random(100,200);
}
return 100;
}
@Override
public String getSctiptVersion()
{
return SCRIPT_VERSION;
}
private boolean isRunningAsTask = false;
private TaskParameters taskingDetails;
@Override
public boolean hasCompleted()
{
if(getLevel(12) >= 31) return true;
return false;
}
@Override
public void endTask()
{
depositAll();
print("Task ended : Crafting to level 31");
switchToScript(taskingDetails.MainScriptName,taskingDetails.MainScriptParams);
}
}