comparison demos/rpg/scripts/objects/items.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
children 6037f79b0dcf
comparison
equal deleted inserted replaced
519:14f777be6b94 520:b6bd314df28a
1 #!/usr/bin/env python
2
3 # -*- coding: utf-8 -*-
4
5 # ####################################################################
6 # Copyright (C) 2005-2010 by the FIFE team
7 # http://www.fifengine.net
8 # This file is part of FIFE.
9 #
10 # FIFE is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2.1 of the License, or (at your option) any later version.
14 #
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
19 #
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with this library; if not, write to the
22 # Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 # ####################################################################
25 # This is the rio de hola client for FIFE.
26
27 import sys, os, re, math, random, shutil
28
29 from fife import fife
30
31 from scripts.objects.baseobject import BaseGameObject, GameObjectTypes
32
33
34 class BaseItem(BaseGameObject):
35 def __init__(self, gamecontroller, itemname, itemtype="unknown"):
36 super(Item, self).__init__(gamecontroller, itemtype, itemname, True)
37
38 self._type = GameObjectTypes["ITEM"]
39
40 def onPickUp(self):
41 #remove item from the map
42 self.destroy()
43
44 def onDrop(self, dropx, dropy):
45 #recreate object
46 self._createFIFEInstance(self)
47 self.setMapPosition(dropx, dropy)
48
49 def _getItemType(self):
50 return self._name
51
52 def _getItemName(self):
53 return self._id
54
55 itemtype = property(_getItemType)
56 itemname = property(_getItemName)