Ejemplo n.º 1
0
		/// <summary>
		/// Registers that '<paramref name="resourceType"/>' uses '<paramref name="variety"/>' so that it can later be queried by <see cref="BrewingResources.GetFromType"/>
		/// </summary>
		public static void RegisterType( Type resourceType, HopsVariety variety )
		{
			if ( m_TypeTable == null )
				m_TypeTable = new Hashtable();

			m_TypeTable[resourceType] = variety;
		}
Ejemplo n.º 2
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
				{
					m_Variety = ( HopsVariety )reader.ReadInt();
					break;
				}
				case 0:
				{
					HopsInfo info;

					switch ( reader.ReadInt() )
					{
						case 0: info = HopsInfo.BitterHops; break;
						case 1: info = HopsInfo.SnowHops; break;
						case 2: info = HopsInfo.ElvenHops; break;
						case 3: info = HopsInfo.SweetHops; break;
						default: info = null; break;
					}

					m_Variety = BrewingResources.GetFromHopsInfo( info );
					break;
				}
			}
		}
Ejemplo n.º 3
0
 public BaseCraftCoffee(int itemID) :  base(itemID)
 {
     m_Quality       = CoffeeQuality.Regular;
     m_Crafter       = null;
     m_Variety       = DefaultVariety;
     this.FillFactor = 4;
 }
Ejemplo n.º 4
0
        public BaseHops(HopsVariety variety, int amount) : base(0x1AA2)
        {
            Stackable = true;
            Weight    = 0.1;
            Hue       = BrewingResources.GetHue(variety);

            m_Variety = variety;
        }
Ejemplo n.º 5
0
		public BaseHops( HopsVariety variety, int amount ) : base( 0x1AA2 )
		{
			Stackable = true;
			Weight = 0.1;
			Hue = BrewingResources.GetHue( variety );

			m_Variety = variety;
		}
Ejemplo n.º 6
0
        public static void RegisterType(Type resourceType, HopsVariety variety)
        {
            if (m_TypeTable == null)
            {
                m_TypeTable = new Hashtable();
            }

            m_TypeTable[resourceType] = variety;
        }
Ejemplo n.º 7
0
        public static HopsVariety GetStart(HopsVariety variety)
        {
            switch (GetType(variety))
            {
            case HopsVarietyType.Hops: return(HopsVariety.BitterHops);
            }

            return(HopsVariety.None);
        }
Ejemplo n.º 8
0
        public static HopsVarietyType GetType(HopsVariety variety)
        {
            if (variety >= HopsVariety.BitterHops && variety <= HopsVariety.SweetHops)
            {
                return(HopsVarietyType.Hops);
            }

            return(HopsVarietyType.None);
        }
Ejemplo n.º 9
0
        public BaseCraftMead( int itemID )
            : base(itemID)
        {
            m_Quality = MeadQuality.Regular;
            m_Crafter = null;

            m_Variety = DefaultVariety;

            this.FillFactor = 4;
        }
Ejemplo n.º 10
0
 public AleKeg( ) : base(0x1940)
 {
     this.Weight      = 1.0;
     m_Held           = 75;
     m_Quality        = AleQuality.Regular;
     m_Crafter        = null;
     m_Variety        = DefaultVariety;
     m_BottleDuration = 7.0;
     m_AllowBottling  = false;
     m_Start          = DateTime.UtcNow;
 }
Ejemplo n.º 11
0
		public HopsVarietyInfo( int hue, int number, string name, HopsVariety variety, params Type[] varietyTypes )
		{
			m_Hue = hue;
			m_Number = number;
			m_Name = name;
			m_Variety = variety;
			m_VarietyTypes = varietyTypes;

			for ( int i = 0; i < varietyTypes.Length; ++i )
				BrewingResources.RegisterType( varietyTypes[i], variety );
		}
Ejemplo n.º 12
0
        public static int GetIndex(HopsVariety variety)
        {
            HopsVariety start = GetStart(variety);

            if (start == HopsVariety.None)
            {
                return(0);
            }

            return((int)(variety - start));
        }
Ejemplo n.º 13
0
        public MeadKeg( )
            : base(0x1940)
        {
            this.Weight = 1.0;

            m_Held = 75;
            m_Quality = MeadQuality.Regular;
            m_Crafter = null;
            m_Variety = DefaultVariety;
            m_BottleDuration = 7.0;
            m_AllowBottling = false;
            m_Start = DateTime.Now;
        }
