diff --git a/python/guilds/clearance.py b/python/guilds/clearance.py index ce34f830e..a1a990c52 100644 --- a/python/guilds/clearance.py +++ b/python/guilds/clearance.py @@ -7,30 +7,30 @@ import string activator=Crossfire.WhoIsActivator() activatorname=activator.Name mymap = activator.Map -def find_player(object): - while (object.Type != 1) : #1 is type 'Player' - object = object.Above - if not object: - return 0 - return object - - - - -whoami=Crossfire.WhoAmI() +def find_player(object): + while (object.Type != 1) : #1 is type 'Player' + object = object.Above + if not object: + return 0 + return object + + + + +whoami=Crossfire.WhoAmI() texta=string.split(Crossfire.WhatIsMessage()) -if (texta[0] == 'enter') or (texta[0] == 'Enter'): +if (texta[0] == 'enter') or (texta[0] == 'Enter'): if (activator.DungeonMaster ==1): ApprovedClearanceLevel = 5 - + Clearancerq=Crossfire.ScriptParameters() # 6 is say event - x1 = activator.X - Y1 = activator.Y + x1 = activator.X + Y1 = activator.Y x= 26 - y=0 + y=0 text = string.split(Clearancerq) guildname = text[0] diff --git a/python/guilds/guild_dues.py b/python/guilds/guild_dues.py index bda3c07dc..d7dcd30de 100644 --- a/python/guilds/guild_dues.py +++ b/python/guilds/guild_dues.py @@ -24,7 +24,11 @@ import string import sys import CFBank import CFMail +import CFLog +log = CFLog.CFLog() +priceMailScroll = 5 +priceFactor = 50 guildname=Crossfire.ScriptParameters() # 6 is say event if (guildname): @@ -33,12 +37,22 @@ activator=Crossfire.WhoIsActivator() in_guild=CFGuilds.SearchGuilds(activator.Name) bankdatabase = "ImperialBank_DB" bank = CFBank.CFBank(bankdatabase) +def find_mailbox(object): + + while (object.Name != 'mailbox') : #1 is type 'Player' + + object = object.Above + if not object: + + return 0 + return object +global whoami - - +X=activator.X +Y=activator.Y x=6 y=7 x1=31 @@ -55,7 +69,11 @@ activator=Crossfire.WhoIsActivator() activatorname=activator.Name mymap = activator.Map whoami=Crossfire.WhoAmI() + if whoami.Name=='Jack': + Items={'BBQ':200*30000/5000, 'Stove':200*30000/5000, 'AlchemyLab':400*30000/5000, 'Cauldron':200*30000/5000, "CrystalRoom":100,"Tannery":200*30000/5000,"ThaumaturgyRoom":200*30000/5000,"JewelrsRoom":400*30000/5000,"ThaumaturgyDesk":200*30000/5000,"TanningDesk":200*30000/5000,"JewelrsBench":400*30000/5000,\ + "Bowyer":200*30000/5000,"BowyerBench":200*25000/5000,"Smithy":200*30000/5000,"Forge":200*25000/5000} + Cards=["Stove","Cauldron","TanningDesk","ThaymaturgyDesk","JewelrsBench","BowyerBench","Forge"] remarklist = ['Excellent','Thank You','Thank You','Thank You', 'Thank You', 'Great', 'OK', 'Wonderful', 'Swell', 'Dude', 'Big Spender'] exclaimlist = ['Hey','Hey','Hey','Hey', 'Now just a minute', 'AHEM', 'OK...Wait a minute', 'Look chowderhead'] buddylist = ['buddy','buddy','buddy','buddy','pal','friend','friend','friend','friend','dude','chum', 'sweetie'] @@ -63,7 +81,11 @@ if whoami.Name=='Jack': guildname=Crossfire.ScriptParameters() # 6 is say event accountname=guildname+str(guildname.__hash__()) text = Crossfire.WhatIsMessage().split() - + path=mymap.Path + path=path.replace("mainfloor","") + SecondFloor=Crossfire.ReadyMap(path+'secondfloor') + ToolShed=Crossfire.ReadyMap(path+"guild_toolshed") + Rooms={"BBQ":(mymap,40,25),"AlchemyLab":(SecondFloor,22,12),"CrystalRoom":(SecondFloor,22,13),"Tannery":(SecondFloor,22,14),"ThaumaturgyRoom":(SecondFloor,21,13),"JewelrsRoom":(SecondFloor,22,14),"Bowyer":(ToolShed,22,16),"Smithy":(ToolShed,23,16)} if (guildname): @@ -71,9 +93,150 @@ if whoami.Name=='Jack': cointype = "jadecoin" #What type of token are we using for guild dues? object = activator.CheckInventory(cointype) if text[0].upper() == 'HELP' or text[0].upper() == 'YES': - message='Let me know how many jade coins you want to pay. Say pay \nYou can also check the balance by saying "balance".' + message='Let me know how many jade coins you want to pay. Say pay \nYou can also check the balance by saying "balance".\nGuild Masters can also purchase items with the "buy" command.\nI also provide mailscrolls at 10 plat each.' + elif text[0].upper()=="BUY": + + try: + + Item=text[1] + + except: + + Item=None + message="Syntax: Buy \n Valid items are: " + for i in Items: + message+=i+", " + message=message[:len(message)-2] + message+='.' + + if Item!=None: + if activator.DungeonMaster==1: + ClearanceApproved=5 + else: + if guild.info(activatorname)!=0: + text1=string.split(str(guild.info(activatorname))) + + + ClearanceApproved = (text1[5]) + if ClearanceApproved=="GuildMaster": + ClearanceAproved=5 + else: + ClearanceApproved=0 + + if ClearanceApproved<5: + + message="Only guild masters and GMs can buy expansions for the guild." + else: + + try: + Price=Items.get(Item) + except: + Item=None + Price=None + message="Syntax: Buy \n Valid items are: " + for i in Items: + message+=i+", " + message=message[:len(message)-2] + message+='.' + + if Price!=None: + balance=bank.getbalance(accountname) + if Price<=balance: + Card=False + for i in Cards: + if i == Item: + Card=True + if Card==True: + + pack=activator.Map.CreateObject('package', 40, 29) + pack.Name = 'IPO-package F: ACME T: ' + guildname + card=mymap.CreateObject('diploma',40,29) + card.Name=Item + + + message = "Your card has been ordered and should arrive in the mail shortly." + + mailbox=mymap.ObjectAt(12,21) + + mailbox=find_mailbox(mailbox) + if mailbox==0: + mailbox=mymap.ObjectAt(30,5) + mailbox=find_mailbox(mailbox) + if mailbox==0: + message+=" The postman couldn't find the mailbox. Please contact a DM to install your mailbox." + else: + cardnew=card.InsertInto(pack) + packnew=pack.InsertInto(mailbox) + bank.withdraw(accountname, Price) + else: + Loc=Rooms.get(Item) + + activator.Teleport(Loc[0],Loc[1],Loc[2]) + + activator.Teleport(mymap,X,Y) + bank.withdraw(accountname, Price) + else: + message="The guild does not have sufficient funds." + elif text[0] == 'mailscroll': + if len(text) == 2: + if log.info(text[1]): + if activator.PayAmount(priceMailScroll*priceFactor*2): + whoami.Say('Here is your mailscroll') + id = activator.Map.CreateObject('scroll', X, Y) + id.Name = 'mailscroll T: '+text[1]+' F: '+activatorname + id.NamePl = 'mailscrolls T: '+text[1]+' F: '+activatorname + id.Value = 0 + else: + whoami.Say('You need %s platinum for a mailscroll'%priceMailScroll) + else: + whoami.Say('I don\'t know %s'%text[1]) + + else: + whoami.Say('Usage "mailscroll "') elif text[0].upper()=='WITHDRAW': - message='not implemented quite yet...' + if activator.DungeonMaster==1: + ClearanceApproved=5 + else: + if guild.info(activatorname)!=0: + text1=string.split(str(guild.info(activatorname))) + + + ClearanceApproved = (text1[5]) + if ClearanceApproved=="GuildMaster": + ClearanceAproved=5 + else: + ClearanceApproved=0 + + if ClearanceApproved<5: + + message="Only guild masters and GMs can withdraw funds from the guild." + else: + try: + Amount=int(text[1]) + + + except: + message = "Syntax: Withdraw " + Amount=None + + if Amount!=None: + balance=bank.getbalance(accountname) + + if Amount <= balance: + + message=(str(Amount)) + + message+=" Jade coins withdrawn.\nYour new present balance is " + + id = activator.Map.CreateObject('jadecoin', activator.X, activator.Y) + bank.withdraw(accountname, Amount) + CFItemBroker.Item(id).add(Amount) + activator.Take(id) + message+=str(bank.getbalance(accountname))+"." + else: + message="You only have "+str(bank.getbalance(accountname))+" Jade coins on account." + + elif text[0].upper()=='BALANCE': balance=bank.getbalance(accountname) message="The guild currently has %s Jade coins on deposit" %(str(balance)) @@ -113,19 +276,6 @@ if whoami.Name=='Jack': else: accountname=guildname+str(guildname.__hash__()) - balance=bank.getbalance(accountname) - whoami.Say(str(balance)) - x = activator.X - y = activator.Y - amount=int(balance) - - if amount <= 0: - message = 'No dues have been paid.' - else: - message = '%d dues withdrawn.' % amount - bank.withdraw(accountname, amount) - id = activator.Map.CreateObject('jadecoin', x, y) - CFItemBroker.Item(id).add(amount) - activator.Take(id) - + bank.deposit(accountname,1) + \ No newline at end of file diff --git a/templates/guild/guild_alchemy b/templates/guild/guild_alchemy index e35871611..28d563741 100644 --- a/templates/guild/guild_alchemy +++ b/templates/guild/guild_alchemy @@ -12,7 +12,7 @@ Creator: CF Java Map Editor Date: 4/8/2007 Map finised by: Alestan jehloq@yahoo.com Date: 8/27/2007 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg end arch woodfloor @@ -690,13 +690,13 @@ x 6 y 7 end arch altar_trigger -name New Cauldron 30000 Rubies -slaying ruby +name New Cauldron +slaying Cauldron msg Removing your old cauldron. Please wait. endmsg exp 60 -food 30000 +food 1 x 6 y 7 connected 9001 diff --git a/templates/guild/guild_bbq b/templates/guild/guild_bbq index 490531d83..057e2cec8 100644 --- a/templates/guild/guild_bbq +++ b/templates/guild/guild_bbq @@ -13,7 +13,7 @@ Editor: CrossfireEditor Date: 3/15/2007 Map finised by: Alestan jehloq@yahoo.com Date: 8/27/2007 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg outdoor 1 end @@ -290,13 +290,13 @@ y 8 unique 1 end arch altar_trigger -name New Stove 30000 Rubies -slaying ruby +name New Stove +slaying Stove msg Removing your old stove. Please wait. endmsg exp 60 -food 30000 +food 1 x 2 y 8 connected 9002 diff --git a/templates/guild/guild_jeweler b/templates/guild/guild_jeweler index 6ad6d57d8..515ecde23 100644 --- a/templates/guild/guild_jeweler +++ b/templates/guild/guild_jeweler @@ -13,7 +13,7 @@ Editor: CrossfireEditor Date: 3/19/2007 Map finised by: Alestan jehloq@yahoo.com Date: 8/27/2007 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg end arch woodfloor @@ -570,13 +570,13 @@ y 8 unique 1 end arch altar_trigger -name New Jeweler's Workbench 30000 Diamonds -slaying diamond +name New Jeweler's Workbench +slaying JewelrsBench msg Removing your old cauldron. Please wait. endmsg exp 60 -food 30000 +food 1 x 5 y 8 connected 8001 diff --git a/templates/guild/guild_tan b/templates/guild/guild_tan index dfa1e26b1..89a30e6a3 100644 --- a/templates/guild/guild_tan +++ b/templates/guild/guild_tan @@ -6,7 +6,7 @@ height 11 msg Creator: Default Date: 2008-06-24 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg end arch woodfloor @@ -183,13 +183,13 @@ y 9 unique 1 end arch altar_trigger -name New Tanning Bench 30000 Rubies -slaying ruby +name New Tanning Bench +slaying TanningDesk msg Removing your old cauldron. Please wait. endmsg exp 60 -food 30000 +food 1 x 1 y 9 connected 8002 diff --git a/templates/guild/guild_thaum b/templates/guild/guild_thaum index 854d23726..82a476fc4 100644 --- a/templates/guild/guild_thaum +++ b/templates/guild/guild_thaum @@ -13,7 +13,7 @@ Editor: CrossfireEditor Date: 3/19/2007 Map finised by: Alestan jehloq@yahoo.com Date: 8/27/2007 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg end arch woodfloor @@ -153,13 +153,13 @@ y 5 unique 1 end arch altar_trigger -name New Thaumaturge Desk 30000 Rubies -slaying ruby +name New Thaumaturge Desk +slaying ThaymaturgyDesk msg Removing your old cauldron. Please wait. endmsg exp 60 -food 30000 +food 1 x 1 y 5 connected 8002 diff --git a/templates/guild/guild_toolshed b/templates/guild/guild_toolshed index 2327a2867..57fd54b51 100644 --- a/templates/guild/guild_toolshed +++ b/templates/guild/guild_toolshed @@ -13,7 +13,7 @@ Editor: CrossfireEditor Date: 3/17/2007 Map finised by: Alestan jehloq@yahoo.com Date: 8/27/2007 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg end arch grass @@ -269,28 +269,6 @@ x 2 y 9 unique 1 end -arch dungeon_magic -x 2 -y 9 -end -arch creator -other_arch flagstone -x 2 -y 9 -connected 76 -arch flagstone -unique 1 -end -end -arch goldfloor -name drop 30,000 rubies for a forge -slaying ruby -food 30000 -x 2 -y 9 -connected 130 -unique 1 -end arch flagstone x 2 y 10 @@ -543,13 +521,13 @@ y 9 unique 1 end arch altar_trigger -name New Forge 25,000 Rubies -slaying ruby +name New Forge +slaying Forge msg Removing your old cauldron. Please wait. endmsg exp 60 -food 25000 +food 1 x 4 y 9 connected 8004 @@ -1294,15 +1272,6 @@ y 4 no_magic 1 unique 1 end -arch button_lever -name Dues -msg -Pull to collect fees for the toolshed. -endmsg -x 10 -y 4 -connected 999 -end arch flagstone x 10 y 5 @@ -1747,6 +1716,11 @@ x 13 y 4 unique 1 end +arch firepot +x 13 +y 4 +glow_radius 4 +end arch flagstone x 13 y 5 @@ -1757,11 +1731,6 @@ x 13 y 6 unique 1 end -arch firepot -x 13 -y 6 -glow_radius 4 -end arch flagstone x 13 y 7 @@ -2039,6 +2008,11 @@ x 15 y 4 unique 1 end +arch firepot +x 15 +y 4 +glow_radius 4 +end arch flagstone x 15 y 5 @@ -2049,11 +2023,6 @@ x 15 y 6 unique 1 end -arch firepot -x 15 -y 6 -glow_radius 4 -end arch flagstone x 15 y 7 @@ -2177,13 +2146,13 @@ y 9 unique 1 end arch altar_trigger -name New Workbench 25,000 Rubies -slaying ruby +name New Workbench +slaying BowyerBench msg Removing your old cauldron. Please wait. endmsg exp 60 -food 25000 +food 1 x 16 y 9 connected 8005 @@ -2409,28 +2378,6 @@ x 18 y 9 unique 1 end -arch dungeon_magic -x 18 -y 9 -end -arch creator -other_arch flagstone -x 18 -y 9 -connected 76 -arch flagstone -unique 1 -end -end -arch goldfloor -name drop 30,000 rubies for a workbench -slaying ruby -food 30000 -x 18 -y 9 -connected 120 -unique 1 -end arch flagstone x 18 y 10 @@ -2821,6 +2768,14 @@ x 21 y 15 end arch blocked +x 21 +y 16 +end +arch blocked +x 21 +y 17 +end +arch blocked x 22 end arch blocked @@ -2883,6 +2838,11 @@ arch blocked x 22 y 15 end +arch button_small +x 22 +y 16 +connected 120 +end arch lightningwall_5 x 23 speed 0.0 @@ -3049,6 +3009,11 @@ arch director_1 x 23 y 10 end +arch button_small +x 23 +y 16 +connected 130 +end arch blocked x 24 end @@ -3257,33 +3222,24 @@ x 27 last_sp 1 connected 121 unique 1 +arch event_trigger +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end end arch flagstone x 27 y 1 unique 1 end -arch creator -other_arch jadecoin -x 27 -y 1 -connected 121 -lifesave 1 -end -arch teleporter -hp 10 -sp 4 -x 27 -y 1 -speed 0.0 -connected 999 -end arch flagstone x 27 y 2 unique 1 end arch teleporter +name GUILD_TEMPLATE hp 2 sp 8 x 27 @@ -3300,27 +3256,16 @@ y 2 last_sp 1 connected 131 unique 1 +arch event_trigger +title Python +slaying /python/guilds/guild_dues.py +end end arch flagstone x 27 y 3 unique 1 end -arch creator -other_arch jadecoin -x 27 -y 3 -connected 131 -lifesave 1 -end -arch teleporter -hp 10 -sp 4 -x 27 -y 3 -speed 0.0 -connected 999 -end arch blocked x 27 y 4 diff --git a/templates/guild/mainfloor b/templates/guild/mainfloor index 3aebcb323..18ea6e3da 100644 --- a/templates/guild/mainfloor +++ b/templates/guild/mainfloor @@ -15,7 +15,7 @@ Avion Date: 11/19/2004 Map finised by: Alestan jehloq@yahoo.com Date: 8/27/2007 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg outdoor 1 end @@ -1026,15 +1026,6 @@ x 4 y 4 unique 1 end -arch button_lever -name BBQ Reset Access -msg -Pull to let unwanted guests out. -endmsg -x 4 -y 4 -connected 7200 -end arch dungeon_magic x 4 y 5 @@ -1045,18 +1036,13 @@ y 5 unique 1 end arch button_lever -name Guild Dues +name BBQ Reset Access msg -Pull to pay out dues and fees. +Pull to let unwanted guests out. endmsg x 4 y 5 -connected 999 -arch event_apply -name GUILD_TEMPLATE -title Python -slaying /python/guilds/guild_dues.py -end +connected 7200 end arch woodfloor x 4 @@ -7871,33 +7857,6 @@ arch grass x 25 y 22 end -arch grass -x 25 -y 22 -move_block swim boat -unique 1 -end -arch dungeon_magic -x 25 -y 22 -end -arch creator -other_arch grass -x 25 -y 22 -connected 110 -arch grass -end -end -arch goldfloor -name drop 30,000 rubies for stove -slaying ruby -food 30000 -x 25 -y 22 -connected 110 -unique 1 -end arch dungeon_magic x 25 y 23 @@ -9228,6 +9187,11 @@ x 30 y 4 last_sp 1 connected 11100 +arch event_trigger +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end end arch grass x 30 @@ -11511,6 +11475,29 @@ arch blocked x 40 y 8 end +arch dungeon_magic +x 40 +y 10 +end +arch woodfloor +x 40 +y 10 +unique 1 +end +arch button_lever +name Guild Dues +msg +Pull to pay out dues and fees. +endmsg +x 40 +y 10 +connected 999 +arch event_apply +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end +end arch blocked x 40 y 11 @@ -11615,3 +11602,17 @@ arch blocked x 40 y 24 end +arch button_small +x 40 +y 25 +connected 110 +end +arch card +name Generic Token +name_pl Generic Tokens +slaying Generic Token +x 40 +y 29 +value 800 +identified 1 +end diff --git a/templates/guild/secondfloor b/templates/guild/secondfloor index 6dec09500..a93cd7f96 100644 --- a/templates/guild/secondfloor +++ b/templates/guild/secondfloor @@ -11,7 +11,7 @@ Creator: majorwoo josh@woosworld.net Date: 11/19/2004 Map finised by: Alestan jehloq@yahoo.com Date: 8/27/2007 -Modified: 2009-12-12 perkins +Modified: 2010-02-27 perkins endmsg end arch dungeon_magic @@ -733,29 +733,6 @@ unique 1 end arch dungeon_magic x 1 -y 10 -end -arch creator -other_arch woodfloor -x 1 -y 10 -connected 10 -end -arch woodfloor -x 1 -y 10 -unique 1 -end -arch goldfloor -name drop 15 diamonds of exceptional beauty for Jewelers room -slaying diamond of exceptional beauty -food 15 -x 1 -y 10 -connected 10 -end -arch dungeon_magic -x 1 y 11 end arch woodfloor @@ -3014,6 +2991,11 @@ food 100 x 7 y 8 connected 52 +arch event_trigger +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end end arch dungeon_magic x 7 @@ -3825,21 +3807,6 @@ x 10 y 8 unique 1 end -arch creator -other_arch woodfloor -x 10 -y 8 -connected 50 -end -arch goldfloor -name drop 30,000 rubies for Tannery room -slaying ruby -food 30000 -x 10 -y 8 -connected 50 -activate_on_release 0 -end arch dungeon_magic x 10 y 9 @@ -4012,20 +3979,6 @@ x 11 y 1 unique 1 end -arch creator -other_arch woodfloor -x 11 -y 1 -connected 40 -end -arch goldfloor -name drop 100 jade coins for Glowing Crystal Room -slaying jadecoin -food 100 -x 11 -y 1 -connected 40 -end arch dungeon_magic x 11 y 2 @@ -4555,20 +4508,6 @@ x 13 y 8 unique 1 end -arch creator -other_arch woodfloor -x 13 -y 8 -connected 30 -end -arch goldfloor -name drop 30,000 diamonds for Alchemy room -slaying diamond -food 30000 -x 13 -y 8 -connected 30 -end arch dungeon_magic x 13 y 9 @@ -4699,20 +4638,6 @@ x 13 y 18 unique 1 end -arch creator -other_arch woodfloor -x 13 -y 18 -connected 20 -end -arch goldfloor -name drop 30,000 rubies for Thaumaturgy room -slaying ruby -food 30000 -x 13 -y 18 -connected 20 -end arch woodfloor x 13 y 19 @@ -5278,15 +5203,6 @@ x 15 y 18 unique 1 end -arch button_lever -name Guild Dues -msg -Pull to pay out dues and fees. -endmsg -x 15 -y 18 -connected 999 -end arch woodfloor x 15 y 19 @@ -6079,6 +5995,11 @@ food 200 x 20 y 11 connected 11 +arch event_trigger +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end end arch teleporter hp 15 @@ -6095,6 +6016,11 @@ food 100 x 20 y 12 connected 31 +arch event_trigger +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end end arch teleporter hp 11 @@ -6268,6 +6194,11 @@ food 100 x 21 y 11 connected 21 +arch event_trigger +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end end arch teleporter hp 10 @@ -6284,6 +6215,21 @@ food 100 x 21 y 12 connected 41 +arch event_trigger +name GUILD_TEMPLATE +title Python +slaying /python/guilds/guild_dues.py +end +end +arch button_small +x 21 +y 13 +connected 20 +end +arch button_small +x 21 +y 14 +connected 10 end arch blocked x 21 @@ -6364,6 +6310,21 @@ sp 1 x 22 y 8 end +arch button_small +x 22 +y 12 +connected 30 +end +arch button_small +x 22 +y 13 +connected 40 +end +arch button_small +x 22 +y 14 +connected 50 +end arch woodfloor2 x 22 y 15