예제 #1
0
파일: actions.py 프로젝트: retooth/shmudder
def takeOutOf (player, arguments):
    """ takes item out of another item """
    itemstr = arguments[0]
    binstr  = arguments[1]
    
    inv  = player.inventory
    room = player.location
    
    bins = callAdressables(binstr,inv.items + room.items)
    
    if not bins:
        raise ItemNotFound("")
    
    allitems = []
    for bin in bins:
        if not "callItems" in dir(bin):
            raise NotABin("")
        items = bin.callItems(itemstr)
        allitems += items
    
    if not allitems:
        raise ItemNotFound
    
    for item in allitems:
        item.takeOut(player)
예제 #2
0
파일: rooms.py 프로젝트: retooth/shmudder
 def leave(self, actor, keyword):        
     """ This method is called, when a player decides
     to exit the room by direction keyword. """
     
     # TODO: party autofollow
     
     exits = callAdressables(keyword, self.exits)
     
     if not exits:
         raise NoSuchDirection("")
     
     if len(exits) > 1:
         raise AmbigousDirection("")
 
     newplace = exits[0].direction
     
     # quest dungeons
     if newplace.dungeon and self.dungeon != newplace.dungeon:
             
         partyident = actor.party.identifier
         clone = newplace.dungeon.getClone(partyident)
             
         # reattach room
         # TODO: sure backRefs are index safe ?
         if clone != newplace.dungeon :
             rindex = newplace.dungeon.rooms.index(newplace)
             newplace = clone.rooms[rindex]
         
     self.removeCharacter(actor)
     newplace.addCharacter(actor)
     
     actor.locationChanged(self, newplace, keyword)
     
     for item in actor.inventory.items:
         item.locationChanged(self, newplace, keyword)
예제 #3
0
파일: items.py 프로젝트: retooth/shmudder
 def callItems (self, keyword):        
     """ 
     Calls every item in collection by keyword and
     returns responding items
     @rtype: list<Item>
     """
     items = callAdressables(keyword, self.items)
     return items
예제 #4
0
 def callCharacters (self, keyword):  
     """ 
     Calls every character in collection by keyword and
     returns responding characters
     @rtype: list<Character>
     """
     chars = callAdressables(keyword, self.characters)
     return chars
예제 #5
0
 def callAttributes(self, keyword):
     """ 
     Calls every attribute in collection by keyword and
     returns responding attributes
     
     @param keyword: keyword, that should be checked 
     @rtype: list<Attribute>
     """
     attributes = callAdressables(keyword, self.attributes)
     return attributes
예제 #6
0
파일: actions.py 프로젝트: retooth/shmudder
def examine (player, arguments):        
    """ examines something in the room or inventory """
    
    room    = player.location    
    exstr   = arguments[0]
    
    addrspace = []
    addrspace += room.details
    addrspace += player.inventory.items
    addrspace += room.items
    addrspace += room.characters

    things = callAdressables(exstr, addrspace)
    
    if not things :
        raise DetailNotFound("")

    for obj in things:
        obj.showLong(player)    
예제 #7
0
 def callBodyParts (self, keyword):
     return callAdressables(keyword, self.bodyparts)