chore: Removes dead gump code (#2403)

This commit is contained in:
Kamron Batman 2026-04-08 08:39:23 -06:00 committed by GitHub
parent 5b6ea0c3b5
commit c0d75562be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 460 additions and 724 deletions

View file

@ -8,26 +8,20 @@ namespace Server.Gumps
{
public class CategorizedAddGump : Gump
{
private static readonly int EntryHeight = PropsConfig.EntryHeight + 4;
private const int EntryHeight = PropsConfig.EntryHeight + 4;
private static readonly int SetOffsetY = PropsConfig.SetOffsetY + (EntryHeight - 20) / 2 / 2;
private const int SetOffsetY = PropsConfig.SetOffsetY + (EntryHeight - 20) / 2 / 2;
private static readonly int PrevOffsetY = PropsConfig.PrevOffsetY + (EntryHeight - 20) / 2 / 2;
private const int PrevOffsetY = PropsConfig.PrevOffsetY + (EntryHeight - 20) / 2 / 2;
private static readonly int NextOffsetY = PropsConfig.NextOffsetY + (EntryHeight - 20) / 2 / 2;
private const int NextOffsetY = PropsConfig.NextOffsetY + (EntryHeight - 20) / 2 / 2;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private const int EntryWidth = 180;
private const int EntryCount = 15;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int EntryWidth = 180;
private static readonly int EntryCount = 15;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private readonly CAGCategory m_Category;
@ -64,7 +58,7 @@ namespace Server.Gumps
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalWidth,
totalHeight,
OffsetGumpID
);
@ -72,40 +66,17 @@ namespace Server.Gumps
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
if (OldStyle)
{
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
if (m_Category.Parent != null)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth * 2 - NextWidth - OffsetSize * 5 -
(OldStyle ? SetWidth + OffsetSize : 0);
if (!OldStyle)
{
AddImageTiled(
x - (OldStyle ? OffsetSize : 0),
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0),
EntryHeight,
EntryGumpID
);
}
const int emptyWidth = TotalWidth - PrevWidth * 2 - NextWidth - OffsetSize * 5;
AddImageTiled(x, y, emptyWidth, EntryHeight, EntryGumpID);
AddHtml(
x + TextOffsetX,
@ -117,40 +88,20 @@ namespace Server.Gumps
x += emptyWidth + OffsetSize;
if (OldStyle)
{
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
if (page > 0)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
if ((page + 1) * EntryCount < nodes.Length)
{
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
if (NextLabel)
{
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
for (int i = 0, index = page * EntryCount; i < EntryCount && index < nodes.Length; ++i, ++index)

View file

@ -59,7 +59,7 @@ namespace Server.Gumps
private const int RedHue = 0x20;
private static readonly string[] m_AccessLevelStrings =
{
[
"Player",
"Counselor",
"Game Master",
@ -67,7 +67,7 @@ namespace Server.Gumps
"Administrator",
"Developer",
"Owner"
};
];
private readonly Mobile m_From;
private readonly List<object> m_List;
@ -703,7 +703,7 @@ namespace Server.Gumps
}
case AdminGumpPage.Accounts:
{
m_List ??= new List<object>();
m_List ??= [];
var rads = state as List<Account>;
@ -1500,7 +1500,7 @@ namespace Server.Gumps
// If we don't have a list, create one
if (!acctExists)
{
accts = new List<Account>();
accts = [];
}
accts.Add(acct);
@ -1829,7 +1829,7 @@ namespace Server.Gumps
--AccountHandler.IPTable[ips[0]];
}
a.LoginIPs = Array.Empty<IPAddress>();
a.LoginIPs = [];
notice = "All addresses in the list have been removed.";
}
@ -2772,7 +2772,7 @@ namespace Server.Gumps
}
else
{
results = new List<IAccount>();
results = [];
foreach (var acct in Accounts.GetAccounts())
{
if (acct.Username.InsensitiveContains(match))

View file

@ -9,7 +9,7 @@ namespace Server.Gumps
{
private readonly List<Account> m_List;
public BanDurationGump(Account a) : this(new List<Account> { a })
public BanDurationGump(Account a) : this([a])
{
}
@ -218,7 +218,10 @@ namespace Server.Gumps
break;
}
default: return;
default:
{
return;
}
}
if (shouldSet)

View file

@ -39,7 +39,7 @@ namespace Server.Gumps
switch (info.ButtonID)
{
case (int)Buttons.Okay:
{
Item item = null;
foreach (var type in m_Selected)
@ -62,11 +62,15 @@ namespace Server.Gumps
}
break;
}
case (int)Buttons.Cancel:
{
sender.Mobile.SendGump(new HeritageTokenGump(m_Token));
break;
}
}
}
private enum Buttons
{

View file

@ -7,12 +7,6 @@ namespace Server.Gumps;
public class GoGump : Gump
{
private const int PrevLabelOffsetX = PrevWidth + 1;
private const int PrevLabelOffsetY = 0;
private const int NextLabelOffsetX = -29;
private const int NextLabelOffsetY = 0;
private const int EntryWidth = 180;
private const int EntryCount = 15;
@ -52,87 +46,38 @@ public class GoGump : Gump
AddPage(0);
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
totalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID);
if (OldStyle)
{
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
if (node.Parent != null)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth * 2 - NextWidth - OffsetSize * 5 -
(OldStyle ? SetWidth + OffsetSize : 0);
if (!OldStyle)
{
AddImageTiled(
x - (OldStyle ? OffsetSize : 0),
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0),
EntryHeight,
EntryGumpID
);
}
const int emptyWidth = TotalWidth - PrevWidth * 2 - NextWidth - OffsetSize * 5;
AddImageTiled(x, y, emptyWidth, EntryHeight, EntryGumpID);
AddHtml(x + TextOffsetX, y, emptyWidth - TextOffsetX, EntryHeight, $"<center>{node.Name}</center>");
x += emptyWidth + OffsetSize;
if (OldStyle)
{
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
if (page > 0)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
if ((page + 1) * EntryCount < node.Categories.Length + node.Locations.Length)
{
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
if (NextLabel)
{
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
var totalEntryCount = node.Categories.Length + node.Locations.Length;

View file

@ -56,8 +56,14 @@ namespace Server.Gumps
switch (info.ButtonID)
{
case 0: return; // Close
case 1: break; // Return to main menu
case 0:
{
return; // Close
}
case 1:
{
break; // Return to main menu
}
case 2:
{
string website;

View file

@ -35,16 +35,22 @@ namespace Server.Gumps
switch (m_Guild.Type)
{
case GuildType.Regular:
{
AddHtmlLocalized(55, 100, 470, 30, 1013059); // Change guild type: Currently Standard
break;
}
case GuildType.Order:
{
AddHtmlLocalized(55, 100, 470, 30, 1013057); // Change guild type: Currently Order
break;
}
case GuildType.Chaos:
{
AddHtmlLocalized(55, 100, 470, 30, 1013058); // Change guild type: Currently Chaos
break;
}
}
}
AddButton(20, 130, 4005, 4007, 5);
AddHtmlLocalized(55, 130, 470, 30, 1011112); // Set the guild's charter.

View file

@ -40,7 +40,7 @@ namespace Server.Guilds
var list = m_List;
if (WillFilter)
{
m_List = new List<T>();
m_List = [];
for (var i = 0; i < list.Count; i++)
{
if (!IsFiltered(list[i], m_Filter))

View file

@ -78,12 +78,11 @@ namespace Server.Guilds
ascending,
filter,
startNumber,
new[]
{
[
new InfoField<Guild>(1062954, 280, NameComparer.Instance), // Guild Name
new InfoField<Guild>(1062957, 50, AbbrevComparer.Instance), // Abbrev
new InfoField<Guild>(1062958, 120, new StatusComparer(g)) // Guild Title
}
]
)
{
m_Display = display;

View file

@ -10,12 +10,12 @@ namespace Server.Guilds
public class GuildRosterGump : BaseGuildListGump<PlayerMobile>
{
private static readonly InfoField<PlayerMobile>[] m_Fields =
{
[
new(1062955, 130, NameComparer.Instance), // Name
new(1062956, 80, RankComparer.Instance), // Rank
new(1062952, 80, LastOnComparer.Instance), // Last On
new(1062953, 150, TitleComparer.Instance) // Guild Title
};
];
public GuildRosterGump(PlayerMobile pm, Guild g) : this(pm, g, LastOnComparer.Instance)
{

View file

@ -291,43 +291,43 @@ namespace Server.Gumps
// 7th anniversary
case 0x64:
{
types = new [] { typeof(LeggingsOfEmbers) };
types = [typeof(LeggingsOfEmbers)];
cliloc = 1078147;
break;
}
case 0x65:
{
types = new [] { typeof(RoseOfTrinsic) };
types = [typeof(RoseOfTrinsic)];
cliloc = 1062913;
break;
}
case 0x66:
{
types = new [] { typeof(ShaminoCrossbow) };
types = [typeof(ShaminoCrossbow)];
cliloc = 1062915;
break;
}
case 0x67:
{
types = new [] { typeof(TapestryOfSosaria) };
types = [typeof(TapestryOfSosaria)];
cliloc = 1062917;
break;
}
case 0x68:
{
types = new [] { typeof(HearthOfHomeFireDeed) };
types = [typeof(HearthOfHomeFireDeed)];
cliloc = 1062919;
break;
}
case 0x69:
{
types = new [] { typeof(HolySword) };
types = [typeof(HolySword)];
cliloc = 1062921;
break;
}
case 0x6A:
{
types = new [] { typeof(SamuraiHelm) };
types = [typeof(SamuraiHelm)];
cliloc = 1062923;
break;
}
@ -337,55 +337,55 @@ namespace Server.Gumps
case 0x6C: types = new [] { typeof( ValorGauntlets ) }; cliloc = 1075192; break;*/
case 0x6D:
{
types = new [] { typeof(DupresShield) };
types = [typeof(DupresShield)];
cliloc = 1075196;
break;
}
case 0x6E:
{
types = new [] { typeof(FountainOfLifeDeed) };
types = [typeof(FountainOfLifeDeed)];
cliloc = 1075197;
break;
}
case 0x6F:
{
types = new [] { typeof(DawnsMusicBox) };
types = [typeof(DawnsMusicBox)];
cliloc = 1075198;
break;
}
case 0x70:
{
types = new [] { typeof(OssianGrimoire) };
types = [typeof(OssianGrimoire)];
cliloc = 1078148;
break;
}
case 0x71:
{
types = new [] { typeof(FerretFormTalisman) };
types = [typeof(FerretFormTalisman)];
cliloc = 1078142;
break;
}
case 0x72:
{
types = new [] { typeof(SquirrelFormTalisman) };
types = [typeof(SquirrelFormTalisman)];
cliloc = 1078143;
break;
}
case 0x73:
{
types = new [] { typeof(CuSidheFormTalisman) };
types = [typeof(CuSidheFormTalisman)];
cliloc = 1078144;
break;
}
case 0x74:
{
types = new [] { typeof(ReptalonFormTalisman) };
types = [typeof(ReptalonFormTalisman)];
cliloc = 1078145;
break;
}
case 0x75:
{
types = new [] { typeof(QuiverOfInfinity) };
types = [typeof(QuiverOfInfinity)];
cliloc = 1075201;
break;
}
@ -393,49 +393,49 @@ namespace Server.Gumps
// evil home decor
case 0x76:
{
types = new [] { typeof(BoneThroneDeed), typeof(BoneCouchDeed), typeof(BoneTableDeed) };
types = [typeof(BoneThroneDeed), typeof(BoneCouchDeed), typeof(BoneTableDeed)];
cliloc = 1074797;
break;
}
case 0x77:
{
types = new []
{
types =
[
typeof(CreepyPortraitDeed),
typeof(DisturbingPortraitDeed),
typeof(UnsettlingPortraitDeed)
};
];
cliloc = 1078146;
break;
}
case 0x78:
{
types = new []
{
types =
[
typeof(MountedPixieBlueDeed),
typeof(MountedPixieGreenDeed),
typeof(MountedPixieLimeDeed),
typeof(MountedPixieOrangeDeed),
typeof(MountedPixieWhiteDeed)
};
];
cliloc = 1074799;
break;
}
case 0x79:
{
types = new [] { typeof(HaunterMirrorDeed) };
types = [typeof(HaunterMirrorDeed)];
cliloc = 1074800;
break;
}
case 0x7A:
{
types = new [] { typeof(BedOfNailsDeed) };
types = [typeof(BedOfNailsDeed)];
cliloc = 1074801;
break;
}
case 0x7B:
{
types = new [] { typeof(SacrificialAltarDeed) };
types = [typeof(SacrificialAltarDeed)];
cliloc = 1074818;
break;
}
@ -443,49 +443,49 @@ namespace Server.Gumps
// broken furniture
case 0x7C:
{
types = new [] { typeof(BrokenCoveredChairDeed) };
types = [typeof(BrokenCoveredChairDeed)];
cliloc = 1076257;
break;
}
case 0x7D:
{
types = new [] { typeof(BrokenBookcaseDeed) };
types = [typeof(BrokenBookcaseDeed)];
cliloc = 1076258;
break;
}
case 0x7E:
{
types = new [] { typeof(StandingBrokenChairDeed) };
types = [typeof(StandingBrokenChairDeed)];
cliloc = 1076259;
break;
}
case 0x7F:
{
types = new [] { typeof(BrokenVanityDeed) };
types = [typeof(BrokenVanityDeed)];
cliloc = 1076260;
break;
}
case 0x80:
{
types = new [] { typeof(BrokenChestOfDrawersDeed) };
types = [typeof(BrokenChestOfDrawersDeed)];
cliloc = 1076261;
break;
}
case 0x81:
{
types = new [] { typeof(BrokenArmoireDeed) };
types = [typeof(BrokenArmoireDeed)];
cliloc = 1076262;
break;
}
case 0x82:
{
types = new [] { typeof(BrokenBedDeed) };
types = [typeof(BrokenBedDeed)];
cliloc = 1076263;
break;
}
case 0x83:
{
types = new [] { typeof(BrokenFallenChairDeed) };
types = [typeof(BrokenFallenChairDeed)];
cliloc = 1076264;
break;
}
@ -493,211 +493,211 @@ namespace Server.Gumps
// other
case 0x84:
{
types = new [] { typeof(SuitOfGoldArmorDeed) };
types = [typeof(SuitOfGoldArmorDeed)];
cliloc = 1076265;
break;
}
case 0x85:
{
types = new [] { typeof(SuitOfSilverArmorDeed) };
types = [typeof(SuitOfSilverArmorDeed)];
cliloc = 1076266;
break;
}
case 0x86:
{
types = new [] { typeof(BoilingCauldronDeed) };
types = [typeof(BoilingCauldronDeed)];
cliloc = 1076267;
break;
}
case 0x87:
{
types = new [] { typeof(GuillotineDeed) };
types = [typeof(GuillotineDeed)];
cliloc = 1024656;
break;
}
case 0x88:
{
types = new [] { typeof(CherryBlossomTreeDeed) };
types = [typeof(CherryBlossomTreeDeed)];
cliloc = 1076268;
break;
}
case 0x89:
{
types = new [] { typeof(AppleTreeDeed) };
types = [typeof(AppleTreeDeed)];
cliloc = 1076269;
break;
}
case 0x8A:
{
types = new [] { typeof(PeachTreeDeed) };
types = [typeof(PeachTreeDeed)];
cliloc = 1076270;
break;
}
case 0x8B:
{
types = new [] { typeof(HangingAxesDeed) };
types = [typeof(HangingAxesDeed)];
cliloc = 1076271;
break;
}
case 0x8C:
{
types = new [] { typeof(HangingSwordsDeed) };
types = [typeof(HangingSwordsDeed)];
cliloc = 1076272;
break;
}
case 0x8D:
{
types = new [] { typeof(BlueFancyRugDeed) };
types = [typeof(BlueFancyRugDeed)];
cliloc = 1076273;
break;
}
case 0x8E:
{
types = new [] { typeof(WoodenCoffinDeed) };
types = [typeof(WoodenCoffinDeed)];
cliloc = 1076274;
break;
}
case 0x8F:
{
types = new [] { typeof(VanityDeed) };
types = [typeof(VanityDeed)];
cliloc = 1074027;
break;
}
case 0x90:
{
types = new [] { typeof(TableWithPurpleClothDeed) };
types = [typeof(TableWithPurpleClothDeed)];
cliloc = 1076635;
break;
}
case 0x91:
{
types = new [] { typeof(TableWithBlueClothDeed) };
types = [typeof(TableWithBlueClothDeed)];
cliloc = 1076636;
break;
}
case 0x92:
{
types = new [] { typeof(TableWithRedClothDeed) };
types = [typeof(TableWithRedClothDeed)];
cliloc = 1076637;
break;
}
case 0x93:
{
types = new [] { typeof(TableWithOrangeClothDeed) };
types = [typeof(TableWithOrangeClothDeed)];
cliloc = 1076638;
break;
}
case 0x94:
{
types = new [] { typeof(UnmadeBedDeed) };
types = [typeof(UnmadeBedDeed)];
cliloc = 1076279;
break;
}
case 0x95:
{
types = new [] { typeof(CurtainsDeed) };
types = [typeof(CurtainsDeed)];
cliloc = 1076280;
break;
}
case 0x96:
{
types = new [] { typeof(ScarecrowDeed) };
types = [typeof(ScarecrowDeed)];
cliloc = 1076281;
break;
}
case 0x97:
{
types = new [] { typeof(WallTorchDeed) };
types = [typeof(WallTorchDeed)];
cliloc = 1076282;
break;
}
case 0x98:
{
types = new [] { typeof(FountainDeed) };
types = [typeof(FountainDeed)];
cliloc = 1076283;
break;
}
case 0x99:
{
types = new [] { typeof(StoneStatueDeed) };
types = [typeof(StoneStatueDeed)];
cliloc = 1076284;
break;
}
case 0x9A:
{
types = new [] { typeof(LargeFishingNetDeed) };
types = [typeof(LargeFishingNetDeed)];
cliloc = 1076285;
break;
}
case 0x9B:
{
types = new [] { typeof(SmallFishingNetDeed) };
types = [typeof(SmallFishingNetDeed)];
cliloc = 1076286;
break;
}
case 0x9C:
{
types = new [] { typeof(HouseLadderDeed) };
types = [typeof(HouseLadderDeed)];
cliloc = 1076287;
break;
}
case 0x9D:
{
types = new [] { typeof(IronMaidenDeed) };
types = [typeof(IronMaidenDeed)];
cliloc = 1076288;
break;
}
case 0x9E:
{
types = new [] { typeof(BluePlainRugDeed) };
types = [typeof(BluePlainRugDeed)];
cliloc = 1076585;
break;
}
case 0x9F:
{
types = new [] { typeof(GoldenDecorativeRugDeed) };
types = [typeof(GoldenDecorativeRugDeed)];
cliloc = 1076586;
break;
}
case 0xA0:
{
types = new [] { typeof(CinnamonFancyRugDeed) };
types = [typeof(CinnamonFancyRugDeed)];
cliloc = 1076587;
break;
}
case 0xA1:
{
types = new [] { typeof(RedPlainRugDeed) };
types = [typeof(RedPlainRugDeed)];
cliloc = 1076588;
break;
}
case 0xA2:
{
types = new [] { typeof(BlueDecorativeRugDeed) };
types = [typeof(BlueDecorativeRugDeed)];
cliloc = 1076589;
break;
}
case 0xA3:
{
types = new [] { typeof(PinkFancyRugDeed) };
types = [typeof(PinkFancyRugDeed)];
cliloc = 1076590;
break;
}
case 0xA4:
{
types = new [] { typeof(CherryBlossomTrunkDeed) };
types = [typeof(CherryBlossomTrunkDeed)];
cliloc = 1076784;
break;
}
case 0xA5:
{
types = new [] { typeof(AppleTrunkDeed) };
types = [typeof(AppleTrunkDeed)];
cliloc = 1076785;
break;
}
case 0xA6:
{
types = new [] { typeof(PeachTrunkDeed) };
types = [typeof(PeachTrunkDeed)];
cliloc = 1076786;
break;
}

View file

@ -42,32 +42,32 @@ namespace Server.Gumps
private const int HighlightedLabelHue = 0x64;
private static readonly int[] m_HangerNumbers =
{
[
2968, 2970, 2972,
2974, 2976, 2978
};
];
private static readonly int[] m_FoundationNumbers = Core.ML
? new[]
{
?
[
20, 189, 765, 65, 101, 0x2DF7, 0x2DFB, 0x3672, 0x3676
}
: new[]
{
]
:
[
20, 189, 765, 65, 101
};
];
private static readonly int[] m_PostNumbers =
{
[
9, 29, 54, 90, 147, 169,
177, 204, 251, 257, 263,
298, 347, 424, 441, 466,
514, 600, 601, 602, 603,
660, 666, 672, 898, 970,
974, 982
};
];
private static readonly List<int> _HouseSigns = new();
private static readonly List<int> _HouseSigns = [];
private readonly BaseHouse m_House;
private readonly HouseGumpPageAOS m_Page;
@ -1046,21 +1046,34 @@ namespace Server.Gumps
switch (index)
{
case 0:
{
page = HouseGumpPageAOS.Information;
break;
}
case 1:
{
page = HouseGumpPageAOS.Security;
break;
}
case 2:
{
page = HouseGumpPageAOS.Storage;
break;
}
case 3:
{
page = HouseGumpPageAOS.Customize;
break;
}
case 4:
{
page = HouseGumpPageAOS.Ownership;
break;
default: return;
}
default:
{
return;
}
}
from.SendGump(new HouseGumpAOS(page, from, m_House));
@ -1459,8 +1472,10 @@ namespace Server.Gumps
break;
}
case 2: // Make Primary
{
break;
}
}
break;
}
@ -1491,18 +1506,29 @@ namespace Server.Gumps
switch (index)
{
case 5:
{
newType = FoundationType.ElvenGrey;
break;
}
case 6:
{
newType = FoundationType.ElvenNatural;
break;
}
case 7:
{
newType = FoundationType.Crystal;
break;
}
case 8:
{
newType = FoundationType.Shadow;
break;
default: return;
}
default:
{
return;
}
}
}
else
@ -1510,21 +1536,34 @@ namespace Server.Gumps
switch (index)
{
case 0:
{
newType = FoundationType.DarkWood;
break;
}
case 1:
{
newType = FoundationType.LightWood;
break;
}
case 2:
{
newType = FoundationType.Dungeon;
break;
}
case 3:
{
newType = FoundationType.Brick;
break;
}
case 4:
{
newType = FoundationType.Stone;
break;
default: return;
}
default:
{
return;
}
}
}

View file

@ -322,28 +322,26 @@ namespace Server.Gumps
public class PlayerVendorCustomizeGump : Gump
{
private static readonly CustomCategory[] Categories =
{
[
new(
Layer.InnerTorso,
1011357,
true,
new[]
{
[
// Upper Torso
new CustomItem(typeof(Shirt), 1011359, 5399),
new CustomItem(typeof(FancyShirt), 1011360, 7933),
new CustomItem(typeof(PlainDress), 1011363, 7937),
new CustomItem(typeof(FancyDress), 1011364, 7935),
new CustomItem(typeof(Robe), 1011365, 7939)
}
]
),
new(
Layer.MiddleTorso,
1011371,
true,
new[]
{
[
// Over chest
new CustomItem(typeof(Doublet), 1011358, 8059),
new CustomItem(typeof(Tunic), 1011361, 8097),
@ -352,29 +350,27 @@ namespace Server.Gumps
new CustomItem(typeof(Surcoat), 1011362, 8189),
new CustomItem(typeof(HalfApron), 1011373, 5435),
new CustomItem(typeof(FullApron), 1011374, 5437)
}
]
),
new(
Layer.Shoes,
1011388,
true,
new[]
{
[
// Footwear
new CustomItem(typeof(Sandals), 1011389, 5901),
new CustomItem(typeof(Shoes), 1011390, 5904),
new CustomItem(typeof(Boots), 1011391, 5899),
new CustomItem(typeof(ThighBoots), 1011392, 5906)
}
]
),
new(
Layer.Helm,
1011375,
true,
new[]
{
[
// Hats
new CustomItem(typeof(SkullCap), 1011376, 5444),
new CustomItem(typeof(Bandana), 1011377, 5440),
@ -382,15 +378,14 @@ namespace Server.Gumps
new CustomItem(typeof(WideBrimHat), 1011379, 5908),
new CustomItem(typeof(Cap), 1011380, 5909),
new CustomItem(typeof(TallStrawHat), 1011382, 5910)
}
]
),
new(
Layer.Helm,
1015319,
true,
new[]
{
[
// More Hats
new CustomItem(typeof(StrawHat), 1011382, 5911),
new CustomItem(typeof(WizardsHat), 1011383, 5912),
@ -398,39 +393,36 @@ namespace Server.Gumps
new CustomItem(typeof(FeatheredHat), 1011385, 5914),
new CustomItem(typeof(TricorneHat), 1011386, 5915),
new CustomItem(typeof(JesterHat), 1011387, 5916)
}
]
),
new(
Layer.Pants,
1011367,
true,
new[]
{
[
// Lower Torso
new CustomItem(typeof(LongPants), 1011368, 5433),
new CustomItem(typeof(Kilt), 1011369, 5431),
new CustomItem(typeof(Skirt), 1011370, 5398)
}
]
),
new(
Layer.Cloak,
1011393,
true,
new[]
{
[
// Back
new CustomItem(typeof(Cloak), 1011394, 5397)
}
]
),
new(
Layer.Hair,
1011395,
true,
new[]
{
[
// Hair
new CustomItem(0x203B, 1011052),
new CustomItem(0x203C, 1011053),
@ -441,15 +433,14 @@ namespace Server.Gumps
new CustomItem(0x2047, 1011396),
new CustomItem(0x2048, 1011048),
new CustomItem(0x2049, 1011049)
}
]
),
new(
Layer.FacialHair,
1015320,
true,
new[]
{
[
// Facial Hair
new CustomItem(0x2041, 1011062),
new CustomItem(0x203F, 1011060),
@ -458,15 +449,14 @@ namespace Server.Gumps
new CustomItem(0x204C, 1015322, true),
new CustomItem(0x2040, 1015323),
new CustomItem(0x204D, 1011401)
}
]
),
new(
Layer.FirstValid,
1011397,
false,
new[]
{
[
// Held items
new CustomItem(typeof(FishingPole), 1011406, 3520),
new CustomItem(typeof(Pickaxe), 1011407, 3717),
@ -477,15 +467,14 @@ namespace Server.Gumps
new CustomItem(typeof(Hammer), 1011411, 4020),
new CustomItem(typeof(Longsword), 1011412, 3936),
new CustomItem(typeof(GnarledStaff), 1011413, 5113)
}
]
),
new(
Layer.FirstValid,
1015325,
false,
new[]
{
[
// More held items
new CustomItem(typeof(Crossbow), 1011414, 3920),
new CustomItem(typeof(WarMace), 1011415, 5126),
@ -493,9 +482,9 @@ namespace Server.Gumps
new CustomItem(typeof(Spear), 1011417, 3939),
new CustomItem(typeof(Katana), 1011418, 5118),
new CustomItem(typeof(Spellbook), 1011419, 3834)
}
]
)
};
];
private readonly Mobile m_Vendor;
@ -913,7 +902,7 @@ namespace Server.Gumps
public class NewPlayerVendorCustomizeGump : Gump
{
private static readonly HairOrBeard[] m_HairStyles =
{
[
new(0x203B, 1011052), // Short
new(0x203C, 1011053), // Long
new(0x203D, 1011054), // Ponytail
@ -923,10 +912,10 @@ namespace Server.Gumps
new(0x2047, 1011396), // Curly
new(0x2048, 1011048), // Receding
new(0x2049, 1011049) // 2-tails
};
];
private static readonly HairOrBeard[] m_BeardStyles =
{
[
new(0x2041, 1011062), // Mustache
new(0x203F, 1011060), // Short beard
new(0x204B, 1015321), // Short Beard & Moustache
@ -934,7 +923,7 @@ namespace Server.Gumps
new(0x204C, 1015322), // Long Beard & Moustache
new(0x2040, 1015323), // Goatee
new(0x204D, 1011401) // Vandyke
};
];
private readonly PlayerVendor m_Vendor;

View file

@ -49,7 +49,7 @@ namespace Server.Gumps
public class PolymorphGump : StaticGump<PolymorphGump>
{
private static readonly PolymorphCategory[] Categories =
{
[
new(
1015235, // Animals
PolymorphEntry.Chicken,
@ -75,7 +75,7 @@ namespace Server.Gumps
PolymorphEntry.Daemon,
PolymorphEntry.HumanFemale
)
};
];
private readonly Item _scroll;
@ -161,7 +161,7 @@ namespace Server.Gumps
public class NewPolymorphGump : StaticGump<NewPolymorphGump>
{
private static readonly PolymorphEntry[] _entries =
{
[
PolymorphEntry.Chicken,
PolymorphEntry.Dog,
PolymorphEntry.Wolf,
@ -180,7 +180,7 @@ namespace Server.Gumps
PolymorphEntry.Troll,
PolymorphEntry.Ettin,
PolymorphEntry.Daemon
};
];
private readonly Item _scroll;

View file

@ -6,33 +6,28 @@ namespace Server.Gumps
{
protected Property m_Property;
public PropertyException(Property property, string message)
: base(message) =>
m_Property = property;
public PropertyException(Property property, string message) : base(message) => m_Property = property;
public Property Property => m_Property;
}
public abstract class BindingException : PropertyException
{
public BindingException(Property property, string message)
: base(property, message)
public BindingException(Property property, string message) : base(property, message)
{
}
}
public sealed class NotYetBoundException : BindingException
{
public NotYetBoundException(Property property)
: base(property, "Property has not yet been bound.")
public NotYetBoundException(Property property) : base(property, "Property has not yet been bound.")
{
}
}
public sealed class AlreadyBoundException : BindingException
{
public AlreadyBoundException(Property property)
: base(property, "Property has already been bound.")
public AlreadyBoundException(Property property) : base(property, "Property has already been bound.")
{
}
}
@ -47,32 +42,28 @@ namespace Server.Gumps
public sealed class ReadOnlyException : BindingException
{
public ReadOnlyException(Property property)
: base(property, "Property is read-only.")
public ReadOnlyException(Property property) : base(property, "Property is read-only.")
{
}
}
public sealed class WriteOnlyException : BindingException
{
public WriteOnlyException(Property property)
: base(property, "Property is write-only.")
public WriteOnlyException(Property property) : base(property, "Property is write-only.")
{
}
}
public abstract class AccessException : PropertyException
{
public AccessException(Property property, string message)
: base(property, message)
public AccessException(Property property, string message) : base(property, message)
{
}
}
public sealed class InternalAccessException : AccessException
{
public InternalAccessException(Property property)
: base(property, "Property is internal.")
public InternalAccessException(Property property) : base(property, "Property is internal.")
{
}
}

View file

@ -2,8 +2,6 @@ namespace Server.Gumps;
public static class PropsConfig
{
public const bool OldStyle = false;
public const int GumpOffsetX = 30;
public const int GumpOffsetY = 30;
@ -13,14 +11,15 @@ public static class PropsConfig
public const int OffsetGumpID = 0x0A40; // Pure black
// Light off-white, textured : Dark navy blue, textured
public const int HeaderGumpID = OldStyle ? 0x0BBC : 0x0E14;
public const int HeaderGumpID = 0x0E14;
public const int EntryGumpID = 0x0BBC; // Light offwhite, textured
public const int BackGumpID = 0x13BE; // Gray slate/stoney
public const int SetGumpID = OldStyle ? 0x0000 : 0x0E14; // Empty : Dark navy blue, textured
public const int SetGumpID = 0x0E14; // Empty : Dark navy blue, textured
public const int SetWidth = 20;
public const int SetOffsetX = OldStyle ? 4 : 2, SetOffsetY = 2;
public const int SetOffsetX = 2;
public const int SetOffsetY = 2;
public const int SetButtonID1 = 0x15E1; // Arrow pointing right
public const int SetButtonID2 = 0x15E5; // " pressed
@ -39,7 +38,4 @@ public static class PropsConfig
public const int EntryHeight = 20;
public const int BorderSize = 10;
public const int ApplySize = 30;
public const bool PrevLabel = false;
public const bool NextLabel = false;
}

View file

@ -24,27 +24,16 @@ namespace Server.Gumps
public class PropertiesGump : Gump
{
private static readonly bool PrevLabel = OldStyle;
private static readonly bool NextLabel = OldStyle;
private static readonly bool TypeLabel = !OldStyle;
private const int NameWidth = 107;
private const int ValueWidth = 128;
public static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private const int MaxEntriesPerPage = 15;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private const int TypeWidth = NameWidth + OffsetSize + ValueWidth;
private static readonly int NameWidth = 107;
private static readonly int ValueWidth = 128;
private const int TotalWidth = OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
public static readonly int MaxEntriesPerPage = 15;
private static readonly int TypeWidth = NameWidth + OffsetSize + ValueWidth;
private static readonly int TotalWidth =
OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
protected static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
protected const int BackWidth = BorderSize + TotalWidth + BorderSize;
protected readonly List<object> m_List;
protected readonly Mobile m_Mobile;
@ -125,7 +114,7 @@ namespace Server.Gumps
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalWidth,
OffsetSize + (EntryHeight + OffsetSize) * (m_EntryCount + 1),
OffsetGumpID
);
@ -133,60 +122,30 @@ namespace Server.Gumps
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4 - (OldStyle ? SetWidth + OffsetSize : 0);
if (OldStyle)
{
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
const int emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4;
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
if (page > 0)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
}
if (TypeLabel && m_Type != null)
if (m_Type != null)
{
AddHtml(
x,
y,
emptyWidth,
EntryHeight,
m_Type.Name.Center(0xFAFAFA)
);
AddHtml(x, y, emptyWidth, EntryHeight, m_Type.Name.Center(0xFAFAFA));
}
x += emptyWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
if ((page + 1) * MaxEntriesPerPage < m_List.Count)
{
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1);
if (NextLabel)
{
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
for (int i = 0, index = page * MaxEntriesPerPage; i < m_EntryCount && index < m_List.Count; ++i, ++index)
@ -452,12 +411,12 @@ namespace Server.Gumps
if (attrs.Length == 0)
{
return Array.Empty<string>();
return [];
}
if (attrs[0] is not CustomEnumAttribute ce)
{
return Array.Empty<string>();
return [];
}
return ce.Names;
@ -627,7 +586,7 @@ namespace Server.Gumps
}
else
{
groups[type] = new List<PropertyInfo> { prop };
groups[type] = [prop];
}
}
}

View file

@ -31,7 +31,7 @@ namespace Server.Gumps
{
try
{
var info = m_Property.PropertyType.GetMethod("Parse", new[] { typeof(string) });
var info = m_Property.PropertyType.GetMethod("Parse", [typeof(string)]);
string result;
@ -43,7 +43,7 @@ namespace Server.Gumps
m_Object,
m_Property,
m_Property.Name,
info.Invoke(null, new object[] { m_Names[index] }),
info.Invoke(null, [m_Names[index]]),
true
);
}

View file

@ -9,13 +9,14 @@ namespace Server.Gumps
{
public class SetGump : Gump
{
private static readonly int EntryWidth = 212;
private const int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 2 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 2 * (EntryHeight + OffsetSize);
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
@ -51,7 +52,7 @@ namespace Server.Gumps
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalWidth,
TotalHeight + (canNull ? EntryHeight + OffsetSize : 0) + (canDye ? EntryHeight + OffsetSize : 0),
OffsetGumpID
);
@ -144,7 +145,6 @@ namespace Server.Gumps
}
else
{
toSet = null;
shouldSet = false;
}
@ -202,8 +202,8 @@ namespace Server.Gumps
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public InternalPicker(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump) : base(((IHued)o).HuedItemID)
public InternalPicker(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(((IHued)o).HuedItemID)
{
m_Property = prop;
m_Mobile = mobile;

View file

@ -9,21 +9,12 @@ namespace Server.Gumps
{
public class SetListOptionGump : Gump
{
private static readonly int EntryWidth = 212;
private static readonly int EntryCount = 13;
private const int EntryWidth = 212;
private const int EntryCount = 13;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly bool PrevLabel = OldStyle;
private static readonly bool NextLabel = OldStyle;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private readonly object[] m_Values;
protected Mobile m_Mobile;
@ -61,19 +52,12 @@ namespace Server.Gumps
var backHeight = BorderSize + totalHeight + BorderSize;
AddBackground(0, 0, BackWidth, backHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
totalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
const int y = BorderSize + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4 -
(OldStyle ? SetWidth + OffsetSize : 0);
const int emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4;
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
@ -88,32 +72,15 @@ namespace Server.Gumps
GumpButtonType.Page,
page - 1
);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(
x - (OldStyle ? OffsetSize : 0),
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0),
EntryHeight,
HeaderGumpID
);
}
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
x += emptyWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
if (page < pages)
{
@ -126,11 +93,6 @@ namespace Server.Gumps
GumpButtonType.Page,
page + 1
);
if (NextLabel)
{
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
AddRect(0, prop.Name, 0);

View file

@ -11,13 +11,13 @@ namespace Server.Gumps
{
public class SetObjectGump : Gump
{
private static readonly int EntryWidth = 212;
private const int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 5 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 5 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
@ -39,13 +39,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;

View file

@ -9,22 +9,20 @@ namespace Server.Gumps
{
public class SetPoint2DGump : Gump
{
private static readonly int CoordWidth = 105;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth;
private const int CoordWidth = 105;
private const int EntryWidth = CoordWidth + OffsetSize + CoordWidth;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public SetPoint2DGump(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
)
public SetPoint2DGump(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(GumpOffsetX, GumpOffsetY)
{
m_PropertiesGump = propertiesGump;
@ -37,13 +35,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
@ -179,9 +171,8 @@ namespace Server.Gumps
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public InternalTarget(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
) : base(-1, true, TargetFlags.None)
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(-1, true, TargetFlags.None)
{
m_Property = prop;
m_Mobile = mobile;

View file

@ -9,23 +9,21 @@ namespace Server.Gumps
{
public class SetPoint3DGump : Gump
{
private static readonly int CoordWidth = 70;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth + OffsetSize + CoordWidth;
private const int CoordWidth = 70;
private const int EntryWidth = CoordWidth + OffsetSize + CoordWidth + OffsetSize + CoordWidth;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public SetPoint3DGump(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
)
public SetPoint3DGump(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(GumpOffsetX, GumpOffsetY)
{
m_PropertiesGump = propertiesGump;
@ -38,13 +36,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
@ -186,9 +178,8 @@ namespace Server.Gumps
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public InternalTarget(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
) : base(-1, true, TargetFlags.None)
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(-1, true, TargetFlags.None)
{
m_PropertiesGump = propertiesGump;
m_Property = prop;

View file

@ -9,13 +9,13 @@ namespace Server.Gumps
{
public class SetTimeSpanGump : Gump
{
private static readonly int EntryWidth = 212;
private const int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 7 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 7 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
@ -36,13 +36,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
AddRect(0, prop?.Name, 0, -1);
AddRect(1, ts.ToString(), 0, -1);

View file

@ -9,13 +9,13 @@ namespace Server.Gumps
{
public class EditSkillGump : Gump
{
private static readonly int EntryWidth = 160;
private const int EntryWidth = 160;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 2 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 2 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_From;
@ -38,13 +38,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
@ -111,22 +105,10 @@ namespace Server.Gumps
public class SkillsGump : Gump
{
/*
private static bool PrevLabel = OldStyle, NextLabel = OldStyle;
private const int NameWidth = 107;
private const int ValueWidth = 128;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
* */
private static readonly int NameWidth = 107;
private static readonly int ValueWidth = 128;
private static readonly int TotalWidth =
OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalWidth = OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
@ -158,47 +140,21 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
totalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4 - (OldStyle ? SetWidth + OffsetSize : 0);
if (OldStyle)
{
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
const int emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4;
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(
x - (OldStyle ? OffsetSize : 0),
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0),
EntryHeight,
HeaderGumpID
);
}
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
x += emptyWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
for (var i = 0; i < m_Groups.Length; ++i)
{
@ -220,12 +176,10 @@ namespace Server.Gumps
x += PrevWidth + OffsetSize;
x -= OldStyle ? OffsetSize : 0;
AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID);
AddImageTiled(x, y, emptyWidth, EntryHeight, EntryGumpID);
AddLabel(x + TextOffsetX, y, TextHue, group?.Name ?? "");
x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0);
x += emptyWidth;
x += OffsetSize;
if (SetGumpID != 0)
@ -238,7 +192,6 @@ namespace Server.Gumps
continue;
}
var indentMaskX = BorderSize;
var indentMaskY = y + EntryHeight + OffsetSize;
for (var j = 0; j < group!.Skills.Length; ++j)
@ -257,18 +210,10 @@ namespace Server.Gumps
x += PrevWidth + OffsetSize;
x -= OldStyle ? OffsetSize : 0;
AddImageTiled(
x,
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth,
EntryHeight,
EntryGumpID
);
AddImageTiled(x, y, emptyWidth - OffsetSize - IndentWidth, EntryHeight, EntryGumpID);
AddLabel(x + TextOffsetX, y, TextHue, sk == null ? "(null)" : sk.Name);
x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth;
x += emptyWidth - OffsetSize - IndentWidth;
x += OffsetSize;
if (SetGumpID != 0)
@ -284,24 +229,30 @@ namespace Server.Gumps
switch (sk.Lock)
{
default:
{
buttonID1 = 0x983;
buttonID2 = 0x983;
xOffset = 6;
yOffset = 4;
break;
}
case SkillLock.Down:
{
buttonID1 = 0x985;
buttonID2 = 0x985;
xOffset = 6;
yOffset = 4;
break;
}
case SkillLock.Locked:
{
buttonID1 = 0x82C;
buttonID2 = 0x82C;
xOffset = 5;
yOffset = 2;
break;
}
}
AddButton(x + xOffset, y + yOffset, buttonID1, buttonID2, GetButtonID(2, j));
@ -331,7 +282,7 @@ namespace Server.Gumps
}
AddImageTiled(
indentMaskX,
BorderSize,
indentMaskY,
IndentWidth + OffsetSize,
group.Skills.Length * (EntryHeight + OffsetSize) - (i < m_Groups.Length - 1 ? OffsetSize : 0),
@ -406,19 +357,25 @@ namespace Server.Gumps
switch (sk.Lock)
{
case SkillLock.Up:
{
sk.SetLockNoRelay(SkillLock.Down);
sk.Update();
break;
}
case SkillLock.Down:
{
sk.SetLockNoRelay(SkillLock.Locked);
sk.Update();
break;
}
case SkillLock.Locked:
{
sk.SetLockNoRelay(SkillLock.Up);
sk.Update();
break;
}
}
}
else
{
m_From.SendMessage("You may not change that.");
@ -451,11 +408,10 @@ namespace Server.Gumps
public SkillName[] Skills { get; }
public static SkillsGumpGroup[] Groups { get; } =
{
[
new(
"Crafting",
new[]
{
[
SkillName.Alchemy,
SkillName.Blacksmith,
SkillName.Cartography,
@ -466,22 +422,20 @@ namespace Server.Gumps
SkillName.Tailoring,
SkillName.Tinkering,
SkillName.Imbuing
}
]
),
new(
"Bardic",
new[]
{
[
SkillName.Discordance,
SkillName.Musicianship,
SkillName.Peacemaking,
SkillName.Provocation
}
]
),
new(
"Magical",
new[]
{
[
SkillName.Chivalry,
SkillName.EvalInt,
SkillName.Magery,
@ -493,12 +447,11 @@ namespace Server.Gumps
SkillName.Bushido,
SkillName.Spellweaving,
SkillName.Mysticism
}
]
),
new(
"Miscellaneous",
new[]
{
[
SkillName.Camping,
SkillName.Fishing,
SkillName.Focus,
@ -509,12 +462,11 @@ namespace Server.Gumps
SkillName.Mining,
SkillName.Snooping,
SkillName.Veterinary
}
]
),
new(
"Combat Ratings",
new[]
{
[
SkillName.Archery,
SkillName.Fencing,
SkillName.Macing,
@ -523,12 +475,11 @@ namespace Server.Gumps
SkillName.Tactics,
SkillName.Wrestling,
SkillName.Throwing
}
]
),
new(
"Actions",
new[]
{
[
SkillName.AnimalTaming,
SkillName.Begging,
SkillName.DetectHidden,
@ -538,21 +489,20 @@ namespace Server.Gumps
SkillName.Stealing,
SkillName.Stealth,
SkillName.Tracking
}
]
),
new(
"Lore & Knowledge",
new[]
{
[
SkillName.Anatomy,
SkillName.AnimalLore,
SkillName.ArmsLore,
SkillName.Forensics,
SkillName.ItemID,
SkillName.TasteID
}
]
)
};
];
private class SkillNameComparer : IComparer<SkillName>
{

View file

@ -7,7 +7,7 @@ namespace Server.Gumps
public class ToTAdminGump : Gump
{
private static readonly string[] m_ToTInfo =
{
[
// Opening Message
"<center>Treasures of Tokuno Admin</center><br>" +
"-Use the gems to switch eras<br>" +
@ -27,7 +27,7 @@ namespace Server.Gumps
"-10 types of 1 charge Fresh Pigments drop as Lesser Artifacts<br>" +
"-1 charge Bleach Pigment can drop as a Lesser Artifact<br>" +
"-Leurocian's Mempo Of Fortune can drop as a Lesser Artifact"
};
];
private readonly int m_ToTEras;

View file

@ -164,35 +164,49 @@ namespace Server.Gumps
switch (info.ButtonID)
{
case 1: // Price Per Rental
{
SetPricePerRental(from);
break;
}
case 2: // Accept offer
{
AcceptOffer(from);
break;
}
case 3: // Renew on expiration - landlord
{
LandlordRenewOnExpiration(from);
break;
}
case 4: // Renew on expiration - renter
{
RenterRenewOnExpiration(from);
break;
}
case 5: // Offer Contract To Someone
{
OfferContract(from);
break;
}
case 6: // Renewal price
{
SetRenewalPrice(from);
break;
}
default:
{
Cancel(from);
break;
}
}
}
}
protected abstract bool IsValidResponse(Mobile from);

View file

@ -9,18 +9,12 @@ using static Server.Gumps.PropsConfig;
namespace Server.Gumps;
public class WhoGump : DynamicGump
{
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private const int EntryWidth = 180;
private const int EntryCount = 15;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int EntryWidth = 180;
private static readonly int EntryCount = 15;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private readonly List<Mobile> _mobiles;
private readonly int _page;
@ -88,29 +82,14 @@ public class WhoGump : DynamicGump
builder.AddPage();
builder.AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
builder.AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
totalHeight,
OffsetGumpID
);
builder.AddImageTiled(BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4 - (OldStyle ? SetWidth + OffsetSize : 0);
const int emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4;
if (!OldStyle)
{
builder.AddImageTiled(
x - (OldStyle ? OffsetSize : 0),
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0),
EntryHeight,
EntryGumpID
);
}
builder.AddImageTiled(x, y, emptyWidth, EntryHeight, EntryGumpID);
builder.AddLabel(
x + TextOffsetX,
@ -121,40 +100,20 @@ public class WhoGump : DynamicGump
x += emptyWidth + OffsetSize;
if (OldStyle)
{
builder.AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
builder.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
if (_page > 0)
{
builder.AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
if (PrevLabel)
{
builder.AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
builder.AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
if ((_page + 1) * EntryCount < _mobiles.Count)
{
builder.AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1);
if (NextLabel)
{
builder.AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
for (int i = 0, index = _page * EntryCount; i < EntryCount && index < _mobiles.Count; ++i, ++index)
@ -270,15 +229,8 @@ public class WhoGump : DynamicGump
public int Compare(Mobile x, Mobile y)
{
if (x == null)
{
throw new ArgumentNullException(nameof(x));
}
if (y == null)
{
throw new ArgumentNullException(nameof(y));
}
ArgumentNullException.ThrowIfNull(x);
ArgumentNullException.ThrowIfNull(y);
if (x.AccessLevel > y.AccessLevel)
{