Example #1
0
        /// <summary>Called when [harvest].</summary>
        /// <param name="Harvest">The harvest.</param>
        /// <param name="BiomassRemoved">The biomass removed.</param>
        public override void OnHarvest(HarvestType Harvest, BiomassRemovedType BiomassRemoved)
        {
            // Some biomass is removed according to harvest height
            FractionHeightRemoved = MathUtilities.Divide(Harvest.Height, Height, 0.0);

            double chop_fr_green = (1.0 - RetainFraction.Value);
            double chop_fr_sen   = (1.0 - RetainFraction.Value);

            double dlt_dm_harvest = Live.Wt * chop_fr_green
                                    + Dead.Wt * chop_fr_sen;

            double dlt_n_harvest = Live.N * chop_fr_green
                                   + Dead.N * chop_fr_sen;

            //double dlt_p_harvest = Green.P * chop_fr_green
            //                    + Senesced.P * chop_fr_sen;

            Dead = Dead * RetainFraction.Value;
            Live = Live * RetainFraction.Value;

            Height = MathUtilities.Constrain(Harvest.Height, 1.0, double.MaxValue);

            int i = Util.IncreaseSizeOfBiomassRemoved(BiomassRemoved);

            BiomassRemoved.dm_type[i]             = Name;
            BiomassRemoved.fraction_to_residue[i] = (float)(1.0 - Harvest.Remove);
            BiomassRemoved.dlt_crop_dm[i]         = (float)(dlt_dm_harvest * Conversions.gm2kg / Conversions.sm2ha);
            BiomassRemoved.dlt_dm_n[i]            = (float)(dlt_n_harvest * Conversions.gm2kg / Conversions.sm2ha);
            //BiomassRemoved.dlt_dm_p[i] = (float)(dlt_p_harvest * Conversions.gm2kg / Conversions.sm2ha);
        }
        private void GiveResourceOnDamage(GameObject target, bool isAlive, bool wasAlive)
        {
            TechType techType = CraftData.GetTechType(target);

            HarvestType harvestTypeFromTech = CraftData.GetHarvestTypeFromTech(techType);

            if (techType == TechType.Creepvine)
            {
                GoalManager.main.OnCustomGoalEvent("Cut_Creepvine");
            }

            if ((harvestTypeFromTech == HarvestType.DamageAlive && wasAlive) || (harvestTypeFromTech == HarvestType.DamageDead && !isAlive))
            {
                int num = 1;

                if (harvestTypeFromTech == HarvestType.DamageAlive && !isAlive)
                {
                    num += CraftData.GetHarvestFinalCutBonus(techType);
                }

                TechType harvestOutputData = CraftData.GetHarvestOutputData(techType);

                if (harvestOutputData != TechType.None)
                {
                    CraftData.AddToInventory(harvestOutputData, num, false, false);
                }
            }
        }
Example #3
0
        /*********
        ** Public Methods
        *********/
        /// <summary>Constructs an instance.</summary>
        /// <param name="uniqueName">The unique name of the produce.</param>
        /// <param name="defaultProductId">The id of the default produce.</param>
        /// <param name="defaultProductMinFriendship">The minimum friendship required for the default product to drop.</param>
        /// <param name="defaultProductMaxFriendship">The maximum friendship allowed for the default product to drop.</param>
        /// <param name="upgradedProductId">The id of the upgraded product.</param>
        /// <param name="upgradedProductMinFriendship">The minimum friendship required for the upgraded product to drop.</param>
        /// <param name="upgradedProductMaxFriendship">The maximum friendship allowed for the upgraded product to drop.</param>
        /// <param name="percentChanceForUpgradedProduct">The percent chance of the updated product to drop.</param>
        /// <param name="upgradedProductIsRare">Whether the upgraded product is a 'rare product' (like the Rabbit Foot or Duck Feather).</param>
        /// <param name="harvestType">The harvest type of the product.</param>
        /// <param name="daysToProduce">The number of days between each time the item gets produced.</param>
        /// <param name="produceFasterWithCoopMaster">Whether <see cref="DaysToProduce"/> should be reduced by one if the player has the Coop Master profession.</param>
        /// <param name="produceFasterWithShepherd">Whether <see cref="DaysToProduce"/> should be reduced by one if the player has the Shepherd profession.</param>
        /// <param name="toolName">The name of the tool required to harvest the product (when the <see cref="HarvestType"/> is <see cref="HarvestType.Tool"/>).</param>
        /// <param name="toolHarvestSound">The sound bank id to play when harvesting the animal with a tool.</param>
        /// <param name="amount">The amount of items that get produced at once.</param>
        /// <param name="seasons">The season the product can be produced.</param>
        /// <param name="percentChance">The percent chance of the object being produced.</param>
        /// <param name="percentChanceForOneExtra">The percent chance of the object producing one extra in it's stack.</param>
        /// <param name="requiresMale">Whether the animal must be male to produce the item.</param>
        /// <param name="requiresCoopMaster">Whether the player must have the Coop Master profession for the animal to produce the item.</param>
        /// <param name="requiresShepherd">Whether the player must have the Shepherd profession for the animal to produce the item.</param>
        /// <param name="standardQualityOnly">Whether the product should be standard quality only.</param>
        /// <param name="doNotAllowDuplicates">Whether the item can not be produced if it's in the player possession.</param>
        /// <param name="showHarvestableSpriteSheet">Whether the produce is able to update the animals sprite sheet to 'harvestable' (if a harvestable sprite sheet is available).</param>
        public AnimalProduce(string uniqueName, int defaultProductId, int defaultProductMinFriendship, int defaultProductMaxFriendship, int upgradedProductId, int upgradedProductMinFriendship, int upgradedProductMaxFriendship, float?percentChanceForUpgradedProduct, bool upgradedProductIsRare, HarvestType harvestType, int daysToProduce, bool produceFasterWithCoopMaster, bool produceFasterWithShepherd, string toolName, string toolHarvestSound, int amount, string[] seasons, float percentChance, float percentChanceForOneExtra, bool?requiresMale, bool?requiresCoopMaster, bool?requiresShepherd, bool standardQualityOnly, bool doNotAllowDuplicates, bool showHarvestableSpriteSheet)
        {
            if (seasons == null || seasons.Length == 0)
            {
                seasons = new[] { "spring", "summer", "fall", "winter" }
            }
            ;

            UniqueName                      = uniqueName;
            DefaultProductId                = defaultProductId;
            DefaultProductMinFriendship     = defaultProductMinFriendship;
            DefaultProductMaxFriendship     = defaultProductMaxFriendship;
            UpgradedProductId               = upgradedProductId;
            UpgradedProductMinFriendship    = upgradedProductMinFriendship;
            UpgradedProductMaxFriendship    = upgradedProductMaxFriendship;
            PercentChanceForUpgradedProduct = percentChanceForUpgradedProduct;
            UpgradedProductIsRare           = upgradedProductIsRare;
            HarvestType                     = harvestType;
            DaysToProduce                   = daysToProduce;
            ProduceFasterWithCoopMaster     = produceFasterWithCoopMaster;
            ProduceFasterWithShepherd       = produceFasterWithShepherd;
            ToolName                   = toolName;
            ToolHarvestSound           = toolHarvestSound;
            Amount                     = amount;
            Seasons                    = seasons;
            PercentChance              = percentChance;
            PercentChanceForOneExtra   = percentChanceForOneExtra;
            RequiresMale               = requiresMale;
            RequiresCoopMaster         = requiresCoopMaster;
            RequiresShepherd           = requiresShepherd;
            StandardQualityOnly        = standardQualityOnly;
            DoNotAllowDuplicates       = doNotAllowDuplicates;
            ShowHarvestableSpriteSheet = showHarvestableSpriteSheet;
        }
