Пример #1
0
shop = Location("Curiosity Shoppe", "A weird little shop. It sells odd stuff.")
shop.insert(shopkeeper, shop)
shop.add_exits([
    Exit(["door", "out"], "town.lane",
         "A fancy door provides access back to the lane outside.")
])

# provide some items in the shop
clock = clone(gameclock)
clock.value = 500
paper = clone(newspaper)
gem2 = clone(diamond)
gem2.value = 80000
gem3 = clone(gem)
gem3.value = 9055
shopkeeper.init_inventory([gem2, gem3, toothpick])
shopkeeper.set_shop(shopinfo)
shop.insert(clock, shop)
shop.insert(paper, shop)
lamp = Item("lamp", "rather small lamp")
lamp.value = 600


class James(NPC, Listener):
    """The customer trying to sell a Lamp, and helpful as rat deterrent."""
    def pubsub_event(self, topicname, event):
        if topicname[0] == "wiretap-location":
            if "Rat arrives" in event[1]:
                mud_context.driver.defer(2, self.rat_scream, "frown")
                mud_context.driver.defer(4, self.rat_kick)
Пример #2
0
shopkeeper = Shopkeeper("Lucy", "f", short_description="Lucy, the shop owner, is looking happily at her newly arrived customer.")
shopkeeper.money = 14000
shop = Location("Curiosity Shoppe", "A weird little shop. It sells odd stuff.")
shop.insert(shopkeeper, shop)
shop.add_exits([Exit(["door", "out"], "town.lane", "A fancy door provides access back to the lane outside.")])


# provide some items in the shop
clock = clone(gameclock)
clock.value = 500
paper = clone(newspaper)
gem2 = clone(diamond)
gem2.value = 80000
gem3 = clone(gem)
gem3.value = 9055
shopkeeper.init_inventory([gem2, gem3, toothpick])
shopkeeper.set_shop(shopinfo)
shop.insert(clock, shop)
shop.insert(paper, shop)
lamp = Item("lamp", "rather small lamp")
lamp.value = 600


class James(NPC, Listener):
    """The customer trying to sell a Lamp, and helpful as rat deterrent."""
    def pubsub_event(self, topicname, event):
        if topicname[0] == "wiretap-location":
            if "Rat arrives" in event[1]:
                mud_context.driver.defer(2, self.rat_scream, "frown")
                mud_context.driver.defer(4, self.rat_kick)