feat: Adds item graphic size to Bounds.bin and makes item graphic offset available to gumps (#2115)
This commit is contained in:
parent
772511d1e8
commit
40479c946a
12 changed files with 96 additions and 50 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue