diff demos/rpg/scripts/actors/baseactor.py @ 520:b6bd314df28a

Added a quest dialog. Added QuestGiver class. Moved level specific settings to another file. Added BaseItem class.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 27 May 2010 16:29:07 +0000
parents 14f777be6b94
children 494c60cf61cf
line wrap: on
line diff
--- a/demos/rpg/scripts/actors/baseactor.py	Thu May 27 04:36:09 2010 +0000
+++ b/demos/rpg/scripts/actors/baseactor.py	Thu May 27 16:29:07 2010 +0000
@@ -29,12 +29,14 @@
 from fife import fife
 from fife.extensions.loaders import loadMapFile
 
-from scripts.objects.baseobject import ObjectActionListener, BaseGameObject
+from scripts.objects.baseobject import ObjectActionListener, BaseGameObject, GameObjectTypes
 
 Actions = {'NONE':0,
 		   'PICKUP':1,
 		   'TALK':2,
-		   'HIT':3}
+		   'HIT':3,
+		   'OPEN':4,
+		   'ENTER':5}
 
 class BaseAction(object):
 	def __init__(self):
@@ -50,7 +52,8 @@
 		self._dest = destobj
 		
 	def execute(self):
-		print "talking"
+		print "talking to: " + self._dest.instance.getId()
+		self._source.showQuestDialog()
 
 ActorStates = {'STAND':0,
 			   'WALK':1,
@@ -76,6 +79,8 @@
 		self._nextaction = None
 		
 		self.stand()
+		
+		self._type = GameObjectTypes["NPC"]
 
 	def stand(self):
 		self._state = ActorStates["STAND"]
@@ -104,3 +109,13 @@
 	
 	state = property(_getState, _setState)
 	nextaction = property(_getNextAction, _setNextAction)
+
+class QuestGiver(Actor):
+	def __init__(self, gamecontroller, instancename, instanceid=None, createInstance=False):
+		super(QuestGiver, self).__init__(gamecontroller, instancename, instanceid, createInstance)
+	
+		self._type = GameObjectTypes["QUESTGIVER"]
+		self._quests = []
+	
+	def addQuest(self, quest):
+		self._quests.append(quest)