Page 1 of 1

Roulette almost ready

Posted: Thu Apr 12, 2007 6:11 pm
by Red Squirrel
That's right! I added a gate under malas at the gate library which goes to the casino. I *should* be adding the roulette after SW. I'm doing some final testing with it and it seems to work great.

So gather up your dusty lesser AoAs, martys and other artifacts you're not using. It will even accept doom artifacts if you feel that lucky. :o:

Archived topic from AOV, old topic ID:480, old post ID:2657

Roulette almost ready

Posted: Thu Apr 12, 2007 9:14 pm
by Lymus
No Luna Lances? D:

Archived topic from AOV, old topic ID:480, old post ID:2669

Roulette almost ready

Posted: Thu Apr 12, 2007 9:18 pm
by Red Squirrel
It's in. yes it should take luna lance. :P

Archived topic from AOV, old topic ID:480, old post ID:2671

Roulette almost ready

Posted: Fri Apr 13, 2007 6:43 am
by Finlander
after 4,000 fame, like 30 aoa's and about 20k gold i belive i am not too lucky today.

-bag of sending x2
-powder of fortifying
-Gargoyles pickaxe
-bag of 40 each mage regent x2


:---D go play roulette

Archived topic from AOV, old topic ID:480, old post ID:2680

Roulette almost ready

Posted: Fri Apr 13, 2007 12:25 pm
by Death
Finlander wrote:after 4,000 fame, like 30 aoa's and about 20k gold i belive i am not too lucky today.

-bag of sending x2
-powder of fortifying
-Gargoyles pickaxe
-bag of 40 each mage regent x2


:---D go play roulette
It's also friday the 13th ;)

Archived topic from AOV, old topic ID:480, old post ID:2682

Roulette almost ready

Posted: Fri Apr 13, 2007 1:55 pm
by Red Squirrel
Oh, fun. And I'm writing my final in about 10 minutes.

Archived topic from AOV, old topic ID:480, old post ID:2683

Roulette almost ready

Posted: Fri Apr 13, 2007 4:41 pm
by Death
Red Squirrel wrote:Oh, fun. And I'm writing my final in about 10 minutes.
lol happy Friday the 13th red.

Archived topic from AOV, old topic ID:480, old post ID:2686

Roulette almost ready

Posted: Sat Apr 14, 2007 1:10 pm
by Red Squirrel
As requested by lymus this is the code. It is subject to change.


Code: Select all

using System;
using Server;
using Server.Spells;
using Server.Items;
using Server.Network;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
using System.Collections;


namespace Server.Items
{
	public class artyroulette : Item
	{

		public override string DefaultName
		{
			get { return "Artifact Roulette"; }
		}


		[Constructable]
		public artyroulette() :  base(7026)
		{
		Hue=51;
		}

		
		public override void OnDoubleClick( Mobile from )
		{
			if(!from.InRange( this, 1 ))
			{
			from.SendMessage("This is too far away");
			return;
			}		
		
		from.SendMessage(57,"Select an artifact to give up for a gamble!  Your reward can be anything from a greater artifact, or a trip to the world of the undead...");
		
		from.Target = new RouletteTarget( from );
		}
		


		private class RouletteTarget : Target
		{
		Point3D m_position;
			
			public RouletteTarget(Mobile mob) : base( 12, false, TargetFlags.None )
			{
			m_position=mob.Location;			
			}

