Changeset 532


Ignore:
Timestamp:
03/19/10 01:08:21 (10 years ago)
Author:
b0rland_parpg
Message:

Ticket #229: patch by b0rland

  • Slightly updated the interaction between dialog gui and inventories/actors
  • Fixed the 'give box' stage of fedex quest
  • Added a dummy image for box
Location:
trunk/game
Files:
1 added
3 edited

Legend:

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

    r473 r532  
    5656 
    5757        def get_stuff(state, thing): 
    58             if not state['pc'].inventory.has(thing): 
    59                 state['pc'].inventory.placeItem(thing) 
    60                 print "You've now have the %s" % thing 
     58            if not state['pc'].inventory.findItem(name = thing): 
     59                try : 
     60                    self.npc.give(self.npc.inventory.findItem(name = thing), state['pc']) 
     61                    print "You've now have the %s" % thing 
     62                except ValueError : 
     63                    print "NPC doesn't have the %s" % thing 
    6164 
    6265        def give_stuff(state,thing): 
  • trunk/game/scripts/gui/inventorygui.py

    r483 r532  
    140140        """Show the inventory. 
    141141           @return: None""" 
     142        self.updateInventoryButtons() 
    142143        self.inventory.show() 
    143144 
  • trunk/game/scripts/objects/actors.py

    r480 r532  
    286286        if inventory == None: 
    287287            self.inventory = Inventory() 
     288            self.inventory.placeItem(CarryableItem(ID = 632, 
     289                                                   name = "box", 
     290                                                   image = "/gui/inv_images/inv_box.png")) 
     291 
    288292        else: 
    289293            self.inventory = inventory 
     
    331335        self.behaviour.pc = pc.behaviour.agent 
    332336        self.behaviour.idle() 
     337         
     338    def give (self, item, actor): 
     339        """Gives the specified item to the different actor. Raises an exception if the item was invalid or not found 
     340           @type item: Carryable 
     341           @param item: The item object to give 
     342           @param actor: Person to give item to""" 
     343        if item == None:  
     344            raise ValueError("I don't have %s" % item.name) 
     345        self.inventory.takeItem(item) 
     346        actor.inventory.placeItem(item)            
    333347     
    334348    def setup(self): 
Note: See TracChangeset for help on using the changeset viewer.