Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treasure Auto-grab, Auto eat, Autofisher - AFK, Auto Reel Rod, Fish I… #1

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions JoysOfEfficiency.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29424.173
# Visual Studio Version 17
VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JoysOfEfficiency", "JoysOfEfficiency\JoysOfEfficiency.csproj", "{0302444C-4190-4C5D-A873-A1F80267961A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JoysOfEfficiency", "JoysOfEfficiency\JoysOfEfficiency.csproj", "{0302444C-4190-4C5D-A873-A1F80267961A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -12,11 +12,15 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0302444C-4190-4C5D-A873-A1F80267961A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Release|Any CPU.Build.0 = Release|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Debug|x86.ActiveCfg = Debug|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Debug|x86.Build.0 = Debug|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Release|Any CPU.Build.0 = Release|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Release|x86.ActiveCfg = Release|Any CPU
{0302444C-4190-4C5D-A873-A1F80267961A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
72 changes: 43 additions & 29 deletions JoysOfEfficiency/Automation/AutoFisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ public static void AutoReelRod()
{
return;
}
String whichFish = rod.whichFish.QualifiedItemId;

if (!rod.isNibbling || !rod.isFishing || whichFish != null || rod.isReeling || rod.hit ||
// if instance here gives error so i instance in the if.
// String whichFish = rod.whichFish.QualifiedItemId;

if (!rod.isNibbling || !rod.isFishing || rod.whichFish != null || rod.isReeling || rod.hit ||
rod.isTimingCast || rod.pullingOutOfWater || rod.fishCaught || rod.castedButBobberStillInAir)
{
return;
Expand All @@ -90,7 +92,7 @@ public static void CollectFish(Farmer who, FishingRod rod)
int recastTimerMs = rod.recastTimerMs;
String whichFish = rod.whichFish.QualifiedItemId;
int fishQuality = rod.fishQuality;
String itemCategory = rod.getCategoryName();
int itemCategory = rod.whichFish.GetParsedData().Category;

if (!Game1.isFestival())
{
Expand Down Expand Up @@ -118,42 +120,57 @@ public static void CollectFish(Farmer who, FishingRod rod)
who.currentLocation.localSound("coin");
if (!rod.treasureCaught)
{
rod.recastTimerMs = 200;
StardewValley.Object @object = null;
switch (itemCategory)
{
case "Object":
{
@object = new StardewValley.Object(whichFish, 1, false, -1, fishQuality);
if (whichFish == GameLocation.CAROLINES_NECKLACE_ITEM_QID)
case -24:
{
@object.questItem.Value = true;
@object = new Furniture(whichFish, Vector2.Zero);
break;
}

if (whichFish == "79" || whichFish == "842")

case -4:
{
@object = who.currentLocation.tryToCreateUnseenSecretNote(who);
if (@object == null)
return;
@object = new StardewValley.Object(whichFish, 1, false, -1, fishQuality);
if (whichFish == GameLocation.CAROLINES_NECKLACE_ITEM_QID)
{
@object.questItem.Value = true;
}
if (whichFish == "79" || whichFish == "842")
{
@object = who.currentLocation.tryToCreateUnseenSecretNote(who);
if (@object == null) return;
}
if (rod.numberOfFishCaught > 1)
{
@object.Stack = 2;
}
break;
}

if (rod.numberOfFishCaught > 1)
default:
{
@object.Stack = rod.numberOfFishCaught;
@object = new StardewValley.Object(whichFish, 1, false, -1);
if (whichFish == GameLocation.CAROLINES_NECKLACE_ITEM_QID)
{
@object.questItem.Value = true;
}
if (whichFish == "79" || whichFish == "842")
{
@object = who.currentLocation.tryToCreateUnseenSecretNote(who);
if (@object == null) return;
}
if (rod.numberOfFishCaught > 1)
{
@object.Stack = 2;
}
break;
}

break;
}
case "Furniture":
{
@object = new Furniture(whichFish, Vector2.Zero);
break;
}
}
bool fromFishPond = rod.fromFishPond;
who.completelyStopAnimatingOrDoingAction();
rod.doneFishing(who, !fromFishPond);
if (!Game1.isFestival() && !fromFishPond && (itemCategory == "Object" && Game1.player.team.specialOrders.Count > 0))
if (!Game1.isFestival() && !fromFishPond && (itemCategory == -4 && Game1.player.team.specialOrders.Count > 0))
{
foreach (SpecialOrder specialOrder in Game1.player.team.specialOrders)
{
Expand All @@ -166,10 +183,7 @@ public static void CollectFish(Farmer who, FishingRod rod)
return;
}

Game1.activeClickableMenu = new ItemGrabMenu(new List<Item>
{
@object
}, rod).setEssential(true);
Game1.activeClickableMenu = new ItemGrabMenu(new List<Item> { @object }, rod).setEssential(true);
}
else
{
Expand Down