Crossfire Server, Trunk
Floor.py
Go to the documentation of this file.
1 import Crossfire,sys
2 Params=Crossfire.ScriptParameters()
3 whoami=Crossfire.WhoAmI()
4 Arch=None
5 if whoami.Name=="Magic Lever":
6  Arch=whoami.Map.ObjectAt(49,2)
7 elif whoami.Name=="Buildable Lever":
8  Arch=whoami.Map.ObjectAt(49,3)
9 StartXY=Params.split(":")[0].split(',')
10 StopXY=Params.split(":")[1].split(',')
11 Width=int(StopXY[0])-int(StartXY[0])
12 Height=int(StopXY[1])-int(StartXY[1])
13 Area=Width*Height
14 XRange=range(int(StartXY[0]),int(StopXY[0]))
15 YRange=range(int(StartXY[1]),int(StopXY[1]))
16 def GetObjectByName(Map,X,Y,Name):
17  Object=Map.ObjectAt(X,Y)
18  while Object!=None:
19  if Object.Name==Name:
20  return Object
21  else:
22  Object=Object.Above
23  return Object
24 if Arch!=None:
25  whoami.Value=int(whoami.Value==1)
26 
27  Arch.Quantity=Area+1
28 
29 
30  #def MoveToBottom(object):
31  #object.Say('s')
32  #Dict={}
33  #Counter=0
34  #Item=object.Below
35  #object.Say(str(Item))
36  #while Item!=None:
37  #Dict.update({str(Counter):Item})
38 
39 
40  #Item=Item.Below
41  #for i in list(Dict.values()):
42  #i.Teleport(object.Map,object.X,object.Y)
43 
44 
45  for i in XRange:
46  for a in YRange:
47  if whoami.Value==1:
48  TmpArch=Arch.Split(1)
49  TmpArch.Teleport(whoami.Map,i,a)
50  #MoveToBottom(TmpArch)
51  else:
52  TmpArch=GetObjectByName(whoami.Map,i,a,Arch.Name)
53  if TmpArch!=None:
54  TmpArch.Remove()
55  else:
56  whoami.Say("Arch not found at "+str(i)+","+str(a))
57 
58 
59 else:
60  for i in XRange:
61  for a in YRange:
62  t=whoami.Map.ObjectAt(i,a)
63 
64  while t!=None:
65  if t.Floor==1:
66  t.Name="Shop Floor"
67  t=t.Above
make_face_from_files.str
str
Definition: make_face_from_files.py:30
make_face_from_files.int
int
Definition: make_face_from_files.py:32
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2606
Floor.GetObjectByName
def GetObjectByName(Map, X, Y, Name)
Definition: Floor.py:16