当前位置: 首页>>代码示例>>Python>>正文


Python Location.add_extradesc方法代码示例

本文整理汇总了Python中tale.base.Location.add_extradesc方法的典型用法代码示例。如果您正苦于以下问题:Python Location.add_extradesc方法的具体用法?Python Location.add_extradesc怎么用?Python Location.add_extradesc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tale.base.Location的用法示例。


在下文中一共展示了Location.add_extradesc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_location

# 需要导入模块: from tale.base import Location [as 别名]
# 或者: from tale.base.Location import add_extradesc [as 别名]
def make_location(vnum):
    """
    Get a Tale location object for the given circle room vnum.
    This performs an on-demand conversion of the circle room data to Tale.
    """
    try:
        return converted_rooms[vnum]   # get cached version if available
    except KeyError:
        c_room = rooms[vnum]
        loc = Location(c_room.name, c_room.desc)
        loc.vnum = vnum  # keep the circle vnum
        for ed in c_room.extradesc:
            loc.add_extradesc(ed["keywords"], ed["text"])
        converted_rooms[vnum] = loc
        for circle_exit in c_room.exits.values():
            if circle_exit.roomlink >= 0:
                xt = make_exit(circle_exit)
                while True:
                    try:
                        xt.bind(loc)
                        break
                    except LocationIntegrityError as x:
                        if x.direction in xt.aliases:
                            # circlemud exit keywords can be duplicated over various exits
                            # if we have a conflict, just remove the alias from the exit and try again
                            xt.aliases = xt.aliases - {x.direction}
                            continue
                        else:
                            if loc.exits[x.direction] is xt:
                                # this can occur, the exit is already bound
                                break
                            else:
                                # in this case a true integrity error occurred
                                raise
            else:
                # add the description of the inaccessible exit to the room's own description.
                loc.description += " " + circle_exit.desc
        return loc
开发者ID:digideskio,项目名称:Tale,代码行数:40,代码来源:__init__.py

示例2: Drone

# 需要导入模块: from tale.base import Location [as 别名]
# 或者: from tale.base.Location import add_extradesc [as 别名]
drone = Drone("drone", "n", race="bot", title="mindless drone",
              description="A stupid metallic drone. It just hovers here with no apparent reason. It has a little label attached to it.")
drone.add_extradesc({"label"}, "The label reads: \"Wall-E was my cousin\".")
drone.aggressive = True

hall.init_inventory([table, key, drone])

attic = Location("Tower attic",
    """
    The dark and dusty attic of the wizard tower.
    There are piles of old scrolls and assorted stuff here of which you assume
    it once held great magical power. All of it is now covered with a thick
    layer of dust.
    """)
attic.add_extradesc({"dust", "stuff", "scrolls"}, "The scrolls look ancient. One looks like a spell!")
attic.add_extradesc({"spell"}, "The scroll looks like it contains a spell, but on closer inspection, it has become too faded to be understood anymore.")


kitchen = Location("Tower kitchen",
    """
    A cozy little kitchen for hungry wizards.
    Magically conjured food often tastes like cardboard, so even wizards need to
    prepare their meals the old-fashioned way. The kitchen looks small but tidy.
    """)

hall.add_exits([
    Exit(["up", "ladder"], attic, "A small ladder leads up through a hole in the ceiling."),
    Exit(["door", "east"], "town.lane", "A heavy wooden door to the east blocks the noises from the street outside."),
    Exit("north", kitchen, "A door to the north leads to the kitchen.")
])
开发者ID:MitsuharuEishi,项目名称:Tale,代码行数:32,代码来源:wizardtower.py

示例3: init

