Adapted the casino-related scripts to CFPython 2.0.
Gros - 18/10/2005 git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@3900 282e977c-c81d-0410-88c4-b93c2d0d6712master
							parent
							
								
									3b77421609
								
							
						
					
					
						commit
						098e3e2016
					
				|  | @ -3,31 +3,31 @@ | ||||||
| #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 | ||||||
| maxpot = 10000 #Maxiumum slot jackpot size | maxpot = 10000 #Maxiumum slot jackpot size | ||||||
| cost = 1 #Price of usage | cost = 1 #Price of usage | ||||||
| 
 | 
 | ||||||
| #Change the items on the slot spinner or the number of items.     | #Change the items on the slot spinner or the number of items. | ||||||
| slotlist = ["Silver", "Gold", "Platinum", "Sapphire", "Emerald", "Ruby", "Diamond", "JackPot"] | slotlist = ["Silver", "Gold", "Platinum", "Sapphire", "Emerald", "Ruby", "Diamond", "JackPot"] | ||||||
| 
 | 
 | ||||||
| spinners = 4 #How many spinners on the slotmachine? | spinners = 4 #How many spinners on the slotmachine? | ||||||
| 
 | 
 | ||||||
| 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): | ||||||
|  | @ -35,7 +35,7 @@ if (object): | ||||||
|        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: | ||||||
|  | @ -57,19 +57,19 @@ if (object): | ||||||
|                 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) | ||||||
|              else: |              else: | ||||||
|                 message = "You win %d %ss!!" %(payoff,cointype)	 |                 message = "You win %d %ss!!" %(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": | ||||||
|  | @ -88,18 +88,18 @@ if (object): | ||||||
|                 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) | ||||||
|              else: |              else: | ||||||
|                 message = "You win %d %ss!!" %(payoff,cointype)	 |                 message = "You win %d %ss!!" %(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)) | ||||||
|  |  | ||||||
|  | @ -2,24 +2,24 @@ | ||||||
| #to make a new kind of slot machine, copy this file, change the settings and point the slotmachine to the new file. | #to make a new kind of slot machine, copy this file, change the settings and point the slotmachine to the new file. | ||||||
| # Standard type Gold Slots | # Standard type Gold Slots | ||||||
| 
 | 
 | ||||||
| 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 = "goldcoin" #What type of coin is this slotmachine using?	 | cointype = "goldcoin" #What type of coin is this slotmachine using? | ||||||
| minpot = 100 #Minimum slot jackpot size	 | minpot = 100 #Minimum slot jackpot size | ||||||
| maxpot = 50000 #Maxiumum slot jackpot size | maxpot = 50000 #Maxiumum slot jackpot size | ||||||
| cost = 1 #Price of usage | cost = 1 #Price of usage | ||||||
| 
 | 
 | ||||||
| #Change the items on the slot spinner or the number of items.     | #Change the items on the slot spinner or the number of items. | ||||||
| slotlist = ["Club", "Staff", "Shield", "Sword", "Wand", "Scroll", "JackPot"] | slotlist = ["Club", "Staff", "Shield", "Sword", "Wand", "Scroll", "JackPot"] | ||||||
| 
 | 
 | ||||||
| spinners = 4 #How many spinners on the slotmachine? | spinners = 4 #How many spinners on the slotmachine? | ||||||
|  | @ -27,12 +27,12 @@ spinners = 4 #How many spinners on the slotmachine? | ||||||
| 
 | 
 | ||||||
| Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) | Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) | ||||||
| 
 | 
 | ||||||
