Changes

Jump to navigation Jump to search
118 bytes removed ,  21:07, 28 September 2019
Line 442: Line 442:  
Notice the additional code in the Edit method, where any mail in the dynamicMail collection is injected into Stardew Valley's content.  There will be no mail in the dynamicMail collection when the MOD is loaded (in this case) the first time.  If you add mail after the original load, then the content will have to be reloaded by invalidating the cache.  Refer to [https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Content#Advanced Invalidating Cache] for more details.
 
Notice the additional code in the Edit method, where any mail in the dynamicMail collection is injected into Stardew Valley's content.  There will be no mail in the dynamicMail collection when the MOD is loaded (in this case) the first time.  If you add mail after the original load, then the content will have to be reloaded by invalidating the cache.  Refer to [https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Content#Advanced Invalidating Cache] for more details.
   −
===Send a letter===
+
===Send a letter (using static content)===
   −
To make uses of this class in your own project, thereby making the mail data available, hook into the OnGameLaunch event, for example
+
To make uses of this class in your own project, thereby making the static mail data available, hook into the OnGameLaunch event, for example.
    
<source lang="c#">
 
<source lang="c#">
Line 468: Line 468:  
The second method (Game1.addMailForTomorrow) will, as the name implies, add the letter to the player's mailbox on the next day.  This method remembers the mail (Id) sent making it possible not to send the same letter over and over.  This can be handled in "DayStaring", "DayEnding" or other events, as dictated by your need.
 
The second method (Game1.addMailForTomorrow) will, as the name implies, add the letter to the player's mailbox on the next day.  This method remembers the mail (Id) sent making it possible not to send the same letter over and over.  This can be handled in "DayStaring", "DayEnding" or other events, as dictated by your need.
   −
You may be able to put the letter directly into the mailbox and also have it be remembered using the next collection (mailRecieved) to be covered, but I have not confirmed that so I don't want to lead you astrayPresumption is you have to add your mail manually if you want it to be remembered when using the add directly to mailbox method.
+
You may be able to put the letter directly into the mailbox and also have it be remembered using the mailRecieved collection.  You can simply add your mailId manually if you want it to be remembered when using the add directly to mailbox method.
    
If you want Stardew Valley to forget that a specific letter has already been sent, you can remove it from the mailReceived collection.  You can iterate through the collection as well using a foreach should you need to remove mail en mass.
 
If you want Stardew Valley to forget that a specific letter has already been sent, you can remove it from the mailReceived collection.  You can iterate through the collection as well using a foreach should you need to remove mail en mass.
Line 476: Line 476:  
</source>
 
</source>
   −
That is all there is to sending a simple letter.  Attaching items, although mentioned in the source code comments above, will need some additional explanation at a future time. Creating mail content dynamically, in respond to game conditions, is a little more complicated and will be covered in the future as well.
+
That is all there is to sending a simple letter.  Attaching objects and sending money via letter is straight-forward, but sending recipes is more complicated  and will need some additional explanation at a future time.
 +
 
 +
===Send a letter (using dynamic content)===
    
==Harmony==
 
==Harmony==
49

edits

Navigation menu