RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO 2.0 RC1] CEOTurboSlots V1.0b

CEO

Sorceror
[RunUO 2.0 RC1] CEOTurboSlots V1.0e

This is my updated slots to work with RunUO 2.0. Please note the following defines in the source of turboslot.cs:

// Undefine for a "live" shard. See profiling notes below.
#define PROFILE
// Undefine if you are not using RunUo 2.0 (Use this for both RC1 and RC2)
#define RUNUO2RC1
/* Using Arte Gordon's XMLSPAWNER? If so leave "#define XMLSPAWNER" below as is.
* If you do not have XMLSPAWNER installed comment out the line. All this does is
* give you a larger property gump to view the slot's properties.
*/
#define XMLSPAWNER
//
// This section allows you turn of themes and/or options that may not work on your shard
//#define MINIHOUSES (Minihouse theme is not done, I didn't want to delay the update tho)
#define MINIHOUSES_CEORANDOM (will explain later, doesn't matter)

/*
Package Name: CEOTurboSlots
Author: CEO
Version: 1.0b
Public Release: 12/22/05
Purpose: Real Casino style slots. 14 different themes and progressive jackpots.

Description: This package allows you to add casino style slots to your shard. You can choose
* from 14 different themes that all give different symbols, pay outs, and unique options. You can
* also link slots together for progressive jackpots. Some slots can be configured to give item
* rewards. Special "Casino Club" cards are given out to big jackpot winners allowing you to configure
* some slots just for those players. A top ten board is included that will show recent jackpot
* winners as well as give overall shardwide stats for GMs and above.
*
* Themes:

* Classic, ClassicII, ClassicIII: Modeled after real Las Vegas slots!
* FarmerFaceoff: "Nickle" slots with a farm theme.
* GruesomeGambling: Creepy. Bleeds player now and then and throws out bones. Top prize
* Hooded Shroud of Shadows. More deadly in Fel.
* Holiday1: Christmas themed slot.
* LadyLuck: Gives out luck items, sashe, cloak, or robe.
* MinerMadness: The original minermadness with exploit removed, streamlined bonus round gump,
* and is NOT a gold farm slot!
* OffToTheRaces: Inexpensive slot with a racing theme.
* Pirates: Arr mateys. 10gp slot with a priate ship model as top prize.
* PowerScrolls: Very colorful slot, that changes symbols (and top prize) every 4 hours.
* StatScrolls: The harrower! Watchout this one bites, more deadly in Fel.
* TailorTreats: Barbed kits as top prize.
* TrophyHunter: Uses the animal trophy mounts as symbols.
*
* Slots that give rewards have values assigned to the rewards. I spent many hours profiling and simulating
* these slots, the text file, allodds.txt, shows the statistical odds and simulated odds over many spins.
* Over alot of spins, they *will* remove gold from the economy. Some may seem to payout more
* often, but overall players will have fun while losing their shirts. :)

* In general the different odds are as such:
*
* Loose: 96%-98%
* Normal: 93%-96%
* Tight: 89%-92%
* Extremely Tight: 85%-88%
* Casino Cheats: 79%-84% (Not really cheating. The preferred setting for progressive groups.)
* Random: The machine will randomly bounce around from Loose-CasioCheats every 15 minutes.
* This setting can make a slot appear "hot", but then go "cold" after awhile.
*
* The odds tables are pretty accurate for each machine. They use odds distribution tables like real
* casinos with each reel having it's own symbol distribution/odds table.
*
* Note: A player's luck can also affect odds, though it'll be random and reevaluted every 10-15 minutes
* simular to the Random setting. The player will never know whether their luck helped or not. If the "roll" favors
* the player, the machine's odds will be bumped up by one favorable level, maxing out of course at Loose.
*
* The Percentage is basically the payback. For instance, a slot with a 95% payback odds means that
* for every 100gp played 95gp will be returned to the player.
* So over time and alot of spins/plays the casino's take will be 5%.
*
* Progressive Jackpots:
*
* With progressive jackpots you can link groups of machines together. As people play these slots
* a percentage of the gold played is added to what's called a progressive jackpot. This jackpot
* continues to grow until someone hits the "big one" on a linked machine. Progressive jackpots can
* get to be over several million gp and cause a playing "frenzy" as they grow. Because the odds of
* a machine can be dramtically affected, you should only link machines together that cost the same amount
* to play. IE. do not link a 5gp machine to a 100gp progresssive pool as the 5gp machine WILL become
* a gold farm. It's also recommended that progressive machine's odds are setup to be either Extremely
* Tight or Casino Cheats as over time the statistical payout will increase, and may even go over 100%.
* With Normal and Loose odds the machines have the potentional to be gold farms. Even in Extremely/CasinoCheats
* modes odds may go over 100%, odds like that are normal though, and only the machine that "hits" will
* be temporarily in the red and appear to be a gold farm.
*
* To setup a progressive pool, first set one slot machine's properties to ProgIsMaster = true. Then
* point other machine's property of ProgSlotMaster toward the "Master" slot machine. The more
* you link together the faster the jackpot will rise (as people play those machines).
*
* Other Options:
*
* Active(false): Determins whether a slot is available for play. A new slot will default to the
* Classic theme and Active=false allowing you to configure it before putting it
* online.
*
* AnnounceJackpots(True): Does a shardwide annoucement when someone hits a big jackpot.
* CardClubOnly(False): Only players holding a Casino Membership card may play this slot.
* CreditATMIncrements(10000):Amount to add to credit from bank gold in ATM transfer.
* CreditATMLimits:Varies with theme. The maximum amount that can be withdrawn from bank to machines credit.
* CreditCashOutAt:The maximum amount allowed on a machine before a bank check is put in player's backpack.
*
* ErrorCode: For determining the cause of a slot machine failure.
*
* JackpotRewards: Values are None (no item rewards), RewardOnly(jackpot gives items only), or
* RewardAndCash(jackpot gives rewards AND cash). This value only applies to those
* themes that give item rewards.
*
* MembershipCard(True):Issues a Casino membership card to jackpot winners over 500k.
* See CardClubOnly above. Also makes for a useful "bragging" trophy.
*
* PlayerSounds:Usually defaults to true. These slots are noisy! Designed to attract attention like
* real slots.
*
* ProgPercent(5%): The amount of gp played to be put into a progressive jackpot. See above for configuring
* progressive jackpot pools.
*
* Random Max/Min: The amount of time a Random machine stays on one odds table. Used also for when a
* player's luck has affected the odds table.
*
* ResetTotals: Used to reset the slots totals. Usually not recommended as you'll lose your stats.
*
* ShowPayback(false):Not recommended, but will show the slot's current payback amount to players. Note: GMs
* or higher will always be able to see this figure on the slot.
*
* SlotTheme: The current slot's theme. See Above.
*
* TotalCollected: Total amount collected by this slot.
* TotalNetProfit: The Casino's "Take".
* TotalSpins: The number of times the slot has been played.
* TotalWon: The amount of gp payed out to players.
*
* w_Percentage: Statistical odds of the machine.
* WinningPercentage: Real "current" odds of the machine.
*
* zJackpotStats0-S2: The # of times a particular jackpot has been hit. Jackpot 0 is the
* top line, S1 and S2 are scatter counters.
* zReelOne,ReelTwo,ReelThree: The current symbol line.
*
*
* Profiling/Creating your own machine.
*
* While there are already 14 themes to choose from, you might find yourself bored one day
* and decide to create your own unique machine. This can be as simple as changing the symbols
* and odds table to as complex as creating new rewards. To start you will need to remove the comments on
* the line "#define PROFILE". This option will present you with additional properties and let you
* put the machine into "test" mode. This IS NOT recommended for live shards as it has the potentional
* to be abused and turn your slots into a gold farmers dream or admin's nightmare!
*
* Building a new theme can also be quite complicated the first time, but after a few times you
* can usually create an all new theme in under an hour. I won't go over all the details on doing
* this, you're on your own except for any posts/info I may give in the script's thread. You should
* have a good grasp of how the slots work and especially what payback odds mean as well as generating
* profiling data to verify you're not creating a gold farm.
*
* -------------------------------------------------------------------
* Top Ten Board.
*
* I've also included a nice litte message board that players can click on to see a list of
* players that have recently won jackpots and encourage play. Put them at your banks and/or casino.
* GMs and above will also have an extra icon that takes you to a shard-wide information gump that
* will display all slots and totals/etc of your casino. Very helpful for an overall view of the
* slots and how much gold they have removed from your economy. It also allows you to get properties of
* a slot machine and zip quickly to a slot machine. You can also set a slot's Active (offline/online)
* property from this gump.
*
* Usage: ]add TurboSlotStats
* -------------------------------------------------------------------
* Casino Tokens.
*
* This item allows a player to play the slots for free up until uses remaining hits 0, which it
* then self deletes. A nice way to get people playing your slots is to drop one of these in their
* backpacks while online, or include it your new player startup pack. Defaults to 10 uses, but can
* be setup to do more then that.
*
* Usage: ]add CasinoToken {uses} {hue}
* -------------------------------------------------------------------
*
Acknowledgements: Thanks to RoninGT for the original miner madness slot.

Installation: Unzip CEOTurboSlots.zip into your custom script folder and restart.

Usage: ]add TurboSlot
*/
// Only use PROFILE options on a test shard!
 