Example #4
0
 /// <summary>Constructs an instance.</summary>
 /// <param name="action">How the animal produce data should be interpreted.</param>
 /// <param name="uniqueName">The unique name for the produce.</param>
 /// <param name="defaultProductId">The id of the default product.</param>
 /// <param name="defaultProductMinFriendship">The minimum friendship required for the default product to drop.</param>
 /// <param name="defaultProductMaxFriendship">The maximum friendship allowed for the default product to drop.</param>
 /// <param name="upgradedProductId">The id of the upgraded product.</param>
 /// <param name="upgradedProductMinFriendship">The minimum friendship required for the upgraded product to drop.</param>
 /// <param name="upgradedProductMaxFriendship">The maximum friendship allowed for the upgraded product to drop.</param>
 /// <param name="percentChanceForUpgradedProduct">The percent chance of the updated product to drop.</param>
 /// <param name="upgradedProductIsRare">Whether the upgraded product is a 'rare product' (like the Rabbit Foot or Duck Feather).</param>
 /// <param name="harvestType">The harvest type of the product.</param>
 /// <param name="daysToProduce">The number of days between each time the item gets produced.</param>
 /// <param name="produceFasterWithCoopMaster">Whether <see cref="DaysToProduce"/> should be reduced by one if the player has the Coop Master profession.</param>
 /// <param name="produceFasterWithShepherd">Whether <see cref="DaysToProduce"/> should be reduced by one if the player has the Shepherd profession.</param>
 /// <param name="toolName">The name of the tool required to harvest the product (when the <see cref="HarvestType"/> is <see cref="HarvestType.Tool"/>).</param>
 /// <param name="toolHarvestSound">The sound bank id to play when harvesting the animal with a tool.</param>
 /// <param name="amount">The amount of items that get produced at once.</param>
 /// <param name="seasons">The season the product can be produced.</param>
 /// <param name="percentChance">The percent chance of the object being produced.</param>
 /// <param name="percentChanceForOneExtra">The percent chance of the object producing one extra in it's stack.</param>
 /// <param name="requiresMale">Whether the animal must be male to produce the item.</param>
 /// <param name="requiresCoopMaster">Whether the player must have the Coop Master profession for the animal to produce the item.</param>
 /// <param name="requiresShepherd">Whether the player must have the Shepherd profession for the animal to produce the item.</param>
 /// <param name="standardQualityOnly">Whether the product should be standard quality only.</param>
 /// <param name="doNotAllowDuplicates">Whether the item can not be produced if it's in the player possession.</param>
 /// <param name="showHarvestableSpriteSheet">Whether the produce is able to update the animals sprite sheet to 'harvestable' (if a harvestable sprite sheet is available).</param>
 public ParsedAnimalProduce(Action action, string uniqueName, string defaultProductId = "-1", int?defaultProductMinFriendship = 0, int?defaultProductMaxFriendship = 1000, string upgradedProductId = "-1", int?upgradedProductMinFriendship = 200, int?upgradedProductMaxFriendship = 1000, float?percentChanceForUpgradedProduct = null, bool?upgradedProductIsRare = false, HarvestType harvestType = FarmAnimalVarietyRedux.HarvestType.Lay, int?daysToProduce = 1, bool?produceFasterWithCoopMaster = false, bool?produceFasterWithShepherd = false, string toolName = null, string toolHarvestSound = null, int?amount = 1, string[] seasons = null, float?percentChance = 100, float percentChanceForOneExtra = 0, bool?requiresMale = null, bool?requiresCoopMaster = null, bool?requiresShepherd = null, bool standardQualityOnly = false, bool doNotAllowDuplicates = false, bool showHarvestableSpriteSheet = true)
 {
     Action                          = action;
     UniqueName                      = uniqueName;
     DefaultProductId                = defaultProductId;
     DefaultProductMinFriendship     = defaultProductMinFriendship;
     DefaultProductMaxFriendship     = defaultProductMaxFriendship;
     UpgradedProductId               = upgradedProductId;
     UpgradedProductMinFriendship    = upgradedProductMinFriendship;
     UpgradedProductMaxFriendship    = upgradedProductMaxFriendship;
     PercentChanceForUpgradedProduct = percentChanceForUpgradedProduct;
     UpgradedProductIsRare           = upgradedProductIsRare;
     HarvestType                     = harvestType;
     DaysToProduce                   = daysToProduce;
     ProduceFasterWithCoopMaster     = produceFasterWithCoopMaster;
     ProduceFasterWithShepherd       = produceFasterWithShepherd;
     ToolName                        = toolName;
     ToolHarvestSound                = toolHarvestSound;
     Amount                          = amount;
     Seasons                         = seasons;
     PercentChance                   = percentChance;
     PercentChanceForOneExtra        = percentChanceForOneExtra;
     RequiresMale                    = requiresMale;
     RequiresCoopMaster              = requiresCoopMaster;
     RequiresShepherd                = requiresShepherd;
     StandardQualityOnly             = standardQualityOnly;
     DoNotAllowDuplicates            = doNotAllowDuplicates;
     ShowHarvestableSpriteSheet      = showHarvestableSpriteSheet;
 }
