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

@ -1,5 +1,4 @@
using System;
using ModernUO.CodeGeneratedEvents;
using Server.Mobiles;
namespace Server.Engines.BuffIcons;

View file

@ -1,4 +1,3 @@
using System;
using Server.Mobiles;
using Server.Network;

View file

@ -0,0 +1,49 @@
using Server.Items;
using Server.Network;
namespace Server.Gumps;
public abstract class SelectAddonDirectionGump<T> : StaticGump<T> where T : SelectAddonDirectionGump<T>
{
private readonly IDirectionAddonDeed _deed;
public SelectAddonDirectionGump(IDirectionAddonDeed deed) : base(60, 63) => _deed = deed;
public override bool Singleton => false;
public abstract int SelectionNumber { get; }
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.AddPage();
builder.AddBackground(0, 0, 273, 324, 0x13BE);
builder.AddImageTiled(10, 10, 253, 20, 0xA40);
builder.AddImageTiled(10, 40, 253, 244, 0xA40);
builder.AddImageTiled(10, 294, 253, 20, 0xA40);
builder.AddAlphaRegion(10, 10, 253, 304);
builder.AddButton(10, 294, 0xFB1, 0xFB2, 0);
builder.AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
builder.AddHtmlLocalized(14, 12, 273, 20, SelectionNumber, 0x7FFF);
builder.AddPage(1);
builder.AddButton(19, 49, 0x845, 0x846, 1);
builder.AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
builder.AddButton(19, 73, 0x845, 0x846, 2);
builder.AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed.East = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
}

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

View file

@ -0,0 +1,8 @@
namespace Server.Items;
public interface IDirectionAddonDeed : IEntity
{
public bool East { get; set; }
public void SendTarget(Mobile m);
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -30,14 +29,14 @@ public partial class BrokenBedAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class BrokenBedDeed : BaseAddonDeed
public partial class BrokenBedDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public BrokenBedDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new BrokenBedAddon(_east);
public override BaseAddon Addon => new BrokenBedAddon(East);
public override int LabelNumber => 1076263; // Broken Bed
@ -53,49 +52,17 @@ public partial class BrokenBedDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly BrokenBedDeed _deed;
public override bool Singleton => true;
public InternalGump(BrokenBedDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076749, 0x7FFF); // Please select your broken bed position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed._east = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076749; // Please select your broken bed position
}
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -26,14 +25,15 @@ public partial class BrokenVanityAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class BrokenVanityDeed : BaseAddonDeed
public partial class BrokenVanityDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public BrokenVanityDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new BrokenVanityAddon(_east);
public override BaseAddon Addon => new BrokenVanityAddon(East);
public override int LabelNumber => 1076260; // Broken Vanity
public override void OnDoubleClick(Mobile from)
@ -48,49 +48,17 @@ public partial class BrokenVanityDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly BrokenVanityDeed _deed;
public override bool Singleton => true;
public InternalGump(BrokenVanityDeed deed) : base(60, 63)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076747, 0x7FFF); // Please select your broken vanity position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed._east = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076747; // Please select your broken vanity position
}
}

View file

@ -60,25 +60,27 @@ public partial class HearthOfHomeFireDeed : BaseAddonDeed
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : StaticGump<InternalGump>
{
private readonly HearthOfHomeFireDeed _deed;
public override bool Singleton => true;
public InternalGump(HearthOfHomeFireDeed deed) : base(150, 50)
public InternalGump(HearthOfHomeFireDeed deed) : base(150, 50) => _deed = deed;
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
_deed = deed;
builder.AddBackground(0, 0, 350, 250, 0xA28);
AddBackground(0, 0, 350, 250, 0xA28);
builder.AddPage();
AddItem(90, 52, 0x2367);
AddItem(112, 35, 0x2360);
AddButton(70, 35, 0x868, 0x869, 1); // South
builder.AddItem(90, 52, 0x2367);
builder.AddItem(112, 35, 0x2360);
builder.AddButton(70, 35, 0x868, 0x869, 1); // South
AddItem(220, 35, 0x2352);
AddItem(242, 52, 0x2358);
AddButton(185, 35, 0x868, 0x869, 2); // East
builder.AddItem(220, 35, 0x2352);
builder.AddItem(242, 52, 0x2358);
builder.AddButton(185, 35, 0x868, 0x869, 2); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -77,14 +76,14 @@ public partial class CurtainsAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class CurtainsDeed : BaseAddonDeed
public partial class CurtainsDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public CurtainsDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new CurtainsAddon(_east);
public override BaseAddon Addon => new CurtainsAddon(East);
public override int LabelNumber => 1076280; // Curtains
public override void OnDoubleClick(Mobile from)
@ -99,49 +98,17 @@ public partial class CurtainsDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly CurtainsDeed _deed;
public override bool Singleton => true;
public InternalGump(CurtainsDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076581, 0x7FFF); // Please select your curtain position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed._east = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076581; // Please select your curtain position
}
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -26,14 +25,14 @@ public partial class HangingAxesAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class HangingAxesDeed : BaseAddonDeed
public partial class HangingAxesDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool m_East;
public bool East { get; set; }
[Constructible]
public HangingAxesDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new HangingAxesAddon(m_East);
public override BaseAddon Addon => new HangingAxesAddon(East);
public override int LabelNumber => 1076271; // Hanging Axes
public override void OnDoubleClick(Mobile from)
@ -48,49 +47,17 @@ public partial class HangingAxesDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly HangingAxesDeed m_Deed;
public override bool Singleton => true;
public InternalGump(HangingAxesDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
m_Deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076745, 0x7FFF); // Please select your hanging axe position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (m_Deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
m_Deed.m_East = info.ButtonID != 1;
m_Deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076745; // Please select your hanging axe position
}
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -26,14 +25,14 @@ public partial class HangingSwordsAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class HangingSwordsDeed : BaseAddonDeed
public partial class HangingSwordsDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public HangingSwordsDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new HangingSwordsAddon(_east);
public override BaseAddon Addon => new HangingSwordsAddon(East);
public override int LabelNumber => 1076272; // Hanging Swords
public override void OnDoubleClick(Mobile from)
@ -48,49 +47,17 @@ public partial class HangingSwordsDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly HangingSwordsDeed m_Deed;
public override bool Singleton => true;
public InternalGump(HangingSwordsDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
m_Deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076746, 0x7FFF); // Please select your hanging sword position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (m_Deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
m_Deed._east = info.ButtonID != 1;
m_Deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076746; // Please select your hanging sword position
}
}

View file

