|
@@ -3770,21 +3770,22 @@ class evilTrade(object):
|
|
|
A little bit on playing evil,
|
|
|
|
|
|
Doing SSM, a bust will cause some holds and any cargo to be removed!
|
|
|
- You must move to different ports to reduce the chance of a bust
|
|
|
+ You must move to different ports to reduce the chance of a bust,
|
|
|
+ Bust's are reset after so many days... so might want to handle that.
|
|
|
|
|
|
SSM rewards you -10 Alignment and +5 Experiece if you are sucessful
|
|
|
in robbing back your cargo you just sold.
|
|
|
|
|
|
States:
|
|
|
0 = Pre-State, Asks the user how many times to run
|
|
|
- 1 = Gather max holds value, also see if the user already has
|
|
|
- Equ in holds... if not go buy some.
|
|
|
- 2 = Find 2 "evil pairs" of ports to do SSM
|
|
|
- 3 = Move to first port pair
|
|
|
+ 1 = Gather user info
|
|
|
+ 2 = Verify Cargo is full of Equ
|
|
|
+ 3 = Find and move to nearest port buying Equ (Express mode!)
|
|
|
+ 3.5 = User does not have Equ, lets buy it, then move on
|
|
|
(SSM: Sell-Steal-Move)
|
|
|
4 = Port and Sell Equ
|
|
|
5 = Port and Steal Equ
|
|
|
- 6 = Move to 2nd port
|
|
|
+ 6 = Move to 2nd nearest port buying Equ (Express mode!)
|
|
|
7 = Port and Sell Equ
|
|
|
8 = Port and Steal Equ
|
|
|
9 = Move to 1st Port
|
|
@@ -3814,11 +3815,12 @@ class evilTrade(object):
|
|
|
self.loops = 0 # Current number of loops left to do
|
|
|
self.completeINFO = False # Collected all INFO needed
|
|
|
self.exp = 0 # Experience Points the player has
|
|
|
- self.alignment = (
|
|
|
- 0 # Alignment the player has, negative is evil and positive is good
|
|
|
- )
|
|
|
+ self.alignment = 0 # Alignment the player has
|
|
|
self.credits = 0 # Credits player has
|
|
|
self.turns = 0 # Turns the player has
|
|
|
+ self.sector = 0 # Current sector
|
|
|
+ self.target_sector = 0 # Next port to trade with
|
|
|
+ self.name = "" # Player name to include into stats for logs
|
|
|
|
|
|
self.prompt = game.buffer
|
|
|
self.save = self.observer.save()
|
|
@@ -3874,18 +3876,23 @@ class evilTrade(object):
|
|
|
ask = PlayerInput(self.game)
|
|
|
d = ask.prompt("How many times: ", 3, name="times", digits=True)
|
|
|
d.addCallback(self.loops_chosen)
|
|
|
- if self.state == 1:
|
|
|
+ elif self.state == 1:
|
|
|
if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
- if self.completeINFO: # We have all our info
|
|
|
- self.send2player(
|
|
|
- self.nl
|
|
|
- + "Experience: {0} Alignment: {1}".format(
|
|
|
- self.exp, self.alignment
|
|
|
+ if self.completeINFO: # We have all our info, lets display it into logs
|
|
|
+ log.info("{0}'s Stats...".format(self.name))
|
|
|
+ log.info(
|
|
|
+ "Experience: {0} Alignment: {1} Turns: {2} Credits: {3} Total Holds: {4} Avaible Holds: {5} Current Sector: {6}".format(
|
|
|
+ self.exp,
|
|
|
+ self.alignment,
|
|
|
+ self.turns,
|
|
|
+ self.credits,
|
|
|
+ self.maxHolds,
|
|
|
+ self.holds,
|
|
|
+ self.sector,
|
|
|
)
|
|
|
- + self.nl
|
|
|
- + "Turns: {0} Credits: {1}".format(self.turns, self.credits)
|
|
|
- + self.nl
|
|
|
- + "Ore: {0} Org: {1} Equ: {2} Colo: {3} Empty: {4}".format(
|
|
|
+ )
|
|
|
+ log.info(
|
|
|
+ "Ore: {0} Org: {1} Equ: {2} Colo: {3} Empty: {4}".format(
|
|
|
self.cargo["Ore"],
|
|
|
self.cargo["Org"],
|
|
|
self.cargo["Equ"],
|
|
@@ -3894,12 +3901,90 @@ class evilTrade(object):
|
|
|
)
|
|
|
)
|
|
|
self.state = 2
|
|
|
+ self.send2game("D")
|
|
|
+ self.game.to_player = True
|
|
|
+ elif self.state == 2:
|
|
|
+ if self.cargo["Ore"] != 0: # Nada, we want Equ
|
|
|
+ self.send2player(
|
|
|
+ self.nl + Boxes.alert("Holds must contain Equ not Ore!")
|
|
|
+ )
|
|
|
+ self.deactivate(True)
|
|
|
+ elif self.cargo["Org"] != 0: # Oops, wrong, Give use Equ
|
|
|
+ self.send2player(
|
|
|
+ self.nl + Boxes.alert("Holds must contain Equ not Org!")
|
|
|
+ )
|
|
|
+ self.deactivate(True)
|
|
|
+ elif (
|
|
|
+ self.cargo["Colo"] != 0
|
|
|
+ ): # We don't want people, let the user handle this
|
|
|
+ self.send2player(
|
|
|
+ self.nl + Boxes.alert("Holds must contain Equ not Colonist!")
|
|
|
+ )
|
|
|
+ self.deactivate(True)
|
|
|
+ elif self.cargo["Equ"] != 0: # We do have Equ, but do we need more?
|
|
|
+ if self.cargo["Equ"] != self.maxHolds:
|
|
|
+ self.send2player(
|
|
|
+ self.nl
|
|
|
+ + Boxes.alert(
|
|
|
+ "You need {0} more Equ!".format(self.cargo["Empty"])
|
|
|
+ )
|
|
|
+ )
|
|
|
+ # Ok nope, we need more, let's find the nearest and "Mush!"
|
|
|
+ place = self.game.gamedata.find_nearest_selling(
|
|
|
+ self.sector, "E", 400
|
|
|
+ )
|
|
|
+ if place == 0:
|
|
|
+ self.queue_game.put(
|
|
|
+ self.nl + Boxes.alert("Find Nearest Failed!")
|
|
|
+ )
|
|
|
+ self.deactivate(True)
|
|
|
+ else:
|
|
|
+ self.send2game("{0}\rEPT".format(place))
|
|
|
+ # Code here to handle getting Equ
|
|
|
+ self.state = 3.5
|
|
|
+ else: # All OK, now to find_nearest_evilpairs
|
|
|
+ self.state = 3
|
|
|
+ self.game.to_player = False
|
|
|
+ self.send2game("D")
|
|
|
+ self.game.to_player = True
|
|
|
+ else: # Ok so we have Empty holds, lets fill it with Equ
|
|
|
+ place = self.game.gamedata.find_nearest_selling(self.sector, "E", 400)
|
|
|
+ if place == 0:
|
|
|
+ self.queue_game.put(self.nl + Boxes.alert("Find Nearest Failed!"))
|
|
|
self.deactivate(True)
|
|
|
+ else:
|
|
|
+ self.send2game("{0}\rEPT".format(place))
|
|
|
+ # Code here to handle getting Equ
|
|
|
+ self.state = 3.5
|
|
|
+ elif self.state == 3.5:
|
|
|
+ # Ok, we are getting Equ into holds then onto 3
|
|
|
+ if prompt.startswith("How many holds of Fuel Ore do you want to buy "):
|
|
|
+ self.send2game("0\r")
|
|
|
+ elif prompt.startswith("How many holds of Organics do you want to buy "):
|
|
|
+ self.send2game("0\r")
|
|
|
+ elif prompt.startswith("How many holds of Equipment do you want to buy "):
|
|
|
+ self.send2game("\r\r")
|
|
|
+ # Oops, we are expecting the user to have enough money to buy it!
|
|
|
+ self.state = 3
|
|
|
+ elif self.state == 3:
|
|
|
+ if prompt.startswith("Your offer"):
|
|
|
+ self.send2game("0\r")
|
|
|
+ self.deactivate(True)
|
|
|
+ else:
|
|
|
+ # Now to go to evil trade pair \o/
|
|
|
+ self.send2player(self.nl + Boxes.alert("Done!"))
|
|
|
+ self.deactivate(True)
|
|
|
|
|
|
def game_line(self, line: str):
|
|
|
log.debug("L {0} | {1}".format(self.state, line))
|
|
|
if self.state == 1:
|
|
|
- if line.startswith("Rank and Exp"):
|
|
|
+ if line.startswith("Trader Name"):
|
|
|
+ work = line.replace("Trader Name :", "").split()
|
|
|
+ self.name = work[-1]
|
|
|
+ elif line.startswith("Current Sector"):
|
|
|
+ work = line.replace("Current Sector : ", "")
|
|
|
+ self.sector = int(work)
|
|
|
+ elif line.startswith("Rank and Exp"):
|
|
|
work = line.replace("Rank and Exp :", "").split()
|
|
|
# Rank and Exp : 110 points, Alignment=-116 Crass
|
|
|
self.exp = work[0]
|
|
@@ -3916,7 +4001,6 @@ class evilTrade(object):
|
|
|
.split()
|
|
|
)
|
|
|
self.maxHolds = int(work[0])
|
|
|
- self.holds = self.maxHolds
|
|
|
# Total Holds : 53 - Empty=53
|
|
|
# Total Holds : 53 - Fuel Ore=1 Organics=2 Equipment=3 Colonists=4 Empty=43
|
|
|
# log.debug(work)
|
|
@@ -3946,11 +4030,10 @@ class evilTrade(object):
|
|
|
elif w == "Empty":
|
|
|
try:
|
|
|
self.cargo["Empty"] = int(work[count + 1])
|
|
|
+ self.holds = self.cargo["Empty"]
|
|
|
except ValueError: # The next value is not a number!
|
|
|
self.cargo["Empty"] = 0
|
|
|
count += 1
|
|
|
- if self.cargo["Empty"] == 0:
|
|
|
- self.send2player(self.nl + Boxes.alert("No Empty Holds!"))
|
|
|
elif line.startswith("Credits"):
|
|
|
work = line.replace("Credits : ", "").replace(",", "")
|
|
|
self.credits = int(work)
|