|
@@ -1020,17 +1020,18 @@ class ScriptExplore(object):
|
|
|
ask = PlayerInput(self.game)
|
|
|
|
|
|
def settimes(*_):
|
|
|
- times = int(ask.keep['times'].strip())
|
|
|
+ times = ask.keep['times'].strip()
|
|
|
log.msg("settimes got '{0}'".format(times))
|
|
|
- if times == None:
|
|
|
+ if times == '':
|
|
|
self.deactivate()
|
|
|
else:
|
|
|
+ times = int(times)
|
|
|
self.times = times
|
|
|
self.maxtimes = times
|
|
|
self.send2game("D")
|
|
|
self.state = 1
|
|
|
|
|
|
- d = ask.prompt("How many sectors would you lick to explode?", 5, name="times", digits=True)
|
|
|
+ d = ask.prompt("How many sectors would you like to explorer?", 5, name="times", digits=True)
|
|
|
|
|
|
|
|
|
d.addCallback(settimes)
|
|
@@ -1095,12 +1096,12 @@ class ScriptExplore(object):
|
|
|
if self.state == 2:
|
|
|
if "Select (H)olo Scan or (D)ensity Scan or (Q)uit" in prompt:
|
|
|
self.send2game("D")
|
|
|
- self.state += 1
|
|
|
- if self.state == 5:
|
|
|
+
|
|
|
+ elif self.state == 5:
|
|
|
log.msg("dense is {0} sectors big".format(len(self.dense)))
|
|
|
self.state += 1
|
|
|
self.send2game("SH")
|
|
|
- if self.state == 12:
|
|
|
+ elif self.state == 12:
|
|
|
|
|
|
if prompt.startswith('Engage the Autopilot? (Y/N/Single step/Express) [Y]'):
|
|
|
self.send2game("S")
|
|
@@ -1108,7 +1109,12 @@ class ScriptExplore(object):
|
|
|
if prompt.startswith('Stop in this sector (Y,N,E,I,R,S,D,P,?) (?=Help) [N]'):
|
|
|
self.send2game("SD")
|
|
|
self.state += 1
|
|
|
- if self.state == 20:
|
|
|
+ elif self.state == 15:
|
|
|
+ if prompt.startswith('Stop in this sector (Y,N,E,I,R,S,D,P,?) (?=Help) [N]'):
|
|
|
+ self.send2game("N")
|
|
|
+ self.travel_path.pop(0)
|
|
|
+ self.state = 12
|
|
|
+ elif self.state == 20:
|
|
|
if prompt.startswith('Stop in this sector (Y,N,E,I,R,S,D,P,?) (?=Help) [N]'):
|
|
|
|
|
|
self.send2game("Y")
|
|
@@ -1121,21 +1127,20 @@ class ScriptExplore(object):
|
|
|
|
|
|
|
|
|
if self.state == 1:
|
|
|
-
|
|
|
- if not self.didDense:
|
|
|
- self.send2game("S")
|
|
|
- self.didDense = True
|
|
|
-
|
|
|
+ self.send2game("S")
|
|
|
+ self.state += 1
|
|
|
+ elif self.state == 2:
|
|
|
if "Relative Density Scan" in line:
|
|
|
self.state = 3
|
|
|
elif "You don't have a long range scanner." in line:
|
|
|
log.msg("FATAL: No Long Range Scanner Installed!")
|
|
|
self.send2player(Boxes.alert("You need a Long Range Scanner!"))
|
|
|
self.deactivate()
|
|
|
- elif "Long Range Scan" in line:
|
|
|
- self.state += 1
|
|
|
-
|
|
|
- if self.state == 2:
|
|
|
+ return
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ elif self.state == 3:
|
|
|
|
|
|
if line.startswith("Sector"):
|
|
|
new_sector = '(' in line
|
|
@@ -1148,20 +1153,27 @@ class ScriptExplore(object):
|
|
|
|
|
|
if new_sector:
|
|
|
|
|
|
- if(work[8] == 'No'):
|
|
|
- temp = False
|
|
|
- else:
|
|
|
- temp = True
|
|
|
-
|
|
|
- self.dense.append( {'sector': int(work[1]), 'density': int(work[2]), 'warps': int(work[4]), 'navhaz': int(work[6]), 'anom': temp} )
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ self.dense.append( {'sector': int(work[1]), 'density': int(work[2]), 'warps': int(work[4]), 'navhaz': int(work[6]), 'anom': work[8] == 'Yes'} )
|
|
|
log.msg(self.dense)
|
|
|
|
|
|
|
|
|
elif line == "":
|
|
|
self.state += 1
|
|
|
- elif self.state == 4:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if self.state == 4:
|
|
|
|
|
|
|
|
|
+ log.msg("state 4: {0}".format(self.dense))
|
|
|
|
|
|
|
|
|
if not self.dense:
|
|
@@ -1169,24 +1181,34 @@ class ScriptExplore(object):
|
|
|
self.dead_end()
|
|
|
return
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- elif self.dense:
|
|
|
-
|
|
|
- t = [d for d in self.dense if d['warps'] > 1]
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if not t:
|
|
|
- log.msg("No Sectors Found except one move sector!")
|
|
|
- self.dead_end()
|
|
|
- return
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1194,102 +1216,143 @@ class ScriptExplore(object):
|
|
|
|
|
|
|
|
|
|
|
|
- for d in self.dense:
|
|
|
- if not d['anom']:
|
|
|
-
|
|
|
- if not d['navhaz']:
|
|
|
-
|
|
|
- if d['density'] in (0, 1, 100, 101):
|
|
|
-
|
|
|
- if d['warps'] > 1:
|
|
|
-
|
|
|
- self.clear.append(d['sector'])
|
|
|
+
|
|
|
+ self.clear = [ x['sector'] for x in self.dense if not x['anom'] and not x['navhaz'] and x['density'] in (0,1,100,101) ]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if self.clear:
|
|
|
log.msg("Clear Sectors: {0}".format(len(self.clear)))
|
|
|
|
|
|
|
|
|
- for c in self.clear:
|
|
|
- for d in self.dense:
|
|
|
- if d['sector'] == c:
|
|
|
- if d['warps'] > self.highwarp:
|
|
|
- self.highwarp = d['warps']
|
|
|
- self.highsector = d['sector']
|
|
|
- elif d['warps'] == self.highwarp:
|
|
|
- if d['sector'] > self.highsector:
|
|
|
- self.highsector = d['sector']
|
|
|
+
|
|
|
+ self.highwarp, self.highsector = max( (x['warps'], x['sector']) for x in self.clear)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if self.highwarp and self.highsector:
|
|
|
- log.msg("Sector: {0:5d} Warps: {1}".format(self.highsector, self.highwarp))
|
|
|
- self.state += 1
|
|
|
- elif self.state == 5:
|
|
|
+
|
|
|
+ log.msg("Sector: {0:5d} Warps: {1}".format(self.highsector, self.highwarp))
|
|
|
+ self.state += 1
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if self.state == 5:
|
|
|
|
|
|
for c in self.clear:
|
|
|
- self.stacksector.add(c)
|
|
|
+ if c != self.highsector:
|
|
|
+ self.stacksector.add(c)
|
|
|
|
|
|
+
|
|
|
|
|
|
- self.stacksector.discard(self.highsector)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if self.times == 0:
|
|
|
+ self.send2player(Boxes.alert("Completed {0}".format(self.maxtimes), base="green"))
|
|
|
+ log.msg("Completed {0}".format(self.maxtimes))
|
|
|
+ self.deactivate()
|
|
|
+ return
|
|
|
|
|
|
+ self.times -= 1
|
|
|
|
|
|
- self.send2game("m{0}\n\r".format(self.highsector))
|
|
|
+ self.send2game("m{0}\r".format(self.highsector))
|
|
|
|
|
|
|
|
|
self.resetStuff()
|
|
|
self.state = 1
|
|
|
-
|
|
|
-
|
|
|
- self.times -= 1
|
|
|
- if self.times <= 0:
|
|
|
- self.send2player(Boxes.alert("Completed {0}".format(self.maxtimes), base="green"))
|
|
|
- log.msg("Completed {0}".format(self.maxtimes))
|
|
|
- self.deactivate()
|
|
|
+
|
|
|
elif self.state == 10:
|
|
|
+ if line.startswith("You are already in that sector!"):
|
|
|
+ log.msg("Already here. (Whoops!)")
|
|
|
+ self.state = 1
|
|
|
+ return
|
|
|
+ if line.startswith("Sector : {0}".format(self.highsector)):
|
|
|
+ log.msg("We're here!")
|
|
|
+
|
|
|
+ self.state = 1
|
|
|
+ return
|
|
|
|
|
|
self.go_on = True
|
|
|
if line.startswith('The shortest path ('):
|
|
|
|
|
|
self.state += 1
|
|
|
elif self.state == 11:
|
|
|
- self.travel_path = line.split(' > ')
|
|
|
+ self.travel_path = line.replace('(', '').replace(')', '').split(' > ')
|
|
|
+ log.msg("Travel path: {0}".format(self.travel_path))
|
|
|
self.state += 1
|
|
|
+ self.travel_path.pop(0)
|
|
|
+ self.stophere = False
|
|
|
+ self.go_on = True
|
|
|
elif self.state == 13:
|
|
|
if 'Relative Density Scan' in line:
|
|
|
self.state += 1
|
|
|
elif self.state == 14:
|
|
|
if line == "":
|
|
|
+ log.msg("PATH: {0}".format(self.travel_path))
|
|
|
+
|
|
|
|
|
|
if self.stophere:
|
|
|
+ log.msg("STOPHERE")
|
|
|
|
|
|
|
|
|
self.stacksector.add(self.highsector)
|
|
|
self.state = 20
|
|
|
else:
|
|
|
if self.go_on:
|
|
|
+ log.msg("GO ON")
|
|
|
|
|
|
- self.state = 12
|
|
|
- self.travel_path.pop(0)
|
|
|
+ self.state = 15
|
|
|
+ else:
|
|
|
+ log.msg("...")
|
|
|
else:
|
|
|
- work = line.replace(' :', '').replace('%', '').replace(')', '').replace('==>', '')
|
|
|
-
|
|
|
- stophere = '(' in work
|
|
|
- work = work.replace('(','')
|
|
|
-
|
|
|
- parts = re.split(r'\s+', work)
|
|
|
-
|
|
|
- if stophere and parts[4] == '1':
|
|
|
- stophere = False
|
|
|
-
|
|
|
- if stophere:
|
|
|
- self.stophere = True
|
|
|
-
|
|
|
- next_stop = travel_path[0]
|
|
|
-
|
|
|
- if parts[1] == next_stop:
|
|
|
-
|
|
|
- if parts[2] not in ('100', '0'):
|
|
|
-
|
|
|
- self.go_on = False
|
|
|
-
|
|
|
+ if line.strip('-') != '':
|
|
|
+ work = line.replace(' :', '').replace('%', '').replace(')', '').replace('==>', '')
|
|
|
+
|
|
|
+ stophere = '(' in work
|
|
|
+ work = work.replace('(','')
|
|
|
+
|
|
|
+ parts = re.split(r'\s+', work)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if stophere:
|
|
|
+ self.stophere = True
|
|
|
+
|
|
|
+ next_stop = self.travel_path[0]
|
|
|
+ log.msg("next_stop {0} from {1}".format(next_stop, self.travel_path))
|
|
|
+ log.msg("parts: {0}".format(parts))
|
|
|
+ if parts[1] == next_stop:
|
|
|
+ log.msg("next_stop {0} found...".format(next_stop))
|
|
|
+
|
|
|
+ if parts[2] not in ('100', '0', '1', '101'):
|
|
|
+
|
|
|
+ self.go_on = False
|
|
|
+
|
|
|
|
|
|
|
|
|
|