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!

[RUO 2.0] Advanced Hearthstone

Vorspire

Knight
[RUO 2.0] Advanced Hearthstone

Advanced Hearthstone
(World of Warcraft Style)

Rhovanion-PK - Ultima Online Free-Shard - RunUO
Ouroboros at Vita-Nex
----------
PACKAGE:
----------
namsepace Server.Items
----------
Click file names to view code.

¬Hearthstone
----------

----------
OVERVIEW:
----------
----------



The Advanced Hearthstone will allow the owner to recall to their set Home location as often as you specify in the configuration options.

This system was designed to mimic the World of Warcraft Hearthstone item as closely as possible, while keeping installation edits to a minimum.

The Hearthstone itself consists of 8 seperate scripts that split the Hearthstone class into partitions to make it easier to edit as a whole.

The HearthSpell is a copy of RecallSpell, with some modifications.
I have commented out some portions of code that apply to travel limitations, I did not remove them incase you wished to re-impliment them.

Capio Mihi Domus is latin for Take Me Home

----------
INSTALLATION:
----------
----------

STEP 1

Drag and drop the Hearthstone scripts into your Scripts directory.

STEP 2

Open Scripts/Mobiles/Vendors/NPC/Innkeeper.cs
The edits you need to make are marked in red in the code below:
Code:
using System; 
using System.Collections; 
using Server; 

namespace Server.Mobiles 
{ 
	public class InnKeeper : BaseVendor 
	{ 
		private ArrayList m_SBInfos = new ArrayList(); 
		protected override ArrayList SBInfos{ get { return m_SBInfos; } } 

		[Constructable]
		public InnKeeper() : base( "the innkeeper" ) 
		{ 
		}

[COLOR="Red"]
		/***BEGIN HEARTHSTONE EDIT***/
		public override void OnSpeech(SpeechEventArgs e)
		{
			base.OnSpeech(e);

			Server.Items.Hearthstone.HandleMobile_OnSpeech(this, e);
		}
		/***END HEARTHSTONE EDIT***/
[/COLOR]

		public override void InitSBInfo() 
		{ 
			m_SBInfos.Add( new SBInnKeeper() ); 
			
			if ( IsTokunoVendor )
				m_SBInfos.Add( new SBSEFood() );
		} 

		public override VendorShoeType ShoeType
		{
			get{ return Utility.RandomBool() ? VendorShoeType.Sandals : VendorShoeType.Shoes; }
		}

		public InnKeeper( 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(); 
		} 
	} 
}

STEP 3

Open Scripts/Mobiles/Vendors/SBInfo/SBInnkeeper.cs
Once again, the edits you need to make are colored in red in the code below:
Code:
using System;
using System.Collections;
using Server.Items;

namespace Server.Mobiles
{
	public class SBInnKeeper : SBInfo
	{
		private ArrayList m_BuyInfo = new InternalBuyInfo();
		private IShopSellInfo m_SellInfo = new InternalSellInfo();

		public SBInnKeeper()
		{
		}

		public override IShopSellInfo SellInfo { get { return m_SellInfo; } }
		public override ArrayList BuyInfo { get { return m_BuyInfo; } }

