File: Floor.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 (67 lines) | stat: -rw-r--r-- 1,490 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
import Crossfire,sys
Params=Crossfire.ScriptParameters()
whoami=Crossfire.WhoAmI()
Arch=None
if whoami.Name=="Magic Lever":
	Arch=whoami.Map.ObjectAt(49,2)
elif whoami.Name=="Buildable Lever":
	Arch=whoami.Map.ObjectAt(49,3)
StartXY=Params.split(":")[0].split(',')
StopXY=Params.split(":")[1].split(',')
Width=int(StopXY[0])-int(StartXY[0])
Height=int(StopXY[1])-int(StartXY[1])
Area=Width*Height
XRange=range(int(StartXY[0]),int(StopXY[0]))
YRange=range(int(StartXY[1]),int(StopXY[1]))
def GetObjectByName(Map,X,Y,Name):
		Object=Map.ObjectAt(X,Y)
		while Object!=None:
			if Object.Name==Name:
				return Object
			else:
				Object=Object.Above
		return Object
if Arch!=None:
	whoami.Value=int(whoami.Value==1)

	Arch.Quantity=Area+1


	#def MoveToBottom(object):
		#object.Say('s')
		#Dict={}
		#Counter=0
		#Item=object.Below
		#object.Say(str(Item))
		#while Item!=None:
			#Dict.update({str(Counter):Item})


			#Item=Item.Below
		#for i in list(Dict.values()):
			#i.Teleport(object.Map,object.X,object.Y)


	for i in XRange:
		for a in YRange:
			if whoami.Value==1:
				TmpArch=Arch.Split(1)
				TmpArch.Teleport(whoami.Map,i,a)
				#MoveToBottom(TmpArch)
			else:
				TmpArch=GetObjectByName(whoami.Map,i,a,Arch.Name)
				if TmpArch!=None:
					TmpArch.Remove()
				else:
					whoami.Say("Arch not found at "+str(i)+","+str(a))


else:
	for i in XRange:
		for a in YRange:
			t=whoami.Map.ObjectAt(i,a)

			while t!=None:
				if t.Floor==1:
					t.Name="Shop Floor"
				t=t.Above