@@ -29,16 +29,16 @@ public override void Entry(IModHelper helper)
2929 {
3030 TreeTransplant . helper = helper ;
3131
32- helper . Events . GameLoop . GameLaunched += onGameLaunched ;
33- helper . Events . Display . MenuChanged += onMenuChanged ;
32+ helper . Events . GameLoop . GameLaunched += OnGameLaunched ;
33+ helper . Events . Display . MenuChanged += OnMenuChanged ;
3434 }
3535
3636 /// <summary>
3737 /// Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.
3838 /// </summary>
3939 /// <param name="sender">The event sender.</param>
4040 /// <param name="e">The event data.</param>
41- private void onGameLaunched ( object sender , GameLaunchedEventArgs e )
41+ private void OnGameLaunched ( object sender , GameLaunchedEventArgs e )
4242 {
4343 // batch together the trees in a render texture for our menu
4444 loadTreeTexture ( ) ;
@@ -53,7 +53,7 @@ private void onGameLaunched(object sender, GameLaunchedEventArgs e)
5353 /// </summary>
5454 /// <param name="sender">The event sender.</param>
5555 /// <param name="e">The event data.</param>
56- private void onMenuChanged ( object sender , MenuChangedEventArgs e )
56+ private void OnMenuChanged ( object sender , MenuChangedEventArgs e )
5757 {
5858 // carpenter dialog in science house?
5959 if ( Game1 . currentLocation ? . Name == "ScienceHouse" && e . NewMenu is DialogueBox && Game1 . currentLocation . lastQuestionKey == "carpenter" && Game1 . IsMasterGame )
@@ -76,30 +76,41 @@ private void handleDialogueMenu()
7676 return ;
7777
7878 // create answer choices
79- var responseList = new List < Response > ( ) { new Response ( "Shop" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_Shop" ) ) } ;
79+ var options = new List < Response > ( ) { new Response ( "Shop" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_Shop" ) ) } ;
8080
8181 // handle if the house can still be upgraded
8282 if ( Game1 . IsMasterGame )
8383 {
8484 if ( Game1 . player . HouseUpgradeLevel < 3 )
85- responseList . Add ( new Response ( "Upgrade" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_UpgradeHouse" ) ) ) ;
86- else if ( ( Game1 . MasterPlayer . mailReceived . Contains ( "ccIsComplete" ) || Game1 . MasterPlayer . mailReceived . Contains ( "JojaMember" ) || Game1 . MasterPlayer . hasCompletedCommunityCenter ( ) ) && ( Game1 . getLocationFromName ( "Town" ) as Town ) . daysUntilCommunityUpgrade . Value <= 0 && ! Game1 . MasterPlayer . mailReceived . Contains ( "pamHouseUpgrade" ) )
87- responseList . Add ( new Response ( "CommunityUpgrade" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_CommunityUpgrade" ) ) ) ;
85+ options . Add ( new Response ( "Upgrade" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_UpgradeHouse" ) ) ) ;
86+ else if ( ( Game1 . MasterPlayer . mailReceived . Contains ( "ccIsComplete" ) || Game1 . MasterPlayer . mailReceived . Contains ( "JojaMember" ) || Game1 . MasterPlayer . hasCompletedCommunityCenter ( ) ) && ( Game1 . getLocationFromName ( "Town" ) as Town ) . daysUntilCommunityUpgrade . Value <= 0 )
87+ {
88+ if ( ! Game1 . MasterPlayer . mailReceived . Contains ( "pamHouseUpgrade" ) || ! Game1 . MasterPlayer . mailReceived . Contains ( "communityUpgradeShortcuts" ) )
89+ options . Add ( new Response ( "CommunityUpgrade" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_CommunityUpgrade" ) ) ) ;
90+ }
91+ }
92+ else if ( Game1 . player . HouseUpgradeLevel < 3 )
93+ options . Add ( new Response ( "Upgrade" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_UpgradeCabin" ) ) ) ;
94+
95+ if ( Game1 . player . HouseUpgradeLevel >= 2 )
96+ {
97+ if ( Game1 . IsMasterGame )
98+ options . Add ( new Response ( "Renovate" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_RenovateHouse" ) ) ) ;
99+ else
100+ options . Add ( new Response ( "Renovate" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_RenovateCabin" ) ) ) ;
88101 }
89- else if ( Game1 . player . HouseUpgradeLevel < 2 )
90- responseList . Add ( new Response ( "Upgrade" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_UpgradeCabin" ) ) ) ;
91102
92- responseList . Add ( new Response ( "Tree" , helper . Translation . Get ( "Carpenter_Option" ) ) ) ;
93- responseList . Add ( new Response ( "Construct" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_Construct" ) ) ) ;
94- responseList . Add ( new Response ( "Leave" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_Leave" ) ) ) ;
103+ options . Add ( new Response ( "Tree" , helper . Translation . Get ( "Carpenter_Option" ) ) ) ;
104+ options . Add ( new Response ( "Construct" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_Construct" ) ) ) ;
105+ options . Add ( new Response ( "Leave" , Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu_Leave" ) ) ) ;
95106
96107 // set the custom key for our dialogue box
97108 Game1 . currentLocation . lastQuestionKey = "custom_carpenter" ;
98109
99110 // create the question dialogue with our custom tag
100111 science . createQuestionDialogue (
101112 Game1 . content . LoadString ( "Strings\\ Locations:ScienceHouse_CarpenterMenu" ) ,
102- responseList . ToArray ( ) ,
113+ options . ToArray ( ) ,
103114 handleCarpenterMenuAnswer
104115 ) ;
105116 }
@@ -271,9 +282,7 @@ private void loadSpecialTreeTexture()
271282 /// </summary>
272283 private void loadFlipTexture ( )
273284 {
274- flipTexture = Texture2D . FromStream (
275- Game1 . graphics . GraphicsDevice ,
276- new FileStream ( Path . Combine ( Helper . DirectoryPath , "assets" , "flip.png" ) , FileMode . Open ) ) ;
285+ flipTexture = helper . Content . Load < Texture2D > ( Path . Combine ( "assets" , "flip.png" ) , ContentSource . ModFolder ) ;
277286 }
278287 }
279288}
0 commit comments