Esempio n. 1
0
 public void PermissionsChanged(bool hasPermission)
 {
     if (!hasPermission)
     {
         MultiLurePlayer player = GetModPlayer();
         player.LureMinimum = 1;
         player.LureMaximum = 1;
     }
 }
Esempio n. 2
0
        public void ChangeLures(bool increase)
        {
            MultiLurePlayer player = GetModPlayer();

            bool success = true;
            int  count   = (increase ? 1 : -1);

            if (Main.keyState.PressingShift())
            {
                count = (increase ? 10 : -10);
            }

            int minimum = 1;

            player.AnyLineEquipped(out minimum);

            if ((!increase && player.LureMinimum == minimum) || (increase && player.LureMinimum == player.LureMaximum))
            {
                success = false;
            }
            else
            {
                int newCount = player.LureMinimum + count;

                if (newCount >= 1 && newCount <= player.LureMaximum)
                {
                    player.LureMinimum += count;
                }
                else if (newCount < minimum)
                {
                    player.LureMinimum = minimum;
                }
                else if (newCount > player.LureMaximum)
                {
                    player.LureMinimum = player.LureMaximum;
                }
                else
                {
                    success = false;
                }
            }

            if (success)
            {
                Main.NewText("Lures " + (increase ? "increased" : "decreased") + " to " + player.LureMinimum + ".");
            }
            else
            {
                Main.NewText($"You already have the {(increase ? "maximum" : "minimum")} numbers of lures " +
                             $"({(increase ? player.LureMaximum : minimum)}).");

                if (increase)
                {
                    addLureKey.Stop();
                }
                else
                {
                    removeLureKey.Stop();
                }
            }
        }