Changeset 480


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
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/gui/hud.py

    r479 r480  
    573573    def readyAction(self, ready_button): 
    574574        """ Called when the user selects a ready button from the HUD """ 
    575         text = "Used the item from %s" % ready_button 
     575        text = "Used the item from %s" % ready_button         
    576576        self.addAction(text) 
    577577         
  • trunk/game/scripts/inventory.py

    r479 r480  
    1818import copy 
    1919 
     20# TODO: many missing function definitions in this code 
     21 
    2022class Inventory(CarryableContainer): 
    2123    """The class to represent inventory 'model': allow operations with 
    22     inventory contents, perform weight/bulk calculations, etc""" 
     24       inventory contents, perform weight/bulk calculations, etc""" 
    2325    def __init__(self, **kwargs): 
    2426        """Initialise instance""" 
    2527        CarryableContainer.__init__(self, **kwargs) 
    26         self.items = {"head": Slot(name="head"), "neck": Slot(name="neck"), "shoulders": Slot(name="shoulders"), 
     28        self.items = {"head": Slot(name="head"), "neck": Slot(name="neck"), 
     29                      "shoulders": Slot(name="shoulders"), 
    2730                      "chest": Slot(), "abdomen": Slot(), "left_arm": Slot(), 
    2831                      "right_arm": Slot(),"groin": Slot(), "hips": Slot(), 
  • 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.