| version 1.4 | | version 1.5 |
|---|
| | |
| #Standard type Diamond Slots | | #Standard type Diamond Slots |
| #FYI - This one uses an object for cointype and not the money code :) | | #FYI - This one uses an object for cointype and not the money code :) |
| | | |
| import CFPython | | import Crossfire |
| import CFGamble | | import CFGamble |
| import CFItemBroker | | import CFItemBroker |
| | | |
| activator=CFPython.WhoIsActivator() | | activator=Crossfire.WhoIsActivator() |
| activatorname=CFPython.GetName(activator) | | activatorname=activator.Name |
| whoami=CFPython.WhoAmI() | | whoami=Crossfire.WhoAmI() |
| #gets slot name and adds map name for unique jackpot | | #gets slot name and adds map name for unique jackpot |
| slotname= '%s#%s' %(CFPython.GetName(whoami),CFPython.GetMapPath(CFPython.GetMap(whoami))) | | slotname= '%s#%s' %(whoami.Name,whoami.Map.Path) |
| x=CFPython.GetXPosition(activator) | | x=activator.X |
| y=CFPython.GetYPosition(activator) | | y=activator.Y |
| | | |
| cointype = "gem" #What type of coin is this slotmachine using? | | cointype = "gem" #What type of coin is this slotmachine using? |
| minpot = 200 #Minimum slot jackpot size | | minpot = 200 #Minimum slot jackpot size |
| | |
| | | |
| Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) | | Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) |
| | | |
| object = CFPython.CheckInventory(activator,cointype) | | object = activator.CheckInventory(cointype) |
| if (object): | | if (object): |
| pay = CFItemBroker.Item(object).subtract(cost) | | pay = CFItemBroker.Item(object).subtract(cost) |
| if (pay): | | if (pay): |
| | |
| results = Slots.spin(spinners) | | results = Slots.spin(spinners) |
| pay = 0 | | pay = 0 |
| pot = Slots.checkslot() | | pot = Slots.checkslot() |
| CFPython.Write('%s' %results, activator, 7) | | activator.Write('%s' %results, 7) |
| for item in results: | | for item in results: |
| #match all but one - pays out by coin e.g 3 to 1 or 4 to 1 | | #match all but one - pays out by coin e.g 3 to 1 or 4 to 1 |
| if results.count(item) == spinners-1: | | if results.count(item) == spinners-1: |
| | |
| pay = 15 | | pay = 15 |
| else: | | else: |
| break | | break |
| CFPython.Write("%d %ss, a minor win!" %(spinners-1,item),activator) | | activator.Write("%d %ss, a minor win!" %(spinners-1,item)) |
| payoff = cost*pay | | payoff = cost*pay |
| Slots.payoff(payoff) | | Slots.payoff(payoff) |
| id = CFPython.CreateObject(cointype, (x, y)) | | id = activator.Map.CreateObject(cointype, x, y) |
| CFItemBroker.Item(id).add(payoff) | | CFItemBroker.Item(id).add(payoff) |
| if payoff == 1: | | if payoff == 1: |
| message = "you win %d %s!" %(payoff,cointype) | | message = "you win %d %s!" %(payoff,cointype) |
| | |
| break | | break |
| elif results.count(item) == spinners: | | elif results.count(item) == spinners: |
| #all match - pays out as percent of pot | | #all match - pays out as percent of pot |
| CFPython.Write('%d %ss, a Major win!' %(spinners,item),activator) | | activator.Write('%d %ss, a Major win!' %(spinners,item)) |
| if item == "Silver": | | if item == "Silver": |
| pay = .1 | | pay = .1 |
| elif item == "Gold": | | elif item == "Gold": |
| | |
| pay = 1 | | pay = 1 |
| payoff = pot*pay | | payoff = pot*pay |
| Slots.payoff(payoff) | | Slots.payoff(payoff) |
| id = CFPython.CreateObject(cointype, (x, y)) | | id = activator.Map.CreateObject(cointype, x, y) |
| CFItemBroker.Item(id).add(payoff) | | CFItemBroker.Item(id).add(payoff) |
| if payoff == 1: | | if payoff == 1: |
| message = "you win %d %s!" %(payoff,cointype) | | message = "you win %d %s!" %(payoff,cointype) |
| | |
| break | | break |
| else: | | else: |
| message = "Better luck next time!" | | message = "Better luck next time!" |
| CFPython.Write(message,activator) | | activator.Write(message) |
| CFPython.Write("%d in the Jackpot, Play again?" %Slots.checkslot(),activator) | | activator.Write("%d in the Jackpot, Play again?" %Slots.checkslot()) |
| else: | | else: |
| CFPython.Write("Sorry, you do not have enough %ss" %(cointype),activator) | | activator.Write("Sorry, you do not have enough %ss" %(cointype)) |
| else: | | else: |
| CFPython.Write("Sorry, you do not have any %ss" %(cointype),activator) | | activator.Write("Sorry, you do not have any %ss" %(cointype)) |