@ -94,46 +94,47 @@ public partial class HouseLadderDeed : BaseAddonDeed
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : StaticGump<InternalGump>
{
private readonly HouseLadderDeed _deed;
public override bool Singleton => true;
public InternalGump(HouseLadderDeed deed) : base(60, 36)
public InternalGump(HouseLadderDeed deed) : base(60, 36) => _deed = deed;
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
_deed = deed;
builder.AddPage();
AddPage(0);
builder.AddBackground(0, 0, 273, 324, 0x13BE);
builder.AddImageTiled(10, 10, 253, 20, 0xA40);
builder.AddImageTiled(10, 40, 253, 244, 0xA40);
builder.AddImageTiled(10, 294, 253, 20, 0xA40);
builder.AddAlphaRegion(10, 10, 253, 304);
builder.AddButton(10, 294, 0xFB1, 0xFB2, 0);
builder.AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
// Please select your ladder position. <br>Use the ladders marked (castle) <br> for accessing the tops of keeps <br> and castles.
AddHtmlLocalized(14, 12, 273, 20, 1076780, 0x7FFF);
builder.AddHtmlLocalized(14, 12, 273, 20, 1076780, 0x7FFF);
AddPage(1);
builder.AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1076794, 0x7FFF); // South (Castle)
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1076795, 0x7FFF); // East (Castle)
AddButton(19, 97, 0x845, 0x846, 3);
AddHtmlLocalized(44, 95, 213, 20, 1076792, 0x7FFF); // North (Castle)
AddButton(19, 121, 0x845, 0x846, 4);
AddHtmlLocalized(44, 119, 213, 20, 1076793, 0x7FFF); // West (Castle)
AddButton(19, 145, 0x845, 0x846, 5);
AddHtmlLocalized(44, 143, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 169, 0x845, 0x846, 6);
AddHtmlLocalized(44, 167, 213, 20, 1075387, 0x7FFF); // East
AddButton(19, 193, 0x845, 0x846, 7);
AddHtmlLocalized(44, 191, 213, 20, 1075389, 0x7FFF); // North
AddButton(19, 217, 0x845, 0x846, 8);
AddHtmlLocalized(44, 215, 213, 20, 1075390, 0x7FFF); // West
builder.AddButton(19, 49, 0x845, 0x846, 1);
builder.AddHtmlLocalized(44, 47, 213, 20, 1076794, 0x7FFF); // South (Castle)
builder.AddButton(19, 73, 0x845, 0x846, 2);
builder.AddHtmlLocalized(44, 71, 213, 20, 1076795, 0x7FFF); // East (Castle)
builder.AddButton(19, 97, 0x845, 0x846, 3);
builder.AddHtmlLocalized(44, 95, 213, 20, 1076792, 0x7FFF); // North (Castle)
builder.AddButton(19, 121, 0x845, 0x846, 4);
builder.AddHtmlLocalized(44, 119, 213, 20, 1076793, 0x7FFF); // West (Castle)
builder.AddButton(19, 145, 0x845, 0x846, 5);
builder.AddHtmlLocalized(44, 143, 213, 20, 1075386, 0x7FFF); // South
builder.AddButton(19, 169, 0x845, 0x846, 6);
builder.AddHtmlLocalized(44, 167, 213, 20, 1075387, 0x7FFF); // East
builder.AddButton(19, 193, 0x845, 0x846, 7);
builder.AddHtmlLocalized(44, 191, 213, 20, 1075389, 0x7FFF); // North
builder.AddButton(19, 217, 0x845, 0x846, 8);
builder.AddHtmlLocalized(44, 215, 213, 20, 1075390, 0x7FFF); // West
}
public override void OnResponse(NetState sender, in RelayInfo info)

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -28,14 +27,14 @@ public partial class StoneStatueAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class StoneStatueDeed : BaseAddonDeed
public partial class StoneStatueDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public StoneStatueDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new StoneStatueAddon(_east);
public override BaseAddon Addon => new StoneStatueAddon(East);
public override int LabelNumber => 1076284; // Statue
public override void OnDoubleClick(Mobile from)
@ -50,49 +49,17 @@ public partial class StoneStatueDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly StoneStatueDeed _deed;
public override bool Singleton => true;
public InternalGump(StoneStatueDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076579, 0x7FFF); // Please select your statue position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed._east = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076579; // Please select your statue position
}
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -30,14 +29,14 @@ public partial class UnmadeBedAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class UnmadeBedDeed : BaseAddonDeed
public partial class UnmadeBedDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public UnmadeBedDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new UnmadeBedAddon(_east);
public override BaseAddon Addon => new UnmadeBedAddon(East);
public override int LabelNumber => 1076279; // Unmade Bed
public override void OnDoubleClick(Mobile from)
@ -52,49 +51,18 @@ public partial class UnmadeBedDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly UnmadeBedDeed _deed;
public override bool Singleton => true;
public InternalGump(UnmadeBedDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076580, 0x7FFF); // Please select your unmade bed position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed._east = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
// Misspelled in cliloc
public override int SelectionNumber => 1076580; // Pleae select your unmade bed position
}
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -27,14 +26,14 @@ public partial class VanityAddon : BaseAddonContainer
}
[SerializationGenerator(0)]
public partial class VanityDeed : BaseAddonContainerDeed
public partial class VanityDeed : BaseAddonContainerDeed, IDirectionAddonDeed
{
private bool m_East;
public bool East { get; set; }
[Constructible]
public VanityDeed() => LootType = LootType.Blessed;
public override BaseAddonContainer Addon => new VanityAddon(m_East);
public override BaseAddonContainer Addon => new VanityAddon(East);
public override int LabelNumber => 1074027; // Vanity
public override void OnDoubleClick(Mobile from)
@ -49,49 +48,17 @@ public partial class VanityDeed : BaseAddonContainerDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly VanityDeed _deed;
public override bool Singleton => true;
public InternalGump(VanityDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076744, 0x7FFF); // Please select your vanity position.
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed.m_East = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076744; // Please select your vanity position.
}
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -38,14 +37,14 @@ public partial class WoodenCoffinAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class WoodenCoffinDeed : BaseAddonDeed
public partial class WoodenCoffinDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool m_East;
public bool East { get; set; }
[Constructible]
public WoodenCoffinDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new WoodenCoffinAddon(m_East);
public override BaseAddon Addon => new WoodenCoffinAddon(East);
public override int LabelNumber => 1076274; // Coffin
public override void OnDoubleClick(Mobile from)
@ -60,49 +59,17 @@ public partial class WoodenCoffinDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly WoodenCoffinDeed _deed;
public override bool Singleton => true;
public InternalGump(WoodenCoffinDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076748, 0x7FFF); // Please select your coffin position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed.m_East = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076748; // Please select your coffin position
}
}

View file

