Esempio n. 1
0
        public int GetPlantLabelSeed(PlantHueInfo hueInfo)
        {
            if (m_PlantLabelSeed != -1)
            {
                return(m_PlantLabelSeed);
            }

            return(hueInfo.IsBright() ? 1061887 : 1061888);            // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
        }
Esempio n. 2
0
        public int GetPlantLabelDecorative(PlantHueInfo hueInfo)
        {
            if (m_PlantLabelDecorative != -1)
            {
                return(m_PlantLabelDecorative);
            }

            return(hueInfo.IsBright() ? 1074267 : 1070973);            // a decorative [bright] ~1_COLOR~ ~2_TYPE~
        }
Esempio n. 3
0
        public int GetSeedLabel(PlantHueInfo hueInfo)
        {
            if (m_SeedLabel != -1)
            {
                return(m_SeedLabel);
            }

            return(hueInfo.IsBright() ? 1061918 : 1061917);            // [bright] ~1_COLOR~ ~2_TYPE~ seed
        }
Esempio n. 4
0
        public Seed(PlantType plantType, PlantHue plantHue, bool showType) : base(0xDCF)
        {
            Weight = 1.0;

            m_PlantType = plantType;
            m_PlantHue  = plantHue;
            m_ShowType  = showType;

            Hue = PlantHueInfo.GetInfo(plantHue).Hue;
        }
Esempio n. 5
0
        public override void AddNameProperty(ObjectPropertyList list)
        {
            if (m_PlantStatus >= PlantStatus.DecorativePlant)
            {
                base.AddNameProperty(list);
            }
            else if (m_PlantStatus >= PlantStatus.FullGrownPlant)
            {
                PlantHueInfo  hueInfo  = PlantHueInfo.GetInfo(m_PlantHue);
                PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(m_PlantType);
                string        args     = string.Format("#{0}\t#{1}\t#{2}", m_PlantSystem.GetLocalizedHealth(), hueInfo.Name, typeInfo.Name);

                if (typeInfo.ContainsPlant)
                {
                    // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~
                    list.Add(hueInfo.IsBright() ? 1061891 : 1061889, args);
                }
                else
                {
                    // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
                    list.Add(hueInfo.IsBright() ? 1061892 : 1061890, args);
                }
            }
            else if (m_PlantStatus >= PlantStatus.Seed)
            {
                PlantHueInfo hueInfo = PlantHueInfo.GetInfo(m_PlantHue);
                string       args    = string.Format("#{0}\t#{1}\t#{2}", m_PlantSystem.GetLocalizedDirtStatus(), m_PlantSystem.GetLocalizedHealth(), hueInfo.Name);

                if (m_ShowType)
                {
                    PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(m_PlantType);
                    args += "\t#" + typeInfo.Name.ToString();

                    if (typeInfo.ContainsPlant && m_PlantStatus == PlantStatus.Plant)
                    {
                        // a bowl of ~1_val~ dirt with a ~2_val~ [bright] ~3_val~ ~4_val~
                        list.Add(hueInfo.IsBright() ? 1060832 : 1060831, args);
                    }
                    else
                    {
                        // a bowl of ~1_val~ dirt with a ~2_val~ [bright] ~3_val~ ~4_val~ ~5_val~
                        list.Add(hueInfo.IsBright() ? 1061887 : 1061888, args + "\t#" + GetLocalizedPlantStatus().ToString());
                    }
                }
                else
                {
                    // a bowl of ~1_val~ dirt with a ~2_val~ [bright] ~3_val~ ~4_val~
                    list.Add(hueInfo.IsBright() ? 1060832 : 1060831, args + "\t#" + GetLocalizedPlantStatus().ToString());
                }
            }
            else
            {
                list.Add(1060830, "#" + m_PlantSystem.GetLocalizedDirtStatus());                 // a bowl of ~1_val~ dirt
            }
        }
