feat: Adds item graphic size to Bounds.bin and makes item graphic offset available to gumps (#2115)

This commit is contained in:
Kamron Batman 2025-02-10 19:31:39 -08:00 committed by GitHub
parent 772511d1e8
commit 40479c946a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 96 additions and 50 deletions

View file

@ -1,6 +1,6 @@
/*************************************************************************
* ModernUO *
* Copyright 2019-2024 - ModernUO Development Team *
* Copyright 2019-2025 - ModernUO Development Team *
* Email: hi@modernuo.com *
* File: BaseGump.cs *
* *
@ -86,4 +86,31 @@ public abstract class BaseGump
return hash == 461 ? hash * primeMulti : hash;
}
}
public static Point2D GetItemGraphicOffset(int itemId)
{
var (width, height) = ItemBounds.Sizes[itemId];
var x = 0;
var y = 0;
if (width > 44)
{
x -= (width - 44) / 2;
}
else if (width < 44)
{
x += (44 - width) / 2;
}
if (height > 44)
{
y -= height - 44;
}
else if (height < 44)
{
y += 44 - height;
}
return new Point2D(x, y);
}
}

View file

@ -62,7 +62,7 @@ namespace Server.Gumps
{
var entry = Rewards[i];
var bounds = ItemBounds.Table[entry.ItemID];
var bounds = ItemBounds.Bounds[entry.ItemID];
var height = Math.Max(36, bounds.Height);
if (offset + height > 320)