Changeset 143 for adventure/thing.py

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

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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':