Skip to content

Commit e3a15c7

Browse files
authored
Fix #22 Missing Dialog when setting checker as NPC (#23)
1 parent 95da5b0 commit e3a15c7

File tree

4 files changed

+97
-25
lines changed

4 files changed

+97
-25
lines changed

AnimalSitter/AnimalSitter.cs

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ private void IterateOverAnimals()
328328
this.AddItemToInventory(toAdd, farmer);
329329

330330
stats.TrufflesHarvested++;
331-
this.isFirstTimeTruffle = false;
332331
}
333332
}
334333
else
@@ -349,6 +348,7 @@ private void IterateOverAnimals()
349348
}
350349
}
351350

351+
this.isFirstTimeTruffle = false;
352352
this.HarvestTruffles(stats);
353353
this.HarvestCoops(stats);
354354

@@ -593,16 +593,45 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
593593
if (character != null)
594594
{
595595
//this.isCheckerCharacter = true;
596-
string portrait = "";
596+
// string portrait = "";
597597
if (character.Name.Equals("Shane"))
598598
{
599-
portrait = "$8";
599+
// portrait = "$8";
600+
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
601+
message += this.GetRandomMessage(messageStoreName: "Shane", low: 1, high: 2);
602+
}
603+
else if (character.Name.Equals("Haley"))
604+
{
605+
// portrait = "$8";
606+
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
607+
message += this.GetRandomMessage(messageStoreName: "Haley", low: 1, high: 2);
608+
}
609+
else if (character.Name.Equals("Alex"))
610+
{
611+
// portrait = "$8";
612+
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
613+
message += this.GetRandomMessage(messageStoreName: "Alex", low: 1, high: 2);
614+
}
615+
else if (character.Name.Equals("Leah"))
616+
{
617+
// portrait = "$8";
618+
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
619+
message += this.GetRandomMessage(messageStoreName: "Leah", low: 1, high: 2);
620+
}
621+
else if (character.Name.Equals("Marnie"))
622+
{
623+
// portrait = "$8";
624+
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
625+
message += this.GetRandomMessage(messageStoreName: "Marnie", low: 1, high: 2);
626+
}
627+
else
628+
{
629+
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("greeting"), stats, this.Config);
630+
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(5, "Xdialog"), stats, this.Config);
631+
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
632+
message += I18n.Dialog_Xdialog5();
600633
}
601634

602-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("greeting"), stats, this.Config);
603-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(5, "Xdialog"), stats, this.Config);
604-
message += I18n.Dialog_Greeting1(name: Game1.player.Name);
605-
message += I18n.Dialog_Xdialog5();
606635

607636
if (this.CostPerAnimal > 0)
608637
{
@@ -625,9 +654,9 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
625654

626655
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("smalltalk"), stats, this.Config);
627656
message += this.GetRandomMessage(messageStoreName: "smalltalk", low: 1, high: 14);
628-
message += portrait + "#$e#";
657+
// message += portrait + "#$e#";
629658

