File: tomb.py

package info (click to toggle)
crossfire-maps 1.75.0%2Bdfsg1-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 275,656 kB
  • sloc: python: 7,711; sql: 92; sh: 73; makefile: 7
file content (73 lines) | stat: -rw-r--r-- 2,404 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'''
This script is part of the Witherspoon quest, that starts in /scorn/mansion/witherspoon_manor_attic.
Check the README file in the same directory as this file for more details.

Script for the tomb near the lake west of Scorn.

This script is called when the player steps on the correct spot where the body is buried.
'''

import Crossfire

def can_dig(pl):
	'''Returns True if the player can dig, False else. Give the relevant message.'''
	if pl.CheckArchInventory('skill_clawing') != None:
		pl.Write('Using your claws, you quickly dig.')
		return True
	if pl.CheckArchInventory('shovel_1') != None:
		pl.Write('You dig with your shovel.')
		return True

	pl.Write('You\'d dig, but you have nothing to dig with...')
	return False

def find_player():
	'''Find the player stepping on the detector'''
	test = Crossfire.WhoAmI().Above
	while test != None:
		if test.Type == Crossfire.Type.PLAYER:
			return test
		test = test.Above
	return None

def main():
	pl = find_player()
	if pl == None:
		return

	if pl.ReadKey('dialog_witherspoon_ghost') != 'witherspoon_ghost:wait':
		return

	if pl.ReadKey('witherspoon_tomb') != '':
		# Already dig, no need to give more items
		return

	pl.Write('You notice the earth here is kind of bumpy.')

	#ok, so two choices for the player: if she got clawing, easy to dig. Else need a shovel.
	dig = can_dig(pl)
	if dig == 0:
		return

	#don't want the player to dig again! Will be reset by the ghost later on
	pl.WriteKey('witherspoon_tomb', 'dig', 1)

	body = Crossfire.CreateObjectByName('corpse') # so it doesn't merge with another item
	body.WriteKey('special_item', 'ghost_body', 1)
	body.Name = 'tortured body'
	body.NamePl = 'tortured bodies'
	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.'
	body.InsertInto(pl)

	dagger = Crossfire.CreateObjectByName('dagger')
	dagger.WriteKey('special_item', 'ghost_dagger', 1)
	dagger.Name = 'strange dagger'
	dagger.NamePl = 'strange daggers'
	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.'
	dagger.InsertInto(pl)

	pl.Write('You find a body with a dagger in it!')
	if pl.QuestGetState("scorn/Witherspoon-ghost") <= 10:
		pl.QuestSetState("scorn/Witherspoon-ghost", 20)

main()