Minor cleanup of slot code. Seperated payout values from logic. Still need to clean code up further and eliminate duplicated code.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@4929 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
a9e82d0988
commit
59c3fa1f29
|
@ -23,6 +23,10 @@ cost = 1 #Price of usage
|
|||
#Change the items on the slot spinner or the number of items.
|
||||
slotlist = ["Silver", "Gold", "Platinum", "Sapphire", "Emerald", "Ruby", "Diamond", "JackPot"]
|
||||
|
||||
#Major as percent of pot. Minor as how many times cost
|
||||
slotminor = [1, 2, 3, 4, 5, 6, 10, 15]
|
||||
slotmajor = [.1, .15, .25, .30, .40, .50, .60, 1]
|
||||
|
||||
spinners = 4 #How many spinners on the slotmachine?
|
||||
|
||||
Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot)
|
||||
|
@ -39,22 +43,8 @@ if (object):
|
|||
for item in results:
|
||||
#match all but one - pays out by coin e.g 3 to 1 or 4 to 1
|
||||
if results.count(item) == spinners-1:
|
||||
if item == "Silver":
|
||||
pay = 1
|
||||
elif item == "Gold":
|
||||
pay = 2
|
||||
elif item == "Platinum":
|
||||
pay = 3
|
||||
elif item == "Sapphire":
|
||||
pay = 4
|
||||
elif item == "Emerald":
|
||||
pay = 5
|
||||
elif item == "Ruby":
|
||||
pay = 6
|
||||
elif item == "Diamond":
|
||||
pay = 10
|
||||
elif item == "JackPot":
|
||||
pay = 15
|
||||
if item in slotlist:
|
||||
pay = slotminor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
activator.Write("%d %ss, a minor win!" %(spinners-1,item))
|
||||
|
@ -70,22 +60,10 @@ if (object):
|
|||
elif results.count(item) == spinners:
|
||||
#all match - pays out as percent of pot
|
||||
activator.Write('%d %ss, a Major win!' %(spinners,item))
|
||||
if item == "Silver":
|
||||
pay = .1
|
||||
elif item == "Gold":
|
||||
pay = .15
|
||||
elif item == "Platinum":
|
||||
pay = .25
|
||||
elif item == "Sapphire":
|
||||
pay = .3
|
||||
elif item == "Emerald":
|
||||
pay = .4
|
||||
elif item == "Ruby":
|
||||
pay = .5
|
||||
elif item == "Diamond":
|
||||
pay = .6
|
||||
elif item == "JackPot":
|
||||
pay = 1
|
||||
if item in slotlist:
|
||||
pay = slotmajor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
payoff = pot*pay
|
||||
Slots.payoff(payoff)
|
||||
id = activator.Map.CreateObject(cointype, x, y)
|
||||
|
|
|
@ -22,6 +22,11 @@ cost = 1 #Price of usage
|
|||
#Change the items on the slot spinner or the number of items.
|
||||
slotlist = ["Club", "Staff", "Shield", "Sword", "Wand", "Scroll", "JackPot"]
|
||||
|
||||
#Pay for minor and major wins.
|
||||
#Major as percent of pot. Minor as how many times cost
|
||||
slotminor = [1, 2, 3, 4, 5, 10, 20]
|
||||
slotmajor = [.10, .15, .20, .25, .35, .50, 1]
|
||||
|
||||
spinners = 4 #How many spinners on the slotmachine?
|
||||
|
||||
|
||||
|
@ -36,22 +41,10 @@ if (activator.PayAmount(cost*10)):#goldcoin
|
|||
for item in results:
|
||||
#match all but one - pays out by coin e.g 3 to 1 or 4 to 1
|
||||
if results.count(item) == spinners-1:
|
||||
if item == "Club":
|
||||
pay = 1
|
||||
elif item == "Staff":
|
||||
pay = 2
|
||||
elif item == "Shield":
|
||||
pay = 3
|
||||
elif item == "Sword":
|
||||
pay = 4
|
||||
elif item == "Wand":
|
||||
pay = 5
|
||||
elif item == "Scroll":
|
||||
pay = 10
|
||||
elif item == "JackPot":
|
||||
pay = 20
|
||||
if item in slotlist:
|
||||
pay = slotminor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
break
|
||||
activator.Write("%d %ss, a minor win!" %(spinners-1,item))
|
||||
payoff = cost*pay
|
||||
Slots.payoff(payoff)
|
||||
|
@ -65,20 +58,10 @@ if (activator.PayAmount(cost*10)):#goldcoin
|
|||
elif results.count(item) == spinners:
|
||||
#all match - pays out as percent of pot
|
||||
activator.Write('%d %ss, a Major win!' %(spinners,item))
|
||||
if item == "Club":
|
||||
pay = .10
|
||||
elif item == "Staff":
|
||||
pay = .15
|
||||
elif item == "Shield":
|
||||
pay = .20
|
||||
elif item == "Sword":
|
||||
pay = .25
|
||||
elif item == "Wand":
|
||||
pay = .35
|
||||
elif item == "Scroll":
|
||||
pay = .50
|
||||
elif item == "JackPot":
|
||||
pay = 1
|
||||
if item in slotlist:
|
||||
pay = slotmajor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
payoff = pot*pay
|
||||
Slots.payoff(payoff)
|
||||
id = activator.Map.CreateObject(cointype, x, y)
|
||||
|
|
|
@ -23,6 +23,11 @@ cost = 1 #Price of usage
|
|||
#Change the items on the slot spinner or the number of items.
|
||||
slotlist = ["Dread", "Dragon", "Knight", "Wizard", "Titan", "Septre", "Emperor", "JackPot"]
|
||||
|
||||
#Pay for minor and major wins.
|
||||
#Major as percent of pot. Minor as how many times cost
|
||||
slotminor = [1, 2, 3, 4, 5, 6, 10, 20]
|
||||
slotmajor = [.1, .15, .20, .25, .30, .40, .50, 1]
|
||||
|
||||
spinners = 4 #How many spinners on the slotmachine?
|
||||
|
||||
Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot)
|
||||
|
@ -39,22 +44,8 @@ if (object):
|
|||
for item in results:
|
||||
#match all but one - pays out by coin e.g 3 to 1 or 4 to 1
|
||||
if results.count(item) == spinners-1:
|
||||
if item == "Dread":
|
||||
pay = 1
|
||||
elif item == "Dragon":
|
||||
pay = 2
|
||||
elif item == "Knight":
|
||||
pay = 3
|
||||
elif item == "Wizard":
|
||||
pay = 4
|
||||
elif item == "Titan":
|
||||
pay = 5
|
||||
elif item == "Septre":
|
||||
pay = 6
|
||||
elif item == "Emperor":
|
||||
pay = 10
|
||||
elif item == "JackPot":
|
||||
pay = 20
|
||||
if item in slotlist:
|
||||
pay = slotminor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
activator.Write("%d %ss, a minor win!" %(spinners-1,item))
|
||||
|
@ -70,22 +61,10 @@ if (object):
|
|||
elif results.count(item) == spinners:
|
||||
#all match - pays out as percent of pot
|
||||
activator.Write('%d %ss, a Major win!' %(spinners,item))
|
||||
if item == "Dread":
|
||||
pay = .1
|
||||
elif item == "Dragon":
|
||||
pay = .15
|
||||
elif item == "Knight":
|
||||
pay = .20
|
||||
elif item == "Wizard":
|
||||
pay = .25
|
||||
elif item == "Titan":
|
||||
pay = .30
|
||||
elif item == "Septre":
|
||||
pay = .40
|
||||
elif item == "Emperor":
|
||||
pay = .50
|
||||
elif item == "JackPot":
|
||||
pay = 1
|
||||
if item in slotlist:
|
||||
pay = slotmajor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
payoff = pot*pay
|
||||
Slots.payoff(payoff)
|
||||
id = activator.Map.CreateObject(cointype, x, y)
|
||||
|
|
|
@ -22,6 +22,11 @@ cost = 1 #Price of usage
|
|||
#Change the items on the slot spinner or the number of items.
|
||||
slotlist = ["Jester", "Lord", "Lady", "Prince", "Princess", "King", "Queen", "JackPot"]
|
||||
|
||||
#Pay for minor and major wins.
|
||||
#Major as percent of pot. Minor as how many times cost
|
||||
slotminor = [1, 2, 3, 4, 5, 10, 20, 25]
|
||||
slotmajor = [.1, .15, .25, .3, .4, .5, .6, 1]
|
||||
|
||||
spinners = 4 #How many spinners on the slotmachine?
|
||||
|
||||
|
||||
|
@ -36,24 +41,10 @@ if (activator.PayAmount(cost*50)):#platinumcoin
|
|||
for item in results:
|
||||
#match all but one - pays out by coin e.g 3 to 1 or 4 to 1
|
||||
if results.count(item) == spinners-1:
|
||||
if item == "Jester":
|
||||
pay = 1
|
||||
elif item == "Lord":
|
||||
pay = 2
|
||||
elif item == "Lady":
|
||||
pay = 3
|
||||
elif item == "Prince":
|
||||
pay = 4
|
||||
elif item == "Princess":
|
||||
pay = 5
|
||||
elif item == "Queen":
|
||||
pay = 10
|
||||
elif item == "King":
|
||||
pay = 20
|
||||
elif item == "JackPot":
|
||||
pay = 25
|
||||
if item in slotlist:
|
||||
pay = slotminor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
break
|
||||
activator.Write("%d %ss, a minor win!" %(spinners-1,item))
|
||||
payoff = cost*pay
|
||||
Slots.payoff(payoff)
|
||||
|
@ -67,22 +58,10 @@ if (activator.PayAmount(cost*50)):#platinumcoin
|
|||
elif results.count(item) == spinners:
|
||||
#all match - pays out as percent of pot
|
||||
activator.Write('%d %ss, a Major win!' %(spinners,item))
|
||||
if item == "Jester":
|
||||
pay = .1
|
||||
elif item == "Lord":
|
||||
pay = .15
|
||||
elif item == "Lady":
|
||||
pay = .25
|
||||
elif item == "Prince":
|
||||
pay = .3
|
||||
elif item == "Princess":
|
||||
pay = .4
|
||||
elif item == "Queen":
|
||||
pay = .5
|
||||
elif item == "King":
|
||||
pay = .6
|
||||
elif item == "JackPot":
|
||||
pay = 1
|
||||
if item in slotlist:
|
||||
pay = slotmajor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
payoff = pot*pay
|
||||
Slots.payoff(payoff)
|
||||
id = activator.Map.CreateObject(cointype, x, y)
|
||||
|
|
|
@ -21,6 +21,11 @@ cost = 1 #Price of usage
|
|||
#Change the items on the slot spinner or the number of items.
|
||||
slotlist = ["Merchant", "Coin", "Diamond", "Imp", "Devil", "JackPot"]
|
||||
|
||||
#Pay for minor and major wins.
|
||||
#Major as percent of pot. Minor as how many times cost.
|
||||
slotminor = [1, 2, 4, 5, 10, 20]
|
||||
slotmajor = [.10, .15, .20, .30, .5, 1]
|
||||
|
||||
spinners = 4 #How many spinners on the slotmachine?
|
||||
|
||||
|
||||
|
@ -35,20 +40,10 @@ if (activator.PayAmount(cost)):#silvercoin
|
|||
for item in results:
|
||||
#match all but one - pays out by coin e.g 3 to 1 or 4 to 1
|
||||
if results.count(item) == spinners-1:
|
||||
if item == "Merchant":
|
||||
pay = 1
|
||||
elif item == "Coin":
|
||||
pay = 2
|
||||
elif item == "Diamond":
|
||||
pay = 4
|
||||
elif item == "Imp":
|
||||
pay = 5
|
||||
elif item == "Devil":
|
||||
pay = 10
|
||||
elif item == "JackPot":
|
||||
pay = 20
|
||||
if item in slotlist:
|
||||
pay = slotminor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
break
|
||||
activator.Write("%d %ss, a minor win!" %(spinners-1,item))
|
||||
payoff = cost*pay
|
||||
Slots.payoff(payoff)
|
||||
|
@ -62,18 +57,10 @@ if (activator.PayAmount(cost)):#silvercoin
|
|||
elif results.count(item) == spinners:
|
||||
#all match - pays out as percent of pot
|
||||
activator.Write('%d %ss, a Major win!' %(spinners,item))
|
||||
if item == "Merchant":
|
||||
pay = .10
|
||||
elif item == "Coin":
|
||||
pay = .15
|
||||
elif item == "Diamond":
|
||||
pay = .20
|
||||
elif item == "Imp":
|
||||
pay = .30
|
||||
elif item == "Devil":
|
||||
pay = .50
|
||||
elif item == "JackPot":
|
||||
pay = 1
|
||||
if item in slotlist:
|
||||
pay = slotmajor[slotlist.index(item)]
|
||||
else:
|
||||
break
|
||||
payoff = pot*pay
|
||||
Slots.payoff(payoff)
|
||||
id = activator.Map.CreateObject(cointype, x, y)
|
||||
|
|
Loading…
Reference in New Issue