version 1.1 | | version 1.2 |
---|
| | |
# Script for say event of IPO employees | | # Script for say event of Imperial Bank Tellers |
# | | # |
# Copyright (C) 2002 Joris Bontje | | # Copyright (C) 2002 Joris Bontje |
# | | # |
| | |
# | | # |
# The author can be reached via e-mail at jbontje@suespammers.org | | # The author can be reached via e-mail at jbontje@suespammers.org |
# | | # |
#Updated to use new path functions in CFPython and broken apart by -Todd Mitchell | | #Updated to use new path functions in CFPython and broken and modified a bit by -Todd Mitchell |
| | |
| | |
import CFPython | | import CFPython |
| | |
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory())) | | sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory())) |
| | |
import string | | import string |
| | import random |
import CFBank | | import CFBank |
| | |
activator=CFPython.WhoIsActivator() | | activator=CFPython.WhoIsActivator() |
| | |
x=CFPython.GetXPosition(activator) | | x=CFPython.GetXPosition(activator) |
y=CFPython.GetYPosition(activator) | | y=CFPython.GetYPosition(activator) |
| | |
| | |
| | #EASILY SETTABLE PARAMETERS |
| | service_charge=5 #service charges for transactions as a percent |
| | exchange_rate=10000 #exchange rate for silver (value 1) |
| | |
| | |
| | fees=(service_charge/100)+1 |
bank = CFBank.CFBank() | | bank = CFBank.CFBank() |
| | |
text = string.split(CFPython.WhatIsMessage()) | | text = string.split(CFPython.WhatIsMessage()) |
| | thanks_message = ['Thank you for banking the Imperial Way.', 'Thank you, please come again.',\ |
| | 'Thank you. "Service" is our middle name.', 'Thank you for your patronage.', 'Thank you, have a nice day.', \ |
| | 'Thank you. Hows about a big slobbery kiss?'] |
| | |
| | |
| | |
if text[0] == 'help' or text[0] == 'yes': | | if text[0] == 'help' or text[0] == 'yes': |
message = 'Here is a quick list of commands:\n\n- deposit\n- withdraw\n- balance\nAll transactions are in Imperials\n(1 Ip = 1000 platinum coins).' | | message ='You can:\n-deposit,-withdraw,-balance,-exchange \ |
CFPython.Say(whoami,message) | | \nAll transactions are in imperial notes\n(1 : 1000 gold coins). \ |
| | \nA service charge of %d percent will be placed on all deposits' %(service_charge) |
| | |
elif text[0] == 'deposit': | | elif text[0] == 'deposit': |
if len(text)==2: | | if len(text)==2: |
if (CFPython.PayAmount(activator, int(text[1])*50000)): | | if (CFPython.PayAmount(activator, (int(text[1])*exchange_rate)*fees)): |
bank.deposit(activatorname, int(text[1])) | | bank.deposit(activatorname, int(text[1])) |
CFPython.Say(whoami, 'Deposited to bank account') | | message = '%d imperials deposited to bank account. %s' %(int(text[1]),random.choice(thanks_message)) |
else: | | else: |
CFPython.Say(whoami, 'You need %d platinum'%(int(text[1])*1000)) | | message = 'You would need %d gold'%((int(text[1])*(exchange_rate/10))*fees) |
else: | | else: |
CFPython.Say(whoami, 'Usage "deposit <amount Ip>"') | | message = 'Usage "deposit <amount in imperials>"' |
| | |
elif text[0] == 'withdraw': | | elif text[0] == 'withdraw': |
if len(text)==2: | | if len(text)==2: |
if (bank.withdraw(activatorname, int(text[1]))): | | if (bank.withdraw(activatorname, int(text[1]))): |
CFPython.Say(whoami, 'Withdrawn from bank account') | | message = '%d imperials withdrawn from bank account. %s' %(int(text[1]),random.choice(thanks_message)) |
| | id = CFPython.CreateObject('imperial', (x, y)) |
| | CFPython.SetQuantity(id, int(text[1])) |
| | else: |
| | message = 'Not enough imperials on your account' |
| | else: |
| | message = 'Usage "withdraw <amount in imperials>"' |
| | |
| | elif text[0] == 'exchange': |
| | if len(text)==2: |
| | inv=CFPython.CheckInventory(activator,'imperial') |
| | if(inv): |
| | available = CFPython.GetQuantity(inv) |
| | remainder = available - int(text[1]) |
| | if remainder > int(text[1]): |
| | CFPython.SetQuantity(inv, (available - int(text[1]))) |
| | id = CFPython.CreateObject('platinum coin', (x, y)) |
| | CFPython.SetQuantity(id, int(text[1])*(exchange_rate/50)) |
| | message = random.choice(thanks_message) |
| | elif remainder == 0: |
| | CFPython.RemoveObject(inv) |
id = CFPython.CreateObject('platinum coin', (x, y)) | | id = CFPython.CreateObject('platinum coin', (x, y)) |
CFPython.SetQuantity(id, int(text[1])*1000) | | CFPython.SetQuantity(id, int(text[1])*(exchange_rate/50)) |
| | message = random.choice(thanks_message) |
else: | | else: |
CFPython.Say(whoami, 'Not enough Imperials on your account') | | message = 'Sorry, you do not have %d imperials' %int(text[1]) |
else: | | else: |
CFPython.Say(whoami, 'Usage "withdraw <amount Ip>"') | | message = 'Sorry, you do not have %d imperials' %int(text[1]) |
| | else: |
| | message = 'Usage "exchange <amount>" (imperials to platimum coins)' |
| | |
elif text[0] == 'balance': | | elif text[0] == 'balance': |
balance = bank.getbalance(activatorname) | | balance = bank.getbalance(activatorname) |
CFPython.Say(whoami, 'Amount on bank: %d Ip'%balance) | | message = 'Amount in bank: %d Ip'%(balance) |
| | |
else: | | else: |
CFPython.Say(whoami, 'Do you need help?') | | message = 'Do you need help?' |
| | |
| | CFPython.Say(whoami, message) |
| | |