Esempio n. 6
0
        private void DrawPlant()
        {
            var status = m_Plant.PlantStatus;

            if (status < PlantStatus.FullGrownPlant)
            {
                AddImage(110, 85, 0x589);

                AddItem(122, 94, 0x914);
                AddItem(135, 94, 0x914);
                AddItem(120, 112, 0x914);
                AddItem(135, 112, 0x914);

                if (status >= PlantStatus.Stage2)
                {
                    AddItem(127, 112, 0xC62);
                }

                if (status is PlantStatus.Stage3 or PlantStatus.Stage4)
                {
                    AddItem(129, 85, 0xC7E);
                }

                if (status >= PlantStatus.Stage4)
                {
                    AddItem(121, 117, 0xC62);
                    AddItem(133, 117, 0xC62);
                }

                if (status >= PlantStatus.Stage5)
                {
                    AddItem(110, 100, 0xC62);
                    AddItem(140, 100, 0xC62);
                    AddItem(110, 130, 0xC62);
                    AddItem(140, 130, 0xC62);
                }

                if (status >= PlantStatus.Stage6)
                {
                    AddItem(105, 115, 0xC62);
                    AddItem(145, 115, 0xC62);
                    AddItem(125, 90, 0xC62);
                    AddItem(125, 135, 0xC62);
                }
            }
            else
            {
                var typeInfo = PlantTypeInfo.GetInfo(m_Plant.PlantType);
                var hueInfo  = PlantHueInfo.GetInfo(m_Plant.PlantHue);

                // The large images for these trees trigger a client crash, so use a smaller, generic tree.
                if (m_Plant.PlantType is PlantType.CypressTwisted or PlantType.CypressStraight)
                {
                    AddItem(130 + typeInfo.OffsetX, 96 + typeInfo.OffsetY, 0x0CCA, hueInfo.Hue);
                }
Esempio n. 7
0
        public Seed(PlantType plantType, PlantHue plantHue, bool showType = false) : base(0xDCF)
        {
            Weight    = 1.0;
            Stackable = Core.SA;

            m_PlantType = plantType;
            m_PlantHue  = plantHue;
            m_ShowType  = showType;

            Hue = PlantHueInfo.GetInfo(plantHue).Hue;
        }
Esempio n. 8
0
 public Seed(PlantType plantType, PlantHue plantHue, bool showType) : base(0xDCF)
 {
     m_PlantType = plantType;
     m_PlantHue  = plantHue;
     m_ShowType  = showType;
     if (PlantType == PlantType.Hedge)
     {
         Name       = "a solen seed";
         m_PlantHue = PlantHue.None;                 //for safety
     }
     Hue = PlantHueInfo.GetInfo(plantHue).Hue;
 }
Esempio n. 9
0
        private int GetLabel(out string args)
        {
            PlantHueInfo hueInfo = PlantHueInfo.GetInfo(this.m_PlantHue);

            int title = PlantTypeInfo.GetBonsaiTitle(this.m_PlantType);

            if (title == 0) // Not a bonsai
            {
                title = hueInfo.Name;
            }
            if (this.m_PlantType == PlantType.CocoaTree)
            {
                title = 1080529;
            }

            int label;

            if (this.Amount == 1)
            {
                label = this.m_ShowType ? 1061917 : 1060838; // ~1_COLOR~ ~2_TYPE~ seed : ~1_val~ seed
            }
            else
            {
                label = this.m_ShowType ? 1113492 : 1113490; // ~1_amount~ ~2_color~ ~3_type~ seeds : ~1_amount~ ~2_val~ seeds
            }
            if (hueInfo.IsBright())
            {
                ++label;
            }

            StringBuilder ab = new StringBuilder();

            if (this.Amount != 1)
            {
                ab.Append(this.Amount);
                ab.Append('\t');
            }

            ab.Append('#');
            ab.Append(title);

            if (this.m_ShowType)
            {
                PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(this.m_PlantType);

                ab.Append("\t#");
                ab.Append(typeInfo.Name);
            }

            args = ab.ToString();

            return(label);
        }
Esempio n. 10
0
        public Seed(PlantType plantType, PlantHue plantHue, bool showType)
            : base(0xDCF)
        {
            this.Weight    = 1.0;
            this.Stackable = Core.SA;

            this.m_PlantType = plantType;
            this.m_PlantHue  = plantHue;
            this.m_ShowType  = showType;

            this.Hue = PlantHueInfo.GetInfo(plantHue).Hue;
        }
Esempio n. 11
0
        public static PlantHueInfo GetInfo(PlantHue plantHue)
        {
            PlantHueInfo info = m_Table[plantHue] as PlantHueInfo;

            if (info != null)
            {
                return(info);
            }
            else
            {
                return((PlantHueInfo)m_Table[PlantHue.Plain]);
            }
        }
Esempio n. 12
0
        public override LocalizedText GetNameProperty()
        {
            if (m_PlantStatus >= PlantStatus.DeadTwigs)
            {
                return(new LocalizedText(1027069));                  // twigs
            }
            else if (m_PlantStatus < PlantStatus.Seed)
            {
                string args = String.Format("#{0}\t#{1}", GetLocalizedContainerType(), m_PlantSystem.GetLocalizedDirtStatus());

                return(new LocalizedText(1060830, args));                  // a ~1_val~ of ~2_val~ dirt
            }
            else
            {
                PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(m_PlantType);
                PlantHueInfo  hueInfo  = PlantHueInfo.GetInfo(m_PlantHue);

                if (m_PlantStatus >= PlantStatus.DecorativePlant)
                {
                    return(new LocalizedText(typeInfo.GetPlantLabelDecorative(hueInfo), String.Format("#{0}\t#{1}", hueInfo.Name, typeInfo.Name)));
                }
                else if (m_PlantStatus >= PlantStatus.FullGrownPlant)
                {
                    return(new LocalizedText(typeInfo.GetPlantLabelFullGrown(hueInfo), String.Format("#{0}\t#{1}\t#{2}", m_PlantSystem.GetLocalizedHealth(), hueInfo.Name, typeInfo.Name)));
                }
                else
                {
                    string args = String.Format("#{0}\t#{1}\t#{2}", GetLocalizedContainerType(), m_PlantSystem.GetLocalizedDirtStatus(), m_PlantSystem.GetLocalizedHealth());

                    if (m_ShowType)
                    {
                        args += String.Format("\t#{0}\t#{1}\t#{2}", hueInfo.Name, typeInfo.Name, GetLocalizedPlantStatus());

                        if (m_PlantStatus == PlantStatus.Plant)
                        {
                            return(new LocalizedText(typeInfo.GetPlantLabelPlant(hueInfo), args));
                        }
                        else
                        {
                            return(new LocalizedText(typeInfo.GetPlantLabelSeed(hueInfo), args));
                        }
                    }
                    else
                    {
                        args += String.Format("\t#{0}\t#{1}", (typeInfo.PlantCategory == PlantCategory.Default) ? hueInfo.Name : (int)typeInfo.PlantCategory, GetLocalizedPlantStatus());

                        return(new LocalizedText(hueInfo.IsBright() ? 1060832 : 1060831, args));                          // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~
                    }
                }
            }
        }
        private void AddSeedsState(int x, int y)
        {
            PlantSystem system     = m_Plant.PlantSystem;
            int         totalSeeds = system.AvailableSeeds + system.LeftSeeds;

            if (!m_Plant.IsCrossable || totalSeeds == 0)
            {
                AddLabel(x + 5, y, 0x21, "X");
            }
            else
            {
                AddLabel(x, y, PlantHueInfo.GetInfo(system.SeedHue).GumpHue, string.Format("{0}/{1}", system.AvailableSeeds, totalSeeds));
            }
        }
Esempio n. 14
0
        public override void OnSingleClick(Mobile from)
        {
            PlantHueInfo hueInfo = PlantHueInfo.GetInfo(m_PlantHue);

            if (m_ShowType)
            {
                PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(m_PlantType);
                LabelTo(from, hueInfo.IsBright() ? 1061918 : 1061917, String.Concat("#", hueInfo.Name.ToString(), "\t#", typeInfo.Name.ToString()));                     // [bright] ~1_COLOR~ ~2_TYPE~ seed
            }
            else
            {
                LabelTo(from, hueInfo.IsBright() ? 1060839 : 1060838, String.Concat("#", hueInfo.Name.ToString()));                     // [bright] ~1_val~ seed
            }
        }
Esempio n. 15
0
        public override void AddNameProperty(ObjectPropertyList list)
        {
            PlantHueInfo hueInfo = PlantHueInfo.GetInfo(m_PlantHue);

            if (m_ShowType)
            {
                PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(m_PlantType);
                list.Add(hueInfo.IsBright() ? 1061918 : 1061917, "#" + hueInfo.Name.ToString() + "\t#" + typeInfo.Name.ToString());                 // [bright] ~1_COLOR~ ~2_TYPE~ seed
            }
            else
            {
                list.Add(hueInfo.IsBright() ? 1060839 : 1060838, "#" + hueInfo.Name.ToString());                 // [bright] ~1_val~ seed
            }
        }
Esempio n. 16
0
        private void AddSeedsState(int x, int y)
        {
            PlantSystem system     = m_Plant.PlantSystem;
            int         totalSeeds = system.AvailableSeeds + system.LeftSeeds;

            if (!m_Plant.Reproduces || totalSeeds == 0)
            {
                AddLabel(x + 5, y, 0x21, "X");
            }
            else
            {
                AddLabel(x, y, PlantHueInfo.GetInfo(system.SeedHue).GumpHue,
                         $"{system.AvailableSeeds}/{totalSeeds}");
            }
        }
        private void AddResourcesState(int x, int y)
        {
            PlantResourceInfo resInfo = PlantResourceInfo.GetInfo(m_Plant.PlantType, m_Plant.PlantHue);

            PlantSystem system         = m_Plant.PlantSystem;
            int         totalResources = system.AvailableResources + system.LeftResources;

            if (resInfo == null || totalResources == 0)
            {
                AddLabel(x + 5, y, 0x21, "X");
            }
            else
            {
                AddLabel(x, y, PlantHueInfo.GetInfo(m_Plant.PlantHue).GumpHue, string.Format("{0}/{1}", system.AvailableResources, totalResources));
            }
        }
Esempio n. 18
0
        public int GetPlantLabelPlant(PlantHueInfo hueInfo)
        {
            if (m_PlantLabelPlant != -1)
            {
                return(m_PlantLabelPlant);
            }

            if (m_ContainsPlant)
            {
                return(hueInfo.IsBright() ? 1060832 : 1060831);                // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~
            }
            else
            {
                return(hueInfo.IsBright() ? 1061887 : 1061888);                // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
            }
        }
Esempio n. 19
0
        public int GetPlantLabelFullGrown(PlantHueInfo hueInfo)
        {
            if (m_PlantLabelFullGrown != -1)
            {
                return(m_PlantLabelFullGrown);
            }

            if (m_ContainsPlant)
            {
                return(hueInfo.IsBright() ? 1061891 : 1061889);                // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~
            }
            else
            {
                return(hueInfo.IsBright() ? 1061892 : 1061890);                // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
            }
        }
Esempio n. 20
0
        private void UpdateMaladies()
        {
            double infestationChance = 0.30 - this.StrengthPotion * 0.075 + (this.Water - 2) * 0.10;

            PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(this.m_Plant.PlantType);

            if (typeInfo.Flowery)
            {
                infestationChance += 0.10;
            }

            if (PlantHueInfo.IsBright(this.m_Plant.PlantHue))
            {
                infestationChance += 0.10;
            }

            if (Utility.RandomDouble() < infestationChance)
            {
                this.Infestation++;
            }

            double fungusChance = 0.15 - this.StrengthPotion * 0.075 + (this.Water - 2) * 0.10;

            if (Utility.RandomDouble() < fungusChance)
            {
                this.Fungus++;
            }

            if (this.Water > 2 || Utility.RandomDouble() < 0.9)
            {
                this.Water--;
            }

            if (this.PoisonPotion > 0)
            {
                this.Poison      += this.PoisonPotion;
                this.PoisonPotion = 0;
            }

            if (this.CurePotion > 0)
            {
                this.Disease   += this.CurePotion;
                this.CurePotion = 0;
            }

            this.StrengthPotion = 0;
        }
Esempio n. 21
0
        private void Grow()
        {
            if (Health < PlantHealth.Healthy)
            {
                m_GrowthIndicator = PlantGrowthIndicator.NotHealthy;
            }
            else if (m_FertileDirt && m_Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1)
            {
                int curStage = (int)m_Plant.PlantStatus;
                m_Plant.PlantStatus = (PlantStatus)(curStage + 2);

                m_GrowthIndicator = PlantGrowthIndicator.DoubleGrown;
            }
            else if (m_Plant.PlantStatus < PlantStatus.Stage9)
            {
                int curStage = (int)m_Plant.PlantStatus;
                m_Plant.PlantStatus = (PlantStatus)(curStage + 1);

                m_GrowthIndicator = PlantGrowthIndicator.Grown;
            }
            else
            {
                if (Pollinated && LeftSeeds > 0 && PlantHueInfo.IsCrossable(m_Plant.PlantHue))
                {
                    LeftSeeds--;
                    AvailableSeeds++;
                }

                if (LeftResources > 0 && PlantResourceInfo.GetInfo(m_Plant.PlantType, m_Plant.PlantHue) != null)
                {
                    LeftResources--;
                    AvailableResources++;
                }

                m_GrowthIndicator = PlantGrowthIndicator.Grown;
            }

            if (m_Plant.PlantStatus >= PlantStatus.Stage9 && !Pollinated)
            {
                Pollinated = true;
                SeedType   = m_Plant.PlantType;
                SeedHue    = m_Plant.PlantHue;
            }
        }
Esempio n. 22
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            case 1:
            {
                m_Level = (SecureLevel)reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                if (version < 1)
                {
                    m_Level = SecureLevel.CoOwners;
                }

                m_PlantStatus = (PlantStatus)reader.ReadInt();
                m_PlantType   = (PlantType)reader.ReadInt();
                m_PlantHue    = (PlantHue)reader.ReadInt();
                m_ShowType    = reader.ReadBool();

                if (m_PlantStatus < PlantStatus.DecorativePlant)
                {
                    m_PlantSystem = new PlantSystem(this, reader);
                }

                if (version < 2 && PlantHueInfo.IsCrossable(m_PlantHue))
                {
                    m_PlantHue |= PlantHue.Reproduces;
                }

                break;
            }
            }

            m_Instances.Add(this);
        }