Example #5
0
    public override void OnHarvest(HarvestType Harvest, BiomassRemovedType BiomassRemoved)
    {
        double dm_init = MathUtility.Constrain(InitialWt * Population.Density, double.MinValue, Live.Wt);
        double n_init  = MathUtility.Constrain(dm_init * InitialNConcentration, double.MinValue, Live.N);
        //double p_init = MathUtility.Constrain(dm_init * SimplePart::c.p_init_conc, double.MinValue, Green.P);

        double retain_fr_green = MathUtility.Divide(dm_init, Live.Wt, 0.0);
        double retain_fr_sen   = 0.0;

        double dlt_dm_harvest = Live.Wt + Dead.Wt - dm_init;
        double dlt_n_harvest  = Live.N + Dead.N - n_init;

        //double dlt_p_harvest = Green.P + Senesced.P - p_init;

        Dead = Dead * retain_fr_sen;
        Live.StructuralWt = Live.Wt * retain_fr_green;
        Live.StructuralN  = n_init;
        //Green.P = p_init;

        int i = Util.IncreaseSizeOfBiomassRemoved(BiomassRemoved);

        BiomassRemoved.dm_type[i]             = Name;
        BiomassRemoved.fraction_to_residue[i] = (float)(1.0 - Harvest.Remove);
        BiomassRemoved.dlt_crop_dm[i]         = (float)(dlt_dm_harvest * Conversions.gm2kg / Conversions.sm2ha);
        BiomassRemoved.dlt_dm_n[i]            = (float)(dlt_n_harvest * Conversions.gm2kg / Conversions.sm2ha);
        //BiomassRemoved.dlt_dm_p[i] = (float)(dlt_p_harvest * Conversions.gm2kg / Conversions.sm2ha);

        InitialiseAreas();
    }
Example #6
0
        public HarvestAchievement(HarvestDefinition def, HarvestType type, TextDefinition name, TextDefinition description, int points, int maxProgress, int prereq)
            : base(AchievementType.Resources, name, description, points, maxProgress, prereq)
        {
            Definition  = def;
            HarvestType = type;

            GumpImage = GetGumpImage(Definition.Skill);
        }
