Ignore:
Timestamp:
02/04/10 15:43:41 (10 years ago)
Author:
maximinus_parpg
Message:

Added inventory images to inventory.
Inventory now displays multiple images, not only the dagger.
Image data is stored in the object, not the inventory.

Location:
trunk/game/scripts/objects
Files:
2 edited

Legend:

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

    r479 r480  
    119119            self.inventory.placeItem(CarryableItem(ID=456, name="Dagger123")) 
    120120            self.inventory.placeItem(CarryableItem(ID=555, name="Beer")) 
    121             self.inventory.placeItem(CarryableItem(ID=616, name="Pamphlet")) 
     121            self.inventory.placeItem(CarryableItem(ID = 616, 
     122                                                   name = "Pamphlet", 
     123                                                   image = "/gui/inv_images/inv_pamphlet.png")) 
    122124        else: 
    123125            self.inventory = inventory 
     
    135137    def __setstate__(self, state): 
    136138        self.__dict__.update(state) 
    137      
     139 
    138140    def meet(self, npc): 
    139141        """Record that the PC has met a certain NPC 
  • trunk/game/scripts/objects/base.py

    r477 r480  
    5959class DynamicObject (object): 
    6060    """A base class that only supports dynamic attributes functionality""" 
    61     def __init__ (self, name="Dynamic object", **kwargs): 
     61    def __init__ (self, name="Dynamic object", image=None, **kwargs): 
    6262        """Initialise minimalistic set of data 
    6363           @type name: String 
    64            @param name: Object display name""" 
     64           @param name: Object display name 
     65           @type image: String or None 
     66           @param name: Filename of image to use in inventory""" 
    6567        self.name = name 
     68        self.image = image 
    6669 
    6770    def trueAttr(self, attr): 
     
    195198    def getInventoryThumbnail(self): 
    196199        # TODO: Implement properly after the objects database is in place 
    197         return "gui/inv_images/inv_litem.png" 
     200        if self.image == None: 
     201            return "gui/inv_images/inv_litem.png" 
     202        else: 
     203            return self.image 
    198204     
    199205class Container (object): 
Note: See TracChangeset for help on using the changeset viewer.