| 1 |
import Crossfire |
| 2 |
import CFGuilds |
| 3 |
|
| 4 |
import sys |
| 5 |
import string |
| 6 |
activator=Crossfire.WhoIsActivator() |
| 7 |
activatorname=activator.Name |
| 8 |
mymap = activator.Map |
| 9 |
def find_player(object): |
| 10 |
while (object.Type != 1) : #1 is type 'Player' |
| 11 |
object = object.Above |
| 12 |
if not object: |
| 13 |
return 0 |
| 14 |
return object |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
whoami=Crossfire.WhoAmI() |
| 20 |
|
| 21 |
def CheckClearance(lParams,oActivator): |
| 22 |
|
| 23 |
ClearanceLevels={"Initiate":1,"Novice":2,"Guildman":3,"Journeyman":4,"Master":5,"GuildMaster":6} |
| 24 |
oGuild=CFGuilds.CFGuild(lParams[0]) |
| 25 |
|
| 26 |
if oActivator.DungeonMaster==1: |
| 27 |
return True |
| 28 |
iClearanceLevel=ClearanceLevels.get(lParams[1],0) |
| 29 |
dGuildInfo=oGuild.info(oActivator.Name) |
| 30 |
|
| 31 |
if dGuildInfo==0: |
| 32 |
return False |
| 33 |
|
| 34 |
iClearanceApproved=ClearanceLevels.get(dGuildInfo['Rank'],0) |
| 35 |
if dGuildInfo["Status"]=='suspended': |
| 36 |
iClearanceApproved=0 |
| 37 |
Crossfire.WhoIsActivator().Say("You are currently suspended from the guild.") |
| 38 |
elif dGuildInfo["Status"]=="probation": |
| 39 |
Crossfire.WhoIsActivator().Say("You are currently on probation.") |
| 40 |
if iClearanceLevel>iClearanceApproved: |
| 41 |
return False |
| 42 |
return True |
| 43 |
|
| 44 |
|
| 45 |
if __name__=='__builtin__': |
| 46 |
|
| 47 |
texta = [ '' ] |
| 48 |
if Crossfire.WhatIsMessage(): |
| 49 |
texta=string.split(Crossfire.WhatIsMessage()) |
| 50 |
|
| 51 |
if (texta[0].upper() == 'ENTER'): |
| 52 |
Params=string.split(Crossfire.ScriptParameters()) |
| 53 |
if CheckClearance(Params,activator): |
| 54 |
Approved = "Access granted" |
| 55 |
else: |
| 56 |
Approved = "Access denied" |
| 57 |
whoami.Say(Approved) |
| 58 |
|
| 59 |
|
| 60 |
if (Approved == 'Access granted'): |
| 61 |
mymap.TriggerConnected(int(Params[2]),0,activator) |
| 62 |
|
| 63 |
else: |
| 64 |
whoami.Say('Say enter to request entry') |