| 1 |
root |
1.1 |
#SlotMachine configuration file |
| 2 |
|
|
#to make a new kind of slot machine, copy this file, change the settings and point the slotmachine to the new file. |
| 3 |
|
|
# Standard type Gold Slots |
| 4 |
|
|
|
| 5 |
|
|
import Crossfire |
| 6 |
|
|
import CFGamble |
| 7 |
|
|
import CFItemBroker |
| 8 |
|
|
|
| 9 |
|
|
activator=Crossfire.WhoIsActivator() |
| 10 |
|
|
activatorname=activator.Name |
| 11 |
|
|
whoami=Crossfire.WhoAmI() |
| 12 |
|
|
#gets slot name and adds map name for unique jackpot |
| 13 |
|
|
slotname= '%s#%s' %(whoami.Name,whoami.Map.Path) |
| 14 |
|
|
x=activator.X |
| 15 |
|
|
y=activator.Y |
| 16 |
|
|
|
| 17 |
|
|
cointype = "goldcoin" #What type of coin is this slotmachine using? |
| 18 |
|
|
minpot = 100 #Minimum slot jackpot size |
| 19 |
|
|
maxpot = 50000 #Maxiumum slot jackpot size |
| 20 |
|
|
cost = 1 #Price of usage |
| 21 |
|
|
|
| 22 |
|
|
#Change the items on the slot spinner or the number of items. |
| 23 |
|
|
slotlist = ["Club", "Staff", "Shield", "Sword", "Wand", "Scroll", "JackPot"] |
| 24 |
|
|
|
| 25 |
|
|
spinners = 4 #How many spinners on the slotmachine? |
| 26 |
|
|
|
| 27 |
|
|
|
| 28 |
|
|
Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) |
| 29 |
|
|
|
| 30 |
|
|
if (activator.PayAmount(cost*10)):#goldcoin |
| 31 |
|
|
Slots.placebet(cost) |
| 32 |
|
|
results = Slots.spin(spinners) |
| 33 |
|
|
pay = 0 |
| 34 |
|
|
pot = Slots.checkslot() |
| 35 |
|
|
activator.Write('%s' %results, 7) |
| 36 |
|
|
for item in results: |
| 37 |
|
|
#match all but one - pays out by coin e.g 3 to 1 or 4 to 1 |
| 38 |
|
|
if results.count(item) == spinners-1: |
| 39 |
|
|
if item == "Club": |
| 40 |
|
|
pay = 1 |
| 41 |
|
|
elif item == "Staff": |
| 42 |
|
|
pay = 2 |
| 43 |
|
|
elif item == "Shield": |
| 44 |
|
|
pay = 3 |
| 45 |
|
|
elif item == "Sword": |
| 46 |
|
|
pay = 4 |
| 47 |
|
|
elif item == "Wand": |
| 48 |
|
|
pay = 5 |
| 49 |
|
|
elif item == "Scroll": |
| 50 |
|
|
pay = 10 |
| 51 |
|
|
elif item == "JackPot": |
| 52 |
|
|
pay = 20 |
| 53 |
|
|
else: |
| 54 |
|
|
break |
| 55 |
|
|
activator.Write("%d %ss, a minor win!" %(spinners-1,item)) |
| 56 |
|
|
payoff = cost*pay |
| 57 |
|
|
Slots.payoff(payoff) |
| 58 |
|
|
id = activator.Map.CreateObject(cointype, x, y) |
| 59 |
|
|
CFItemBroker.Item(id).add(payoff) |
| 60 |
|
|
if payoff == 1: |
| 61 |
|
|
message = "you win %d %s!" %(payoff,cointype) |
| 62 |
|
|
else: |
| 63 |
|
|
message = "You win %d %ss!!" %(payoff,cointype) |
| 64 |
|
|
break |
| 65 |
|
|
elif results.count(item) == spinners: |
| 66 |
|
|
#all match - pays out as percent of pot |
| 67 |
|
|
activator.Write('%d %ss, a Major win!' %(spinners,item)) |
| 68 |
|
|
if item == "Club": |
| 69 |
|
|
pay = .10 |
| 70 |
|
|
elif item == "Staff": |
| 71 |
|
|
pay = .15 |
| 72 |
|
|
elif item == "Shield": |
| 73 |
|
|
pay = .20 |
| 74 |
|
|
elif item == "Sword": |
| 75 |
|
|
pay = .25 |
| 76 |
|
|
elif item == "Wand": |
| 77 |
|
|
pay = .35 |
| 78 |
|
|
elif item == "Scroll": |
| 79 |
|
|
pay = .50 |
| 80 |
|
|
elif item == "JackPot": |
| 81 |
|
|
pay = 1 |
| 82 |
|
|
payoff = pot*pay |
| 83 |
|
|
Slots.payoff(payoff) |
| 84 |
|
|
id = activator.Map.CreateObject(cointype, x, y) |
| 85 |
|
|
CFItemBroker.Item(id).add(payoff) |
| 86 |
|
|
if payoff == 1: |
| 87 |
|
|
message = "you win %d %s!" %(payoff,cointype) |
| 88 |
|
|
else: |
| 89 |
|
|
message = "You win %d %ss!!" %(payoff,cointype) |
| 90 |
|
|
break |
| 91 |
|
|
else: |
| 92 |
|
|
message = "Better luck next time!" |
| 93 |
|
|
activator.Write(message) |
| 94 |
|
|
activator.Write("%d in the Jackpot, Play again?" %Slots.checkslot()) |
| 95 |
|
|
else: |
| 96 |
|
|
activator.Write("Sorry, you do not have enough money") |