ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/python/guilds/guild_dues.py
Revision: 1.1.1.1 (vendor branch)
Committed: Sun Feb 5 00:02:09 2006 UTC (18 years, 5 months ago) by root
Content type: text/x-python
Branch: UPSTREAM, MAIN
CVS Tags: post_fixaltar, last_stable, post_fixaltar2, rel-2_82, rel-2_81, rel-2_80, pre_coinconvert, UPSTREAM_2006_03_15, rel-3_0, rel-2_6, rel-2_7, rel-2_4, rel-2_5, rel-2_2, rel-2_0, rel-2_1, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, UPSTREAM_2006_02_01, rel-2_53, pre_material_cfarch_normalize_run, rel-2_32, pre_fixconverter, post_coinconvert, pre_fixaltar2, pre_map_rename, UPSTREAM_2006_02_22, rel-2_90, rel-2_92, rel-2_93, rel-2_78, post_fixconverter, pre_fixaltar, rel-2_61, rel-2_43, rel-2_42, rel-2_41, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
Initial Import

File Contents

# User Rev Content
1 root 1.1 #Script for paying Guild Dues
2     #
3     # This program is free software; you can redistribute it and/or modify
4     # it under the terms of the GNU General Public License as published by
5     # the Free Software Foundation; either version 2 of the License, or
6     # (at your option) any later version.
7     #
8     # This program is distributed in the hope that it will be useful,
9     # but WITHOUT ANY WARRANTY; without even the implied warranty of
10     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11     # GNU General Public License for more details.
12     #
13     # You should have received a copy of the GNU General Public License
14     # along with this program; if not, write to the Free Software
15     # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16     #
17     # author:Avion temitchell@sourceforge.net
18    
19     import Crossfire
20     import CFGuilds
21     import CFItemBroker
22     import random
23     import string
24    
25     activator=Crossfire.WhoIsActivator()
26     activatorname=activator.Name
27     whoami=whoami.WhoAmI()
28    
29     remarklist = ['Excellent','Thank You','Thank You','Thank You', 'Thank You', 'Great', 'OK', 'Wonderful', 'Swell', 'Dude', 'Big Spender']
30     exclaimlist = ['Hey','Hey','Hey','Hey', 'Now just a minute', 'AHEM', 'OK...Wait a minute', 'Look chowderhead']
31     buddylist = ['buddy','buddy','buddy','buddy','pal','friend','friend','friend','friend','dude','chum', 'sweetie']
32    
33     guildname=Crossfire.ScriptParameters() # 6 is say event
34     text = string.split(Crossfire.WhatIsMessage())
35    
36     if (guildname):
37     guild = CFGuilds.CFGuild(guildname)
38     cointype = "imperial" #What type of token are we using for guild dues?
39     object = activator.CheckInventory(cointype)
40    
41     if text[0] == 'help' or text[0] == 'yes':
42     message='Let me know how many %s you want to pay. Say pay <amount>' %cointype
43    
44     elif text[0] == 'pay':
45     if len(text)==2:
46     cost = int(text[1])
47     if (object):
48     pay = CFItemBroker.Item(object).subtract(cost)
49     if (pay):
50     guild.pay_dues(activatorname,cost)
51     message = "%s, %d %s paid to the guild." %(random.choice(remarklist),cost, cointype)
52     else:
53     if cost > 1:
54     message ="%s, you don't have %d %ss." %(random.choice(exclaimlist),cost,cointype)
55     else:
56     message ="You don't have any %s %s." %(cointype,random.choice(buddylist))
57     else:
58     message = "Come back when you got the %ss %s." %(cointype,random.choice(buddylist))
59     else:
60     message = "How much ya wanna pay %s?" %(random.choice(buddylist))
61     else:
62     message = "Howdy %s, paying some guild dues today?" %(random.choice(buddylist))
63     whoami.Say(message)
64     else:
65     activator.Write('Guildname Error, please notify a DM')