public static void RunSpawnRateGauging(Player player)
        {
            var spawns = NPCFinderHelpers.GaugeSpawnRatesForPlayer(player, 29, out WitchingTargetData.RandomSpawnPos);

            foreach (var kv in spawns)
            {
                if (!WitchingTargetData.TotalSpawns.ContainsKey(kv.Key))
                {
                    WitchingTargetData.TotalSpawns[kv.Key] = kv.Value / 29f;
                }
                else
                {
                    WitchingTargetData.TotalSpawns[kv.Key] += kv.Value / 29f;
                }
            }

            if (WitchingTargetData.GaugeTimer <= 0)
            {
                int refill = 10 * 60;
                WitchingTargetData.GaugeTimer = refill;

                WitchingTargetData.SpawnsPerSecond = new Dictionary <int, float>();

                foreach (var kv in WitchingTargetData.TotalSpawns)
                {
                    WitchingTargetData.SpawnsPerSecond[kv.Key] = kv.Value / refill;
                }
                WitchingTargetData.TotalSpawns = new Dictionary <int, float>();
            }
            WitchingTargetData.GaugeTimer--;
        }
Esempio n. 2
0
        private int UpdateShopItem(Item item, Chest shop = null)
        {
            var mymod = CapitalismMod.Instance;

            // Compute new price
            int price = (int)this.GetPriceOf(item.type);

            // Female NPCs during a bloodmoon markup their prices
            bool isGrill = NPCTownHelpers.GetFemaleTownNpcTypes().Contains(this.NpcType);

            if (Main.bloodMoon && isGrill)
            {
                price = (int)((float)price * mymod.Config.FemaleBloodMoonSellPricePercent);
            }

            NPC    npc    = NPCFinderHelpers.FindFirstNpcByType(this.NpcType);
            Player player = Main.player[Main.myPlayer];

            if (npc != null && player != null)
            {
                // Stinky players markup prices
                if (player.FindBuffIndex(120) >= 0)
                {
                    price = (int)((float)price * mymod.Config.StinkySellPricePercent);
                }

                // Love struck NPCs markdown prices
                if (npc.FindBuffIndex(119) >= 0)
                {
                    bool isGendered = !NPCTownHelpers.GetNonGenderedTownNpcTypes().Contains(this.NpcType);

                    if (isGendered && (player.Male && isGrill) || (!player.Male && !isGrill))
                    {
                        price = (int)((float)price * mymod.Config.LovestruckSellPricePercent);
                    }
                }
            }

            return(price);
        }