Mercurial > fife-parpg
comparison demos/rpg/scripts/quests/basequest.py @ 534:65a92a2449d5
Doing some re-factoring.
Minor change to the way the console commands are parsed.
Added the spawn command to the help file.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 31 May 2010 17:45:04 +0000 |
parents | |
children | 2e739ae9a8bc |
comparison
equal
deleted
inserted
replaced
533:082e919cc348 | 534:65a92a2449d5 |
---|---|
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, time | |
28 from datetime import datetime | |
29 | |
30 from fife import fife | |
31 | |
32 class Quest(object): | |
33 def __init__(self, owner, questname, questtext): | |
34 self._owner = owner | |
35 self._name = questname | |
36 self._text = questtext | |
37 self._requireditems = [] | |
38 self._requiredgold = 0 | |
39 | |
40 def addRequiredItem(self, itemid): | |
41 self._requireditems.append(itemid) | |
42 | |
43 def addRequiredGold(self, goldcount): | |
44 self._requiredgold += goldcount | |
45 | |
46 def checkQuestCompleted(self, actor): | |
47 completed = False | |
48 | |
49 if self._requiredgold > 0: | |
50 if actor.gold >= self._requiredgold: | |
51 completed = True | |
52 | |
53 for item in self._requireditems: | |
54 if item in actor.inventory: | |
55 completed = True | |
56 | |
57 return completed | |
58 | |
59 def _getOwner(self): | |
60 return self._owner | |
61 | |
62 def _getName(self): | |
63 return self._name | |
64 | |
65 def _setName(self, questname): | |
66 self._name = questname | |
67 | |
68 def _getText(self): | |
69 return self._text | |
70 | |
71 def _setText(self, questtext): | |
72 self._text = questtext | |
73 | |
74 def _getRequiredGold(self): | |
75 return self._requiredgold | |
76 | |
77 def _getRequiredItems(self): | |
78 return self._requireditems | |
79 | |
80 owner = property(_getOwner) | |
81 name = property(_getName, _setName) | |
82 text = property(_getText, _setText) | |
83 requiredgold = property(_getRequiredGold) | |
84 requireditems = property(_getRequiredItems) | |
85 |