Ejemplo n.º 14
0
        public HopsVarietyInfo(int hue, int number, string name, HopsVariety variety, params Type[] varietyTypes)
        {
            m_Hue          = hue;
            m_Number       = number;
            m_Name         = name;
            m_Variety      = variety;
            m_VarietyTypes = varietyTypes;

            for (int i = 0; i < varietyTypes.Length; ++i)
            {
                BrewingResources.RegisterType(varietyTypes[i], variety);
            }
        }
Ejemplo n.º 15
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_Start          = reader.ReadDateTime();
            m_BottleDuration = reader.ReadDouble();
            m_AllowBottling  = reader.ReadBool();
            SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

            if (GetSaveFlag(flags, SaveFlag.Held))
            {
                m_Held = reader.ReadInt();
            }
            if (GetSaveFlag(flags, SaveFlag.Crafter))
            {
                m_Crafter = reader.ReadMobile();
            }
            if (GetSaveFlag(flags, SaveFlag.Quality))
            {
                m_Quality = (AleQuality)reader.ReadEncodedInt();
            }
            else
            {
                m_Quality = AleQuality.Regular;
            }
            if (m_Quality == AleQuality.Low)
            {
                m_Quality = AleQuality.Regular;
            }
            if (GetSaveFlag(flags, SaveFlag.Variety))
            {
                m_Variety = ( HopsVariety )reader.ReadEncodedInt();
            }
            else
            {
                m_Variety = DefaultVariety;
            }
            if (m_Variety == HopsVariety.None)
            {
                m_Variety = DefaultVariety;
            }
        }
Ejemplo n.º 16
0
        public static HopsVarietyInfo GetInfo(HopsVariety variety)
        {
            HopsVarietyInfo[] list = null;

            switch (GetType(variety))
            {
            case HopsVarietyType.Hops: list = m_HopsInfo; break;
            }

            if (list != null)
            {
                int index = GetIndex(variety);

                if (index >= 0 && index < list.Length)
                {
                    return(list[index]);
                }
            }

            return(null);
        }
Ejemplo n.º 17
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int      version = reader.ReadInt();
            SaveFlag flags   = (SaveFlag)reader.ReadEncodedInt();

            if (GetSaveFlag(flags, SaveFlag.Crafter))
            {
                m_Crafter = reader.ReadMobile();
            }
            if (GetSaveFlag(flags, SaveFlag.Quality))
            {
                m_Quality = (CoffeeQuality)reader.ReadEncodedInt();
            }
            else
            {
                m_Quality = CoffeeQuality.Regular;
            }
            if (m_Quality == CoffeeQuality.Low)
            {
                m_Quality = CoffeeQuality.Regular;
            }
            if (GetSaveFlag(flags, SaveFlag.Variety))
            {
                m_Variety = (HopsVariety)reader.ReadEncodedInt();
            }
            else
            {
                m_Variety = DefaultVariety;
            }
            if (m_Variety == HopsVariety.None)
            {
                m_Variety = DefaultVariety;
            }
            m_Poisoner   = reader.ReadMobile();
            m_Poison     = Poison.Deserialize(reader);
            m_FillFactor = reader.ReadInt();
        }
Ejemplo n.º 18
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Variety = ( HopsVariety )reader.ReadInt();
                break;
            }

            case 0:
            {
                HopsInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = HopsInfo.BitterHops; break;

                case 1: info = HopsInfo.SnowHops; break;

                case 2: info = HopsInfo.ElvenHops; break;

                case 3: info = HopsInfo.SweetHops; break;

                default: info = null; break;
                }

                m_Variety = BrewingResources.GetFromHopsInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 19
0
		/// <summary>
		/// Returns the <see cref="HopsVarietyInfo.Name"/> property of '<paramref name="variety"/>' -or- an empty string if the variety specified was invalid.
		/// </summary>
		public static string GetName( HopsVariety variety )
		{
			HopsVarietyInfo info = GetInfo( variety );

			return ( info == null ? String.Empty : info.Name );
		}
Ejemplo n.º 20
0
		/// <summary>
		/// Returns the <see cref="GrapeVarietyInfo.Hue"/> property of '<paramref name="variety"/>' -or- 0 if an invalid variety was specified.
		/// </summary>
		public static int GetHue( HopsVariety variety )
		{
			HopsVarietyInfo info = GetInfo( variety );

			return ( info == null ? 0 : info.Hue );
		}
Ejemplo n.º 21
0
		/// <summary>
		/// Returns the <see cref="HopsVarietyInfo.Number"/> property of '<paramref name="variety"/>' -or- 0 if an invalid variety was specified.
		/// </summary>
		public static int GetLocalizationNumber( HopsVariety variety )
		{
			HopsVarietyInfo info = GetInfo( variety );

			return ( info == null ? 0 : info.Number );
		}