Example #7
0
 /*********
 ** Public Methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="id">The id of the product.</param>
 /// <param name="harvestType">The harvest type of the product.</param>
 /// <param name="toolName">The name of the tool required to harvest to the product.</param>
 /// <param name="heartsRequired">The number of friendship hearts required for the animal to produce the product.</param>
 /// <param name="percentChance">The percent chance of the object being produced.</param>
 public FavrAnimalProduct(string id, HarvestType harvestType, string toolName, int heartsRequired = 0, int percentChance = 100)
 {
     Id             = id;
     HarvestType    = harvestType;
     ToolName       = toolName;
     HeartsRequired = heartsRequired;
     PercentChance  = percentChance;
 }
Example #8
0
    public void OnHarvest(HarvestType Harvest)
    {
        WriteHarvestReport();

        // Tell the rest of the system we are about to harvest
        if (Harvesting != null)
        {
            Harvesting.Invoke();
        }

        // Check some bounds
        if (Harvest.Remove < 0 || Harvest.Remove > 1.0)
        {
            throw new Exception("Harvest remove fraction needs to be between 0 and 1");
        }
        if (Harvest.Height < 0 || Harvest.Height > 1000.0)
        {
            throw new Exception("Harvest height needs to be between 0 and 1000");
        }

        // Set the population denisty if one was provided by user.
        if (Harvest.Plants != 0)
        {
            Population.Density = Harvest.Plants;
        }

        // Call each organ's OnHarvest. They fill a BiomassRemoved structure. We then publish a
        // BiomassRemoved event.
        BiomassRemovedType BiomassRemovedData = new BiomassRemovedType();

        foreach (Organ1 Organ in Organ1s)
        {
            Organ.OnHarvest(Harvest, BiomassRemovedData);
        }
        BiomassRemovedData.crop_type = CropType;
        BiomassRemoved.Invoke(BiomassRemovedData);
        WriteBiomassRemovedReport(BiomassRemovedData);

        // now update new canopy covers
        PlantSpatial.Density     = Population.Density;
        PlantSpatial.CanopyWidth = Leaf.width;
        foreach (Organ1 Organ in Organ1s)
        {
            Organ.DoCover();
        }
        UpdateCanopy();

        foreach (Organ1 Organ in Organ1s)
        {
            Organ.DoNConccentrationLimits();
        }
    }
Example #9
0
        /// <summary>Called when [harvest].</summary>
        /// <param name="Harvest">The harvest.</param>
        /// <param name="BiomassRemoved">The biomass removed.</param>
        public override void OnHarvest(HarvestType Harvest, BiomassRemovedType BiomassRemoved)
        {
            int i = Util.IncreaseSizeOfBiomassRemoved(BiomassRemoved);

            BiomassRemoved.dm_type[i]             = "meal";
            BiomassRemoved.fraction_to_residue[i] = 0.0F;
            BiomassRemoved.dlt_crop_dm[i]         = (float)((Live.Wt + Dead.Wt) * Conversions.gm2kg / Conversions.sm2ha);
            BiomassRemoved.dlt_dm_n[i]            = (float)((Live.N + Dead.N) * Conversions.gm2kg / Conversions.sm2ha);
            //BiomassRemoved.dlt_dm_p[i] = (float)((Green.P + Senesced.P) * Conversions.gm2kg / Conversions.sm2ha);

            Live.Clear();
            Dead.Clear();
        }
Example #10
0
        /// <summary>Get a random product id.</summary>
        /// <param name="numberOfHearts">The number of hearts the player has with the animal (This is for the heart based produce).</param>
        /// <param name="harvestType">The harvest type of the item.</param>
        /// <returns>A random product id.</returns>
        public int GetRandomDefault(int numberOfHearts, out HarvestType harvestType)
        {
            var random           = new Random();
            var possibleProducts = AllSeasons?.Products?.ToList() ?? new List <AnimalProduct>();

            switch (Game1.currentSeason)
            {
            case "spring":
                var springProducts = Spring?.Products?.Where(product => product.HeartsRequired <= numberOfHearts && random.Next(100) + 1 <= product.PercentChance).ToList();
                if (springProducts != null && springProducts.Count > 0)
                {
                    possibleProducts.AddRange(springProducts);
                }
                break;

            case "summer":
                var summerProducts = Summer?.Products?.Where(product => product.HeartsRequired <= numberOfHearts && random.Next(100) + 1 <= product.PercentChance).ToList();
                if (summerProducts != null && summerProducts.Count > 0)
                {
                    possibleProducts.AddRange(summerProducts);
                }
                break;

            case "fall":
                var fallProducts = Fall?.Products?.Where(product => product.HeartsRequired <= numberOfHearts && random.Next(100) + 1 <= product.PercentChance).ToList();
                if (fallProducts != null && fallProducts.Count > 0)
                {
                    possibleProducts.AddRange(fallProducts);
                }
                break;

            case "winter":
                var winterProducts = Winter?.Products?.Where(product => product.HeartsRequired <= numberOfHearts && random.Next(100) + 1 <= product.PercentChance).ToList();
                if (winterProducts != null && winterProducts.Count > 0)
                {
                    possibleProducts.AddRange(winterProducts);
                }
                break;
            }

            if (possibleProducts.Count == 0)
            {
                harvestType = HarvestType.Lay;
                return(-1);
            }

            var product = possibleProducts[Game1.random.Next(possibleProducts.Count)];

            harvestType = product.HarvestType;
            return(Convert.ToInt32(product.Id)); // already validated so no need to try parse
        }
Example #11
0
        /// <summary>Get a random deluxe product id.</summary>
        /// <param name="harvestType">The harvest type of the item.</param>
        /// <returns>A random deluxe product id.</returns>
        public int GetRandomDeluxe(out HarvestType harvestType)
        {
            var possibleProducts = AllSeasons?.DeluxeProducts?.ToList() ?? new List <AnimalProduct>();

            switch (Game1.currentSeason)
            {
            case "spring":
                var springProducts = Spring?.DeluxeProducts?.ToList();
                if (springProducts != null && springProducts.Count > 0)
                {
                    possibleProducts.AddRange(springProducts);
                }
                break;

            case "summer":
                var summerProducts = Summer?.DeluxeProducts?.ToList();
                if (summerProducts != null && summerProducts.Count > 0)
                {
                    possibleProducts.AddRange(summerProducts);
                }
                break;

            case "fall":
                var fallProducts = Fall?.DeluxeProducts?.ToList();
                if (fallProducts != null && fallProducts.Count > 0)
                {
                    possibleProducts.AddRange(fallProducts);
                }
                break;

            case "winter":
                var winterProducts = Winter?.DeluxeProducts?.ToList();
                if (winterProducts != null && winterProducts.Count > 0)
                {
                    possibleProducts.AddRange(winterProducts);
                }
                break;
            }

            if (possibleProducts.Count == 0)
            {
                harvestType = HarvestType.Lay;
                return(-1);
            }

            var product = possibleProducts[Game1.random.Next(possibleProducts.Count)];

            harvestType = product.HarvestType;
            return(Convert.ToInt32(product.Id)); // already validated so no need to try parse
        }
Example #12
0
        public static void NotifyStaff(Mobile from, HarvestType type)
        {
            string htype = "";

            switch (type)
            {
            case HarvestType.Fishing: { htype = "fishing"; } break;

            case HarvestType.Lumberjacking: { htype = "lumberjacking"; } break;

            case HarvestType.Mining: { htype = "mining"; } break;
            }
            CommandHandlers.BroadcastMessage(AccessLevel.GameMaster, 0x482, String.Format("Watchlist player \"{0}\" is currently {1}.", from.Name, htype));
        }
Example #13
0
        //private void GiveResourceOnDamage(GameObject target, bool isAlive, bool wasAlive)
        public static void GiveResourceOnDamage_Postfix(GameObject target, bool isAlive, bool wasAlive)
        {
            TechType techType = CraftData.GetTechType(target);

            if ((int)techType == (int)purplePineConeTechType) // If it's our custom purple pinecone
            {
#if DEBUG_KNIFE
                Logger.Log("DEBUG: Entering custom purple pinecone event. techType=[" + (int)techType + "][" + techType.AsString(false) + "] purplePineConeTechType=[" + (int)purplePineConeTechType + "][" + purplePineConeTechType.AsString(false) + "]");
#endif
                HarvestType harvestTypeFromTech = CraftData.GetHarvestTypeFromTech(techType);
                if ((harvestTypeFromTech == HarvestType.DamageAlive && wasAlive) || (harvestTypeFromTech == HarvestType.DamageDead && !isAlive))
                {
                    CraftData.AddToInventory(TechType.Salt, 1, false, false); // Add one salt in player's inventory
                }
            }
        }
Example #14
0
        public static void PlayerHarvest(Mobile from, HarvestType type, Int32 amount)
        {
            if (m_WatchList.Contains(from))
            {
                NotifyStaff(from, type);
            }

            if (m_DateLastWroteLog.Date < DateTime.UtcNow.Date)
            {
                WriteTopFile();
                return;
            }

            if (type == HarvestType.Fishing)
            {
                if (m_TableFish.ContainsKey(from))
                {
                    m_TableFish[from] += amount;
                }
                else
                {
                    m_TableFish.Add(from, amount);
                }
            }
            else if (type == HarvestType.Lumberjacking)
            {
                if (m_TableLumber.ContainsKey(from))
                {
                    m_TableLumber[from] += amount;
                }
                else
                {
                    m_TableLumber.Add(from, amount);
                }
            }
            else if (type == HarvestType.Mining)
            {
                if (m_TableOre.ContainsKey(from))
                {
                    m_TableOre[from] += amount;
                }
                else
                {
                    m_TableOre.Add(from, amount);
                }
            }
        }
Example #15
0
 protected override void OnSaveDetails(JsonWriter writer)
 {
     base.SaveDetails(writer);
     SaveManager.WriteBoolean(writer, "Harvesting", IsHarvesting);
     SaveManager.WriteBoolean(writer, "Emptying", IsEmptying);
     SaveManager.WriteFloat(writer, "CurrentLoad", currentLoadAmount);
     SaveManager.WriteFloat(writer, "CurrentDeposit", currentDepositAmount);
     SaveManager.WriteBoolean(writer, "HarvestMoving", IsHarvestMoving);
     SaveManager.WriteString(writer, "HarvestType", HarvestType.ToString());
     if (resourceTarget)
     {
         SaveManager.WriteInt(writer, "ResourceDepositId", resourceTarget.GlobalID);
     }
     SaveManager.WriteBoolean(writer, "Focused", IsFocused);
     SaveManager.WriteBoolean(writer, "InRange", inRange);
     SaveManager.WriteLong(writer, "HarvestCount", harvestCount);
     SaveManager.WriteLong(writer, "FastRangeToTarget", fastRangeToTarget);
 }
Example #16
0
        //private void GiveResourceOnDamage(GameObject target, bool isAlive, bool wasAlive)
        public static void GiveResourceOnDamage_Postfix(GameObject target, bool isAlive, bool wasAlive)
        {
            TechType techType = CraftData.GetTechType(target);

            if ((int)techType == (int)purplePineConeTechType && purplePineConeTechType != TechType.None) // If it's our custom purple pinecone
            {
#if DEBUG_KNIFE
                Logger.Log("DEBUG: Entering custom purple pinecone event. techType=[" + (int)techType + "][" + techType.AsString(false) + "] purplePineConeTechType=[" + (int)purplePineConeTechType + "][" + purplePineConeTechType.AsString(false) + "]");
#endif
#if BELOWZERO
                HarvestType harvestTypeFromTech = TechData.GetHarvestType(techType);
#else
                HarvestType harvestTypeFromTech = CraftData.GetHarvestTypeFromTech(techType);
#endif
                if ((harvestTypeFromTech == HarvestType.DamageAlive && wasAlive) || (harvestTypeFromTech == HarvestType.DamageDead && !isAlive))
                {
                    CraftData.AddToInventory(ConfigSwitcher.PurplePineconeDroppedResource, ConfigSwitcher.PurplePineconeDroppedResourceAmount, false, false); // This will add PurplePineconeDroppedResourceAmount of PurplePineconeDroppedResource in player's inventory
                }
            }
        }
Example #17
0
    public override void OnHarvest(HarvestType Harvest, BiomassRemovedType BiomassRemoved)
    {
        Biomass Dead;

        Dead = Live * DieBackFraction;

        // however dead roots have a given N concentration
        Dead.StructuralN = Dead.Wt * NSenescenceConcentration;

        Live = Live - Dead;
        Dead = Dead + Dead;

        int i = Util.IncreaseSizeOfBiomassRemoved(BiomassRemoved);

        // Unlike above ground parts, no roots go to surface residue module.
        BiomassRemoved.dm_type[i]             = Name;
        BiomassRemoved.fraction_to_residue[i] = 0.0F;
        BiomassRemoved.dlt_crop_dm[i]         = 0.0F;
        BiomassRemoved.dlt_dm_n[i]            = 0.0F;
        BiomassRemoved.dlt_dm_p[i]            = 0.0F;
    }
Example #18
0
 /*********
 ** Public Methods
 *********/
 /// <summary>Constructs an instance.</summary>
 /// <param name="defaultProductId">The id of the default product.</param>
 /// <param name="defaultProductMinFriendship">The minimum friendship required for the default product to drop.</param>
 /// <param name="defaultProductMaxFriendship">The maximum friendship allowed for the default product to drop.</param>
 /// <param name="upgradedProductId">The id of the upgraded product.</param>
 /// <param name="upgradedProductMinFriendship">The minimum friendship required for the upgraded product to drop.</param>
 /// <param name="upgradedProductMaxFriendship">The maximum friendship allowed for the upgraded product to drop.</param>
 /// <param name="percentChanceForUpgradedProduct">The percent chance of the updated product to drop.</param>
 /// <param name="harvestType">The harvest type of the product.</param>
 /// <param name="daysToProduce">The number of days between each time the item gets produced.</param>
 /// <param name="toolName">The name of the tool required to harvest the product (when the <see cref="HarvestType"/> is <see cref="HarvestType.Tool"/>).</param>
 /// <param name="toolHarvestSound">The sound bank id to play when harvesting the animal with a tool.</param>
 /// <param name="amount">The amount of items that get produced at once.</param>
 /// <param name="seasons">The season the product can be produced.</param>
 /// <param name="percentChance">The percent chance of the object being produced.</param>
 /// <param name="percentChanceForOneExtra">The percent chance of the object producing one extra in it's stack.</param>
 /// <param name="requiresMale">Whether the animal must be male to produce the item.</param>
 /// <param name="requiresCoopMaster">Whether the player must have the Coop Master profession for the animal to produce the item.</param>
 /// <param name="requiresShepherd">Whether the player must have the Shepherd profession for the animal to produce the item.</param>
 /// <param name="standardQualityOnly">Whether the product should be standard quality only.</param>
 public FavrAnimalProduce(string defaultProductId = "-1", int?defaultProductMinFriendship = 0, int?defaultProductMaxFriendship = 1000, string upgradedProductId = "-1", int?upgradedProductMinFriendship = 200, int?upgradedProductMaxFriendship = 1000, float?percentChanceForUpgradedProduct = null, bool?upgradedProductIsRare = false, HarvestType harvestType = Favr.HarvestType.Lay, int?daysToProduce = 1, string toolName = null, string toolHarvestSound = null, int?amount = 1, string[] seasons = null, float?percentChance = 100, float percentChanceForOneExtra = 0, bool?requiresMale = null, bool?requiresCoopMaster = null, bool?requiresShepherd = null, bool standardQualityOnly = false)
 {
     DefaultProductId                = defaultProductId;
     DefaultProductMinFriendship     = defaultProductMinFriendship;
     DefaultProductMaxFriendship     = defaultProductMaxFriendship;
     UpgradedProductId               = upgradedProductId;
     UpgradedProductMinFriendship    = upgradedProductMinFriendship;
     UpgradedProductMaxFriendship    = upgradedProductMaxFriendship;
     PercentChanceForUpgradedProduct = percentChanceForUpgradedProduct;
     UpgradedProductIsRare           = upgradedProductIsRare;
     HarvestType              = harvestType;
     DaysToProduce            = daysToProduce;
     ToolName                 = toolName;
     ToolHarvestSound         = toolHarvestSound;
     Amount                   = amount;
     Seasons                  = seasons;
     PercentChance            = percentChance;
     PercentChanceForOneExtra = percentChanceForOneExtra;
     RequiresMale             = requiresMale;
     RequiresCoopMaster       = requiresCoopMaster;
     RequiresShepherd         = requiresShepherd;
     StandardQualityOnly      = standardQualityOnly;
 }
