Crossfire Server, Trunk
guildbuy.py
Go to the documentation of this file.
1 import Crossfire
2 import CFGuilds
3 
4 whoami=Crossfire.WhoAmI()
5 guildname=Crossfire.ScriptParameters() # 1 is 'apply' event
6 
7 def find_player(object):
8  while (object.Type != 1) : #1 is type 'Player'
9  object = object.Above
10  if not object:
11  return 0
12  return object
13 
14 activator=Crossfire.WhoIsActivator()
15 map = activator.Map
16 
17 players = []
18 names = []
19 
20 if (guildname):
21  #find players by coords
22  ob1=map.ObjectAt(33,24)
23  ob2=map.ObjectAt(33,26)
24  objects = [ob1, ob2]
25  for object in objects:
26  temp = find_player(object)
27  if temp:
28  players.append(temp)
29  players.append(activator)
30 
31  for player in players:
32  names.append(player.Name)
33 
34  if len(players) == 3:
35  Crossfire.Log(Crossfire.LogInfo, '%s,%s and %s found guild %s' %(names[0], names[1], names[2], guildname))
36 
37  CFGuilds.CFGuildHouses().establish(guildname)
38  #Masterize them
39  for player, name in zip(players, names):
40  CFGuilds.CFGuild(guildname).add_member(name, 'GuildMaster')
41 
42  #teleport them
43  player.Teleport(map,int(11),int(16))
44  message = "You have purchased the %s guild. Rule it wisely. (I would type 'save' right about now...)"%guildname
45  elif len(players)==2:
46  message="To purchase a guild requires one additional person to stand on the alcoves above."
47  else:
48  message = 'To purchase a guild requires two additional persons to stand on the alcoves above.'
49 else:
50  Crossfire.Log(Crossfire.LogError, 'Guild Purchase Error: %s, %s' %(guildname, activatorname))
51  message = 'Guild Purchase Error, please notify a DM'
52 
53 whoami.Say(message)
guildbuy.find_player
def find_player(object)
Definition: guildbuy.py:7
CFGuilds.CFGuild
Definition: CFGuilds.py:131
CFGuilds.CFGuildHouses
Definition: CFGuilds.py:47
make_face_from_files.int
int
Definition: make_face_from_files.py:32