Ejemplo n.º 1
0
import sys

from lib.client_interfacer import ClientInterfacer, Command
from lib.recipe import runCommandSequence

cf = ClientInterfacer()

# Find the cauldron on the ground.
itemsOn   = cf.getItemsOfType("on")
cauldrons = []
for item in itemsOn:
    if item.name == "cauldron":
        cauldrons.append(item)
if len(cauldrons) != 1:
    cf.logError("Expected 1 cauldron on ground, got %d" % len(cauldrons))
    sys.exit(0)
cauldron = cauldrons[0]

# Find the largest pile of waters in the player's inventory.
waters = None
inv = cf.getInventory()
for item in inv:
    if item.name.endswith(" water") or item.name.endswith(" waters"):
        if waters is None or item.num > waters.num:
            waters = item
    if "ingred" in item.name:
        cf.logError("You already have an item matching \"ingred\"; I'm not "
            "programmed to uniquify names well enough to deal with this.")
        sys.exit(0)
if waters is None:
Ejemplo n.º 2
0
import sys

from lib.client_interfacer import ClientInterfacer, Command
from lib.recipe import runCommandSequence

cf = ClientInterfacer()

# Find the cauldron on the ground.
itemsOn   = cf.getItemsOfType("on")
cauldrons = []
for item in itemsOn:
    if item.name == "cauldron":
        cauldrons.append(item)
if len(cauldrons) != 1:
    cf.logError("Expected 1 cauldron on ground, got %d" % len(cauldrons))
    sys.exit(0)
cauldron = cauldrons[0]

# Find the largest pile of waters in the player's inventory.
waters = None
inv = cf.getInventory()
for item in inv:
    if item.name.endswith(" water") or item.name.endswith(" waters"):
        if waters is None or item.num > waters.num:
            waters = item
if waters is None:
    cf.logError("You don't have any water.")
    sys.exit(0)

# TODO: Generator instead of list.