public void Resolver(Farmer who, string answer)
 {
     if (answer == "n")
     {
         return;
     }
     if ((this.Conditional.Item == -1 && who.Money >= this.Conditional.Amount) || who.hasItemInInventory(this.Conditional.Item, this.Conditional.Amount))
     {
         if (this.Conditional.Item == -1)
         {
             who.Money -= this.Conditional.Amount;
         }
         else
         {
             who.removeItemsFromInventory(this.Conditional.Item, this.Conditional.Amount);
         }
         who.mailReceived.Add("ALLCondition_" + this.Conditional.Name);
         ModEntry.Logger.Log("Conditional completed: " + this.Conditional.Name, LogLevel.Trace);
         ModEntry.UpdateConditionalEdits();
         if (this.Conditional.Success != null)
         {
             Game1.drawDialogueBox(this.Conditional.Success);
         }
     }
     else
     {
         Game1.drawObjectDialogue(ModEntry.Strings.Get("notEnough", new { itemName = this.GetItemName() }));
     }
 }
Exemple #2
0
 /*********
 ** Public methods
 *********/
 public static void TimeEvents_AfterDayStarted(object s, EventArgs e)
 {
     ModEntry.UpdateConditionalEdits();
     if (Game1.dayOfMonth == 1)
     {
         ModEntry.UpdateTilesheets();
     }
 }
 /// <summary>Raised after a player warps to a new location.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnWarped(object sender, WarpedEventArgs e)
 {
     if (e.IsLocalPlayer)
     {
         this.Helper.Events.Player.Warped -= this.OnWarped;
         ModEntry.UpdateConditionalEdits();
     }
 }
 /// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private static void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     ModEntry.UpdateConditionalEdits();
     if (Game1.dayOfMonth == 1)
     {
         ModEntry.UpdateTilesheets();
     }
 }
Exemple #5
0
 public static void PlayerEvents_Warped(object s, EventArgs e)
 {
     PlayerEvents.Warped -= Events.PlayerEvents_Warped;
     ModEntry.UpdateConditionalEdits();
 }
Exemple #6
0
 internal static void LocationEvents_CurrentLocationChanged(object s, EventArgs e)
 {
     LocationEvents.CurrentLocationChanged -= LocationEvents_CurrentLocationChanged;
     ModEntry.UpdateConditionalEdits();
 }