Have the priest give (almost) free restorations, if the player knows the answers.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@12527 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
ff54b9d8b3
commit
054058c980
|
@ -0,0 +1,54 @@
|
|||
import Crossfire
|
||||
from CFDataFile import CFDataFile, CFData
|
||||
|
||||
who = Crossfire.WhoAmI()
|
||||
event = Crossfire.WhatIsEvent()
|
||||
player = Crossfire.WhoIsActivator()
|
||||
message = Crossfire.WhatIsMessage().lower()
|
||||
|
||||
# questions giving free restoration
|
||||
questions = [
|
||||
'please tell me the name of the town we are in.',
|
||||
'tell me the name of the tavern east of Scorn.'
|
||||
]
|
||||
# answers to above questions
|
||||
answers = ['scorn', 'goth']
|
||||
# level to remove depletion
|
||||
levels = [ 5, 5 ]
|
||||
|
||||
def player_status():
|
||||
header = ['uses']
|
||||
data = CFData('Scorn_HouseOfHealing', header)
|
||||
if data.exist(player.Name):
|
||||
return int(data.get_record(player.Name)['uses'])
|
||||
return 0
|
||||
|
||||
def player_set_status(uses):
|
||||
header = ['uses']
|
||||
data = CFData('Scorn_HouseOfHealing', header)
|
||||
record = { '#' : player.Name, 'uses' : uses }
|
||||
data.put_record(record)
|
||||
|
||||
def greet():
|
||||
who.Say('Welcome to the house of healing!\nThis is the place where injured and ill people get cured of their torments.')
|
||||
|
||||
def do_say():
|
||||
uses = player_status()
|
||||
|
||||
if (uses < len(questions)):
|
||||
if (message == answers[uses]):
|
||||
who.Say('Correct! Be restored!');
|
||||
result = player.RemoveDepletion(5)
|
||||
player_set_status(uses + 1)
|
||||
return
|
||||
greet()
|
||||
who.Say('If you wish me to restore your stats, %s'%questions[uses])
|
||||
return
|
||||
|
||||
greet()
|
||||
|
||||
if (event.Subtype == Crossfire.EventType.SAY):
|
||||
do_say()
|
||||
|
||||
|
||||
Crossfire.SetReturnValue(1)
|
|
@ -11,7 +11,7 @@ enter_x 10
|
|||
enter_y 33
|
||||
msg
|
||||
Created: 1999-04-02
|
||||
Modified: 2008-12-02 Rick Tanner
|
||||
Modified: 2010-02-28 Nicolas Weeger
|
||||
endmsg
|
||||
end
|
||||
arch grass
|
||||
|
@ -3308,6 +3308,10 @@ endmsg
|
|||
x 11
|
||||
y 29
|
||||
friendly 1
|
||||
arch event_say
|
||||
title Python
|
||||
slaying /python/maps/scorn/HouseofHealing.py
|
||||
end
|
||||
end
|
||||
arch dungeon_magic
|
||||
x 11
|
||||
|
|
Loading…
Reference in New Issue