Example #19
0
 /*********
 ** Public Methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="daysToProduce">The number of days it takes the animal to produce product.</param>
 /// <param name="daysTillMature">The number of days it takes the animal to become an adult.</param>
 /// <param name="soundId">The id of the sound the animal will make.</param>
 /// <param name="harvestType">The method required to harvest product from the animal.</param>
 /// <param name="harvestToolName">The name of the tool required to harvest (If the harvest method requires a tool).</param>
 /// <param name="frontAndBackSpriteWidth">The width of the animal sprite when it's looking toward / away from the camera.</param>
 /// <param name="frontAndBackSpriteHeight">The height of the animal sprite when it's looking toward / away from the camera.</param>
 /// <param name="sideSpriteWidth">The width of the animal sprite when it's looking to the side.</param>
 /// <param name="sideSpriteHeight">The height of the animal sprite when it's looking to the side.</param>
 /// <param name="fullnessDrain">The amount the animal's hunger bar will drain each night.</param>
 /// <param name="happinessDrain">The amount the animal's happiness bar will drain each night.</param>
 /// <param name="happinessIncrease">The amount the animal's happiness bar will increase when pet.</param>
 /// <param name="buyPrice">The amount the animal costs.</param>
 /// <param name="buildings">The name(s) of the building(s) the animal can be housed in.</param>
 /// <param name="walkSpeed">The walk speed multiple of the animal.</param>
 /// <param name="bedTime">The time the animal will go to sleep.</param>
 /// <param name="seasonsAllowedOutdoors">The seasons the animal is able to go outside.</param>
 public AnimalData(string description, int daysToProduce, int daysTillMature, string soundId, HarvestType harvestType, string harvestToolName, int frontAndBackSpriteWidth, int frontAndBackSpriteHeight,
                   int sideSpriteWidth, int sideSpriteHeight, int fullnessDrain, int happinessDrain, int happinessIncrease, int buyPrice, List <string> buildings, float walkSpeed, int bedTime,
                   List <Season> seasonsAllowedOutdoors)
 {
     Description              = description;
     DaysToProduce            = daysToProduce;
     DaysTillMature           = daysTillMature;
     SoundId                  = soundId;
     HarvestType              = harvestType;
     HarvestToolName          = harvestToolName;
     FrontAndBackSpriteWidth  = frontAndBackSpriteWidth;
     FrontAndBackSpriteHeight = frontAndBackSpriteHeight;
     SideSpriteWidth          = sideSpriteWidth;
     SideSpriteHeight         = sideSpriteHeight;
     FullnessDrain            = fullnessDrain;
     HappinessDrain           = happinessDrain;
     HappinessIncrease        = happinessIncrease;
     BuyPrice                 = buyPrice;
     Buildings                = buildings;
     WalkSpeed                = walkSpeed;
     BedTime                  = bedTime;
     SeasonsAllowedOutdoors   = seasonsAllowedOutdoors;
 }
Example #20
0
 /// <summary>
 /// <para>Allows you to edit how TechTypes are harvested.</para>
 /// <para>Can be used for existing TechTypes too.</para>
 /// </summary>
 /// <param name="techType">The TechType whose HarvestType you want to edit.</param>
 /// <param name="harvestType">The HarvestType for that TechType.</param>
 public static void SetHarvestType(TechType techType, HarvestType harvestType)
 {
     Main.SetHarvestType(techType, harvestType);
 }
Example #21
0
        /// <summary>
        /// start synchronization of specified localbusiness stream
        /// </summary>
        public void Synchronize(long localBusinessId, HarvestType type)
        {
            try
            {
                var timeSpan = ConvertTimespan(type);

                // we really want all playlists
                var ratingsList = Repository
                    .GetOrderedGrandChildren<PlaylistSongRating>(
                        typeof(PlaylistSongRating),
                        "Playlist",
                        "LocalBusiness",
                        localBusinessId,
                        "FacebookAddedDate",
                        0,
                        int.MaxValue,
                        timeSpan)
                    .Where(rating => !string.IsNullOrEmpty(rating.FBPostId))
                    .ToList();

                if (ratingsList.Count > 0)
                {
                    Synchronize(ratingsList,
                        ratingsList[0].Playlist.LocalBusiness);
                }
                FbStreamUpdated(StreamUpdateStatus.Finished);
            }
            catch(Exception ex)
            {
                Logger.Error("The following error has occured", ex);
            }
        }
Example #22
0
 /// <summary>
 /// convert local format of timespan into date/time value
 /// </summary>
 ///
 /// <param name="type">
 /// local timespan value
 /// </param>
 ///
 /// <returns>
 /// Real time span
 /// </returns>
 private static DateTime? ConvertTimespan(HarvestType type)
 {
     switch (type)
     {
         case HarvestType.Last24hrs:
             return DateTime.Now.AddDays(-1);
         case HarvestType.LastWeek:
             return DateTime.Now.AddDays(-7);
         case HarvestType.TopTen:
         case HarvestType.All:
             return null;
         default:
             return null;
     }
 }
Example #23
0
        /// <summary>
        /// import posts of all the specified fan pages with specified query
        /// </summary>
        ///
        /// <param name="lbsE">
        /// fan pages to be processed
        /// </param>
        ///
        /// <param name="graphQuery">
        /// graph API query to use for retrieval of posts
        /// </param>
        private void Import(IEnumerable<LocalBusiness> lbsE, string graphQuery, HarvestType type)
        {
            /* input sanity check */
            if (lbsE == null)
            {
                throw new ArgumentNullException("lbsE");
            }

            /* convert IEnumerable to list */
            var lbs = lbsE.ToList();

            try
            {
                FbStreamUpdated(StreamUpdateStatus.Intiailized);

                if (lbs.Count() == 0)
                {
                    FbStreamUpdated(StreamUpdateStatus.Error);
                    return;
                }

                Repository.BeginTransaction();
                var tasks = new List<Task>();
                var taskFactory = new TaskFactory(
                            TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness,
                            TaskContinuationOptions.LongRunning | TaskContinuationOptions.PreferFairness);

                foreach (var fp in lbs)
                {
                    FbStreamUpdated(StreamUpdateStatus.RetrievingPosts);

                    var postsInfos = ProcessFanPage(fp, graphQuery, type);

                    // commiting changes
                    Repository.CommitTransaction();

                    FbStreamUpdated(StreamUpdateStatus.RetrievingLikes);

                    if (postsInfos != null)
                    {
                        var task = taskFactory.StartNew(
                            l => SaveLikesInfo(postsInfos, (LocalBusiness)l),
                            fp);

                        tasks.Add(task);
                    }
                }

                // waiting for last thread to compelte execution before exiting
                if (tasks.Count > 0)
                {
                    Logger.Info("Waiting for all likes to be retrieived");
                    Task.WaitAll(tasks.ToArray());
                }

                Repository.CommitTransaction();
            }
            catch (Exception ex)
            {
                FbStreamUpdated(StreamUpdateStatus.Error, ex);
            }
        }
