me
/
LeekBots
Archived
1
0
Fork 0

Add Use Potion

master
sheychen 2018-03-20 10:32:52 +01:00 committed by GitHub
parent 81074bd936
commit 46de89c0fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -519,6 +519,18 @@ class Pool:
print(format(err))
except ValueError as err:
print(format(err))
def usePotion(params, options):
try:
potion = params[0]
for leek in Pool.get(Settings(options), Pool.parse(options)):
try:
leek.usePotion(potion)
leek.raiseError('OK') #Ugly
except ValueError as err:
print(format(err))
except ValueError as err:
print(format(err))
def buy(params, options):
item = params[0]
@ -852,6 +864,9 @@ class Leek:
def unequipChip(self, wid):
self.checkRequest(lwapi.leek.remove_chip(wid, self.farmer.token))
def usePotion(self, pid):
self.checkRequest(lwapi.leek.use_potion(pid, self.farmer.token))
def characteristics(self, bonuses):
self.checkRequest(
@ -896,6 +911,7 @@ if __name__ == "__main__":
.addCommand('pool unequip weapon', 'unequip a weapon', Pool.unequipWeapon, [{'name': 'item', 'type': int}])\
.addCommand('pool equip chip', 'equip a chip', Pool.equipChip, [{'name': 'item', 'type': int}])\
.addCommand('pool unequip chip', 'unequip a chip', Pool.unequipChip, [{'name': 'item', 'type': int}])\
.addCommand('pool use potion', 'use a potion', Pool.usePotion, [{'name': 'potion', 'type': int}])\
.addCommand('pool characteristics', 'buy characteristics', Pool.characteristics, [{'name': 'count', 'type': int}, {'name': 'type', 'list': ['life', 'strength', 'wisdom', 'agility', 'resistance', 'science', 'magic', 'tp', 'mp', 'frequency']}])\
.addCommand('pool buy', 'buy an item',Pool.buy, [{'name': 'item', 'type': int}])\
.addCommand('pool sell', 'sell an item',Pool.sell, [{'name': 'item', 'type': int}])\
@ -906,4 +922,4 @@ if __name__ == "__main__":
.addCommand('pool farmers tournament', 'register each farmer to tournament', Pool.farmersTournament, [])\
.addCommand('pool auto', 'run "fight, fight force, team fight, tournament, team tournament"', Pool.auto, [])\
.addCommand('team create', 'create a team', Team.create, [{'name': 'name'}, {'name': 'owner'}])\
.parse(sys.argv)
.parse(sys.argv)