SBAnimalTrainer.cs (explain this code to me)

Moderators: Benn, Calix, senji

Post Reply
Calix
MOTODEAMON
Posts: 6109
Joined: Sat Dec 27, 2003 10:05 am

SBAnimalTrainer.cs (explain this code to me)

Post by Calix »

How would you add more options into the 'for sale' list? Obviously they need to appear on the gump as well - I'm not sure where the file is drawing the information from for the items already in the list?

Code: Select all

using System;
using System.Collections.Generic;
using Server.Items;

namespace Server.Mobiles
{
	public class SBAnimalTrainer : SBInfo
	{
		private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
		private IShopSellInfo m_SellInfo = new InternalSellInfo();

		public SBAnimalTrainer()
		{
		}

		public override IShopSellInfo SellInfo { get { return m_SellInfo; } }
		public override List<GenericBuyInfo> BuyInfo { get { return m_BuyInfo; } }

		public class InternalBuyInfo : List<GenericBuyInfo>
		{
			public InternalBuyInfo()
			{
				Add( new AnimalBuyInfo( 1, typeof( Cat ), 132, 10, 201, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( Dog ), 170, 10, 217, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( Horse ), 550, 10, 204, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( PackHorse ), 631, 10, 291, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( PackLlama ), 565, 10, 292, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( Rabbit ), 106, 10, 205, 0 ) );

				if( !Core.AOS )
				{
					Add( new AnimalBuyInfo( 1, typeof( Eagle ), 402, 10, 5, 0 ) );
					Add( new AnimalBuyInfo( 1, typeof( BrownBear ), 855, 10, 167, 0 ) );
					Add( new AnimalBuyInfo( 1, typeof( GrizzlyBear ), 1767, 10, 212, 0 ) );
					Add( new AnimalBuyInfo( 1, typeof( Panther ), 1271, 10, 214, 0 ) );
					Add( new AnimalBuyInfo( 1, typeof( TimberWolf ), 768, 10, 225, 0 ) );
					Add( new AnimalBuyInfo( 1, typeof( Rat ), 107, 10, 238, 0 ) );
				}
					
			}
		}

		public class InternalSellInfo : GenericSellInfo
		{
			public InternalSellInfo()
			{
			}
		}
	}
}

Superfast Oz
Cardinal Chunder
Posts: 1031
Joined: Fri Nov 19, 2004 11:23 pm
Contact:

Re: SBAnimalTrainer.cs (explain this code to me)

Post by Superfast Oz »

The buy/sell is from the player point of view, so the list in: public InternalBuyInfo() is the for sale list:

Code: Select all

Add( new AnimalBuyInfo( 1, typeof( Cat ), 132, 10, 201, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( Dog ), 170, 10, 217, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( Horse ), 550, 10, 204, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( PackHorse ), 631, 10, 291, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( PackLlama ), 565, 10, 292, 0 ) );
				Add( new AnimalBuyInfo( 1, typeof( Rabbit ), 106, 10, 205, 0 ) );
To add an item you use the following: Add( new AnimalBuyInfo( 1, typeof( Rat ), 107, 10, 238, 0 ) );

Which relates to:

AnimalBuyInfo( int controlSlots, Type type, int price, int amount, int itemID, int hue )

Or just tell me what you want to add.

Calix
MOTODEAMON
Posts: 6109
Joined: Sat Dec 27, 2003 10:05 am

Re: SBAnimalTrainer.cs (explain this code to me)

Post by Calix »

Right, cheers. Was just going to experiment with adding warhorses to list.

Post Reply