Ejemplo n.º 22
0
		/// <summary>
		/// Returns the index of '<paramref name="variety"/>' in the seriest of varietys for which it belongs.
		/// </summary>
		public static int GetIndex( HopsVariety variety )
		{
			HopsVariety start = GetStart( variety );

			if ( start == HopsVariety.None )
				return 0;

			return (int)(variety - start);
		}
Ejemplo n.º 23
0
 public static bool IsStandard(HopsVariety variety)
 {
     return(variety == HopsVariety.None || variety == HopsVariety.BitterHops);
 }
Ejemplo n.º 24
0
        public static int GetLocalizationNumber(HopsVariety variety)
        {
            HopsVarietyInfo info = GetInfo(variety);

            return(info == null ? 0 : info.Number);
        }
Ejemplo n.º 25
0
        public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            Held = 75;

            Quality = (MeadQuality)quality;

            if ( makersMark )
                Crafter = from;

            Item[] items = from.Backpack.FindItemsByType( typeof( BreweryLabelMaker ) );

            if ( items.Length != 0 )
            {
                foreach( BreweryLabelMaker lm in items )
                {
                    if (lm.BreweryName != null)
                    {
                        this.Name = lm.BreweryName;
                        break;
                    }
                }
            }

            Type resourceType = typeRes;

            if ( resourceType == null )
                resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;

            Variety = BrewingResources.GetFromType( resourceType );

            CraftContext context = craftSystem.GetContext( from );

            Hue = 0;

            BottleDuration = 7.0;
            AllowBottling = false;
            m_Start = DateTime.Now;

            return quality;
        }
Ejemplo n.º 26
0
		public BaseHops( HopsVariety variety ) : this( variety, 1 )
		{
		}
Ejemplo n.º 27
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 2:
                {
                    m_Start = reader.ReadDateTime();
                    m_BottleDuration = reader.ReadDouble();
                    m_AllowBottling = reader.ReadBool();

                    goto case 1;
                }
                case 1:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Held ) )
                        m_Held = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
                        m_Crafter = reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                        m_Quality = (MeadQuality)reader.ReadEncodedInt();
                    else
                        m_Quality = MeadQuality.Regular;

                    if ( m_Quality == MeadQuality.Low )
                        m_Quality = MeadQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.Variety ) )
                        m_Variety = ( HopsVariety )reader.ReadEncodedInt();
                    else
                        m_Variety = DefaultVariety;

                    if ( m_Variety == HopsVariety.None )
                        m_Variety = DefaultVariety;

                    break;
                }
            }
        }
Ejemplo n.º 28
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 2:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
                        m_Crafter = reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                        m_Quality = (MeadQuality)reader.ReadEncodedInt();
                    else
                        m_Quality = MeadQuality.Regular;
                    if ( m_Quality == MeadQuality.Low )
                        m_Quality = MeadQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.Variety ) )
                        m_Variety = (HopsVariety)reader.ReadEncodedInt();
                    else
                        m_Variety = DefaultVariety;

                    if ( m_Variety == HopsVariety.None )
                        m_Variety = DefaultVariety;

                    //break;
                    goto case 1;
                }
                case 1:
                {
                    m_Poisoner = reader.ReadMobile();

                    goto case 0;
                }
                case 0:
                {
                    m_Poison = Poison.Deserialize( reader );
                    m_FillFactor = reader.ReadInt();
                    /*
                    m_Crafter = reader.ReadMobile();
                    m_Quality = (MeadQuality)reader.ReadInt();

                    if ( version >= 2 )
                    {
                        m_Variety = (HopsVariety)reader.ReadInt();
                    }
                    else
                    {
                        HopsInfo info;

                        switch ( reader.ReadInt() )
                        {
                            default:
                            case 0: info = HopsInfo.BitterHops; break;
                            case 1: info = HopsInfo.SnowHops; break;
                            case 2: info = HopsInfo.ElvenHops; break;
                            case 3: info = HopsInfo.SweetHops; break;
                        }

                        m_Variety = BrewingResources.GetFromHopsInfo( info );
                    }
                    */
                    break;
                }
            }
        }
