ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/python/casino/platinumslots.py
Revision: 1.1.1.1 (vendor branch)
Committed: Sun Feb 5 00:02:09 2006 UTC (18 years, 4 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

# Content
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")