comparison src/parpg/objects/action.py @ 115:a85d58fcd253

Fixed PickUpAction. Items can be picked up again.
author KarstenBock@gmx.net
date Fri, 23 Sep 2011 15:09:02 +0200
parents 5508000aceaf
children 9b5498e3bda0
comparison
equal deleted inserted replaced
114:b10d12fbbb3f 115:a85d58fcd253
19 19
20 logger = logging.getLogger('action') 20 logger = logging.getLogger('action')
21 21
22 from parpg.gui import drag_drop_data as data_drag 22 from parpg.gui import drag_drop_data as data_drag
23 from parpg.dialoguecontroller import DialogueController 23 from parpg.dialoguecontroller import DialogueController
24 from parpg.components import container
25
24 26
25 class NoSuchQuestException(Exception): 27 class NoSuchQuestException(Exception):
26 """NoQuestException is used when there is no active quest with the id""" 28 """NoQuestException is used when there is no active quest with the id"""
27 pass 29 pass
28 30
371 super(UseAction, self).execute() 373 super(UseAction, self).execute()
372 374
373 class PickUpAction(Action): 375 class PickUpAction(Action):
374 """Action for picking up items from a map""" 376 """Action for picking up items from a map"""
375 377
376 def __init__(self, controller, map_item, commands = None): 378 def __init__(self, controller, item, commands = None):
377 super(PickUpAction, self).__init__(controller, commands) 379 super(PickUpAction, self).__init__(controller, commands)
378 self.map_item = map_item 380 self.item = item
379 self.view = controller.view 381 self.view = controller.view
380 382
381 def execute(self): 383 def execute(self):
382 real_item = self.map_item.item 384 real_item = self.item.containable
383 self.model.deleteObject(self.map_item.ID) 385 player = self.model.game_state.getObjectById("PlayerCharacter")
384 self.model.game_state.getObjectById("PlayerCharacter").fifeagent.\ 386 self.model.moveObject(self.item.fifeagent.identifier, None)
385 inventory.placeItem(real_item) 387 container.put_item(player.container, real_item)
386 self.view.hud.inventory.updateInventoryButtons()
387 super(PickUpAction, self).execute() 388 super(PickUpAction, self).execute()
388 389
389 class DropItemAction(Action): 390 class DropItemAction(Action):
390 """Action for dropping an items on a map""" 391 """Action for dropping an items on a map"""
391 def __init__(self, controller, item, commands = None): 392 def __init__(self, controller, item, commands = None):