| 1 |
''' |
| 2 |
This script is part of the Witherspoon quest, that starts in /scorn/mansion/witherspoon_manor_attic. |
| 3 |
Check the README file in the same directory as this file for more details. |
| 4 |
|
| 5 |
Script for Rolanda, in /scorn/houses/rolanda. |
| 6 |
|
| 7 |
Support to be called for TIME, TIMER and CUSTOM events. |
| 8 |
''' |
| 9 |
|
| 10 |
import Crossfire |
| 11 |
import CFMove |
| 12 |
import random |
| 13 |
|
| 14 |
whoami = Crossfire.WhoAmI() |
| 15 |
whoisother = Crossfire.WhoIsOther() |
| 16 |
command = Crossfire.WhatIsMessage() |
| 17 |
event = Crossfire.WhatIsEvent() |
| 18 |
pl = Crossfire.WhoIsActivator() |
| 19 |
|
| 20 |
|
| 21 |
# Message color for player |
| 22 |
color = Crossfire.MessageFlag.NDI_BROWN |
| 23 |
|
| 24 |
# coordinates to look for chairs |
| 25 |
search_chairs = [ [ 0, -1 ], [ 0, 1 ], [ -1, 0 ], [ 1, 0 ] ] |
| 26 |
|
| 27 |
def do_give(): |
| 28 |
'''handle the player giving an item.''' |
| 29 |
if whoisother.ReadKey('special_item') != 'ghost_dagger': |
| 30 |
whoami.Say('And what am I supposed to do with this %s.'%whoisother.Name) |
| 31 |
return |
| 32 |
|
| 33 |
whoami.Say('Ohhhhhhhh... This, this dagger...') |
| 34 |
pl.Message('%s puts her hand to her forehead, and staggers.'%whoami.Name) |
| 35 |
whoami.WriteKey('witherspoon_saw_dagger', '1', 1) |
| 36 |
whoami.WriteKey('witherspoon_seated', '', 1) |
| 37 |
whoami.WriteKey('explaining_for', pl.Name, 1) |
| 38 |
|
| 39 |
def search_chair(): |
| 40 |
'''if fainting, try to find a chair when TIME happens.''' |
| 41 |
for search in range(0, len(search_chairs)): |
| 42 |
x = whoami.X + search_chairs[search][0] |
| 43 |
y = whoami.Y + search_chairs[search][1] |
| 44 |
obj = whoami.Map.ObjectAt(x, y) |
| 45 |
while obj: |
| 46 |
if obj.Name == 'chair': |
| 47 |
whoami.WriteKey('witherspoon_seated', '1', 1) |
| 48 |
whoami.Say('Thank you very much.') |
| 49 |
whoami.WriteKey('chair_x', str(x), 1) |
| 50 |
whoami.WriteKey('chair_y', str(y), 1) |
| 51 |
return |
| 52 |
obj = obj.Above |
| 53 |
|
| 54 |
def move_to_chair(): |
| 55 |
'''trying to move to first found chair.''' |
| 56 |
m = CFMove.get_object_to(whoami, int(whoami.ReadKey('chair_x')), int(whoami.ReadKey('chair_y'))) |
| 57 |
if m == 0: |
| 58 |
whoami.WriteKey('witherspoon_seated', '2', 1) |
| 59 |
whoami.Map.Print('%s sits on the chair.'%whoami.Name, color) |
| 60 |
whoami.Say('I shall explain everything...') |
| 61 |
whoami.Map.Print('%s starts sobbing.'%whoami.Name, color) |
| 62 |
whoami.CreateTimer(random.randint(5, 10), 1) |
| 63 |
elif m == 2: |
| 64 |
whoami.Say('Please let me sit...') |
| 65 |
|
| 66 |
def explain(): |
| 67 |
'''explanation of the ghost story. Let Rolanda be still from now on.''' |
| 68 |
|
| 69 |
pl = Crossfire.FindPlayer(whoami.ReadKey('explaining_for')) |
| 70 |
if pl == None: |
| 71 |
# just in case someone else is around ^_- |
| 72 |
whoami.Say('Tss, people just aren\'t patient...') |
| 73 |
return |
| 74 |
pl.WriteKey('witherspoon_know_all', '1', 1) |
| 75 |
|
| 76 |
whoami.Say('See, this dagger...') |
| 77 |
whoami.Say('Alfred wanted...') |
| 78 |
whoami.Map.Print('%s sighes deeply, and goes on.'%whoami.Name) |
| 79 |
whoami.Say('he wanted to have some, shall I say, different experience, the kind a man and a woman can have together.') |
| 80 |
whoami.Say('And since he likes pain, he asked to suffer, to see if the pain would... excite him.') |
| 81 |
whoami.Map.Print('%s sobs'%whoami.Name) |
| 82 |
whoami.Say('But he didn\'t think he would die!') |
| 83 |
whoami.Say('So I... I hide the body, hoping to forget him.') |
| 84 |
whoami.Say('But now I can\'t forget him! Ever!') |
| 85 |
pl.Write('You wonder what the ghost (Alfred, according to %s) will make of that...'%whoami.Name, color) |
| 86 |
if pl.QuestGetState("scorn/Witherspoon-ghost") <= 40: |
| 87 |
pl.QuestSetState("scorn/Witherspoon-ghost", 50) |
| 88 |
|
| 89 |
if event.Subtype == Crossfire.EventType.USER and command == 'give': |
| 90 |
do_give() |
| 91 |
elif event.Subtype == Crossfire.EventType.TIME: |
| 92 |
if whoami.ReadKey('witherspoon_saw_dagger') != '': |
| 93 |
# No moving while fainting |
| 94 |
Crossfire.SetReturnValue(1) |
| 95 |
if whoami.ReadKey('witherspoon_seated') == '': |
| 96 |
search_chair() |
| 97 |
elif whoami.ReadKey('witherspoon_seated') == '1': |
| 98 |
move_to_chair() |
| 99 |
elif event.Subtype == Crossfire.EventType.SAY: |
| 100 |
if whoami.ReadKey('witherspoon_saw_dagger') != '': |
| 101 |
# No talking while fainting |
| 102 |
Crossfire.SetReturnValue(1) |
| 103 |
whoami.Say('Ohhhhhhh......') |
| 104 |
pl.Message('%s seems to be ready to faint.'%whoami.Name) |
| 105 |
elif event.Subtype == Crossfire.EventType.TIMER: |
| 106 |
if whoami.ReadKey('witherspoon_seated') == '2': |
| 107 |
explain() |