Beispiel #1
0
 public BaseCraftJuice(int itemID) :  base(itemID)
 {
     m_Quality       = JuiceQuality.Regular;
     m_Crafter       = null;
     m_Variety       = DefaultVariety;
     this.FillFactor = 2;
 }
Beispiel #2
0
 public static FruitsVariety GetStart(FruitsVariety variety)
 {
     switch (GetType(variety))
     {
     case FruitsVarietyType.Fruits: return(FruitsVariety.Apple);
     }
     return(FruitsVariety.None);
 }
Beispiel #3
0
 public static FruitsVarietyType GetType(FruitsVariety variety)
 {
     if (variety >= FruitsVariety.Apple && variety <= FruitsVariety.Turnip)
     {
         return(FruitsVarietyType.Fruits);
     }
     return(FruitsVarietyType.None);
 }
Beispiel #4
0
 public static void RegisterType(Type resourceType, FruitsVariety variety)
 {
     if (m_TypeTable == null)
     {
         m_TypeTable = new Hashtable();
     }
     m_TypeTable[resourceType] = variety;
 }
Beispiel #5
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 = (JuiceQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = JuiceQuality.Regular;
                }
                if (m_Quality == JuiceQuality.Low)
                {
                    m_Quality = JuiceQuality.Regular;
                }
                if (GetSaveFlag(flags, SaveFlag.Variety))
                {
                    m_Variety = (FruitsVariety)reader.ReadEncodedInt();
                }
                else
                {
                    m_Variety = DefaultVariety;
                }
                if (m_Variety == FruitsVariety.None)
                {
                    m_Variety = DefaultVariety;
                }
                goto case 1;
            }

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

            case 0:
            {
                m_Poison     = Poison.Deserialize(reader);
                m_FillFactor = reader.ReadInt();
                break;
            }
            }
        }
        public BaseCraftJuice( int itemID )
            : base(itemID)
        {
            m_Quality = JuiceQuality.Regular;
            m_Crafter = null;

            m_Variety = DefaultVariety;

            this.FillFactor = 4;
        }
Beispiel #7
0
        public static int GetIndex(FruitsVariety variety)
        {
            FruitsVariety start = GetStart(variety);

            if (start == FruitsVariety.None)
            {
                return(0);
            }
            return((int)(variety - start));
        }
Beispiel #8
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 = (JuiceQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = JuiceQuality.Regular;
                }
                if (m_Quality == JuiceQuality.Low)
                {
                    m_Quality = JuiceQuality.Regular;
                }
                if (GetSaveFlag(flags, SaveFlag.Variety))
                {
                    m_Variety = ( FruitsVariety )reader.ReadEncodedInt();
                }
                else
                {
                    m_Variety = DefaultVariety;
                }
                if (m_Variety == FruitsVariety.None)
                {
                    m_Variety = DefaultVariety;
                }
                break;
            }
            }
        }
Beispiel #9
0
 public JuiceKeg( ) : base(0x1940)
 {
     this.Weight      = 1.0;
     m_Held           = 75;
     m_Quality        = JuiceQuality.Regular;
     m_Crafter        = null;
     m_Variety        = DefaultVariety;
     m_BottleDuration = 1.0;
     m_AllowBottling  = false;
     m_Start          = DateTime.UtcNow;
 }
		public FruitsVarietyInfo( int hue, int number, string name, FruitsVariety 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 )
				JuicingResources.RegisterType( varietyTypes[i], variety );
		}
Beispiel #11
0
        public FruitsVarietyInfo(int hue, int number, string name, FruitsVariety 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)
            {
                JuicingResources.RegisterType(varietyTypes[i], variety);
            }
        }
Beispiel #12
0
        public JuiceKeg( )
            : base(0x1940)
        {
            this.Weight = 1.0;

            m_Held = 75;
            m_Quality = JuiceQuality.Regular;
            m_Crafter = null;
            m_Variety = DefaultVariety;
            m_BottleDuration = 1.0;
            m_AllowBottling = false;
            m_Start = DateTime.Now;
        }
Beispiel #13
0
        public static FruitsVarietyInfo GetInfo(FruitsVariety variety)
        {
            FruitsVarietyInfo[] list = null;
            switch (GetType(variety))
            {
            case FruitsVarietyType.Fruits: list = m_FruitsInfo; break;
            }

            if (list != null)
            {
                int index = GetIndex(variety);
                if (index >= 0 && index < list.Length)
                {
                    return(list[index]);
                }
            }
            return(null);
        }
Beispiel #14
0
 /// <summary>
 /// Returns true if '<paramref name="variety"/>' is None or Apple, False if otherwise.
 /// </summary>
 public static bool IsStandard(FruitsVariety variety)
 {
     return(variety == FruitsVariety.None || variety == FruitsVariety.Apple);
 }
