Debian Codegraph @

python/maps/witherspoon_manor/tomb.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 tomb near the lake west of Scorn.
6
7 This script is called when the player steps on the correct spot where the body is buried.
8 '''
9
10 import Crossfire
11
12 def can_dig(pl):
13 '''Returns True if the player can dig, False else. Give the relevant message.'''
14 if pl.CheckArchInventory('skill_clawing') != None:
15 pl.Write('Using your claws, you quickly dig.')
16 return True
17 if pl.CheckArchInventory('shovel_1') != None:
18 pl.Write('You dig with your shovel.')
19 return True
20
21 pl.Write('You\'d dig, but you have nothing to dig with...')
22 return False
23
24 def find_player():
25 '''Find the player stepping on the detector'''
26 test = Crossfire.WhoAmI().Above
27 while test != None:
28 if test.Type == Crossfire.Type.PLAYER:
29 return test
30 test = test.Above
31 return None
32
33 def main():
34 pl = find_player()
35 if pl == None:
36 return
37
38 if pl.ReadKey('dialog_witherspoon_ghost') != 'witherspoon_ghost:wait':
39 return
40
41 if pl.ReadKey('witherspoon_tomb') != '':
42 # Already dig, no need to give more items
43 return
44
45 pl.Write('You notice the earth here is kind of bumpy.')
46
47 #ok, so two choices for the player: if she got clawing, easy to dig. Else need a shovel.
48 dig = can_dig(pl)
49 if dig == 0:
50 return
51
52 #don't want the player to dig again! Will be reset by the ghost later on
53 pl.WriteKey('witherspoon_tomb', 'dig', 1)
54
55 body = Crossfire.CreateObjectByName('corpse') # so it doesn't merge with another item
56 body.WriteKey('special_item', 'ghost_body', 1)
57 body.Name = 'tortured body'
58 body.NamePl = 'tortured bodies'
59 body.Message = 'You suppose this is the body of the ghost in Witherspoon Manor. It is covered in scars, as if someone really wanted to make him pay for something.'
60 body.InsertInto(pl)
61
62 dagger = Crossfire.CreateObjectByName('dagger')
63 dagger.WriteKey('special_item', 'ghost_dagger', 1)
64 dagger.Name = 'strange dagger'
65 dagger.NamePl = 'strange daggers'
66 dagger.Message = 'You found this dagger with the body of the Witherspoon Manor ghost. It has some weird look. You wonder if a marchant could figure what the symbols mean.'
67 dagger.InsertInto(pl)
68
69 pl.Write('You find a body with a dagger in it!')
70 if pl.QuestGetState("scorn/Witherspoon-ghost") <= 10:
71 pl.QuestSetState("scorn/Witherspoon-ghost", 20)
72
73 main()