Attachments

  • CEOTurboSlots.zip
    42.5 KB · Views: 2,066

CEO

Sorceror
* -------------------------------------------------------------------
* Top Ten Board.
*
* I've also included a nice litte message board that players can click on to see a list of
* players that have recently won jackpots and encourage play. Put them at your banks and/or casino.
* GMs and above will also have an extra icon that takes you to a shard-wide information gump that
* will display all slots and totals/etc of your casino. Very helpful for an overall view of the
* slots and how much gold they have removed from your economy. It also allows you to get properties of
* a slot machine and zip quickly to a slot machine. You can also set a slot's Active (offline/online)
* property from this gump.
*
* ]add TurboSlotStats
* -------------------------------------------------------------------
* Casino Tokens.
*
* This item allows a player to play the slots for free up until uses remaining hits 0, which it
* then self deletes. A nice way to get people playing your slots is to drop one of these in their
* backpacks while online, or include it your new player startup pack. Defaults to 10 uses, but can
* be setup to do more then that.
*
* ]add CasinoToken {uses} {hue}
* -------------------------------------------------------------------
 

Dudus88

Wanderer
all nice but i got crash look :

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.TurboSlot.OnMovement(Mobile m, Point3D oldLocation)
at Server.Mobile.Move(Direction d)
at Server.Mobiles.PlayerMobile.Move(Direction d)
at Server.Network.PacketHandlers.MovementReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)