Beispiel #15
0
        /// <summary>
        /// Registers that '<paramref name="resourceType"/>' uses '<paramref name="variety"/>' so that it can later be queried by <see cref="JuicingResources.GetFromType"/>
        /// </summary>
        public static void RegisterType( Type resourceType, FruitsVariety variety )
        {
            if ( m_TypeTable == null )
                m_TypeTable = new Hashtable();

            m_TypeTable[resourceType] = variety;
        }
Beispiel #16
0
 /// <summary>
 /// Returns true if '<paramref name="variety"/>' is None or Apple, False if otherwise.
 /// </summary>
 public static bool IsStandard( FruitsVariety variety )
 {
     return ( variety == FruitsVariety.None || variety == FruitsVariety.Apple );
 }
Beispiel #17
0
        /// <summary>
        /// Returns a <see cref="FruitsVarietyType"/> value indiciating the type of '<paramref name="variety"/>'.
        /// </summary>
        public static FruitsVarietyType GetType( FruitsVariety variety )
        {
            if ( variety >= FruitsVariety.Apple && variety <= FruitsVariety.Strawberry )
                return FruitsVarietyType.Fruits;

            return FruitsVarietyType.None;
        }
Beispiel #18
0
        /// <summary>
        /// Returns the first <see cref="GrapeVariety"/> in the series of varietys for which '<paramref name="variety"/>' belongs.
        /// </summary>
        public static FruitsVariety GetStart( FruitsVariety variety )
        {
            switch ( GetType( variety ) )
            {
                case FruitsVarietyType.Fruits: return FruitsVariety.Apple;
            }

            return FruitsVariety.None;
        }
        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 = (JuiceQuality)reader.ReadEncodedInt();
                    else
                        m_Quality = JuiceQuality.Regular;
                    if ( m_Quality == JuiceQuality.Low )
                        m_Quality = JuiceQuality.Regular;

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

                    if ( m_Variety == FruitsVariety.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 = (JuiceQuality)reader.ReadInt();

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

                        switch ( reader.ReadInt() )
                        {
                            default:
                            case 0: info = FruitsInfo.Apple; break;
                            case 1: info = FruitsInfo.Banana; break;
                            case 2: info = FruitsInfo.Dates; break;
                            case 3: info = FruitsInfo.Grapes; break;
                            case 4: info = FruitsInfo.Lemon; break;
                            case 5: info = FruitsInfo.Lime; break;
                            case 6: info = FruitsInfo.Orange; break;
                            case 7: info = FruitsInfo.Peach; break;
                            case 8: info = FruitsInfo.Pear; break;
                            case 9: info = FruitsInfo.Pumpkin; break;
                            case 10: info = FruitsInfo.Tomato; break;
                            case 11: info = FruitsInfo.Watermelon; break;
                            case 12: info = FruitsInfo.Apricot; break;
                            case 13: info = FruitsInfo.Blackberries; break;
                            case 14: info = FruitsInfo.Blueberries; break;
                            case 15: info = FruitsInfo.Cherries; break;
                            case 16: info = FruitsInfo.Cranberries; break;
                            case 17: info = FruitsInfo.Grapefruit; break;
                            case 18: info = FruitsInfo.Kiwi; break;
                            case 19: info = FruitsInfo.Mango; break;
                            case 20: info = FruitsInfo.Pineappe; break;
                            case 21: info = FruitsInfo.Pomegranate; break;
                            case 22: info = FruitsInfo.Strawberry; break;
                        }

                        m_Variety = BrewingResources.GetFromFruitsInfo( info );
                    }
                    */
                    break;
                }
            }
        }
Beispiel #20
0
        /// <summary>
        /// Returns the <see cref="FruitsVarietyInfo.Name"/> property of '<paramref name="variety"/>' -or- an empty string if the variety specified was invalid.
        /// </summary>
        public static string GetName(FruitsVariety variety)
        {
            FruitsVarietyInfo info = GetInfo(variety);

            return(info == null ? String.Empty : info.Name);
        }
Beispiel #21
0
        /// <summary>
        /// Returns a <see cref="FruitsVarietyInfo"/> instance describing '<paramref name="variety"/>' -or- null if an invalid variety was specified.
        /// </summary>
        public static FruitsVarietyInfo GetInfo( FruitsVariety variety )
        {
            FruitsVarietyInfo[] list = null;

            switch ( GetType( variety ) )
            {
                case FruitsVarietyType.Fruits: list = m_FruitsInfo; break;
            }

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

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

            return null;
        }
Beispiel #22
0
        /// <summary>
        /// Returns the index of '<paramref name="variety"/>' in the seriest of varietys for which it belongs.
        /// </summary>
        public static int GetIndex( FruitsVariety variety )
        {
            FruitsVariety start = GetStart( variety );

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

            return (int)(variety - start);
        }