Esempio n. 23
0
        public override void AddNameProperty(ObjectPropertyList list)
        {
            PlantHueInfo hueInfo = PlantHueInfo.GetInfo(m_PlantHue);

            int title = PlantTypeInfo.GetBonsaiTitle(m_PlantType);

            if (title == 0)               // Not a bonsai
            {
                title = hueInfo.Name;
            }

            if (m_ShowType)
            {
                PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(m_PlantType);
                list.Add(hueInfo.IsBright() ? 1061918 : 1061917, String.Concat("#", title.ToString(), "\t#", typeInfo.Name.ToString()));                     // [bright] ~1_COLOR~ ~2_TYPE~ seed
            }
            else
            {
                list.Add(hueInfo.IsBright() ? 1060839 : 1060838, String.Concat("#", title.ToString()));                     // [bright] ~1_val~ seed
            }
        }
Esempio n. 24
0
		public int GetPlantLabelFullGrown( PlantHueInfo hueInfo )
		{
			if ( m_PlantLabelFullGrown != -1 )
				return m_PlantLabelFullGrown;

			if ( m_ContainsPlant )
				return hueInfo.IsBright() ? 1061891 : 1061889; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~
			else
				return hueInfo.IsBright() ? 1061892 : 1061890; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
		}
Esempio n. 25
0
		public int GetPlantLabelSeed( PlantHueInfo hueInfo )
		{
			if ( m_PlantLabelSeed != -1 )
				return m_PlantLabelSeed;

			return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
		}
