Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using Microsoft.Xna.Framework;
- using StardewModdingAPI;
- using StardewModdingAPI.Events;
- using StardewModdingAPI.Utilities;
- using StardewValley;
- namespace LuckyShoes
- {
- /// <summary>The mod entry point.</summary>
- public class ModEntry : Mod
- {
- /// <summary>The mod entry point, called after the mod is first loaded.</summary>
- /// <param name="helper">Provides simplified APIs for writing mods.</param>
- ///
- private int leprechaunShoes = 14;
- private bool isWearingLeprechaunShoes = false;
- public override void Entry(IModHelper helper)
- {
- //helper.Events.GameLoop.UpdateTicked += onUpdateTicked;
- helper.Events.Player.InventoryChanged += onInventoryChanged;
- }
- private void onInventoryChanged(object sender, InventoryChangedEventArgs e)
- {
- this.equippedBoots();
- if (isWearingLeprechaunShoes = true && Context.IsWorldReady.Equals(true))
- {
- this.giveBuff();
- Monitor.Log($"Buff applied.", LogLevel.Debug);
- }
- else
- {
- this.doNothing();
- }
- }
- private void giveBuff()
- {
- Buff luckBuff = new Buff(0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 100, "Lucky", "Lucky");
- Game1.buffsDisplay.addOtherBuff(luckBuff);
- Monitor.Log($"Adding luck buff.", LogLevel.Debug);
- }
- private void equippedBoots()
- {
- var currentBoots = Game1.player.shoes.Value;
- if (currentBoots != leprechaunShoes)
- {
- Monitor.Log($"Boots are not Lucky Shoes.", LogLevel.Debug);
- Monitor.Log($"Current boots value is {currentBoots}.", LogLevel.Debug);
- isWearingLeprechaunShoes = false;
- return;
- }
- else
- {
- isWearingLeprechaunShoes = true;
- Monitor.Log($"Player is wearing correct boots? {isWearingLeprechaunShoes}.", LogLevel.Debug);
- }
- }
- private void doNothing()
- {
- Monitor.Log($"We're doing nothing", LogLevel.Debug);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement