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 
24 import sys
25 
26 import string
27 
28 activator=Crossfire.WhoIsActivator()
29 activatorname=activator.Name
30 mymap = activator.Map
31 activatorx=activator.X
32 activatory=activator.Y
33 whoami=Crossfire.WhoAmI()
34 
35 Params=Crossfire.ScriptParameters().split()
36 
37 guild = CFGuilds.CFGuild(Params[0])
38 guildname=Params[0]
39 
40 text = Crossfire.WhatIsMessage().split()
41 guildrecord = CFGuilds.CFGuildHouses().info(guildname)
42 found = 0
43 if text:
44  if text[0].upper() == 'ENTER':
45  #print guildrecord
46  if guildrecord['Status'] == 'inactive':
47  message = 'This guild is currently inactive and available to be bought.'
48  elif guildrecord['Status'] == 'suspended':
49  message = 'This guild is currently under suspension.\nPlease see a DM for more information'
50  elif guildrecord['Status'] == 'probation':
51  activator.Write('This guild is currently under probation.\nPlease see a DM for more information')
52  elif (CheckClearance(Params,activator)):
53  #check their status
54  if len(Params) < 3:
55  message = "I don't know which door I'm supposed to open for you. Contact a DM."
56  else:
57  message = 'Entry granted for %s' %activatorname
58  mymap.TriggerConnected(int(Params[2]),1,activator)
59  else:
60  message = "You are not allowed through this door. Access denied."
61 
62  elif text[0].upper() == 'BUY' and whoami.Name=="Guardian":
63  if guildrecord['Status'] == 'inactive':
64  in_guild = CFGuilds.SearchGuilds(activatorname)
65  x = 30
66  y = 19
67  message = "Proceed, but know ye that three are required to found a guild and the cost is high."
68  if in_guild != 0:
69  message += "\n Note, you are already a member of a guild, some servers may prohibit being in multiple guilds. Proceed at your own risk."
70  activator.Teleport(mymap,int(x),int(y)) #teleport them
71  else:
72  message = 'This guild is already owned.'
73  elif whoami.Name=="Guardian":
74  message = 'This is the entry to the great %s guild. Enter or begone!' %guildname
75  else:
76  message = "Say enter to request entry."
77 else:
78  message = 'Guild Guardian Error, please notify a DM'
79 
80 whoami.Say(message)
81 
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