Example #24
0
        /// <summary>
        /// process wall messages of a single fan page
        /// </summary>
        ///
        /// <param name="fp">
        /// fan page to process
        /// </param>
        ///
        /// <param name="graphQuery">
        /// graph API query to use when processing this fan page
        /// </param>
        private List<PlaylistSongRatingAndLikes> ProcessFanPage(
            LocalBusiness fp, string graphQuery, HarvestType type)
        {
            Logger.InfoFormat("Processing fan page {0}: {1}... ",
                fp.FanPageId, fp.Name);

            /* build the initial URL of the page */
            var feedUrl = string.Format(graphQuery, fp.FanPageId);

            var defaultUser = GetDefaultUser(fp, graphQuery);
            var postsInfo = new List<PlaylistSongRatingAndLikes>();

            var isReadComplete = false;
            dynamic parameters = new ExpandoObject();
            parameters.limit = FB_FETCH_LIMIT;
            parameters.offset = 0;

            var data = FbApp.Get(feedUrl, parameters);
            do
            {
                Logger.Info("fetching posts");
                if (!data.ContainsKey("data"))
                {
                    return postsInfo;
                }

                foreach (var dat in data["data"])
                {
                    try
                    {
                        var postLink = GetVideoLink(dat);
                        var postType = dat.ContainsKey("type") ?
                            (string)dat["type"] : string.Empty;

                        /* in order to simplify conditions, continue is used
                         * otherwise, "if's" are too comples */
                        if (postType == null || postLink == null)
                        {
                            continue;
                        }

                        /* filter allowed content */
                        if (!postType.Equals("video") &&
                            !postType.Equals("swf") &&
                            !postType.Equals("link"))
                        {
                            continue;
                        }

                        /* process only YouTube links */
                        if (!postLink.Contains("youtube.com"))
                        {
                            continue;
                        }

                        var postInfo = ProcessLink(fp, dat, defaultUser);

                        /* wasn't previously added, handling cases of duplicate
                         * posts */
                        if (postInfo != null && !postsInfo.Contains(postInfo))
                        {
                            postsInfo.Add(postInfo);
                        }
                    }
                    catch (Exception ex)
                    {
                        FbStreamUpdated(StreamUpdateStatus.Error, ex);
                        Logger.Error("This should not have happened", ex);
                        return null;
                    }

                    if (type == HarvestType.TopTen && postsInfo.Count >= 10)
                        break;
                }

                if (type == HarvestType.TopTen && postsInfo.Count >= 10)
                    break;

                Logger.InfoFormat("finished fetching {0} posts",
                    postsInfo.Count);

                if (!data.ContainsKey("paging") ||
                    !data["paging"].ContainsKey("next"))
                {
                    isReadComplete = true;
                }
                else
                {
                    var serializer = new JavaScriptSerializer();
                    string nextPage = data["paging"]["next"];

                    if (graphQuery.ToLower().Contains("since"))
                    {
                        nextPage =
                            string.Format("{0}&since=yesterday", nextPage);
                    }

                    var request = new MyWebRequest(nextPage);
                    data = serializer.Deserialize<dynamic>(
                        request.GetResponse());
                }
            } while (!isReadComplete);

            Logger.InfoFormat("Done processing fan page {0}: {1}",
                fp.FanPageId, fp.Name);

            return postsInfo;
        }