Beispiel #23
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( FruitsVariety variety )
        {
            FruitsVarietyInfo info = GetInfo( variety );

            return ( info == null ? 0 : info.Hue );
        }
		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 = (JuiceQuality)reader.ReadEncodedInt();
					else
						m_Quality = JuiceQuality.Regular;
	
					if ( m_Quality == JuiceQuality.Low )
						m_Quality = JuiceQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Variety ) )
						m_Variety = ( FruitsVariety )reader.ReadEncodedInt();
					else
						m_Variety = DefaultVariety;
	
					if ( m_Variety == FruitsVariety.None )
						m_Variety = DefaultVariety;
						
					break;
				}
			}
		}
Beispiel #25
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 = (JuiceQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = JuiceQuality.Regular;
                }
                if (m_Quality == JuiceQuality.Low)
                {
                    m_Quality = JuiceQuality.Regular;
                }

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

                if (m_Variety == FruitsVariety.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 = (JuiceQuality)reader.ReadInt();
                 *
                 * if ( version >= 2 )
                 * {
                 *      m_Variety = (FruitsVariety)reader.ReadInt();
                 * }
                 * else
                 * {
                 *      FruitsInfo info;
                 *
                 *      switch ( reader.ReadInt() )
                 *      {
                 *              default:
                 *              case 0: info = FruitsInfo.Apple; break;
                 *              case 1: info = FruitsInfo.Banana; break;
                 *              case 2: info = FruitsInfo.Dates; break;
                 *              case 3: info = FruitsInfo.Grapes; break;
                 *              case 4: info = FruitsInfo.Lemon; break;
                 *              case 5: info = FruitsInfo.Lime; break;
                 *              case 6: info = FruitsInfo.Orange; break;
                 *              case 7: info = FruitsInfo.Peach; break;
                 *              case 8: info = FruitsInfo.Pear; break;
                 *              case 9: info = FruitsInfo.Pumpkin; break;
                 *              case 10: info = FruitsInfo.Tomato; break;
                 *              case 11: info = FruitsInfo.Watermelon; break;
                 *              case 12: info = FruitsInfo.Apricot; break;
                 *              case 13: info = FruitsInfo.Blackberries; break;
                 *              case 14: info = FruitsInfo.Blueberries; break;
                 *              case 15: info = FruitsInfo.Cherries; break;
                 *              case 16: info = FruitsInfo.Cranberries; break;
                 *              case 17: info = FruitsInfo.Grapefruit; break;
                 *              case 18: info = FruitsInfo.Kiwi; break;
                 *              case 19: info = FruitsInfo.Mango; break;
                 *              case 20: info = FruitsInfo.Pineappe; break;
                 *              case 21: info = FruitsInfo.Pomegranate; break;
                 *              case 22: info = FruitsInfo.Strawberry; break;
                 *      }
                 *
                 *      m_Variety = BrewingResources.GetFromFruitsInfo( info );
                 * }
                 */
                break;
            }
            }
        }
Beispiel #26
0
        /// <summary>
        /// Returns the <see cref="FruitsVarietyInfo.Number"/> property of '<paramref name="variety"/>' -or- 0 if an invalid variety was specified.
        /// </summary>
        public static int GetLocalizationNumber(FruitsVariety variety)
        {
            FruitsVarietyInfo info = GetInfo(variety);

            return(info == null ? 0 : info.Number);
        }
Beispiel #27
0
        /// <summary>
        /// Returns the <see cref="FruitsVarietyInfo.Number"/> property of '<paramref name="variety"/>' -or- 0 if an invalid variety was specified.
        /// </summary>
        public static int GetLocalizationNumber( FruitsVariety variety )
        {
            FruitsVarietyInfo info = GetInfo( variety );

            return ( info == null ? 0 : info.Number );
        }
Beispiel #28
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(FruitsVariety variety)
        {
            FruitsVarietyInfo info = GetInfo(variety);

            return(info == null ? 0 : info.Hue);
        }
Beispiel #29
0
        /// <summary>
        /// Returns the <see cref="FruitsVarietyInfo.Name"/> property of '<paramref name="variety"/>' -or- an empty string if the variety specified was invalid.
        /// </summary>
        public static string GetName( FruitsVariety variety )
        {
            FruitsVarietyInfo info = GetInfo( variety );

            return ( info == null ? String.Empty : info.Name );
        }
Beispiel #30
0
        public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            Held = 75;

            Quality = (JuiceQuality)quality;

            if ( makersMark )
                Crafter = from;

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

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

            Type resourceType = typeRes;

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

            Variety = JuicingResources.GetFromType( resourceType );

            CraftContext context = craftSystem.GetContext( from );

            Hue = 0;

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

            return quality;
        }
        public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            Quality = (JuiceQuality)quality;

            if ( makersMark )
                Crafter = from;

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

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

            Type resourceType = typeRes;

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

            Variety = JuicingResources.GetFromType( resourceType );

            CraftContext context = craftSystem.GetContext( from );

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

            return quality;
        }