| 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 the shop owner of the weapon shop in Scorn. |
| 6 |
|
| 7 |
Will handle the 'give' event to examine the dagger, and various events. |
| 8 |
|
| 9 |
This script should be called for the 'TIMER', 'TIME' and 'custom' events. |
| 10 |
''' |
| 11 |
|
| 12 |
import Crossfire |
| 13 |
|
| 14 |
whoami = Crossfire.WhoAmI() |
| 15 |
whoisother = Crossfire.WhoIsOther() |
| 16 |
command = Crossfire.WhatIsMessage() |
| 17 |
event = Crossfire.WhatIsEvent() |
| 18 |
pl = Crossfire.WhoIsActivator() |
| 19 |
|
| 20 |
#Message color for player |
| 21 |
color = Crossfire.MessageFlag.NDI_BROWN |
| 22 |
|
| 23 |
def do_give(): |
| 24 |
'''Player gives an item to the owner.''' |
| 25 |
if whoisother.ReadKey('special_item') != 'ghost_dagger': |
| 26 |
whoami.Say('Nice %s.'%whoisother.Name) |
| 27 |
return |
| 28 |
|
| 29 |
whoami.Say('Oh, this looks like a really interesting dagger.') |
| 30 |
pl.Message('The owner takes the %s and starts examining it carefully.'%whoisother.Name, color) |
| 31 |
whoami.CreateTimer(8, 1) |
| 32 |
whoami.WriteKey('examining_item', '1', 1) |
| 33 |
whoami.WriteKey('examining_for', pl.Name, 1) |
| 34 |
|
| 35 |
return |
| 36 |
|
| 37 |
def do_timer(): |
| 38 |
'''Owner finished examining the item.''' |
| 39 |
whoami.WriteKey('examining_item', '0', 1) |
| 40 |
|
| 41 |
#let's see if the player is still around |
| 42 |
pl = Crossfire.FindPlayer(whoami.ReadKey('examining_for')) |
| 43 |
if pl == None: |
| 44 |
# just in case someone else is around ^_- |
| 45 |
whoami.Say('Tss, people just aren\'t patient...') |
| 46 |
return |
| 47 |
|
| 48 |
whoami.Say('This dagger is pretty old, and is covered with runes. Unfortunately I can\'t describe what they mean, but they sure look like religious ones. Maybe you could go ask a priest?') |
| 49 |
|
| 50 |
if pl.QuestGetState("scorn/Witherspoon-ghost") <= 20: |
| 51 |
pl.QuestSetState("scorn/Witherspoon-ghost", 30) |
| 52 |
|
| 53 |
if command == 'give': |
| 54 |
if whoami.ReadKey('examining_item') == '1': |
| 55 |
pl.Message('The owner is busy.', color) |
| 56 |
else: |
| 57 |
do_give() |
| 58 |
elif event.Subtype == Crossfire.EventType.TIMER: |
| 59 |
do_timer() |
| 60 |
elif event.Subtype == Crossfire.EventType.TIME: |
| 61 |
if whoami.ReadKey('examining_item') == '1': |
| 62 |
#No moving while examining. |
| 63 |
Crossfire.SetReturnValue(1) |