# 需要导入模块: from tale.base import Location [as 别名]
# 或者: from tale.base.Location import add_extradesc [as 别名]
Also defines the Neighbor's house, where other things can be found.
"""

from __future__ import absolute_import, print_function, division, unicode_literals
from tale.base import Location, Exit, Door


def init(driver):
    # called when zone is first loaded
    pass


# ----------------- START House & Kitchen  -------------------------

livingroom = Location("Living room", "The living room in your little home. Your big TV hangs on a wall.")
livingroom.add_extradesc({"plasma", "tv"}, "You recently bought a bigger TV, but haven't yet found the time to actually watch anything.")
kitchen = Location("Kitchen", "A small but well supplied kitchen. Rather than ordering take-away, "
                              "you prefer cooking your own meals -- unlike most of the other people you know in town. A window lets you look outside.")
kitchen.add_extradesc({"window", "outside"}, "Through the kitchen window you can see your small garden and behind that, the children's playground.")

#  Exits

front_door = Door(["door", "outside", "street"], "magnolia_st.street1", "Your front door leads outside, to the street.",
                  "There's a heavy front door here that leads to the streets outside.", opened=False)
house_door = front_door.reverse_door(["house", "north", "inside"], livingroom,
                                     "You can go back inside your house.", "It's your house, on the north side of the street.",
                                     reverse_open_msg="Someone outside opens the door.",
                                     reverse_close_msg="Someone outside closes the door.",
                                     this_open_msg="Someone in the house opens the door.",
                                     this_close_msg="Someone in the house closes the door.")
livingroom.add_exits([
开发者ID:MitsuharuEishi,项目名称:Tale,代码行数:33,代码来源:houses.py

示例4: Location

# 需要导入模块: from tale.base import Location [as 别名]
# 或者: from tale.base.Location import add_extradesc [as 别名]
south_street = Location("Rose Street", "The southern part of Rose Street.")

crossing = Location("Crossing", "Town Crossing.")
crossing.add_exits([
    Exit("west", "magnolia_st.street2", "Westwards lies Magnolia Street."),
    Exit("east", "magnolia_st.street3", "Magnolia Street extends to the east, eventually leading towards the factory."),
])

Exit.connect(crossing, "north", "A part of Rose Street lies to the north.", None,
             north_street, ["south", "crossing"], "The street goes south towards the crossing.", None)
Exit.connect(crossing, "south", "Rose Street continues to the south.", None,
             south_street, ["north", "crossing"], "The crossing is back towards the north.", None)

playground = Location("Playground", "Children's playground. You see a rusty merry-go-round, and a little swing. "
                                    "To the west, a house is visible.")
playground.add_extradesc({"west", "house"}, "You can see your house from here!")
playground.add_exits([
    Door("fence", _limbo, "On the north end of the playground is a sturdy looking padlocked fence.",
         locked=True, opened=False, key_code="999999999"),  # this door is never meant to be opened
])

Exit.connect(playground, ["east", "street"], "Rose Street is back east.", None,
             north_street, ["west", "playground"], "The children's playground is to the west.", None)


class CarPark(Location):
    def init(self):
        self.verbs = {"drive": "Drive a car",
                      "open": "Open something",
                      "enter": "Enter something",
                      "sit": "Sit somewhere",
开发者ID:irmen,项目名称:Tale,代码行数:33,代码来源:rose_st.py

示例5: Location

# 需要导入模块: from tale.base import Location [as 别名]
# 或者: from tale.base.Location import add_extradesc [as 别名]

north_street = Location("Rose Street", "The northern part of Rose Street.")
south_street = Location("Rose Street", "The southern part of Rose Street.")

crossing = Location("Crossing", "Town Crossing.")
crossing.add_exits([
    Exit("west", "magnolia_st.street2", "Westwards lies Magnolia Street."),
    Exit("east", "magnolia_st.street3", "Magnolia Street extends to the east, eventually leading towards the factory."),
    Exit("north", north_street, "A part of Rose Street lies to the north."),
    Exit("south", south_street, "Rose Street continues to the south.")
])

playground = Location("Playground", "Children's playground. You see a rusty merry-go-round, and a little swing. "
                                    "To the west, a house is visible.")
playground.add_extradesc({"west", "house"}, "You can see your house from here!")
playground.add_exits([
    Door("fence", _limbo, "On the north end of the playground is a sturdy looking padlocked fence.", locked=True, opened=False),  # this door is never meant to be opened
    Exit(["east", "street"], north_street, "Rose Street is back east."),
    zones.magnolia_st.street_gate
])

carpark = Location("Car Parking", "There are a few cars still parked over here. Their owners are nowhere to be seen. "
                                  "One yellow car grabs your attention.")
carpark.add_extradesc({"cars"}, "They look abandoned, but their doors are all locked.")
carpark.add_extradesc({"car", "yellow"}, "It is a small two seater!")
carpark.add_exits([
    Exit(["gate", "street"], north_street, "Rose street is back through the gate.")
])

parking_gate = Door(["gate", "parking"], carpark, "Through the iron gate you can see the car parking. A few cars are still parked there, it seems.", locked=True, opened=False)
开发者ID:MitsuharuEishi,项目名称:Tale,代码行数:32,代码来源:rose_st.py


注:本文中的tale.base.Location.add_extradesc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。