| 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') |