public TaxationService()
        {
            Util.Helper.Events.GameLoop.DayStarted      += this.GameLoop_DayStarted;
            Util.Helper.Events.GameLoop.DayEnding       += this.DayEnding;
            Util.Helper.Events.GameLoop.ReturnedToTitle += this.GameLoop_ReturnedToTitle;

            LotValue = new LotValue();
            LotValue.AddDefaultLotValue();
            if (Util.Config.IncludeOwnedObjectsOnLotValue)
            {
                WorldItemScanner = new WorldItemScanner(Util.Helper.Reflection);

                LotValue.Add("OwnedItems", () =>
                {
                    var items = WorldItemScanner.GetAllOwnedItems();

                    var ItemPrices = items.Select(c => new
                    {
                        c.Item.DisplayName,
                        price = c.Item.GetType().GetProperty("Price") != null ? (int)c.Item.GetType().GetProperty("Price").GetValue(c.Item) : c.Item.salePrice()
                    });

                    return(ItemPrices.Sum(c => c.price));
                });
            }
        }
Beispiel #2
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="customFarmingRedux">The Custom Farming Redux integration.</param>
 /// <param name="producerFrameworkMod">The Producer Framework Mod integration.</param>
 /// <param name="metadata">Provides metadata that's not available from the game data directly.</param>
 /// <param name="reflection">Simplifies access to protected code.</param>
 public GameHelper(CustomFarmingReduxIntegration customFarmingRedux, ProducerFrameworkModIntegration producerFrameworkMod, Metadata metadata, IReflectionHelper reflection)
 {
     this.DataParser           = new DataParser(this);
     this.CustomFarmingRedux   = customFarmingRedux;
     this.ProducerFrameworkMod = producerFrameworkMod;
     this.Metadata             = metadata;
     this.WorldItemScanner     = new WorldItemScanner(reflection);
 }