			protected override void OnTarget( Mobile from, object o )
			{
				if(m_position!=from.Location)
				{
				from.SendMessage("You cannot move away from the roulette while using it.");
				return;
				}			
			
				if(o is Item)
				{
				Item item = o as Item;
				
				 if(!item.IsChildOf( from.Backpack ))
				 {
				 from.SendMessage("The item must be in your backpack");
				 return;
				 }
				 
				 Type gambletype = item.GetType();
				 
				 //we made it here, all is good now, start checking to make sure the item is exeptable
				 
				 int artypoints=0; //higher the number, lower the chance
				 
				 
				 //check if it's a lesser AoA ------------------------------------------------
				 
				 for(int i=0;i<Server.Misc.TreasuresOfFelucca.m_LesserArtifacts.Length;i++)
				 {
				 Item tempitem = Activator.CreateInstance( Server.Misc.TreasuresOfFelucca.m_LesserArtifacts[i]) as Item;
				 Type temptype = tempitem.GetType();
				 
					 if(gambletype==tempitem.GetType())
					 {
					 artypoints=10;
					 tempitem.Delete();	
					 break;
					 }
					 
				  tempitem.Delete();				 
				 }
				 
				 
				 if(artypoints>0)
				 {
				 Gamble(from,item,artypoints);
				 return;
				 }
				 
				 
				 //check if it's a greater AoA ------------------------------------
				
				  for(int i=0;i<Server.Misc.TreasuresOfFelucca.m_GreaterArtifacts.Length;i++)
				 {
				 Item tempitem = Activator.CreateInstance( Server.Misc.TreasuresOfFelucca.m_GreaterArtifacts[i]) as Item;
				 Type temptype = tempitem.GetType();
				 
					 if(gambletype==tempitem.GetType())
					 {
					 artypoints=2;
					 tempitem.Delete();	
					 break;
					 }
					 
			     tempitem.Delete();				 
				 }
				 
				 
				 if(artypoints>0)
				 {
				 Gamble(from,item,artypoints);
				 return;
				 }
				 
				 
				 
				 //check if it's a minor artifact --------------------------------------------
				 
				 for(int i=0;i<Server.Mobiles.Paragon.Artifacts.Length;i++)
				 {
				 Item tempitem = Activator.CreateInstance( Server.Mobiles.Paragon.Artifacts[i]) as Item;
				 Type temptype = tempitem.GetType();
				 
					 if(gambletype==tempitem.GetType())
					 {
					 artypoints=25;
					 tempitem.Delete();	
					 break;
					 }
					 
				 tempitem.Delete();				 
				 }
				 
				 
				 if(artypoints>0)
				 {
				 Gamble(from,item,artypoints);
				 return;
				 }		 
				 
				 
				 //check if it's a lesser tot --------------------------------------------
				 
				  for(int i=0;i<Server.Misc.TreasuresOfTokuno.m_LesserArtifacts.Length;i++)
				 {
				 Item tempitem = Activator.CreateInstance( Server.Misc.TreasuresOfTokuno.m_LesserArtifacts[i]) as Item;
				 Type temptype = tempitem.GetType();
				 
					 if(gambletype==tempitem.GetType())
					 {
					 artypoints=65;
					 tempitem.Delete();	
					 break;
					 }
					 
				 tempitem.Delete();				 
				 }
				 
				 
				 if(artypoints>0)
				 {
				 Gamble(from,item,artypoints);
				 return;
				 }		 				 


				 //check if it's a greater tot --------------------------------------------
				 
				  for(int i=0;i<Server.Misc.TreasuresOfTokuno.GreaterArtifacts.Length;i++)
				 {
				 Item tempitem = Activator.CreateInstance( Server.Misc.TreasuresOfTokuno.GreaterArtifacts[i]) as Item;
				 Type temptype = tempitem.GetType();
				 
					 if(gambletype==tempitem.GetType())
					 {
					 artypoints=15;
					 tempitem.Delete();	
					 break;
					 }
					 
				 tempitem.Delete();				 
				 }
				 
				 
				 if(artypoints>0)
				 {
				 Gamble(from,item,artypoints);
				 return;
				 }	
				 
				 
				 //check if it's a rarity 10 doom arty --------------------------------------------
				 
				  for(int i=0;i<Server.Mobiles.DemonKnight.ArtifactRarity10.Length;i++)
				 {
				 Item tempitem = Activator.CreateInstance( Server.Mobiles.DemonKnight.ArtifactRarity10[i]) as Item;
				 Type temptype = tempitem.GetType();
				 
					 if(gambletype==tempitem.GetType())
					 {
					 artypoints=4;
					 tempitem.Delete();	
					 break;
					 }
					 
				 tempitem.Delete();				 
				 }
				 
				 
				 if(artypoints>0)
				 {
				 Gamble(from,item,artypoints);
				 return;
				 }			




				//check if it's a rarity 11 doom arty --------------------------------------------
				 
				  for(int i=0;i<Server.Mobiles.DemonKnight.ArtifactRarity11.Length;i++)
				 {
				 Item tempitem = Activator.CreateInstance( Server.Mobiles.DemonKnight.ArtifactRarity11[i]) as Item;
				 Type temptype = tempitem.GetType();
				 
					 if(gambletype==tempitem.GetType())
					 {
					 artypoints=2;
					 tempitem.Delete();	
					 break;
					 }
					 
				 tempitem.Delete();				 
				 }
				 
				 
				 if(artypoints>0)
				 {
				 Gamble(from,item,artypoints);
				 return;
				 }			
				
				 

				
				from.SendMessage("The roulette cannot not accept this item, please try another item.");
				}
				else
				{
				from.SendMessage("You may only select items!");
				}
			}

			protected override void OnTargetFinish( Mobile from )
			{
			}
		
