Crossfire Server, Trunk
rhyzian_amulet.py
Go to the documentation of this file.
1 import Crossfire
2 import CFWorld
3 
4 scorn_loc = (5272, 5786)
5 navar_loc = (6112, 5850)
6 
7 Crossfire.SetReturnValue( 1 )
8 
9 #outputs in miles
10 def getuserdist(dist):
11  return (int(dist/8.0+0.5))
12 
13 def gettext(loc1, loc2, name):
14  diff = CFWorld.getdiff(loc2, loc1)
15  loc_raw_dist = CFWorld.getdist(diff)
16  loc_dist = getuserdist(loc_raw_dist)
17  loc_dir = CFWorld.getdir(diff)
18  if (abs(loc_dist) > 5):
19  loc_distmsg = "A "+name+" arrow flashes "+str(loc_dist)+" times"
20  else:
21  loc_distmsg = "A "+name+" arrow glows steady"
22  if (loc_raw_dist):
23  loc_distmsg += ", pointing to the "+loc_dir+"."
24  else:
25  loc_distmsg += ", spinning in one place."
26  return loc_distmsg
27 
28 pl = Crossfire.WhoIsActivator()
29 me = Crossfire.WhoAmI()
30 
31 location = CFWorld.loc_from_ob(pl)
32 if (location):
33  scorntxt = gettext(location, scorn_loc, "red")
34  navartxt = gettext(location, navar_loc, "blue")
35  pl.Write(scorntxt+" "+navartxt)
36 else:
37  pl.Write("The amulet doesn't seem to work here.")
CFWorld.loc_from_ob
def loc_from_ob(ob)
Definition: CFWorld.py:15
make_face_from_files.str
str
Definition: make_face_from_files.py:30
CFWorld.getdir
def getdir(v)
Definition: CFWorld.py:27
rhyzian_amulet.gettext
def gettext(loc1, loc2, name)
Definition: rhyzian_amulet.py:13
CFWorld.getdiff
def getdiff(loc1, loc2)
Definition: CFWorld.py:24
rhyzian_amulet.getuserdist
def getuserdist(dist)
Definition: rhyzian_amulet.py:10
make_face_from_files.int
int
Definition: make_face_from_files.py:32
CFWorld.getdist
def getdist(loc)
Definition: CFWorld.py:36