-
Notifications
You must be signed in to change notification settings - Fork 0
/
MDropper1_5.java
executable file
·237 lines (207 loc) · 6.69 KB
/
MDropper1_5.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
import com.swath.*;
import com.swath.event.*;
import com.swath.cmd.*;
public class MDropper1_5 extends UserDefinedScript {
private int as;
private Parameter isPhotoning;
private Parameter choice;
private Parameter returnHome;
private int startingSector;
private boolean foundSector;
public String getName() { return "MDropper Complete 1.5"; }
public boolean initScript() throws Exception {
if(Swath.main.prompt() != Swath.CITADEL_PROMPT) {
throw new ScriptException("You must start in the citadel");
}
choice = new Parameter("What Type Of Planet Drop?");
choice.setType(Parameter.CHOICE);
choice.addChoice(0,"Plain Planet Drop");
choice.addChoice(1,"Planet Drop, then Adjacent");
choice.addChoice(2,"Adjacent Fighter Photon");
choice.addChoice(3,"Adjacent Limpet Photon");
choice.addChoice(4,"Adjacent Fig/Limp Photon");
choice.setCurrentChoice(1);
isPhotoning = new Parameter("Photon When Adjacent?");
isPhotoning.setType(Parameter.BOOLEAN);
isPhotoning.setBoolean(true);
returnHome = new Parameter("Return Home?");
returnHome.setType(Parameter.BOOLEAN);
returnHome.setBoolean(true);
registerParam(choice);
registerParam(returnHome);
registerParam(isPhotoning);
return true;
}
// END INITSCRIPT
public boolean runScript() throws Exception {
startingSector = Swath.sector.sector();
if(choice.getCurrentChoice() == 0 || choice.getCurrentChoice() == 1){
if(choice.getCurrentChoice() == 0){
SendSSRadioMessage.exec("Starting MDropper, Standard Planet Drop...");
}
else{
SendSSRadioMessage.exec("Starting MDropper, Planet Drop then Adjacent Photon...");
}
while(true){
DisplayCurrentInfo.exec(true);
boolean warped = false;
if(((as = ((ShipEnteredSector)WaitForEvent.exec(ShipEnteredSector.class)).getSector())) != Swath.sector.sector()){
try{
PlanetWarp.exec(as);
warped = true;
if(returnHome.getBoolean()){
Thread.sleep(5000);
SendSSRadioMessage.exec("(MDropper) Going home"+startingSector);
PlanetWarp.exec(startingSector);
}
}
catch(Exception e){
}
if(!warped && choice.getCurrentChoice() == 1){
try{
AdjacentPlanetWarp.exec(as);
if(isPhotoning.getBoolean() && Swath.ship.photonMissiles() > 0){
CitadelPhoton.exec(as);
}
if(returnHome.getBoolean()){
SendSSRadioMessage.exec("going home"+startingSector);
sleep(500);
PlanetWarp.exec(startingSector);
}
}
catch(Exception f){
SendSSRadioMessage.exec(f.toString());
}
}
//SendString.exec("/");
//DisplaySector.exec();
}
}
}
else if(choice.getCurrentChoice() == 2){
SendSSRadioMessage.exec("Starting MDropper, Adjacent Fighter Photon...");
ShipEnteredSector e;
DisplaySector.exec();
while(true){
SendString.exec("/");
WaitForPrompt.exec(Swath.CITADEL_PROMPT);
if((e = ((ShipEnteredSector)WaitForEvent.exec(ShipEnteredSector.class))).getTrader().isRealPlayer() && (e.getSector() != Swath.sector.sector())){
as = e.getSector();
adjacentPlanetWarp();
if(isPhotoning.getBoolean() && Swath.ship.photonMissiles() > 0 && foundSector == true && startingSector != Swath.sector.sector()){
firePhoton();
}
DisplaySector.exec();
SendString.exec("d");
if(returnHome.getBoolean() && startingSector != Swath.sector.sector()){
goHome();
}
}
}
}
else if(choice.getCurrentChoice() == 3){
SendSSRadioMessage.exec("Starting MDropper, Adjacent Limpet Photon...");
SendString.exec("/");
WaitForPrompt.exec(Swath.CITADEL_PROMPT);
DisplaySector.exec();
while(true){
if((as = ((LimpetActivated)WaitForEvent.exec(LimpetActivated.class)).getSector()) != Swath.sector.sector()){
adjacentPlanetWarp();
if(isPhotoning.getBoolean() && Swath.ship.photonMissiles() > 0 && foundSector == true && startingSector != Swath.sector.sector()){
firePhoton();
}
DisplaySector.exec();
SendString.exec("d");
if(returnHome.getBoolean() && startingSector != Swath.sector.sector()){
goHome();
}
}
}
}
else if(choice.getCurrentChoice() == 4){
SendSSRadioMessage.exec("Starting MDropper, Adjacent Fighter And Limpet Photon...");
DisplaySector.exec();
boolean shouldAttack = true;
Class list[] = new Class[2];
list[0] = LimpetActivated.class;
list[1] = ShipEnteredSector.class;
while(true){
DisplayCurrentInfo.exec(true);
EventIfc event = WaitForEvent.exec(list);
if(event.isEventClass(LimpetActivated.class)){
as = ((LimpetActivated)event).getSector();
}
else{
as = ((ShipEnteredSector)event).getSector();
shouldAttack = ((ShipEnteredSector)event).getTrader().isRealPlayer();
}
if(as != Swath.sector.sector() && shouldAttack){
adjacentPlanetWarp();
}
if(shouldAttack && isPhotoning.getBoolean() && Swath.ship.photonMissiles() > 0 && foundSector == true ){
firePhoton();
}
DisplaySector.exec();
if(returnHome.getBoolean() && startingSector != Swath.sector.sector()){
goHome();
}
}
}
return true;
// END RUNSCRIPT
}
private void goHome() throws Exception {
Thread.sleep(5000);
try{
WaitForPrompt.exec(Swath.CITADEL_PROMPT,1000);
}
catch(Exception t){
if(Swath.main.prompt() == Swath.COMPUTER_PROMPT){
LeaveComputer.exec();
}
else if(Swath.main.prompt() == Swath.CORP_PROMPT){
LeaveCorporateMenu.exec();
}
else if(Swath.main.prompt() == Swath.PLANET_PROMPT){
EnterCitadel.exec();
}
else{
SendString.exec(SendString.RETURN_KEY);
}
}
if(startingSector != Swath.sector.sector()){
SendSSRadioMessage.exec("(MDropper) Going home: "+startingSector);
PlanetWarp.exec(startingSector);
}
}
private void firePhoton() throws Exception {
if(Swath.ship.photonMissiles() > 0){
SendString.exec("cpy"+as+SendString.RETURN_KEY+"q");
try{
WaitForPrompt.exec(Swath.CITADEL_PROMPT,1000);
}
catch(Exception t){
if(!atPrompt(Swath.CITADEL_PROMPT)){
SendString.exec("q");
}
}
}
}
private void adjacentPlanetWarp() throws Exception{
int[] neighborSectors;
neighborSectors = Swath.getSector(as).warpSectors();
int[] oneWaySectors = Swath.getSector(as).oneWays();
Sector possible = null;
foundSector = false;
int count = 0;
while(!foundSector && count < neighborSectors.length){
possible = Swath.getSector(neighborSectors[count]);
if((possible.ftrOwner().isYourCorporation() || possible.ftrOwner().isYou() && oneWaySectors[count] != Sector.ONE_WAY)){
SendString.exec("p"+possible.sector()+SendString.RETURN_KEY+"y");
foundSector = true;
}
count++;
}
}
}
/* end class */