Ejemplo n.º 1
0
        public void SeedSoil(Mobile from, Seed s)
        {
            if (from != null && !from.Deleted)
            {
                //planting gfx and sfx
                from.Animate(32, 5, 1, true, false, 0);
                from.PlaySound(0x368);

                //editing the targeted soil
                setOccupied(true);
                setOwner(from);
                PlantType = s.GetParentType();
                m_SeedName = s.Name;
                int enhancedHarvestingLevel = ((IKhaerosMobile)m_Owner).Feats.GetFeatLevel(FeatList.EnhancedHarvesting);

                //tracking when the soil was seeded and when it will bloom, and creating a delay for growth based on that.
                m_Seeded = DateTime.Now;
                m_Bloom = m_Seeded.AddDays(7 - enhancedHarvestingLevel);
                m_GrowthDelay = m_Bloom - m_Seeded;

                //reseting the deletion date of the soil and attached plants now that it has been refreshed through seeding.
                m_LastPlantRefresh = m_Seeded;
                m_PlantDeath = m_LastPlantRefresh + TimeSpan.FromDays(3 + enhancedHarvestingLevel);

                if (UniversalPlantTimer == null || !UniversalPlantTimer.Running)
                {
                    UniversalPlantTimer = new PlantTimer();
                    UniversalPlantTimer.Start();
                }
            }
            else
            {
                from.SendMessage("ERROR: Seed's parent is " + s.GetParentType());
                return;
            }
        }
Ejemplo n.º 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 1:
                    {
                        m_Owner = (Mobile)reader.ReadMobile();
                        m_SeedName = (String)reader.ReadString();

                        if (reader.ReadBool())
                            m_PlantType = (Type)ScriptCompiler.FindTypeByName(reader.ReadString());

                        m_Occupied = (bool)reader.ReadBool();
                        m_FullGrown = (bool)reader.ReadBool();
                        m_Seeded = (DateTime)reader.ReadDateTime();
                        m_Bloom = (DateTime)reader.ReadDateTime();
                        m_GrowthDelay = (TimeSpan)reader.ReadTimeSpan();
                        m_LastPlantRefresh = (DateTime)reader.ReadDateTime();
                        m_PlantDeath = (DateTime)reader.ReadDateTime();
                        if (version < 1)
                            reader.ReadBool();

                        if (version < 1)
                        {
                            if (reader.ReadBool())
                                m_Plant = (Item)reader.ReadItem();
                        }
                        else
                            m_Plant = (Item)reader.ReadItem();
                        goto case 0;
                    }
                case 0: break;
            }

            if (UniversalPlantTimer == null || !UniversalPlantTimer.Running)
            {
                UniversalPlantTimer = new PlantTimer();
                UniversalPlantTimer.Start();
            }

            WaterHueCheck();
        }