Debian Codegraph @

python/maps/witherspoon_manor/devourers.py

raw
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 priest of Devourers in Scorn.
6
7 Will handle the 'give' event to examine the dagger or money, 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 priest.'''
25 if whoami.ReadKey('got_offrand') == '':
26 if whoisother.ArchName == 'platinacoin':
27 if whoisother.Quantity < 10:
28 pl.Message('The priest looks at your money and sighes deeply, but doesn\'t take it.', color)
29 return
30
31 rem = whoisother.Quantity
32 if whoisother.Quantity > 50:
33 rem = 50
34 whoami.Say('Now, now, I can\' accept all that money.')
35 pl.Message('The priest takes 50 platinum coins.', color)
36 else:
37 pl.Message('The priest accepts your money.', color)
38
39 whoisother.Quantity = whoisother.Quantity - rem
40
41 whoami.WriteKey('got_offrand', '1', 1)
42 whoami.Say('Many thanks for your offrand!')
43
44 return
45
46 whoami.Say('Our church needs some restoration, could you donate to it?')
47
48 return
49
50 whoami.WriteKey('got_offrand', '', 1)
51
52 if whoisother.ReadKey('special_item') != 'ghost_dagger':
53 whoami.Say('Nice %s.'%whoisother.Name)
54 return
55
56 whoami.Say('My, my, those runes are pretty interesting.')
57 pl.Message('The priest takes the %s and looks at it carefully.'%whoisother.Name, color)
58 whoami.CreateTimer(8, 1)
59 whoami.WriteKey('examining_item', '1', 1)
60 whoami.WriteKey('examining_for', pl.Name, 1)
61
62 return
63
64 def do_timer():
65 '''Priest finished examining the item.'''
66 whoami.WriteKey('examining_item', '0', 1)
67
68 #let's see if the player is still around
69 pl = Crossfire.FindPlayer(whoami.ReadKey('examining_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
75 pl.WriteKey('witherspoon_know_dagger', '1', 1)
76 whoami.Say('As far as I can tell, the runes on this dagger represent an invocation to our Lord. It is meant to keep the soul in the body for hours after the death.')
77 whoami.Map.Print('The priest shudders.', color)
78 whoami.Say('The victim of the spell can still feel pain, even agonizing one, but will not die before the spell effect wears out.')
79 whoami.Say('Even our Lord, in his mercy, does not inflict on his followers such agonizing pain.')
80 whoami.Say('For someone to use such a spell, the victim must have been so hated!')
81 whoami.Map.Print('The priest thinks for a few seconds.', color)
82 whoami.Say('I think there is a witch, Olandi or something, who lives south of Scorn and specializes in Devourers magic.')
83 whoami.Say('Maybe she could help you?')
84
85 if pl.QuestGetState("scorn/Witherspoon-ghost") <= 30:
86 pl.QuestSetState("scorn/Witherspoon-ghost", 40)
87
88 if command == 'give':
89 if whoami.ReadKey('examining_item') == '1':
90 pl.Message('The priest is busy.', color)
91 else:
92 do_give()
93 elif event.Subtype == Crossfire.EventType.TIMER:
94 do_timer()
95 elif event.Subtype == Crossfire.EventType.TIME:
96 if whoami.ReadKey('examining_item') == '1':
97 #No moving while examining.
98 Crossfire.SetReturnValue(1)