Advertisement
minervamaga

Untitled

Mar 10th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.27 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using Microsoft.Xna.Framework;
  4. using StardewModdingAPI;
  5. using StardewModdingAPI.Events;
  6. using StardewModdingAPI.Utilities;
  7. using StardewValley;
  8.  
  9. namespace LuckyShoes
  10. {
  11.     /// <summary>The mod entry point.</summary>
  12.     public class ModEntry : Mod
  13.     {
  14.         /// <summary>The mod entry point, called after the mod is first loaded.</summary>
  15.         /// <param name="helper">Provides simplified APIs for writing mods.</param>
  16.         ///
  17.         private int leprechaunShoes = 14;
  18.         private bool isWearingLeprechaunShoes = false;
  19.  
  20.         public override void Entry(IModHelper helper)
  21.         {
  22.             //helper.Events.GameLoop.UpdateTicked += onUpdateTicked;
  23.             helper.Events.Player.InventoryChanged += onInventoryChanged;
  24.  
  25.         }
  26.  
  27.         private void onInventoryChanged(object sender, InventoryChangedEventArgs e)
  28.         {
  29.             this.equippedBoots();
  30.  
  31.             if (isWearingLeprechaunShoes = true && Context.IsWorldReady.Equals(true))
  32.             {
  33.                 this.giveBuff();
  34.                 Monitor.Log($"Buff applied.", LogLevel.Debug);
  35.             }
  36.             else
  37.             {
  38.                 this.doNothing();
  39.             }
  40.         }
  41.  
  42.         private void giveBuff()
  43.         {
  44.             Buff luckBuff = new Buff(0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 100, "Lucky", "Lucky");
  45.  
  46.             Game1.buffsDisplay.addOtherBuff(luckBuff);
  47.             Monitor.Log($"Adding luck buff.", LogLevel.Debug);
  48.         }
  49.  
  50.         private void equippedBoots()
  51.         {
  52.             var currentBoots = Game1.player.shoes.Value;
  53.  
  54.             if (currentBoots != leprechaunShoes)
  55.             {
  56.                 Monitor.Log($"Boots are not Lucky Shoes.", LogLevel.Debug);
  57.                 Monitor.Log($"Current boots value is {currentBoots}.", LogLevel.Debug);
  58.                 isWearingLeprechaunShoes = false;
  59.                 return;
  60.             }
  61.             else
  62.             {
  63.                 isWearingLeprechaunShoes = true;
  64.                 Monitor.Log($"Player is wearing correct boots? {isWearingLeprechaunShoes}.", LogLevel.Debug);
  65.             }
  66.         }
  67.  
  68.         private void doNothing()
  69.         {
  70.             Monitor.Log($"We're doing nothing", LogLevel.Debug);
  71.         }
  72.  
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement