From 054058c980886079f5b5102cff1b4f07fc0cd396 Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Sun, 28 Feb 2010 11:53:13 +0000 Subject: [PATCH] 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-b93c2d0d6712 --- python/maps/scorn/HouseofHealing.py | 54 +++++++++++++++++++++++++++++ scorn/misc/HouseofHealing | 6 +++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 python/maps/scorn/HouseofHealing.py diff --git a/python/maps/scorn/HouseofHealing.py b/python/maps/scorn/HouseofHealing.py new file mode 100644 index 000000000..8be62e892 --- /dev/null +++ b/python/maps/scorn/HouseofHealing.py @@ -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) diff --git a/scorn/misc/HouseofHealing b/scorn/misc/HouseofHealing index 490e64e95..70e5e4988 100644 --- a/scorn/misc/HouseofHealing +++ b/scorn/misc/HouseofHealing @@ -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