@ -212,7 +212,7 @@ public partial class WreathDeed : Item
if (northWall && westWall)
{
from.SendGump(new WreathDeedGump(from, loc, this));
from.SendGump(new WreathDeedGump(loc, this));
}
else
{
@ -267,47 +267,45 @@ public partial class WreathDeed : Item
}
}
private class WreathDeedGump : Gump
private class WreathDeedGump : StaticGump<WreathDeedGump>
{
private readonly WreathDeed _deed;
private readonly Mobile _from;
private readonly Point3D _loc;
public WreathDeedGump(Mobile from, Point3D loc, WreathDeed deed) : base(150, 50)
public WreathDeedGump(Point3D loc, WreathDeed 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, 0x232D);
AddItem(180, 30, 0x232C);
AddButton(50, 35, 0x868, 0x869, 1);
AddButton(145, 35, 0x868, 0x869, 2);
builder.AddItem(90, 30, 0x232D);
builder.AddItem(180, 30, 0x232C);
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

@ -292,65 +292,52 @@ public partial class BannerDeed : Item, IRewardItem
}
}
private class FacingGump : Gump
private class FacingGump : DynamicGump
{
private readonly BannerDeed m_Banner;
private readonly BaseHouse m_House;
private readonly int m_ItemID;
private readonly Point3D m_Location;
private readonly BannerDeed _banner;
private readonly BaseHouse _house;
private readonly int _itemId;
private readonly Point3D _location;
public override bool Singleton => true;
public FacingGump(BannerDeed banner, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{
m_Banner = banner;
m_ItemID = itemID;
m_Location = location;
m_House = house;
_banner = banner;
_itemId = itemID;
_location = location;
_house = house;
}
Closable = true;
Disposable = true;
Draggable = true;
Resizable = false;
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
builder.SetNoResize();
AddPage(0);
builder.AddPage();
AddBackground(0, 0, 300, 150, 0xA28);
builder.AddBackground(0, 0, 300, 150, 0xA28);
AddItem(90, 30, itemID + 1);
AddItem(180, 30, itemID);
builder.AddItem(90, 30, _itemId + 1);
builder.AddItem(180, 30, _itemId);
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)
{
if (m_Banner?.Deleted != false || m_House == null)
if (_banner?.Deleted != false || _house == null)
{
return;
}
Banner banner = null;
Banner banner = new Banner(_itemId + (info.ButtonID == (int)Buttons.East ? 1 : 0));
_house.Addons.Add(banner);
if (info.ButtonID == (int)Buttons.East)
{
banner = new Banner(m_ItemID + 1);
}
else if (info.ButtonID == (int)Buttons.South)
{
banner = new Banner(m_ItemID);
}
banner.IsRewardItem = _banner.IsRewardItem;
banner.MoveToWorld(_location, sender.Mobile.Map);
if (banner != null)
{
m_House.Addons.Add(banner);
banner.IsRewardItem = m_Banner.IsRewardItem;
banner.MoveToWorld(m_Location, sender.Mobile.Map);
m_Banner.Delete();
}
_banner.Delete();
}
private enum Buttons

View file

@ -271,7 +271,7 @@ public partial class HangingSkeletonDeed : Item, IRewardItem
}
}
private class FacingGump : Gump
private class FacingGump : DynamicGump
{
private readonly BaseHouse _house;
private readonly int _itemID;
@ -286,26 +286,26 @@ public partial class HangingSkeletonDeed : Item, IRewardItem
_itemID = itemID;
_location = location;
_house = house;
}
Closable = true;
Disposable = true;
Draggable = true;
Resizable = false;
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
builder.SetNoResize();
AddPage(0);
builder.AddPage();
AddBackground(0, 0, 300, 150, 0xA28);
builder.AddBackground(0, 0, 300, 150, 0xA28);
AddItem(90, 30, GetWestItemID(itemID));
AddItem(180, 30, itemID);
builder.AddItem(90, 30, GetWestItemID(_itemID));
builder.AddItem(180, 30, _itemID);
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)
{
if (_skeleton?.Deleted != false || _house == null)
if (_skeleton?.Deleted != false || _house == null || info.ButtonID == (int)Buttons.Cancel)
{
return;
}
@ -316,8 +316,7 @@ public partial class HangingSkeletonDeed : Item, IRewardItem
{
banner = new HangingSkeleton(GetWestItemID(_itemID));
}
if (info.ButtonID == (int)Buttons.South)
else if (info.ButtonID == (int)Buttons.South)
{
banner = new HangingSkeleton(_itemID);
}

View file

@ -1,4 +1,3 @@
using System;
using ModernUO.Serialization;
namespace Server.Mobiles