630-
character.CurrentDialogue.Push(new Dialogue(character, message));
659+
character.CurrentDialogue.Push(new Dialogue(character, "", message));
631660
Game1.drawDialogue(character);
632661
}
633662
else
@@ -719,6 +748,48 @@ private string GetRandomMessage(string messageStoreName, int low=1, int high=4)
719748
_ => I18n.Dialog_Smalltalk1(),
720749
};
721750
}
751+
else if (messageStoreName == "Shane")
752+
{
753+
return rand switch
754+
{
755+
1 => I18n.Dialog_Shane1(),
756+
2 => I18n.Dialog_Shane2(),
757+
_ => I18n.Dialog_Shane1(),
758+
};
759+
}
760+
else if (messageStoreName == "Haley")
761+
{
762+
return rand switch
763+
{
764+
1 => I18n.Dialog_Haley1(),
765+
2 => I18n.Dialog_Haley2(),
766+
_ => I18n.Dialog_Haley1(),
767+
};
768+
}
769+
else if (messageStoreName == "Alex")
770+
{
771+
return rand switch
772+
{
773+
1 => I18n.Dialog_Alex1(),
774+
_ => I18n.Dialog_Alex1(),
775+
};
776+
}
777+
else if (messageStoreName == "Leah")
778+
{
779+
return rand switch
780+
{
781+
1 => I18n.Dialog_Leah1(),
782+
_ => I18n.Dialog_Leah1(),
783+
};
784+
}
785+
else if (messageStoreName == "Marnie")
786+
{
787+
return rand switch
788+
{
789+
1 => I18n.Dialog_Marnie1(),
790+
_ => I18n.Dialog_Marnie1(),
791+
};
792+
}
722793
else
723794
{
724795
return "...$h#$e#";

AnimalSitter/AnimalSitter.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<AssemblyName>AnimalSitter</AssemblyName>
55
<RootNamespace>AnimalSitter</RootNamespace>
6-
<Version>2.2.2</Version>
6+
<Version>2.2.3</Version>
77
<TargetFramework>net6.0</TargetFramework>
88
<Platforms>AnyCPU</Platforms>
99
<PlatformTarget>AnyCPU</PlatformTarget>

AnimalSitter/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"Name": "Animal Sitter LTS",
33
"Author": "oliver",
4-
"Version": "2.2.2",
4+
"Version": "2.2.3",
55
"Description": "Long Term Support Mod Version for Animal Sitter Mod. Let someone else pet all those pesky animals!",
66
"UniqueID": "oliver.AnimalSitterLTS",
77
"EntryDll": "AnimalSitter.dll",

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ Here's the default configuration:
7575

7676
The first specifies the item ID and the chest coordinates, this knows to check for a chest on the farm at that location. The second specifies an item id, a chest location, and a building. This will look for a chest at (7,4) in the FarmHouse (which in the starting house is the spot next to the fireplace).
7777

78-
### Customization
78+
### Customization on Dialogs
7979

80-
The `dialog.xnb` file will allow you to customize the dialog to your liking. I've also included the dialog.yaml source file, but the mod will read it from the XNB file. If you don't know how to do it, google "how to unpack and repack stardew valley mods".
80+
Now our mod support [SMAPI-ModTranslationClassBuilder](https://github.com/Pathoschild/SMAPI-ModTranslationClassBuilder) Framework. So all the strings used in mod will stored in [i18n/default.json](AnimalSitter/i18n/default.json). If you want to add more Dialog or Strings, you need to modify strings inside `default.json` or yoru specific `language.json` file.
8181

8282
The dialogue elements are arranged in a name_index format. If the name starts with a capital 'X', that means those messages need to stay roughly in that order and in the same format for the dialog to make sense. The number is important.
8383

@@ -87,26 +87,27 @@ Also you'll see that I added a few names down at the bottom,"Shane_1", "Shane_2"
8787

8888
Most of the notation that existing SDV dialogs use will work(for example @ is replaced by the name of the farmer). There's also notation added to use values from this mod in the dialog, they are (along with a description)
8989

90-
**%%animalsPet%%** - The number of animals that were petted.
91-
**%%trufflesHarvested%%** - The number of truffles that were harvested.
92-
**%%productsHarvested%%** - The number of other animal products that were harvested (I promise to allow more granular tracking in the future).
93-
**%%aged%%** - The number of animals that were aged to maturity.
94-
**%%fed%%** - The number of animals that were fed.
95-
**%%maxHappiness%%** - The number of animals who had their happiness maxed.
96-
**%%maxFriendship%%** - The number animals that had their friendship toward the farmer maxed out.
97-
**%%numActions%%** - The total number of actions performed.
98-
**%%totalCost%%** - The total costs for all animals.
99-
**%%spouse%%** - The farmer's spouse's name (if married), the value of whoChecks otherwise.
90+
**{{animalsPet}}** - The number of animals that were petted.
91+
**{{trufflesHarvested}}** - The number of truffles that were harvested.
92+
**{{productsHarvested}}** - The number of other animal products that were harvested (I promise to allow more granular tracking in the future).
93+
**{{aged}}** - The number of animals that were aged to maturity.
94+
**{{fed}}** - The number of animals that were fed.
95+
**{{maxHappiness}}** - The number of animals who had their happiness maxed.
96+
**{{maxFriendship}}** - The number animals that had their friendship toward the farmer maxed out.
97+
**{{numActions}}** - The total number of actions performed.
98+
**{{totalCost}}** - The total costs for all animals.
99+
**{{spouse}}** - The farmer's spouse's name (if married), the value of whoChecks otherwise.
100100

101101
The dialog groups in the file, and a quick explanation of when each are used:
102102

103103
**Xdialog** - Some specific dialogs used when the spouse or non-character check the pots.
104104
**greeting** - Greetings the checker will use when addressing the farmer.
105105
**unfinishedmoney** - Comments the character checker will make when they weren't able to finish on account of no money.
106-
**freebies** - Comments the character checker will make when allowFreebies is true, and the cost of services was more than the farmer has on hand. (Not really used in this mod yet)
107106
**unfinishedinventory** - Comments the character checker will make when they weren't able to finish on account of not having anywhere to deliver the goods. (Not really used in this mod yet)
108107
**smalltalk & character names** - Comments that are thrown in at the end of most conversations.
109108

109+
Note: If you add more strings, the mod need to be updated to show those new messages. If you want to contribute, feel free to edit and submit Pull Request to [i18n/default.json](https://github.com/WuZhuoran/Stardew_AnimalSitter/blob/main/AnimalSitter/i18n/default.json). I will update the mod ASAP.
110+
110111
## Credit
111112

112113
* Original [Mod](https://www.nexusmods.com/stardewvalley/mods/581) and [Code](https://github.com/jdusbabek/stardewvalley) from [John Dusbabek](https://github.com/jdusbabek)
@@ -117,7 +118,7 @@ The dialog groups in the file, and a quick explanation of when each are used:
117118

118119
This project will maintain Open Source [here](https://github.com/WuZhuoran/Stardew_AnimalSitter).
119120

120-
For i18n and translation support. Just Add your languages in `i18n` folders.
121+
For i18n and translation support. Just Add your languages in `i18n` folders or Add more strings to `default.json` file.
121122

122123
We appreciate all contributions. Feel Free to raise any issues or pull requests.
123124

0 commit comments

Comments
 (0)