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

Fixed 5.2 artifact inventory UI change bug #540

Merged
merged 3 commits into from
Nov 23, 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
2 changes: 1 addition & 1 deletion InventoryKamera/scraping/ArtifactScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void ScanArtifacts(int count = 0)
Navigation.Wait(1);
}
// Scroll back one to keep it from getting too crazy
if (page % 3 == 0)
if (page % 12 == 0)
{
Logger.Debug("Scrolled back one");
Navigation.sim.Mouse.VerticalScroll(1);
Expand Down
21 changes: 15 additions & 6 deletions InventoryKamera/scraping/InventoryScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,15 @@ internal string CurrentSortingMethod()
using (var brush = new SolidBrush(Color.Black))
{
// Fill Top region
g.FillRectangle(brush, 0, 0, processedScreenshot.Width, (int)(processedScreenshot.Height * 0.09));
switch (inventoryPage)
{
case InventoryPage.Artifacts:
g.FillRectangle(brush, 0, 0, processedScreenshot.Width, (int)(processedScreenshot.Height * 0.143));
break;
default:
g.FillRectangle(brush, 0, 0, processedScreenshot.Width, (int)(processedScreenshot.Height * 0.09));
break;
}

// Fill Left region
g.FillRectangle(brush, 0, 0, (int)(processedScreenshot.Width * 0.05), processedScreenshot.Height);
Expand All @@ -402,11 +410,12 @@ internal string CurrentSortingMethod()
List<Rectangle> rectangles;
int cols, rows, itemCount, counter = 0;
double weight = 0;
int itemPerPage = inventoryPage == InventoryPage.Artifacts ? 32 : 40;
do
{
(rectangles, cols, rows) = ProcessScreenshot(processedScreenshot, weight);
itemCount = rows * cols;
if (itemCount != 40 && !acceptLess)
if (itemCount != itemPerPage && !acceptLess)
{
Logger.Warn("Unable to locate full page of weapons with weight {0}", weight);
Logger.Warn("Detected {0} rows and {1} columns of items", rows, cols);
Expand All @@ -425,14 +434,14 @@ internal string CurrentSortingMethod()
}
else break;

if (itemCount <= 40)
if (itemCount <= 32)
weight += 0.125;
else
{ weight -= 0.095; ++counter; }
weight = Math.Min(weight, 1);
rectangles = null;
}
while (itemCount != 40 && weight < 1 && counter < 25);
while (itemCount != itemPerPage && weight < 1 && counter < 25);

if (Properties.Settings.Default.LogScreenshots)
{
Expand All @@ -446,7 +455,7 @@ internal string CurrentSortingMethod()

if (rectangles == null)
{
Logger.Warn("Could not find 40 items in inventory. Re-using previous item page.");
Logger.Warn("Could not find {0} items in inventory. Re-using previous item page.", itemPerPage);

return prevRect == null ?
throw new ArgumentNullException("Could not find first page of items!")
Expand Down Expand Up @@ -516,7 +525,7 @@ internal static Bitmap GetLockedBitmap(Bitmap card)
{
return GenshinProcesor.CopyBitmap(card,
new Rectangle(
x: (int)(card.Width * 0.855),
x: (int)(card.Width * 0.75),
y: (int)(card.Height * (Navigation.IsNormal ? 0.353 : 0.309)),
width: (int)(card.Width * 0.0955),
height: (int)(card.Height * (Navigation.IsNormal ? 0.055 : 0.0495))));
Expand Down