		public class InternalBuyInfo : ArrayList
		{
			public InternalBuyInfo()
			{
[COLOR="Red"]
				/***BEGIN HEARTHSTONE EDIT***/
				Add(new Hearthstone.BuyInfo());
				/***END HEARTHSTONE EDIT***/
[/COLOR]

				Add( new BeverageBuyInfo( typeof( BeverageBottle ), BeverageType.Ale, 7, 20, 0x99F, 0 ) );
				Add( new BeverageBuyInfo( typeof( BeverageBottle ), BeverageType.Wine, 7, 20, 0x9C7, 0 ) );
				Add( new BeverageBuyInfo( typeof( BeverageBottle ), BeverageType.Liquor, 7, 20, 0x99B, 0 ) );
				Add( new BeverageBuyInfo( typeof( Jug ), BeverageType.Cider, 13, 20, 0x9C8, 0 ) );
				Add( new BeverageBuyInfo( typeof( Pitcher ), BeverageType.Milk, 7, 20, 0x9F0, 0 ) );
				Add( new BeverageBuyInfo( typeof( Pitcher ), BeverageType.Ale, 11, 20, 0x1F95, 0 ) );
				Add( new BeverageBuyInfo( typeof( Pitcher ), BeverageType.Cider, 11, 20, 0x1F97, 0 ) );
				Add( new BeverageBuyInfo( typeof( Pitcher ), BeverageType.Liquor, 11, 20, 0x1F99, 0 ) );
				Add( new BeverageBuyInfo( typeof( Pitcher ), BeverageType.Wine, 11, 20, 0x1F9B, 0 ) );
				Add( new BeverageBuyInfo( typeof( Pitcher ), BeverageType.Water, 11, 20, 0x1F9D, 0 ) );

				Add( new GenericBuyInfo( typeof( BreadLoaf ), 6, 10, 0x103B, 0 ) );
				Add( new GenericBuyInfo( typeof( CheeseWheel ), 21, 10, 0x97E, 0 ) );
				Add( new GenericBuyInfo( typeof( CookedBird ), 17, 20, 0x9B7, 0 ) );
				Add( new GenericBuyInfo( typeof( LambLeg ), 8, 20, 0x160A, 0 ) );
				Add( new GenericBuyInfo( typeof( ChickenLeg ), 5, 20, 0x1608, 0 ) );
				Add( new GenericBuyInfo( typeof( Ribs ), 7, 20, 0x9F2, 0 ) );

				Add( new GenericBuyInfo( typeof( WoodenBowlOfCarrots ), 3, 20, 0x15F9, 0 ) );
				Add( new GenericBuyInfo( typeof( WoodenBowlOfCorn ), 3, 20, 0x15FA, 0 ) );
				Add( new GenericBuyInfo( typeof( WoodenBowlOfLettuce ), 3, 20, 0x15FB, 0 ) );
				Add( new GenericBuyInfo( typeof( WoodenBowlOfPeas ), 3, 20, 0x15FC, 0 ) );
				Add( new GenericBuyInfo( typeof( EmptyPewterBowl ), 2, 20, 0x15FD, 0 ) );
				Add( new GenericBuyInfo( typeof( PewterBowlOfCorn ), 3, 20, 0x15FE, 0 ) );
				Add( new GenericBuyInfo( typeof( PewterBowlOfLettuce ), 3, 20, 0x15FF, 0 ) );
				Add( new GenericBuyInfo( typeof( PewterBowlOfPeas ), 3, 20, 0x1600, 0 ) );
				Add( new GenericBuyInfo( typeof( PewterBowlOfPotatos ), 3, 20, 0x1601, 0 ) );
				Add( new GenericBuyInfo( typeof( WoodenBowlOfStew ), 3, 20, 0x1604, 0 ) );
				Add( new GenericBuyInfo( typeof( WoodenBowlOfTomatoSoup ), 3, 20, 0x1606, 0 ) );

				Add( new GenericBuyInfo( typeof( ApplePie ), 7, 20, 0x1041, 0 ) ); //OSI just has Pie, not Apple/Fruit/Meat

				Add( new GenericBuyInfo( typeof( Peach ), 3, 20, 0x9D2, 0 ) );
				Add( new GenericBuyInfo( typeof( Pear ), 3, 20, 0x994, 0 ) );
				Add( new GenericBuyInfo( typeof( Grapes ), 3, 20, 0x9D1, 0 ) );
				Add( new GenericBuyInfo( typeof( Apple ), 3, 20, 0x9D0, 0 ) );
				Add( new GenericBuyInfo( typeof( Banana ), 2, 20, 0x171F, 0 ) );
				Add( new GenericBuyInfo( typeof( Torch ), 7, 20, 0xF6B, 0 ) );
				Add( new GenericBuyInfo( typeof( Candle ), 6, 20, 0xA28, 0 ) );
				Add( new GenericBuyInfo( typeof( Beeswax ), 1, 20, 0x1422, 0 ) );

				Add( new GenericBuyInfo( typeof( Backpack ), 15, 20, 0x9B2, 0 ) );
				Add( new GenericBuyInfo( "1016450", typeof( Chessboard ), 2, 20, 0xFA6, 0 ) );
				Add( new GenericBuyInfo( "1016449", typeof( CheckerBoard ), 2, 20, 0xFA6, 0 ) );
				Add( new GenericBuyInfo( typeof( Backgammon ), 2, 20, 0xE1C, 0 ) );
				Add( new GenericBuyInfo( typeof( Dices ), 2, 20, 0xFA7, 0 ) );
				Add( new GenericBuyInfo( "1041243", typeof( ContractOfEmployment ), 1252, 20, 0x14F0, 0 ) );
				Add( new GenericBuyInfo( "a barkeep contract", typeof( BarkeepContract ), 1252, 20, 0x14F0, 0 ) );

				if ( Multis.BaseHouse.NewVendorSystem )
					Add( new GenericBuyInfo( "1062332", typeof( VendorRentalContract ), 1252, 20, 0x14F0, 0x672 ) );
			}
		}