can somone help?
 

ArteGordon

Wanderer
I think that you just need to change the OnMovement method in turboslot.cs from this

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					m_InUseBy.CloseGump(typeof(TurboSlotGump));
					m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
					m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
					m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						m_InUseBy.PlaySound(52);
						m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(m_InUseBy); // Give them their winnings
					}
					InUseBy = null;
				}
			}
		}

to this

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					Mobile from = m_InUseBy;
					from.CloseGump(typeof(TurboSlotGump));
					from.CloseGump(typeof(NewMinerBonusGump));
					from.CloseGump(typeof(TurboSlotPayTableGump));
					from.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						from.PlaySound(52);
						from.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(from); // Give them their winnings
					}
					InUseBy = null;
				}
			}
		}

The problem is that when the gumps get closed, they can reset m_InUseBy to null.
 
Dudus88 said:
all nice but i got crash look :

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.TurboSlot.OnMovement(Mobile m, Point3D oldLocation)
at Server.Mobile.Move(Direction d)
at Server.Mobiles.PlayerMobile.Move(Direction d)
at Server.Network.PacketHandlers.MovementReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)


can somone help?

The same problem was on my shard. When the player go out from the slot and have some money in, slot tryes to give back money for the player. If player staying farther then 2 tiles from the slot, crash appears.

