Skip to content

Commit bcd0526

Browse files
authored
Fix: #28 Failed to get more products after golden animal biscuits given (#29)
* Fix: #28 Failed to get more products after golden animal biscuits given * Fix some useless using
1 parent 33eeac1 commit bcd0526

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

AnimalSitter/AnimalSitter.cs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ private void IterateOverAnimals()
373373

374374
foreach (FarmAnimal animal in this.GetAnimals())
375375
{
376+
Random random = Utility.CreateRandom(animal.myID.Value / 2.0, Game1.stats.DaysPlayed);
376377
try
377378
{
378379
if (!animal.wasPet.Value && this.PettingEnabled)
@@ -425,18 +426,22 @@ private void IterateOverAnimals()
425426
{
426427
if (this.TakeTrufflesFromPigs && this.isFirstTimeTruffle)
427428
{
428-
Object toAdd = new Object(animal.currentProduce.Value, 1, false, -1, animal.produceQuality.Value);
429+
int stack = random.NextDouble() + Game1.player.team.AverageDailyLuck() * animal.GetAnimalData().DeluxeProduceLuckMultiplier < 0.7 ? 1 : 2;
430+
Object toAdd = new Object(animal.currentProduce.Value, stack, false, -1, animal.produceQuality.Value);
429431
this.AddItemToInventory(toAdd, farmer);
430432

431433
stats.TrufflesHarvested++;
432434
}
433435
}
434436
else
435437
{
436-
Object toAdd = new Object(animal.currentProduce.Value, 1, false, -1, animal.produceQuality.Value);
438+
int stack = random.NextDouble() + Game1.player.team.AverageDailyLuck() * animal.GetAnimalData().DeluxeProduceLuckMultiplier < 0.7 ? 1 : 2;
439+
stack = animal.hasEatenAnimalCracker.Value ? stack * 2 : stack;
440+
441+
Object toAdd = new Object(animal.currentProduce.Value, stack, false, -1, animal.produceQuality.Value);
437442
this.AddItemToInventory(toAdd, farmer);
443+
animal.currentProduce.Value = null;
438444

439-
animal.currentProduce.Value = "0";
440445
stats.ProductsHarvested++;
441446
}
442447

@@ -656,18 +661,15 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
656661
if (Game1.player.isMarriedOrRoommates())
657662
{
658663
string spouse = Game1.player.isMarriedOrRoommates() ? Game1.player.getSpouse().getName() : this.Checker;
659-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(1, "Xdialog"), stats, this.Config);
660664
message += I18n.Dialog_Xdialog1(spouse: spouse);
661665
}
662666
else
663667
{
664-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(2, "Xdialog"), stats, this.Config);
665668
message += I18n.Dialog_Xdialog2(num_actions: stats.NumActions);
666669
}
667670

668671
if (totalCost > 0 && this.CostPerAnimal > 0)
669672
{
670-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(3, "Xdialog"), stats, this.Config);
671673
message += I18n.Dialog_Xdialog3(total_cost: stats.TotalCost);
672674
}
673675

@@ -676,12 +678,10 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
676678
}
677679
else if (gatheringOnly)
678680
{
679-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(4, "Xdialog"), stats, this.Config);
680681
message += I18n.Dialog_Xdialog4(checker: this.Checker);
681682

682683
if (totalCost > 0 && this.CostPerAnimal > 0)
683684
{
684-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(3, "Xdialog"), stats, this.Config);
685685
message += I18n.Dialog_Xdialog3(total_cost: stats.TotalCost);
686686
}
687687

@@ -693,7 +693,7 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
693693
NPC character = Game1.getCharacterFromName(this.Checker);
694694
if (character != null)
695695
{
696-
//this.isCheckerCharacter = true;
696+
// this.isCheckerCharacter = true;
697697
// string portrait = "";
698698
if (character.Name.Equals("Shane"))
699699
{
@@ -727,8 +727,6 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
727727
}
728728
else
729729
{
730-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("greeting"), stats, this.Config);
731-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(5, "Xdialog"), stats, this.Config);
732730
message += this.GetRandomMessage(messageStoreName: "greeting", low: 1, high: 7);
733731
message += I18n.Dialog_Xdialog5();
734732
}
@@ -738,12 +736,10 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
738736
{
739737
if (doesPlayerHaveEnoughCash)
740738
{
741-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(6, "Xdialog"), stats, this.Config);
742739
message += I18n.Dialog_Xdialog6(total_cost: stats.TotalCost);
743740
}
744741
else
745742
{
746-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("unfinishedmoney"), stats, this.Config);
747743
message += this.GetRandomMessage(messageStoreName: "unfinishedmoney", low: 1, high: 8);
748744
}
749745
}
@@ -753,7 +749,6 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
753749
//message += portrait + "#$e#";
754750
}
755751

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

@@ -762,8 +757,6 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
762757
}
763758
else
764759
{
765-
//message += checker + " has performed " + numActions + " for your animals.";
766-
// message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(7, "Xdialog"), stats, this.Config);
767760
message += I18n.Dialog_Xdialog7(checker: this.Checker, num_actions: stats.NumActions);
768761
HUDMessage msg = new HUDMessage(message);
769762
Game1.addHUDMessage(msg);

AnimalSitter/i18n/zh.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"config.KeyBind": "快捷键",
3-
"config.KeyBind.description": "默认'O'键,按下后助手开始工作。",
3+
"config.KeyBind.description": "默认快捷键,按下后助手开始工作。默认为'O'",
44

55
"config.GrowUpEnabled": "立即成长开关",
66
"config.GrowUpEnabled.description": "开启后助手会使用神秘力量使你的动物立即长大,并产出产品。默认为关闭。",
@@ -17,8 +17,8 @@
1717
"config.PettingEnabled": "抚摸开关",
1818
"config.PettingEnabled.description": "助手会抚摸动物。默认开启。如果想自己动手,则设置为关闭。",
1919

20-
"config.PettingPetEnabled": "PettingPetEnabled",
21-
"config.PettingPetEnabled.description": "This tells your animal worker that you want your pets petted. Default as true.",
20+
"config.PettingPetEnabled": "照顾宠物开关",
21+
"config.PettingPetEnabled.description": "助手会照顾宠物,包括摸摸宠物和给宠物水盆浇水。默认为是。",
2222

2323
"config.MaxFriendshipEnabled": "好感度开关",
2424
"config.MaxFriendshipEnabled.description": "助手照料动物后,动物好感度是否增长。默认为否。",
@@ -33,8 +33,8 @@
3333
"config.EnableMessages": "信息显示开关",
3434
"config.EnableMessages.description": "是否在游戏中开启动物照料的信息提醒。默认为是。",
3535

36-
"config.TakeTrufflesFromPigs": "修复松露开关",
37-
"config.TakeTrufflesFromPigs.description": "助手会捡拾松露。解决松露变杂草的BUG",
36+
"config.TakeTrufflesFromPigs": "检查松露开关",
37+
"config.TakeTrufflesFromPigs.description": "助手会从猪的身上搜索松露,会每天在猪找到松露之前就给你一些。默认为否",
3838

3939
"config.BypassInventory": "产品入箱开关",
4040
"config.BypassInventory.description": "产品被收集后,是否不进入背包,而是存放在你指定的箱子中,默认为否。",

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.3.1",
4+
"Version": "2.3.2",
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",

0 commit comments

Comments
 (0)