Example #25
0
        public static List <KeyValuePair <Mobile, Int32> > ReturnTop10(HarvestType type)
        {
            switch (type)
            {
            case HarvestType.Fishing:
            {
                List <KeyValuePair <Mobile, Int32> > m_List = new List <KeyValuePair <Mobile, Int32> >();
                foreach (KeyValuePair <Mobile, Int32> entry in m_TableFish)
                {
                    m_List.Add(entry);
                }
                m_List.Sort(delegate(KeyValuePair <Mobile, Int32> x, KeyValuePair <Mobile, Int32> y) { return(y.Value.CompareTo(x.Value)); });
                int i = 10;
                if (m_List.Count < 10)
                {
                    i = m_List.Count;
                }
                if (m_List.Count > 0)
                {
                    return(m_List.GetRange(0, i));
                }
                else
                {
                    return(null);
                }
            }

            case HarvestType.Lumberjacking:
            {
                List <KeyValuePair <Mobile, Int32> > m_List = new List <KeyValuePair <Mobile, Int32> >();
                foreach (KeyValuePair <Mobile, Int32> entry in m_TableLumber)
                {
                    m_List.Add(entry);
                }
                m_List.Sort(delegate(KeyValuePair <Mobile, Int32> x, KeyValuePair <Mobile, Int32> y) { return(y.Value.CompareTo(x.Value)); });
                int i = 10;
                if (m_List.Count < 10)
                {
                    i = m_List.Count;
                }
                if (m_List.Count > 0)
                {
                    return(m_List.GetRange(0, i));
                }
                else
                {
                    return(null);
                }
            }

            case HarvestType.Mining:
            {
                List <KeyValuePair <Mobile, Int32> > m_List = new List <KeyValuePair <Mobile, Int32> >();
                foreach (KeyValuePair <Mobile, Int32> entry in m_TableOre)
                {
                    m_List.Add(entry);
                }
                m_List.Sort(delegate(KeyValuePair <Mobile, Int32> x, KeyValuePair <Mobile, Int32> y) { return(y.Value.CompareTo(x.Value)); });
                int i = 10;
                if (m_List.Count < 10)
                {
                    i = m_List.Count;
                }
                if (m_List.Count > 0)
                {
                    return(m_List.GetRange(0, i));
                }
                else
                {
                    return(null);
                }
            }
            }

            return(null);
        }