| if (CFPython.PayAmount(activator, cost*10)):#goldcoin | if (activator.PayAmount(cost*10)):#goldcoin | ||||||
|    Slots.placebet(cost) |    Slots.placebet(cost) | ||||||
|    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: | ||||||
|  | @ -52,19 +52,19 @@ if (CFPython.PayAmount(activator, cost*10)):#goldcoin | ||||||
|             pay = 20 |             pay = 20 | ||||||
|          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) | ||||||
| 	 else: | 	 else: | ||||||
| 	    message = "You win %d %ss!!" %(payoff,cointype)	 | 	    message = "You win %d %ss!!" %(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 == "Club": |          if item == "Club": | ||||||
|             pay = .10 |             pay = .10 | ||||||
|          elif item == "Staff": |          elif item == "Staff": | ||||||
|  | @ -81,16 +81,16 @@ if (CFPython.PayAmount(activator, cost*10)):#goldcoin | ||||||
|             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) | ||||||
| 	 else: | 	 else: | ||||||
| 	    message = "You win %d %ss!!" %(payoff,cointype)	 | 	    message = "You win %d %ss!!" %(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 money",activator) |    activator.Write("Sorry, you do not have enough money") | ||||||
|  |  | ||||||
|  | @ -3,31 +3,31 @@ | ||||||
| #Standard type Imperial Slots | #Standard type Imperial 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 = "imperial" #What type of coin is this slotmachine using?	 | cointype = "imperial" #What type of coin is this slotmachine using? | ||||||
| minpot = 200 #Minimum slot jackpot size	 | minpot = 200 #Minimum slot jackpot size | ||||||
| maxpot = 10000 #Maxiumum slot jackpot size | maxpot = 10000 #Maxiumum slot jackpot size | ||||||
| cost = 1 #Price of usage | cost = 1 #Price of usage | ||||||
| 
 | 
 | ||||||
| #Change the items on the slot spinner or the number of items.     | #Change the items on the slot spinner or the number of items. | ||||||
| slotlist = ["Dread", "Dragon", "Knight", "Wizard", "Titan", "Septre", "Emperor", "JackPot"] | slotlist = ["Dread", "Dragon", "Knight", "Wizard", "Titan", "Septre", "Emperor", "JackPot"] | ||||||
| 
 | 
 | ||||||
| spinners = 4 #How many spinners on the slotmachine? | spinners = 4 #How many spinners on the slotmachine? | ||||||
| 
 | 
 | ||||||
| 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): | ||||||
|  | @ -35,7 +35,7 @@ if (object): | ||||||
|        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: | ||||||
|  | @ -57,19 +57,19 @@ if (object): | ||||||
|                 pay = 20 |                 pay = 20 | ||||||
|              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) | ||||||
|              else: |              else: | ||||||
|                 message = "You win %d %ss!!" %(payoff,cointype)	 |                 message = "You win %d %ss!!" %(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 == "Dread": |              if item == "Dread": | ||||||
|                 pay = .1 |                 pay = .1 | ||||||
|              elif item == "Dragon": |              elif item == "Dragon": | ||||||
|  | @ -88,18 +88,18 @@ if (object): | ||||||
|                 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) | ||||||
|              else: |              else: | ||||||
|                 message = "You win %d %ss!!" %(payoff,cointype)	 |                 message = "You win %d %ss!!" %(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)) | ||||||
|  |  | ||||||
|  | @ -2,24 +2,24 @@ | ||||||
| #to make a new kind of slot machine, copy this file, change the settings and point the slotmachine to the new file. | #to make a new kind of slot machine, copy this file, change the settings and point the slotmachine to the new file. | ||||||
| # Standard type Platinum Slots | # Standard type Platinum Slots | ||||||
| 
 | 
 | ||||||
| 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 = "platinacoin" #What type of coin is this slotmachine using?	 | cointype = "platinacoin" #What type of coin is this slotmachine using? | ||||||
| minpot = 200 #Minimum slot jackpot size	 | minpot = 200 #Minimum slot jackpot size | ||||||
| maxpot = 100000 #Maxiumum slot jackpot size | maxpot = 100000 #Maxiumum slot jackpot size | ||||||
| cost = 1 #Price of usage | cost = 1 #Price of usage | ||||||
| 
 | 
 | ||||||
| #Change the items on the slot spinner or the number of items.     | #Change the items on the slot spinner or the number of items. | ||||||
| slotlist = ["Jester", "Lord", "Lady", "Prince", "Princess", "King", "Queen", "JackPot"] | slotlist = ["Jester", "Lord", "Lady", "Prince", "Princess", "King", "Queen", "JackPot"] | ||||||
| 
 | 
 | ||||||
| spinners = 4 #How many spinners on the slotmachine? | spinners = 4 #How many spinners on the slotmachine? | ||||||
|  | @ -27,12 +27,12 @@ spinners = 4 #How many spinners on the slotmachine? | ||||||
| 
 | 
 | ||||||
| Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) | Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) | ||||||
| 
 | 
 | ||||||
