24 from CFGuildClearance
import CheckClearance
26 activator=Crossfire.WhoIsActivator()
27 activatorname=activator.Name
28 whoami=Crossfire.WhoAmI()
29 isDM=activator.DungeonMaster
32 guildname=Crossfire.ScriptParameters()
36 Approved =
'Access granted'
38 Approved =
'Access denied'
42 if (Approved ==
'Access granted'):
47 if (Access ==1)
or (isDM == 1):
51 text = Crossfire.WhatIsMessage().
split()
52 if guild.info(activatorname) == 0
and isDM == 0:
53 message =
'You don\'t belong to this guild!'
54 elif text[0] ==
'help' or text[0] ==
'yes':
56 message =
'\nList of commands:\n-list\n-add <name>\n-remove <member>\n-info <member>\n-promote <member>\n-demote <member>\n-status <member> <status>\n-guildstatus <status>'
58 message=
'\nList of commands:\n-list\n-remove <member>\n-info <member>\n-promote <member>\n-demote <member>\n-status <member> <status>'
59 elif text[0] ==
'info':
61 record = guild.info(text[1])
63 message =
'Information for %s:\n' %text[1]
64 message +=
'Rank: %s\n'%record[
'Rank']
65 message +=
'Status: %s\n'%record[
'Status']
66 message +=
'Join date: %s\n'%record[
'Join_date']
67 if record[
'Demerits'] !=
'0':
68 message +=
'Demerits: %s\n'%record[
'Demerits']
69 if record[
'Dues'] !=
'0':
70 message +=
'Paid dues: %s\n'%Crossfire.CostStringFromValue(long(record[
'Dues']))
72 message =
'%s is not a member' %text[1]
74 message =
'Usage "info <member_name>"'
76 elif text[0] ==
'remove':
78 if guild.info(text[1]):
79 message =
'Removed %s from the guild' %text[1]
80 guild.remove_member(text[1])
82 message =
'%s was not a member' %text[1]
84 message =
'Usage "remove <member_name>"'
85 elif text[0] ==
'list':
86 Crossfire.SetPlayerMessage(
'Who are the members?', 2)
87 list = guild.list_members()
89 message =
'\nList of members:\n'
91 message +=
'%s (%s)\n'%(member, guild.info(member)[
'Rank'])
92 message +=
'Total members = ' +
str(len(list))
94 elif text[0] ==
'promote':
96 record = guild.info(text[1])
98 if guild.promote_member(text[1]):
99 record = guild.info(text[1])
100 message =
'%s promoted to %s' %(text[1], record[
'Rank'])
102 message =
'You cannot promote %s' %text[1]
104 message =
'%s is not a member' %text[1]
106 message =
'Usage "promote <member_name>"'
107 elif text[0] ==
'demote':
109 record = guild.info(text[1])
111 if guild.demote_member(text[1]):
112 record = guild.info(text[1])
113 message =
'%s demoted to %s' %(text[1], record[
'Rank'])
115 message =
'You cannot demote %s' %text[1]
117 message =
'%s is not a member' %text[1]
119 message =
'Usage "demote <member_name>"'
120 elif text[0] ==
'status':
122 record = guild.info(text[1])
125 if guild.change_status(text[1],text[2]):
126 record = guild.info(text[1])
127 message =
'%s now has status of %s' %(text[1], record[
'Status'])
129 status =
', '.join(guild.status)
130 message =
'%s is not a valid status, valid values are %s.' %(text[2],status)
132 status =
', '.join(guild.status)
133 message =
'Current status for %s is %s.\nTo change use "status %s <status>" where status is one of %s.' %(text[1],record[
'Status'],text[1],status)
135 message =
'%s is not a member' %text[1]
137 message =
"Say status <member> to query the member's status."
138 elif text[0] ==
'add' and isDM:
140 if log.info(text[1]):
141 if guild.info(text[1]):
142 message =
'%s is already a member.' %text[1]
144 guild.add_member(text[1],
'Initiate' )
145 message =
'Added %s to the guild as Initiate' %text[1]
147 message =
'Sorry, I don\'t know any %s' %text[1]
149 message =
'Usage "add <membername>"'
150 elif text[0] ==
'guildstatus' and isDM:
151 record = guildhouse.info(guildname)
154 if guildhouse.change_status(guildname,text[1]):
155 record = guildhouse.info(guildname)
156 message =
'%s now has status of %s' %(guildname, record[
'Status'])
158 message =
'%s is not a valid status' %text[1]
160 message =
'%s is not a guild' %guildname
162 status =
", ".join(guildhouse.status)
163 message =
'Current guild status is %s.\nTo change it use "guildstatus <status>" where status is one of %s' %(
str(record[
'Status']),status)
165 message =
'What did you need?'
167 message =
'Board Error'