Esempio n. 1
0
        private void AfterTick(object sender, UpdateTickedEventArgs e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            double fullness = Game1.player.GetFullness();

            Buff fullBuff = Game1.buffsDisplay.otherBuffs.Find(b => b.source == "Fullness");

            if (fullness > Mod.Config.PositiveBuffThreshold)
            {
                if (fullBuff == null)
                {
                    fullBuff = new Buff(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 10, "Fullness", I18n.Buff_Full());
                    Game1.buffsDisplay.addOtherBuff(fullBuff);
                }
                fullBuff.millisecondsDuration = 7000 * (int)((fullness - Mod.Config.PositiveBuffThreshold) / (10 * Mod.Config.DrainPerMinute));
            }
            else if (fullBuff != null)
            {
                fullBuff.millisecondsDuration = 0;
            }

            Buff hungryBuff = Game1.buffsDisplay.otherBuffs.Find(b => b.source == "Hungry");

            if (fullness < Mod.Config.NegativeBuffThreshold)
            {
                if (hungryBuff == null)
                {
                    hungryBuff = new Buff(0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 10, "Hungry", I18n.Buff_Hungry());
                    Game1.buffsDisplay.addOtherBuff(hungryBuff);
                }
                hungryBuff.millisecondsDuration = 7000 * (int)(fullness / (10 * Mod.Config.DrainPerMinute));
            }
            else if (hungryBuff != null)
            {
                hungryBuff.millisecondsDuration = 0;
            }
        }