| if (CFPython.PayAmount(activator, cost*50)):#platinumcoin | if (activator.PayAmount(cost*50)):#platinumcoin | ||||||
|    Slots.placebet(cost) |    Slots.placebet(cost) | ||||||
|    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: | ||||||
|  | @ -54,19 +54,19 @@ if (CFPython.PayAmount(activator, cost*50)):#platinumcoin | ||||||
|             pay = 25 |             pay = 25 | ||||||
|          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) | ||||||
| 	 else: | 	 else: | ||||||
| 	    message = "You win %d %ss!!" %(payoff,cointype)	 | 	    message = "You win %d %ss!!" %(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 == "Jester": |          if item == "Jester": | ||||||
|             pay = .1 |             pay = .1 | ||||||
|          elif item == "Lord": |          elif item == "Lord": | ||||||
|  | @ -85,16 +85,16 @@ if (CFPython.PayAmount(activator, cost*50)):#platinumcoin | ||||||
|             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) | ||||||
| 	 else: | 	 else: | ||||||
| 	    message = "You win %d %ss!!" %(payoff,cointype)	 | 	    message = "You win %d %ss!!" %(payoff,cointype) | ||||||
|          break |          break | ||||||
|       else: |       else: | ||||||
|          message = "Better luck next time!" |          message = "Better luck next time!" | ||||||
|    CFPython.Write(message,activator) |    activator.Write(message,activator) | ||||||
|    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 money",activator) |    activator.Write("Sorry, you do not have enough money") | ||||||
|  |  | ||||||
|  | @ -1,24 +1,24 @@ | ||||||
| #SlotMachine configuration file | #SlotMachine configuration file | ||||||
| #to make a new kind of slot machine, copy this file, change the settings and point the slotmachine to the new file. | #to make a new kind of slot machine, copy this file, change the settings and point the slotmachine to the new file. | ||||||
| 
 | 
 | ||||||
| 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 = "silvercoin" #What type of coin is this slotmachine using?	 | cointype = "silvercoin" #What type of coin is this slotmachine using? | ||||||
| minpot = 100 #Minimum slot jackpot size	 | minpot = 100 #Minimum slot jackpot size | ||||||
| maxpot = 50000 #Maxiumum slot jackpot size | maxpot = 50000 #Maxiumum slot jackpot size | ||||||
| cost = 1 #Price of usage | cost = 1 #Price of usage | ||||||
| 
 | 
 | ||||||
| #Change the items on the slot spinner or the number of items.     | #Change the items on the slot spinner or the number of items. | ||||||
| slotlist = ["Merchant", "Coin", "Diamond", "Imp", "Devil", "JackPot"] | slotlist = ["Merchant", "Coin", "Diamond", "Imp", "Devil", "JackPot"] | ||||||
| 
 | 
 | ||||||
| spinners = 4 #How many spinners on the slotmachine? | spinners = 4 #How many spinners on the slotmachine? | ||||||
|  | @ -26,12 +26,12 @@ spinners = 4 #How many spinners on the slotmachine? | ||||||
| 
 | 
 | ||||||
| Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) | Slots=CFGamble.SlotMachine(slotname,slotlist,minpot,maxpot) | ||||||
| 
 | 
 | ||||||
| if (CFPython.PayAmount(activator, cost)):#silvercoin | if (activator.PayAmount(cost)):#silvercoin | ||||||
|    Slots.placebet(cost) |    Slots.placebet(cost) | ||||||
|    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: | ||||||
|  | @ -49,19 +49,19 @@ if (CFPython.PayAmount(activator, cost)):#silvercoin | ||||||
|             pay = 20 |             pay = 20 | ||||||
|          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) | ||||||
| 	 else: | 	 else: | ||||||
| 	    message = "You win %d %ss!!" %(payoff,cointype)	 | 	    message = "You win %d %ss!!" %(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 == "Merchant": |          if item == "Merchant": | ||||||
|             pay = .10 |             pay = .10 | ||||||
|          elif item == "Coin": |          elif item == "Coin": | ||||||
|  | @ -76,16 +76,16 @@ if (CFPython.PayAmount(activator, cost)):#silvercoin | ||||||
|             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) | ||||||
| 	 else: | 	 else: | ||||||
| 	    message = "You win %d %ss!!" %(payoff,cointype)	 | 	    message = "You win %d %ss!!" %(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 money",activator) |    activator.Write("Sorry, you do not have enough money") | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue