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

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