Ejemplo n.º 29
0
        public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            Quality = (MeadQuality)quality;

            if ( makersMark )
                Crafter = from;

            Item[] items = from.Backpack.FindItemsByType( typeof( BreweryLabelMaker ) );

            if ( items.Length != 0 )
            {
                foreach( BreweryLabelMaker lm in items )
                {
                    if (lm.BreweryName != null)
                    {
                        this.Name = lm.BreweryName;
                        break;
                    }
                }
            }

            Type resourceType = typeRes;

            if ( resourceType == null )
                resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;

            Variety = BrewingResources.GetFromType( resourceType );

            CraftContext context = craftSystem.GetContext( from );

            //if ( context != null && context.DoNotColor )
                Hue = 0;

            return quality;
        }
Ejemplo n.º 30
0
        public static int GetHue(HopsVariety variety)
        {
            HopsVarietyInfo info = GetInfo(variety);

            return(info == null ? 0 : info.Hue);
        }
Ejemplo n.º 31
0
        public static string GetName(HopsVariety variety)
        {
            HopsVarietyInfo info = GetInfo(variety);

            return(info == null ? String.Empty : info.Name);
        }
Ejemplo n.º 32
0
		/// <summary>
		/// Returns true if '<paramref name="variety"/>' is None or BitterHops, False if otherwise.
		/// </summary>
		public static bool IsStandard( HopsVariety variety )
		{
			return ( variety == HopsVariety.None || variety == HopsVariety.BitterHops );
		}
Ejemplo n.º 33
0
		/// <summary>
		/// Returns a <see cref="HopsVarietyType"/> value indiciating the type of '<paramref name="variety"/>'.
		/// </summary>
		public static HopsVarietyType GetType( HopsVariety variety )
		{
			if ( variety >= HopsVariety.BitterHops && variety <= HopsVariety.SweetHops )
				return HopsVarietyType.Hops;

			return HopsVarietyType.None;
		}
Ejemplo n.º 34
0
		/// <summary>
		/// Returns a <see cref="HopsVarietyInfo"/> instance describing '<paramref name="variety"/>' -or- null if an invalid variety was specified.
		/// </summary>
		public static HopsVarietyInfo GetInfo( HopsVariety variety )
		{
			HopsVarietyInfo[] list = null;

			switch ( GetType( variety ) )
			{
				case HopsVarietyType.Hops: list = m_HopsInfo; break;
			}

			if ( list != null )
			{
				int index = GetIndex( variety );

				if ( index >= 0 && index < list.Length )
					return list[index];
			}

			return null;
		}
Ejemplo n.º 35
0
		/// <summary>
		/// Returns the first <see cref="GrapeVariety"/> in the series of varietys for which '<paramref name="variety"/>' belongs.
		/// </summary>
		public static HopsVariety GetStart( HopsVariety variety )
		{
			switch ( GetType( variety ) )
			{
				case HopsVarietyType.Hops: return HopsVariety.BitterHops;
			}

			return HopsVariety.None;
		}
Ejemplo n.º 36
0
 public BaseHops(HopsVariety variety) : this(variety, 1)
 {
 }
Ejemplo n.º 37
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                if (GetSaveFlag(flags, SaveFlag.Crafter))
                {
                    m_Crafter = reader.ReadMobile();
                }

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (MeadQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = MeadQuality.Regular;
                }
                if (m_Quality == MeadQuality.Low)
                {
                    m_Quality = MeadQuality.Regular;
                }

                if (GetSaveFlag(flags, SaveFlag.Variety))
                {
                    m_Variety = (HopsVariety)reader.ReadEncodedInt();
                }
                else
                {
                    m_Variety = DefaultVariety;
                }

                if (m_Variety == HopsVariety.None)
                {
                    m_Variety = DefaultVariety;
                }

                //break;
                goto case 1;
            }

            case 1:
            {
                m_Poisoner = reader.ReadMobile();

                goto case 0;
            }

            case 0:
            {
                m_Poison     = Poison.Deserialize(reader);
                m_FillFactor = reader.ReadInt();

                /*
                 * m_Crafter = reader.ReadMobile();
                 * m_Quality = (MeadQuality)reader.ReadInt();
                 *
                 * if ( version >= 2 )
                 * {
                 *      m_Variety = (HopsVariety)reader.ReadInt();
                 * }
                 * else
                 * {
                 *      HopsInfo info;
                 *
                 *      switch ( reader.ReadInt() )
                 *      {
                 *              default:
                 *              case 0: info = HopsInfo.BitterHops; break;
                 *              case 1: info = HopsInfo.SnowHops; break;
                 *              case 2: info = HopsInfo.ElvenHops; break;
                 *              case 3: info = HopsInfo.SweetHops; break;
                 *      }
                 *
                 *      m_Variety = BrewingResources.GetFromHopsInfo( info );
                 * }
                 */
                break;
            }
            }
        }