Debian Codegraph @

python/guilds/guild_entry.py

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