Changeset 143

Show
Ignore:
Timestamp:
04/26/08 19:31:59 (23 months ago)
Author:
thib
Message:

Gestion de l'attribut count pour l'action give, et affichage automatisé des sorties

Location:
adventure
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • adventure/place.py

    r140 r143  
    113113                            '\n******\n\n\n\n**********\n' 
    114114                            'Entering %s\n**********' 
    115                             '\n\n%s\n' % (self.name.capitalize(), 
    116                                           self.description)) 
     115                            '\n\n%s\nYou can go %s.' % (self.name.capitalize(), 
     116                                                        self.description, 
     117                                                        ', '.join(self.exits.keys()))) 
    117118         
    118119        # Trigger on-enter events 
  • adventure/thing.py

    r135 r143  
    7373        action_obj = dict() 
    7474        action_obj['name'] = action_element.localName 
    75         action_obj['target'] = action_element.getAttribute('target') 
     75        for i in ('target', 'count'): 
     76            action_obj[i] = action_element.getAttribute(i) 
     77         
    7678        if action_element.firstChild and action_element.firstChild.data: 
    7779            action_obj['params'] = action_element.firstChild.data.strip() 
     
    161163                target = player 
    162164            if target: 
    163                 target.inventory.append(params) 
     165                if action['count'] or target.inventory.count(params) < count: 
     166                    target.inventory.append(params) 
    164167        #   <use target="target">object</give> 
    165168        elif action['name'] == 'use': 
  • adventure/tower/tower.xml

    r131 r143  
    172172                <command signal="Spider_take_the_key"> 
    173173                    <narration>The kind spider helps you to get the key</narration> 
    174                     <give>wizard's key</give> 
     174                    <give count="1">wizard's key</give> 
    175175                </command> 
    176176            </commands> 
  • adventure/world.dtd

    r132 r143  
    6060<!ELEMENT give (#EMPTY)> 
    6161<!ATTLIST give 
    62  target CDATA #IMPLIED> 
     62 target CDATA #IMPLIED 
     63 count CDATA #IMPLIED> 
    6364 
    6465<!ELEMENT signal (#PCDATA)> 
  • adventure/world.py

    r135 r143  
    273273 
    274274    def handle_message(self, msg): 
    275         """ Handle message stanzas coming to the room """ 
     275        """ Handle message stanzas coming to the MUC """ 
    276276        player = None 
    277277