Example #26
0
 /// <summary>Called when [harvest].</summary>
 /// <param name="Harvest">The harvest.</param>
 /// <param name="BiomassRemoved">The biomass removed.</param>
 public abstract void OnHarvest(HarvestType Harvest, BiomassRemovedType BiomassRemoved);
Example #27
0
 public HarvestAchievement(HarvestDefinition def, HarvestType type, TextDefinition name, TextDefinition description, int points, int maxProgress)
     : this(def, type, name, description, points, maxProgress, -1)
 {
 }
Example #28
0
 /// <summary>
 /// <para>Allows you to edit how TechTypes are harvested.</para>
 /// <para>Can be used for existing TechTypes too.</para>
 /// </summary>
 /// <param name="techType">The TechType whose HarvestType you want to edit.</param>
 /// <param name="harvestType">The HarvestType for that TechType.</param>
 void ICraftDataHandler.SetHarvestType(TechType techType, HarvestType harvestType)
 {
     AddJsonProperty(techType, "harvestType", new JsonValue((int)harvestType));
 }
Example #29
0
 public Harvest(int id, HarvestType type, Point p)
 {
     harvestID = id;
     Type      = type;
     point     = p;
 }
Example #30
0
        /// <summary>Retrieves all the pending produce of an animal for a specified harvest type.</summary>
        /// <param name="animal">The animal whose pending produce should be retrieved.</param>
        /// <param name="harvestType">The harvest type the retrieved produce shoudl be.</param>
        /// <param name="harvestableProducePredicate">The predicate to check when filtering on <paramref name="harvestType"/>.</param>
        /// <returns>The pending produce of <paramref name="animal"/> with a harvest type of <paramref name="harvestType"/>.</returns>
        public static Dictionary <AnimalProduce, StardewValley.Object> GetPendingProduceDrops(FarmAnimal animal, HarvestType harvestType, Predicate <AnimalProduce> harvestableProducePredicate = null)
        {
            var pendingProduceDrops = new Dictionary <AnimalProduce, StardewValley.Object>();

            var subtype = ModEntry.Instance.Api.GetAnimalSubtypeByInternalName(animal.type);

            if (subtype?.Produce == null || subtype.Produce.Count == 0)
            {
                return(pendingProduceDrops);
            }

            // get all modData products
            var parsedProduces = new List <SavedProduceData>();

            if (animal.modData.TryGetValue($"{ModEntry.Instance.ModManifest.UniqueID}/produces", out var producesString))
            {
                parsedProduces = JsonConvert.DeserializeObject <List <SavedProduceData> >(producesString);
            }

            // get the parsed products that have the specified harvest type, and that is pending to drop (zero 'days till next produce' in modData)
            var harvestTypeParsedProduce = subtype.Produce.Where(product => product.HarvestType == harvestType && (harvestableProducePredicate?.Invoke(product) ?? true));
            var validProduces            = Utilities.GetValidAnimalProduce(harvestTypeParsedProduce, animal);
            var readyParsedProduces      = parsedProduces
                                           .Where(product => product.DaysLeft <= 0 && validProduces.Any(animalProduct => animalProduct.UniqueName.ToLower() == product.UniqueName.ToLower()));

            // create objects to produce
            foreach (var readyParsedProduce in readyParsedProduces)
            {
                // try to get the animal produce that matches the current parsed produce
                var animalProduce = harvestTypeParsedProduce.FirstOrDefault(ap => ap.UniqueName.ToLower() == readyParsedProduce.UniqueName.ToLower());
                if (animalProduce == null)
                {
                    continue;
                }

                // determine item to drop (default or upgraded)
                var productId          = -1;
                var shouldDropUpgraded = Utilities.ShouldDropUpgradedProduct(animalProduce, animal);
                if (shouldDropUpgraded.HasValue)
                {
                    if (shouldDropUpgraded.Value)
                    {
                        productId = animalProduce.UpgradedProductId;
                    }
                    else
                    {
                        productId = animalProduce.DefaultProductId;
                    }
                }

                if (productId == -1)
                {
                    continue;
                }

                // ensure product can be dropped based off of duplicates property
                if (animalProduce.DoNotAllowDuplicates)
                {
                    if (Utilities.IsObjectInPlayerPossession(productId))
                    {
                        continue;
                    }
                }

                // create object to spawn
                var amount  = Utilities.DetermineDropAmount(animalProduce);
                var quality = Utilities.DetermineProductQuality(animal, animalProduce);
                var @object = new StardewValley.Object(productId, amount, quality: quality);
                @object.modData[$"{ModEntry.Instance.ModManifest.UniqueID}/uniqueProduceName"] = animalProduce.UniqueName; // a temp mod data used to easily update the parsed modData
                pendingProduceDrops[animalProduce] = @object;
            }

            return(pendingProduceDrops);
        }
Example #31
0
 /// <summary>
 /// <para>Allows you to edit how TechTypes are harvested.</para>
 /// <para>Can be used for existing TechTypes too.</para>
 /// </summary>
 /// <param name="techType">The TechType whose HarvestType you want to edit.</param>
 /// <param name="harvestType">The HarvestType for that TechType.</param>
 void ICraftDataHandler.SetHarvestType(TechType techType, HarvestType harvestType)
 {
     CraftDataPatcher.CustomHarvestTypeList[techType] = harvestType;
 }
 /*********
 ** Public Methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="id">The id of the product.</param>
 /// <param name="harvestType">The harvest type of the product.</param>
 /// <param name="toolName">The name of the tool required to harvest to the product.</param>
 public FavrAnimalProduct(string id, HarvestType harvestType, string toolName)
 {
     Id          = id;
     HarvestType = harvestType;
     ToolName    = toolName;
 }
Example #33
0
        /// <summary>
        /// import single local business data
        /// </summary>
        ///
        /// <param name="lbid">
        /// local business ID
        /// </param>
        ///
        /// <param name="type">
        /// type of the import: required timespan actually
        /// </param>
        void ISocialStreamReader.Import(long lbid, HarvestType type)
        {
            var lb = Repository.Get<LocalBusiness>(lbid);

            Logger.Info(string.Format("Starting import for business {0}",
                lb.Name));

            var lbs = new[] { lb };
            if (MTsDict.ContainsKey(type))
            {
                Import(lbs, MTsDict[type], type);
            }
            else
            {
                Logger.ErrorFormat("Invalid time span: {0}", type);
            }
            FbStreamUpdated(StreamUpdateStatus.Finished);
        }