Also you can solve the problem by this way:

Code:
  public override void OnMovement(Mobile m, Point3D oldLocation)
  {
   if (m_InUseBy != null)
   {
    if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
    {
[COLOR=red]     if (m_Won != 0)
      {
        m_InUseBy.PlaySound(52);
        m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
        DoCashOut(m_InUseBy); // Give them their winnings
      }[/COLOR]
       m_InUseBy.CloseGump(typeof(TurboSlotGump));
       m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
       m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
       m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
       InUseBy = null;
    }
   }
}


 

CEO

Sorceror
Odd, this worked fine before. I'll look into it asap, and have a fix shortly if it's reproducable.
 

CEO

Sorceror
ArteGordon said:
The problem is that when the gumps get closed, they can reset m_InUseBy to null.
Good catch. I've never seen this happen on our shard, must be something in 2.0?

Why does it get set to null though and from doesn't? Something in the way the gumps close I guess. I should close the gumps after the cash payout I'm guessing...


Edit: Aw yes, I see. the CloseGump function I don't believe in 1.0 sent a 'close' to OnResponse in the gump before, now it does, which I have code in there to also close and payout.... So it's executing the gumps onclose as well. Here's what I've got, to keep it 1.0/2.0 compat:

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					m_InUseBy.CloseGump(typeof(TurboSlotGump));
#if !RUNUO2RC1
					m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
					m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
					m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						m_InUseBy.PlaySound(52);
						m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(m_InUseBy); // Give them their winnings
					} 
#endif
					InUseBy = null;
				}
			}
		}
 

CEO

Sorceror
Updated to 1.0c to fix the way gumps close with 2.0, didn't even think to test that. Sorry about that. This might affect other close operations that I'll need to check. :(

Edit. Bumped again to 1.0d. Fixed one other closegump possible crash, but only when profiling a new slot, which should only be done on a non-live shard anyways.
 

CEO

Sorceror
Also, please make sure you've commented out the "#define PROFILE" line, I've changed it and reuploaded 1.0e, as I've distributed the default with that undefined in the past, but didn't turn it off again while testing. You do not want PROFILE defined on a live shard, GMs have a potentional to 'profile' a theme and produce huge checks when cashing out, not to mention it'll stall the server for about 30 seconds+ while profiling! Of course, all the GMs we hire are honest, but just in case.... :p
 

ArteGordon

Wanderer
CEO said:
Good catch. I've never seen this happen on our shard, must be something in 2.0?

Why does it get set to null though and from doesn't? Something in the way the gumps close I guess. I should close the gumps after the cash payout I'm guessing...


Edit: Aw yes, I see. the CloseGump function I don't believe in 1.0 sent a 'close' to OnResponse in the gump before, now it does, which I have code in there to also close and payout.... So it's executing the gumps onclose as well. Here's what I've got, to keep it 1.0/2.0 compat:

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					m_InUseBy.CloseGump(typeof(TurboSlotGump));
#if !RUNUO2RC1
					m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
					m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
					m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						m_InUseBy.PlaySound(52);
						m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(m_InUseBy); // Give them their winnings
					} 
#endif
					InUseBy = null;
				}
			}
		}

if you do it using the temporary 'from' variable, then it will be bulletproof since 'from' is assigned to the the value of m_InUseBy that passes the check, so it is guaranteed not to be null, and it is local so you know that it cannot be externally modified.
Then any other code, such as the gump code, that could subsequently change m_InUseBy, wont make any difference because you dont refer to InUseBy after that point.
If you leave the references to m_InUseBy, then there will always be the possibility of crashing since InUseBy is publicly accessible and so cannot be guaranteed to have the non-null value that initially passed the check since anyone can change it.

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					Mobile from = m_InUseBy;
					from.CloseGump(typeof(TurboSlotGump));
					from.CloseGump(typeof(NewMinerBonusGump));
					from.CloseGump(typeof(TurboSlotPayTableGump));
					from.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						from.PlaySound(52);
						from.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(from); // Give them their winnings
					}
					InUseBy = null;
				}
			}
		}
 
Top