		public class InternalSellInfo : GenericSellInfo
		{
			public InternalSellInfo()
			{
				Add( typeof( BeverageBottle ), 3 );
				Add( typeof( Jug ), 6 );
				Add( typeof( Pitcher ), 5 );
				Add( typeof( GlassMug ), 1 );
				Add( typeof( BreadLoaf ), 3 );
				Add( typeof( CheeseWheel ), 12 );
				Add( typeof( Ribs ), 6 );
				Add( typeof( Peach ), 1 );
				Add( typeof( Pear ), 1 );
				Add( typeof( Grapes ), 1 );
				Add( typeof( Apple ), 1 );
				Add( typeof( Banana ), 1 );
				Add( typeof( Torch ), 3 );
				Add( typeof( Candle ), 3 );
				Add( typeof( Chessboard ), 1 );
				Add( typeof( CheckerBoard ), 1 );
				Add( typeof( Backgammon ), 1 );
				Add( typeof( Dices ), 1 );
				Add( typeof( ContractOfEmployment ), 626 );
				Add( typeof( Beeswax ), 1 );
				Add( typeof( WoodenBowlOfCarrots ), 1 );
				Add( typeof( WoodenBowlOfCorn ), 1 );
				Add( typeof( WoodenBowlOfLettuce ), 1 );
				Add( typeof( WoodenBowlOfPeas ), 1 );
				Add( typeof( EmptyPewterBowl ), 1 );
				Add( typeof( PewterBowlOfCorn ), 1 );
				Add( typeof( PewterBowlOfLettuce ), 1 );
				Add( typeof( PewterBowlOfPeas ), 1 );
				Add( typeof( PewterBowlOfPotatos ), 1 );
				Add( typeof( WoodenBowlOfStew ), 1 );
				Add( typeof( WoodenBowlOfTomatoSoup ), 1 );
			}
		}
	}
}

----------
CONFIGURATION:
----------
----------

The Hearthstone's default settings can be configured in HS_Config.cs - All options have a summary describing what they do.

----------
EVENTS:
----------
----------

If you wish to interconnect another script on your server with the Hearthstone system, you may use this event handler (pseudo-code example):
Code:
[COLOR="Blue"]
using System;

using Server;
using Server.Items;
[/COLOR]

[COLOR="Blue"]namespace Server[/COLOR]
{
	[COLOR="Blue"]public static class[/COLOR] [COLOR="Teal"]HelloWorld[/COLOR]
	{
		[COLOR="Blue"]public static void[/COLOR] [COLOR="DarkRed"]Initialize[/COLOR]( )
		{
			[COLOR="Teal"]Hearthstone[/COLOR].Event_OnUsed += [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]Hearthstone.HearthstoneUsedEventHandler[/COLOR]( [COLOR="DarkRed"]Hearthstone_OnUsed[/COLOR] );
		}

		[COLOR="Blue"]private static void[/COLOR] [COLOR="DarkRed"]Hearthstone_OnUsed[/COLOR]( [COLOR="Teal"]Hearthstone[/COLOR] hs )
		{
			
		}
	}
}


----------
LIVE USAGE:
----------
----------

Now that you have everything isntalled and configured, it's time to buy your first Hearthstone.



If you do not have a Hearthstone, you must buy one from an Innkeeper.
Once you have purchased your Hearthstone, it will become Blessed for you an only you.
You won't be able to trash it, you won't be able to trade it or throw it on the floor.
You won't be able to store it in a container that you don't own, or is not directly in your posession (this means containers in houses and other such places).
You will only be able to store your Hearthstone in your Backpack, or a bag withn your Backpack, the same goes for your Bank.
You can only have one Hearthstone, so if you waste any gold trying to buy a second one, it's your own fault!

OK... So now you have your Hearthstone, it's not currently working, you've probebly tried it by now ayway, you would have seen the message telling you to speak to an Innkeeper by now...
So you know you have to speak to an Innkeeper, but what do you say? That depends on how your shard admin has set this system up.
There are 2 default phrases that you can say to an Innkeeper to allow him to enchant your Hearthone;
  • make this place my home
  • enchant my hearthstone

Go ahead, say one of those phrases to an Innkeeper to enchant your Hearthstone, it will be marked with the location that you are currently standing on.

When you're done, simply double-click your Hearthstone to use it, the default cast delay is 10 seconds, but this again depends on the system setup.

To update the remaining time on your Hearthstone, simply double-click it again.

Anyone with GameMaster access and above are exempt from Cooldown checks.

------------------------------------------------------------

Please do not post help requests or error reports in this thread.

------------------------------------------------------------

Enjoy :)

Regards,
Vorspire
 

Attachments

  • Hearthstone_Props.jpg
    Hearthstone_Props.jpg
    88.4 KB · Views: 231
  • Hearthstone_Buy.jpg
    Hearthstone_Buy.jpg
    114.8 KB · Views: 230
  • Hearthstone.zip
    7.3 KB · Views: 62

DevXLX

Sorceror
Could someone say how to add a default location?

So a newbie doesn't have to figure out how to use the stone at first, but it's already pre-set at britain inn felucca as example :)
 
Top