feat: Standardizes South/East selection gumps (#1839)

This commit is contained in:
Kamron Batman 2025-02-14 00:15:14 -08:00 • committed by GitHub
parent 279b10dd0f
commit 2e08eda8cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 263 additions and 520 deletions

View file

@ -226,7 +226,7 @@ public partial class MistletoeDeed : Item
if (northWall && westWall)
{
from.SendGump(new MistletoeDeedGump(from, loc, this));
from.SendGump(new MistletoeDeedGump(loc, this));
}
else
{
@ -276,47 +276,47 @@ public partial class MistletoeDeed : Item
}
}
private class MistletoeDeedGump : Gump
private class MistletoeDeedGump : StaticGump<MistletoeDeedGump>
{
private readonly MistletoeDeed _deed;
private readonly Mobile _from;
private readonly Point3D _loc;
public MistletoeDeedGump(Mobile from, Point3D loc, MistletoeDeed deed) : base(150, 50)
public override bool Singleton => false;
public MistletoeDeedGump(Point3D loc, MistletoeDeed deed) : base(150, 50)
{
_from = from;
_loc = loc;
_deed = deed;
}
AddBackground(0, 0, 300, 150, 0xA28);
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.AddBackground(0, 0, 300, 150, 0xA28);
AddPage(0);
builder.AddPage();
AddItem(90, 30, 0x2375);
AddItem(180, 30, 0x2374);
AddButton(50, 35, 0x868, 0x869, 1);
AddButton(145, 35, 0x868, 0x869, 2);
builder.AddItem(90, 30, 0x2375);
builder.AddItem(180, 30, 0x2374);
builder.AddButton(50, 35, 0x868, 0x869, 1);
builder.AddButton(145, 35, 0x868, 0x869, 2);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed.Deleted)
if (_deed.Deleted || info.ButtonID == 0)
{
return;
}
switch (info.ButtonID)
var from = sender.Mobile;
if (info.ButtonID == 1)
{
case 1:
{
_deed.PlaceAddon(_from, _loc, false, true);
break;
}
case 2:
{
_deed.PlaceAddon(_from, _loc, true, false);
break;
}
_deed.PlaceAddon(from, _loc, false, true);
}
else
{
_deed.PlaceAddon(from, _loc, true, false);
}
}
}

View file

@ -85,35 +85,27 @@ public partial class FirefliesDeed : Item
return;
}
from.SendGump(new FacingGump(this, from));
from.SendGump(new FacingGump(this));
}
private class FacingGump : Gump
private class FacingGump : StaticGump<FacingGump>
{
private readonly FirefliesDeed _deed;
private readonly Mobile _placer;
public override bool Singleton => true;
public FacingGump(FirefliesDeed deed, Mobile player) : base(150, 50)
public FacingGump(FirefliesDeed deed) : base(150, 50) => _deed = deed;
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
_deed = deed;
_placer = player;
builder.AddBackground(0, 0, 300, 150, 0xA28);
builder.AddPage();
Closable = true;
Disposable = true;
Draggable = true;
Resizable = false;
builder.AddItem(90, 30, 0x2332);
builder.AddItem(180, 30, 0x2336);
AddPage(0);
AddBackground(0, 0, 300, 150, 0xA28);
AddItem(90, 30, 0x2332);
AddItem(180, 30, 0x2336);
AddButton(50, 35, 0x868, 0x869, (int)Buttons.East);
AddButton(145, 35, 0x868, 0x869, (int)Buttons.South);
builder.AddButton(50, 35, 0x868, 0x869, (int)Buttons.East);
builder.AddButton(145, 35, 0x868, 0x869, (int)Buttons.South);
}
public override void OnResponse(NetState sender, in RelayInfo info)
@ -130,7 +122,12 @@ public partial class FirefliesDeed : Item
_ => 0
};
_placer.Target = new InternalTarget(_deed, itemId);
if (itemId == 0)
{
return;
}
sender.Mobile.Target = new InternalTarget(_deed, itemId);
}
private enum Buttons