Skip to content

Commit

Permalink
Fix #22 Missing Dialog when setting checker as NPC (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
WuZhuoran authored Apr 19, 2024
1 parent 95da5b0 commit e3a15c7
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 25 deletions.
89 changes: 80 additions & 9 deletions AnimalSitter/AnimalSitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ private void IterateOverAnimals()
this.AddItemToInventory(toAdd, farmer);

stats.TrufflesHarvested++;
this.isFirstTimeTruffle = false;
}
}
else
Expand All @@ -349,6 +348,7 @@ private void IterateOverAnimals()
}
}

this.isFirstTimeTruffle = false;
this.HarvestTruffles(stats);
this.HarvestCoops(stats);

Expand Down Expand Up @@ -593,16 +593,45 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
if (character != null)
{
//this.isCheckerCharacter = true;
string portrait = "";
// string portrait = "";
if (character.Name.Equals("Shane"))
{
portrait = "$8";
// portrait = "$8";
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
message += this.GetRandomMessage(messageStoreName: "Shane", low: 1, high: 2);
}
else if (character.Name.Equals("Haley"))
{
// portrait = "$8";
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
message += this.GetRandomMessage(messageStoreName: "Haley", low: 1, high: 2);
}
else if (character.Name.Equals("Alex"))
{
// portrait = "$8";
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
message += this.GetRandomMessage(messageStoreName: "Alex", low: 1, high: 2);
}
else if (character.Name.Equals("Leah"))
{
// portrait = "$8";
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
message += this.GetRandomMessage(messageStoreName: "Leah", low: 1, high: 2);
}
else if (character.Name.Equals("Marnie"))
{
// portrait = "$8";
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
message += this.GetRandomMessage(messageStoreName: "Marnie", low: 1, high: 2);
}
else
{
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("greeting"), stats, this.Config);
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(5, "Xdialog"), stats, this.Config);
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
message += I18n.Dialog_Xdialog5();
}

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

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

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

character.CurrentDialogue.Push(new Dialogue(character, message));
character.CurrentDialogue.Push(new Dialogue(character, "", message));
Game1.drawDialogue(character);
}
else
Expand Down Expand Up @@ -719,6 +748,48 @@ private string GetRandomMessage(string messageStoreName, int low=1, int high=4)
_ => I18n.Dialog_Smalltalk1(),
};
}
else if (messageStoreName == "Shane")
{
return rand switch
{
1 => I18n.Dialog_Shane1(),
2 => I18n.Dialog_Shane2(),
_ => I18n.Dialog_Shane1(),
};
}
else if (messageStoreName == "Haley")
{
return rand switch
{
1 => I18n.Dialog_Haley1(),
2 => I18n.Dialog_Haley2(),
_ => I18n.Dialog_Haley1(),
};
}
else if (messageStoreName == "Alex")
{
return rand switch
{
1 => I18n.Dialog_Alex1(),
_ => I18n.Dialog_Alex1(),
};
}
else if (messageStoreName == "Leah")
{
return rand switch
{
1 => I18n.Dialog_Leah1(),
_ => I18n.Dialog_Leah1(),
};
}
else if (messageStoreName == "Marnie")
{
return rand switch
{
1 => I18n.Dialog_Marnie1(),
_ => I18n.Dialog_Marnie1(),
};
}
else
{
return "...$h#$e#";
Expand Down
2 changes: 1 addition & 1 deletion AnimalSitter/AnimalSitter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>AnimalSitter</AssemblyName>
<RootNamespace>AnimalSitter</RootNamespace>
<Version>2.2.2</Version>
<Version>2.2.3</Version>
<TargetFramework>net6.0</TargetFramework>
<Platforms>AnyCPU</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
2 changes: 1 addition & 1 deletion AnimalSitter/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "Animal Sitter LTS",
"Author": "oliver",
"Version": "2.2.2",
"Version": "2.2.3",
"Description": "Long Term Support Mod Version for Animal Sitter Mod. Let someone else pet all those pesky animals!",
"UniqueID": "oliver.AnimalSitterLTS",
"EntryDll": "AnimalSitter.dll",
Expand Down
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ Here's the default configuration:

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).

### Customization
### Customization on Dialogs

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".
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.

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.

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

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)

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

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

**Xdialog** - Some specific dialogs used when the spouse or non-character check the pots.
**greeting** - Greetings the checker will use when addressing the farmer.
**unfinishedmoney** - Comments the character checker will make when they weren't able to finish on account of no money.
**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)
**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)
**smalltalk & character names** - Comments that are thrown in at the end of most conversations.

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.

## Credit

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

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

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

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

Expand Down

0 comments on commit e3a15c7

Please sign in to comment.