Ignore:
Timestamp:
06/28/10 17:09:02 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

  • Added item_id property to the CarryableItem? class. This should be the basic ID without the added number.
  • Container now can search an item by item_id too
  • Changed get_stuff function of dialoguegui to search an item by item_id instead of ID
Location:
trunk/game/scripts/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/objects/base.py

    r568 r569  
    348348        return None 
    349349 
     350    def findItemByItemID(self, item_id): 
     351        """Returns the item with the passed item_id""" 
     352        for i in self.items : 
     353            if self.items[i].item_id == item_id: 
     354                return self.items[i] 
     355        return None 
     356 
    350357    def findItem(self, **kwargs): 
    351358        """Find an item in container by attributes. All params are optional. 
     
    362369            if "kind" in kwargs and not self.items[i].trueAttr(kwargs["kind"]): 
    363370                continue 
     371            if "item_id" in kwargs and self.items[i].item_id != kwargs["item_id"]: 
     372                continue 
    364373            return self.items[i] 
    365374        return None 
  • trunk/game/scripts/objects/composed.py

    r568 r569  
    8181class CarryableItem (GameObject, Carryable, Usable): 
    8282    """Composite class that will be used for all carryable items""" 
    83     def __init__(self, **kwargs): 
     83    def __init__(self, item_id, **kwargs): 
    8484        GameObject.__init__(self, **kwargs) 
    8585        Carryable.__init__(self, **kwargs) 
    8686        Usable.__init__(self, **kwargs) 
     87        self.item_id = item_id 
    8788 
    8889    def prepareStateForSaving(self, state): 
Note: See TracChangeset for help on using the changeset viewer.