		private void Loose(Mobile from,Item arty)
		{
		if(from==null || arty==null)return;
		
		Effects.PlaySound( from.Location, from.Map, 479 );
		
		
		string message = String.Concat(from.Name," has lost! ");
		from.PublicOverheadMessage( MessageType.Regular, 37, false, message );		
		arty.Delete();
		
			//random bad stuff can happen
			switch(Utility.Random(20))
			{
			case 2:
			from.Kill();
			break;
			
			case 4:
			from.BoltEffect( 0 );
			AOS.Damage( from,from, 60+Utility.Random(50) , 0, 0, 0, 0, 100 );
			break;
			
			case 6:
			AOS.Damage( from,from, 60+Utility.Random(50) , 20, 20, 20, 20, 20 );
			break;
			
			case 8:
			from.Poison=Poison.Lethal;
			break;		
			}
			
		
		}
		
		private void Win(Mobile from,Item artytowin,Item gamblearty)
		{
		if(from==null || artytowin==null || gamblearty==null)return;
		

			Effects.PlaySound( from.Location, from.Map, 503 ); 	
			Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );		
		
		
			Container pack = from.Backpack;
			if ( pack == null || !pack.TryDropItem( from, artytowin, false ) )
			{
			from.BankBox.DropItem( artytowin );			
			from.SendMessage("As your backpack is full, your prize was sent to your bank box.");
			}
		
		
		
		string message = String.Concat(String.Concat(from.Name,String.Concat(" has won ",artytowin.Name),"!"));
		from.PublicOverheadMessage( MessageType.Regular, 92, false, message);		
		gamblearty.Delete();
		}
		
		private void Gamble(Mobile from,Item item,int chancefactor)
		{
		if(from==null || item==null)return;
		
			//greater AOA
			if((chancefactor/3)==Utility.Random(chancefactor))
			{
			Item winartifact;
			
				//chance of getting screwed over and getting a lesser
				if(0.15>Utility.RandomDouble())winartifact = Activator.CreateInstance( Server.Misc.TreasuresOfFelucca.m_LesserArtifacts[Utility.Random(Server.Misc.TreasuresOfFelucca.m_LesserArtifacts.Length)]) as Item;
				else winartifact = Activator.CreateInstance( Server.Misc.TreasuresOfFelucca.m_GreaterArtifacts[Utility.Random(Server.Misc.TreasuresOfFelucca.m_GreaterArtifacts.Length)]) as Item;
			
			Win(from,winartifact,item);
			return;
			}
			
			
			if(10>Utility.Random((chancefactor*2)+15))
			{
			Item winitem=null;
				switch(Utility.Random(Utility.Random(12)))
				{
				case 11:
				winitem = new ClothingBlessDeed();
				winitem.Name="Clothing Bless Deed";
				break;
				
				case 10:
				winitem = new BankCheck(5000000);
				winitem.Name="5mil Jackpot";
				break;
				
				case 9:
				winitem = new BankCheck(1000000);
				winitem.Name="1mil Jackpot";
				break;			
				
				case 8:
				winitem = new RunicSewingKit(CraftResource.HornedLeather);
				winitem.Name = "Horned Runic Sewing Kit";
				break;
				
				case 7:
				winitem = new GargoylesPickaxe(100);
				winitem.Name="Gargoye's Pickaxe";
				break;
				
				case 6:
				winitem = new RandomPowerScroll();
				winitem.Name = "Power Scroll";
				break;				
				
				case 5:
				winitem = new PowderOfTemperament(Utility.Random(1,3)*5);
				winitem.Name = "Powder of fortification";
				break;
				
				case 4:
				winitem = new BagOfNecroReagents(200*Utility.Random(1,5));
				winitem.Name="Bag of Necro Reagents";
				break;

				case 3:
				winitem = new BagOfReagents( 200*Utility.Random(1,5));
				winitem.Name="Bag of Mage Reagents";
				break;	

				case 2:
				winitem = new skilldeed();
				break;	

				case 1:
				winitem = new PowderOfTranslocation(100);
				winitem.Name="Powder of Translocation";
				break;	
				
				case 0:
				winitem = new BagOfSending();
				if(Utility.Random(10)==5)winitem.LootType=LootType.Blessed;
				winitem.Name="Bag of Sending";
				break;
				}
			if(winitem==null)winitem=new BankCheck(100);  //default crappy prize :P (should not hit that)
			
			Win(from,winitem,item);
			return;
			}
			
			
			
		//we lost!
		Loose(from,item);		
		}
			
			
			
			
		}			
		
		
		


		public artyroulette( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
					base.Serialize( writer );
					writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
					base.Deserialize( reader );
					int version = reader.ReadInt();

		}
	}
	


	
	
}

Won't work out of the box though, need to set a couple static classes to public.

Archived topic from AOV, old topic ID:480, old post ID:2754