Esempio n. 26
0
		public int GetPlantLabelPlant( PlantHueInfo hueInfo )
		{
			if ( m_PlantLabelPlant != -1 )
				return m_PlantLabelPlant;

			if ( m_ContainsPlant )
				return hueInfo.IsBright() ? 1060832 : 1060831; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~
			else
				return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
		}
Esempio n. 27
0
		public int GetPlantLabelDecorative( PlantHueInfo hueInfo )
		{
			if ( m_PlantLabelDecorative != -1 )
				return m_PlantLabelDecorative;

			return hueInfo.IsBright() ? 1074267 : 1070973; // a decorative [bright] ~1_COLOR~ ~2_TYPE~
		}
Esempio n. 28
0
		public int GetSeedLabel( PlantHueInfo hueInfo )
		{
			if ( m_SeedLabel != -1 )
				return m_SeedLabel;

			return hueInfo.IsBright() ? 1061918 : 1061917; // [bright] ~1_COLOR~ ~2_TYPE~ seed
		}
Esempio n. 29
0
		public int GetSeedLabelPlural( PlantHueInfo hueInfo )
		{
			if ( m_SeedLabelPlural != -1 )
				return m_SeedLabelPlural;

			return hueInfo.IsBright() ? 1113493 : 1113492; // ~1_amount~ [bright] ~2_color~ ~3_type~ seeds
		}