ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/deliantra/maps/python/casino/goldslots.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 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")