Crossfire Server, Trunk
guild_entry.py
Go to the documentation of this file.
1 # Script for entering guild houses
2 #
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 #
18 # authors: majorwoo josh@woosworld.net, Avion temitchell@sourceforge.net
19 
20 import Crossfire
21 import CFGuilds
22 from CFGuildClearance import CheckClearance
23 import misc.trigger
24 
25 import sys
26 
27 import string
28 
29 activator=Crossfire.WhoIsActivator()
30 activatorname=activator.Name
31 mymap = activator.Map
32 activatorx=activator.X
33 activatory=activator.Y
34 whoami=Crossfire.WhoAmI()
35 
36 Params=Crossfire.ScriptParameters().split()
37 
38 guild = CFGuilds.CFGuild(Params[0])
39 guildname=Params[0]
40 
41 text = Crossfire.WhatIsMessage().split()
42 guildrecord = CFGuilds.CFGuildHouses().info(guildname)
43 found = 0
44 if text:
45  if text[0].upper() == 'ENTER':
46  #print guildrecord
47  if guildrecord['Status'] == 'inactive':
48  message = 'This guild is currently inactive and available to be bought.'
49  elif guildrecord['Status'] == 'suspended':
50  message = 'This guild is currently under suspension.\nPlease see a DM for more information'
51  elif guildrecord['Status'] == 'probation':
52  activator.Write('This guild is currently under probation.\nPlease see a DM for more information')
53  elif (CheckClearance(Params,activator)):
54  #check their status
55  if len(Params) < 3:
56  message = "I don't know which door I'm supposed to open for you. Contact a DM."
57  else:
58  message = 'Entry granted for %s' %activatorname
59  misc.trigger.trigger(whoami, int(Params[2]))
60  else:
61  message = "You are not allowed through this door. Access denied."
62 
63  elif text[0].upper() == 'BUY' and whoami.Name=="Guardian":
64  if guildrecord['Status'] == 'inactive':
65  in_guild = CFGuilds.SearchGuilds(activatorname)
66  x = 30
67  y = 19
68  message = "Proceed, but know ye that three are required to found a guild and the cost is high."
69  if in_guild != 0:
70  message += "\n Note, you are already a member of a guild, some servers may prohibit being in multiple guilds. Proceed at your own risk."
71  activator.Teleport(mymap,int(x),int(y)) #teleport them
72  else:
73  message = 'This guild is already owned.'
74  elif whoami.Name=="Guardian":
75  message = 'This is the entry to the great %s guild. Enter or begone!' %guildname
76  else:
77  message = "Say enter to request entry."
78 else:
79  message = 'Guild Guardian Error, please notify a DM'
80 
81 whoami.Say(message)
82 
CFGuilds.SearchGuilds
def SearchGuilds(player)
Definition: CFGuilds.py:38
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
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2606
CFGuildClearance.CheckClearance
def CheckClearance(lParams, oActivator)
Definition: CFGuildClearance.py:21