Crossfire Server, Trunk
HouseofHealing.py
Go to the documentation of this file.
1 import Crossfire
2 from CFDataFile import CFDataFile, CFData
3 
4 who = Crossfire.WhoAmI()
5 event = Crossfire.WhatIsEvent()
6 player = Crossfire.WhoIsActivator()
7 message = Crossfire.WhatIsMessage().lower()
8 
9 # questions giving free restoration
10 questions = [
11  'please tell me the name of the town we are in.',
12  'tell me the name of the tavern east of Scorn.'
13 ]
14 # answers to above questions
15 answers = ['scorn', 'goth']
16 # level to remove depletion
17 levels = [ 5, 5 ]
18 
20  header = ['uses']
21  data = CFData('Scorn_HouseOfHealing', header)
22  if data.exist(player.Name):
23  return int(data.get_record(player.Name)['uses'])
24  return 0
25 
27  header = ['uses']
28  data = CFData('Scorn_HouseOfHealing', header)
29  record = { '#' : player.Name, 'uses' : uses }
30  data.put_record(record)
31 
32 def greet():
33  who.Say('Welcome to the house of healing!\nThis is the place where injured and ill people get cured of their torments.')
34 
35 def do_say():
36  uses = player_status()
37 
38  if (uses < len(questions)):
39  if (message == answers[uses]):
40  who.Say('Correct! Be restored!')
41  result = player.RemoveDepletion(5)
42  player_set_status(uses + 1)
43  return
44  greet()
45  who.Say('If you wish me to restore your stats, %s'%questions[uses])
46  return
47 
48  greet()
49 
50 if (event.Subtype == Crossfire.EventType.SAY):
51  do_say()
52 
53 
54 Crossfire.SetReturnValue(1)
CFDataFile.CFData
Definition: CFDataFile.py:94
HouseofHealing.greet
def greet()
Definition: HouseofHealing.py:32
HouseofHealing.player_set_status
def player_set_status(uses)
Definition: HouseofHealing.py:26
HouseofHealing.do_say
def do_say()
Definition: HouseofHealing.py:35
HouseofHealing.player_status
def player_status()
Definition: HouseofHealing.py:19
make_face_from_files.int
int
Definition: make_face_from_files.py:32