ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/maps/python/casino/platinumslots.py
Revision: 1.1
Committed: Sun Feb 5 00:02:09 2006 UTC (20 years, 8 months ago) by root
Content type: text/x-python
Branch point for: UPSTREAM, MAIN
Log Message:
Initial revision

File Contents

# User Rev Content
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 Platinum 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 = "platinacoin" #What type of coin is this slotmachine using?
18     minpot = 200 #Minimum slot jackpot size
19     maxpot = 100000 #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 = ["Jester", "Lord", "Lady", "Prince", "Princess", "King", "Queen", "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*50)):#platinumcoin
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 == "Jester":
40     pay = 1
41     elif item == "Lord":
42     pay = 2
43     elif item == "Lady":
44     pay = 3
45     elif item == "Prince":
46     pay = 4
47     elif item == "Princess":
48     pay = 5
49     elif item == "Queen":
50     pay = 10
51     elif item == "King":
52     pay = 20
53     elif item == "Jackpot":
54     pay = 25
55     else:
56     break
57     activator.Write("%d %ss, a minor win!" %(spinners-1,item))
58     payoff = cost*pay
59     Slots.payoff(payoff)
60     id = activator.Map.CreateObject(cointype, x, y)
61     CFItemBroker.Item(id).add(payoff)
62     if payoff == 1:
63     message = "you win %d %s!" %(payoff,cointype)
64     else:
65     message = "You win %d %ss!!" %(payoff,cointype)
66     break
67     elif results.count(item) == spinners:
68     #all match - pays out as percent of pot
69     activator.Write('%d %ss, a Major win!' %(spinners,item))
70     if item == "Jester":
71     pay = .1
72     elif item == "Lord":
73     pay = .15
74     elif item == "Lady":
75     pay = .25
76     elif item == "Prince":
77     pay = .3
78     elif item == "Princess":
79     pay = .4
80     elif item == "Queen":
81     pay = .5
82     elif item == "King":
83     pay = .6
84     elif item == "JackPot":
85     pay = 1
86     payoff = pot*pay
87     Slots.payoff(payoff)
88     id = activator.Map.CreateObject(cointype, x, y)
89     CFItemBroker.Item(id).add(payoff)
90     if payoff == 1:
91     message = "you win %d %s!" %(payoff,cointype)
92     else:
93     message = "You win %d %ss!!" %(payoff,cointype)
94     break
95     else:
96     message = "Better luck next time!"
97     activator.Write(message)
98     activator.Write("%d in the Jackpot, Play again?" %Slots.checkslot())
99     else:
100     activator.Write("Sorry, you do not have enough money")