Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -94,33 +94,31 @@ namespace Server.Engines.BulkOrders
AddImage(5, 424, 10460);
AddImage(585, 424, 10460);
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor, false, false); // Filter Preference
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor); // Filter Preference
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor, false, false); // Bulk Order Type
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor); // Bulk Order Type
AddFilterList(25, 96, m_XOffsets_Type, 40, m_TypeFilters, m_XWidths_Small, f.Type, 0);
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor, false, false); // Quality
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor); // Quality
AddFilterList(320, 96, m_XOffsets_Quality, 40, m_QualityFilters, m_XWidths_Small, f.Quality, 1);
AddHtmlLocalized(26, 160, 120, 32, 1062232, LabelColor, false, false); // Material Type
AddHtmlLocalized(26, 160, 120, 32, 1062232, LabelColor); // Material Type
AddFilterList(25, 192, m_XOffsets_Material, 40, m_MaterialFilters, m_XWidths_Large, f.Material, 2);
AddHtmlLocalized(26, 320, 120, 32, 1062217, LabelColor, false, false); // Amount
AddHtmlLocalized(26, 320, 120, 32, 1062217, LabelColor); // Amount
AddFilterList(25, 352, m_XOffsets_Amount, 40, m_AmountFilters, m_XWidths_Small, f.Quantity, 3);
AddHtmlLocalized(75, 416, 120, 32, 1062477, from.UseOwnFilter ? LabelColor : 16927, false,
false); // Set Book Filter
AddButton(40, 416, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(75, 416, 120, 32, 1062477, from.UseOwnFilter ? LabelColor : 16927); // Set Book Filter
AddButton(40, 416, 4005, 4007, 1);
AddHtmlLocalized(235, 416, 120, 32, 1062478, from.UseOwnFilter ? 16927 : LabelColor, false,
false); // Set Your Filter
AddButton(200, 416, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(235, 416, 120, 32, 1062478, from.UseOwnFilter ? 16927 : LabelColor); // Set Your Filter
AddButton(200, 416, 4005, 4007, 2);
AddHtmlLocalized(405, 416, 120, 32, 1062231, LabelColor, false, false); // Clear Filter
AddButton(370, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(405, 416, 120, 32, 1062231, LabelColor); // Clear Filter
AddButton(370, 416, 4005, 4007, 3);
AddHtmlLocalized(540, 416, 50, 32, 1011046, LabelColor, false, false); // APPLY
AddButton(505, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(540, 416, 50, 32, 1011046, LabelColor); // APPLY
AddButton(505, 416, 4017, 4018, 0);
}
private void AddFilterList(int x, int y, int[] xOffsets, int yOffset, int[,] filters, int[] xWidths, int filterValue,
@ -139,9 +137,9 @@ namespace Server.Engines.BulkOrders
isSelected = filterValue == 0;
AddHtmlLocalized(x + 35 + xOffsets[i % xOffsets.Length], y + i / xOffsets.Length * yOffset,
xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor, false, false);
xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor);
AddButton(x + xOffsets[i % xOffsets.Length], y + i / xOffsets.Length * yOffset, 4005, 4007,
4 + filterIndex + i * 4, GumpButtonType.Reply, 0);
4 + filterIndex + i * 4);
}
}
@ -221,4 +219,4 @@ namespace Server.Engines.BulkOrders
}
}
}
}
}

View file

@ -56,7 +56,7 @@ namespace Server.Engines.BulkOrders
{
VendorItem vi = pv.GetVendorItem(book);
canBuy = vi != null && !vi.IsForSale;
canBuy = vi?.IsForSale == false;
}
int width = 600;
@ -103,45 +103,45 @@ namespace Server.Engines.BulkOrders
AddImage(5, 424, 10460);
AddImage(width - 15, 424, 10460);
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor, false, false); // Type
AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor, false, false); // Item
AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor, false, false); // Quality
AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor, false, false); // Material
AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor, false, false); // Amount
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor); // Bulk Order Book
AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor); // Type
AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor); // Item
AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor); // Quality
AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor); // Material
AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor); // Amount
AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false); // Set Filter
AddButton(35, 32, 4005, 4007, 1);
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor); // Set Filter
BOBFilter f = from.UseOwnFilter ? from.BOBFilter : book.Filter;
if (f.IsDefault)
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false); // Using No Filter
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927); // Using No Filter
else if (from.UseOwnFilter)
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false); // Using Your Filter
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927); // Using Your Filter
else
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false); // Using Book Filter
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927); // Using Book Filter
AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT
AddButton(375, 416, 4017, 4018, 0);
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor); // EXIT
if (canDrop)
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false); // Drop
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor); // Drop
if (canPrice)
{
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false); // Price
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor); // Price
if (canBuy)
{
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false); // Buy
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor); // Buy
}
else
{
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false); // Set
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor); // Set
AddButton(450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0);
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false);
AddButton(450, 416, 4005, 4007, 4);
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>");
}
}
@ -149,14 +149,14 @@ namespace Server.Engines.BulkOrders
if (page > 0)
{
AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page
AddButton(75, 416, 4014, 4016, 2);
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor); // Previous page
}
if (GetIndexForPage(page + 1) < list.Count)
{
AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false); // Next page
AddButton(225, 416, 4005, 4007, 3);
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor); // Next page
}
for (int i = index; i < index + count && i >= 0 && i < list.Count; ++i)
@ -171,31 +171,31 @@ namespace Server.Engines.BulkOrders
int y = 96 + tableIndex * 32;
if (canDrop)
AddButton(35, y + 2, 5602, 5606, 5 + i * 2, GumpButtonType.Reply, 0);
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
if (canDrop || canBuy && entry.Price > 0)
{
AddButton(579, y + 2, 2117, 2118, 6 + i * 2, GumpButtonType.Reply, 0);
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
AddLabel(495, y, 1152, entry.Price.ToString());
}
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor, false, false); // Large
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor); // Large
for (int j = 0; j < largeEntry.Entries.Length; ++j)
{
BOBLargeSubEntry sub = largeEntry.Entries[j];
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor, false, false);
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor);
if (entry.RequireExceptional)
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
else
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
object name = GetMaterialName(entry.Material, entry.DeedType, sub.ItemType);
if (name is int intName)
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor, false, false);
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor);
else
AddLabel(316, y, 1152, name.ToString());
@ -212,27 +212,27 @@ namespace Server.Engines.BulkOrders
int y = 96 + tableIndex++ * 32;
if (canDrop)
AddButton(35, y + 2, 5602, 5606, 5 + i * 2, GumpButtonType.Reply, 0);
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
if (canDrop || canBuy && smallEntry.Price > 0)
{
AddButton(579, y + 2, 2117, 2118, 6 + i * 2, GumpButtonType.Reply, 0);
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
AddLabel(495, y, 1152, smallEntry.Price.ToString());
}
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor, false, false); // Small
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor); // Small
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor, false, false);
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor);
if (smallEntry.RequireExceptional)
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
else
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
object name = GetMaterialName(smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType);
if (name is int intName)
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor, false, false);
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor);
else
AddLabel(316, y, 1152, name.ToString());
@ -242,11 +242,11 @@ namespace Server.Engines.BulkOrders
}
public bool CheckFilter(IBOBEntry entry)
{
{
if (entry is BOBLargeEntry largeEntry)
return CheckFilter(entry.Material, entry.AmountMax, true, entry.RequireExceptional, entry.DeedType,
largeEntry.Entries.Length > 0 ? largeEntry.Entries[0].ItemType : null);
if (entry is BOBSmallEntry smallEntry)
return CheckFilter(entry.Material, entry.AmountMax, false, entry.RequireExceptional,
entry.DeedType, smallEntry.ItemType);
@ -355,7 +355,7 @@ namespace Server.Engines.BulkOrders
int count = 0;
int page = 0;
int i;
List<IBOBEntry> list = m_List;
for (i = 0; i < index && i < list.Count; i++)
{
@ -510,8 +510,8 @@ namespace Server.Engines.BulkOrders
Item item = bobEntry.Reconstruct();
Container pack = m_From.Backpack;
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
item.PileWeight + item.TotalWeight))
if (pack?.CheckHold(m_From, item, true, true, 0,
item.PileWeight + item.TotalWeight) != true)
{
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
@ -558,26 +558,26 @@ namespace Server.Engines.BulkOrders
{
VendorItem vi = pv.GetVendorItem(m_Book);
if (vi != null && !vi.IsForSale)
{
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
int price = bobEntry.Price;
if (vi?.IsForSale != false)
return;
if (price == 0)
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
int price = bobEntry.Price;
if (price == 0)
{
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
}
else
{
if (m_Book.Entries.Count > 0)
{
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
}
else
{
if (m_Book.Entries.Count > 0)
{
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
}
else
{
m_From.SendLocalizedMessage(1062381); // The book is emptz
}
m_From.SendLocalizedMessage(1062381); // The book is emptz
}
}
}
@ -625,7 +625,7 @@ namespace Server.Engines.BulkOrders
if (!m_Book.Entries.Contains(entry))
continue;
entry.Price = price;
}
@ -644,4 +644,4 @@ namespace Server.Engines.BulkOrders
}
}
}
}
}

View file

@ -67,7 +67,7 @@ namespace Server.Engines.BulkOrders
else if (DeedType == BODType.Tailor)
bod = new LargeTailorBOD(AmountMax, RequireExceptional, Material, ReconstructEntries());
for (int i = 0; bod != null && i < bod.Entries.Length; ++i)
for (int i = 0; bod?.Entries.Length >= i; ++i)
bod.Entries[i].Owner = bod;
return bod;
@ -103,4 +103,4 @@ namespace Server.Engines.BulkOrders
Entries[i].Serialize(writer);
}
}
}
}

View file

@ -25,17 +25,17 @@ namespace Server.Engines.BulkOrders
AddBackground(100, 10, 300, 150, 5054);
AddHtmlLocalized(125, 20, 250, 24, 1019070, false, false); // You have agreed to purchase:
AddHtmlLocalized(125, 45, 250, 24, 1045151, false, false); // a bulk order deed
AddHtmlLocalized(125, 20, 250, 24, 1019070); // You have agreed to purchase:
AddHtmlLocalized(125, 45, 250, 24, 1045151); // a bulk order deed
AddHtmlLocalized(125, 70, 250, 24, 1019071, false, false); // for the amount of:
AddHtmlLocalized(125, 70, 250, 24, 1019071); // for the amount of:
AddLabel(125, 95, 0, price.ToString());
AddButton(250, 130, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(282, 130, 100, 24, 1011012, false, false); // CANCEL
AddButton(250, 130, 4005, 4007, 1);
AddHtmlLocalized(282, 130, 100, 24, 1011012); // CANCEL
AddButton(120, 130, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(152, 130, 100, 24, 1011036, false, false); // OKAY
AddButton(120, 130, 4005, 4007, 2);
AddHtmlLocalized(152, 130, 100, 24, 1011036); // OKAY
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -57,12 +57,12 @@ namespace Server.Engines.BulkOrders
pv.SayTo(m_From, 1062382); // The deed selected is not available.
return;
}
int price = 0;
VendorItem vi = pv.GetVendorItem(m_Book);
if (vi != null && !vi.IsForSale)
if (vi?.IsForSale == false)
price = m_Entry.Price;
if (price != m_Price)
@ -79,13 +79,13 @@ namespace Server.Engines.BulkOrders
}
Item item = m_Entry.Reconstruct();
pv.Say(m_From.Name);
Container pack = m_From.Backpack;
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
item.PileWeight + item.TotalWeight))
if (pack?.CheckHold(m_From, item, true, true, 0,
item.PileWeight + item.TotalWeight) != true)
{
pv.SayTo(m_From, 503204); // You do not have room in your backpack for this
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
@ -120,4 +120,4 @@ namespace Server.Engines.BulkOrders
}
}
}
}
}

View file

@ -70,9 +70,9 @@ namespace Server.Engines.BulkOrders
{
SecureTrade trade = cont.Trade;
if ( trade != null && trade.From.Mobile == from )
if (trade?.From.Mobile == from )
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.To.Mobile, this ) );
else if ( trade != null && trade.To.Mobile == from )
else if (trade?.To.Mobile == from )
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.From.Mobile, this ) );
}
}
@ -159,9 +159,9 @@ namespace Server.Engines.BulkOrders
{
base.Serialize( writer );
writer.Write( (int) 2 ); // version
writer.Write( 2 ); // version
writer.Write( (int) ItemCount );
writer.Write( ItemCount );
writer.Write( (int) Level );
@ -169,7 +169,7 @@ namespace Server.Engines.BulkOrders
Filter.Serialize( writer );
writer.WriteEncodedInt( (int) Entries.Count );
writer.WriteEncodedInt( Entries.Count );
for ( int i = 0; i < Entries.Count; ++i )
{

View file

@ -218,13 +218,13 @@ namespace Server.Engines.BulkOrders
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( 0 ); // version
writer.Write( m_AmountMax );
writer.Write( m_RequireExceptional );
writer.Write( (int) m_Material );
writer.Write( (int) m_Entries.Length );
writer.Write( m_Entries.Length );
for ( int i = 0; i < m_Entries.Length; ++i )
m_Entries[i].Serialize( writer );

View file

@ -30,48 +30,45 @@ namespace Server.Engines.BulkOrders
AddImage(20, 225 + entries.Length * 24, 10460);
AddImage(430, 225 + entries.Length * 24, 10460);
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false,
false); // Ah! Thanks for the goods! Would you help me out?
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF); // Items requested:
int y = 120;
for (int i = 0; i < entries.Length; ++i, y += 24)
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF, false, false);
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF);
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
y += 24;
if (deed.RequireExceptional)
{
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
y += 24;
}
if (deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(40, y, 350, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false,
false); // All items must be made with x material.
AddHtmlLocalized(40, y, 350, 20, GetMaterialNumberFor(deed.Material), 0x7FFF); // All items must be made with x material.
y += 24;
}
}
AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF, false,
false); // Do you want to accept this order?
AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF, false, false); // Ok
AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1);
AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF); // Ok
AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0);
AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -104,4 +101,4 @@ namespace Server.Engines.BulkOrders
return 0;
}
}
}
}

View file

@ -30,13 +30,13 @@ namespace Server.Engines.BulkOrders
AddImage(45, 221 + entries.Length * 24, 10460);
AddImage(480, 221 + entries.Length * 24, 10460);
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF); // Items requested:
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
int y = 96;
@ -45,7 +45,7 @@ namespace Server.Engines.BulkOrders
LargeBulkEntry entry = entries[i];
SmallBulkEntry details = entry.Details;
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF, false, false);
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF);
AddLabel(275, y, 0x480, entry.Amount.ToString());
y += 24;
@ -53,26 +53,24 @@ namespace Server.Engines.BulkOrders
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
y += 24;
}
if (deed.RequireExceptional)
{
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
y += 24;
}
if (deed.Material != BulkMaterialType.None)
AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false,
false); // All items must be made with x material.
AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF); // All items must be made with x material.
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(160, 168 + entries.Length * 24, 300, 20, 1045155, 0x7FFF, false,
false); // Combine this deed with another deed.
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2);
AddHtmlLocalized(160, 168 + entries.Length * 24, 300, 20, 1045155, 0x7FFF); // Combine this deed with another deed.
AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1);
AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF); // EXIT
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -97,4 +95,4 @@ namespace Server.Engines.BulkOrders
return 0;
}
}
}
}

View file

@ -29,11 +29,7 @@ namespace Server.Engines.BulkOrders
public sealed class RewardItem
{
public RewardItem(int weight, ConstructCallback constructor) : this(weight, constructor, 0)
{
}
public RewardItem(int weight, ConstructCallback constructor, int type)
public RewardItem(int weight, ConstructCallback constructor, int type = 0)
{
Weight = weight;
Constructor = constructor;
@ -583,7 +579,7 @@ namespace Server.Engines.BulkOrders
{
Groups = new[]
{
new RewardGroup(0, new RewardItem(1, Cloth, 0)),
new RewardGroup(0, new RewardItem(1, Cloth)),
new RewardGroup(50, new RewardItem(1, Cloth, 1)),
new RewardGroup(100, new RewardItem(1, Cloth, 2)),
new RewardGroup(150, new RewardItem(9, Cloth, 3), new RewardItem(1, Sandals)),
@ -745,4 +741,4 @@ namespace Server.Engines.BulkOrders
#endregion
}
}
}

View file

@ -28,36 +28,35 @@ namespace Server.Engines.BulkOrders
AddImage(20, 249, 10460);
AddImage(430, 249, 10460);
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false,
false); // Ah! Thanks for the goods! Would you help me out?
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF); // A bulk order
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF); // Item requested:
AddItem(385, 96, deed.Graphic);
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF, false, false);
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF);
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
if (deed.RequireExceptional)
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
if (deed.Material != BulkMaterialType.None)
AddHtmlLocalized(40, deed.RequireExceptional ? 192 : 168, 350, 20, GetMaterialNumberFor(deed.Material),
0x7FFF, false, false); // All items must be made with x material.
0x7FFF); // All items must be made with x material.
}
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF, false, false); // Do you want to accept this order?
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
AddButton(100, 240, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF, false, false); // Ok
AddButton(100, 240, 4005, 4007, 1);
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF); // Ok
AddButton(275, 240, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
AddButton(275, 240, 4005, 4007, 0);
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -90,4 +89,4 @@ namespace Server.Engines.BulkOrders
return 0;
}
}
}
}

View file

@ -27,34 +27,34 @@ namespace Server.Engines.BulkOrders
AddImage(45, 245, 10460);
AddImage(480, 245, 10460);
AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF); // A bulk order
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF); // Item requested:
AddItem(410, 72, deed.Graphic);
AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF, false, false);
AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF);
AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
if (deed.RequireExceptional)
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
if (deed.Material != BulkMaterialType.None)
AddHtmlLocalized(75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor(deed.Material),
0x7FFF, false, false); // All items must be made with x material.
0x7FFF); // All items must be made with x material.
AddButton(125, 192, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
AddButton(125, 192, 4005, 4007, 2);
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF); // Combine this deed with the item requested.
AddButton(125, 216, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(160, 216, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
AddButton(125, 216, 4005, 4007, 1);
AddHtmlLocalized(160, 216, 120, 20, 1011441, 0x7FFF); // EXIT
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -79,4 +79,4 @@ namespace Server.Engines.BulkOrders
return 0;
}
}
}
}

View file

@ -78,10 +78,11 @@ namespace Server.Engines.BulkOrders
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
}
}
catch
{
}
}
catch
{
// ignored
}
}
}
}

View file

@ -61,7 +61,7 @@ namespace Server.Engines.CannedEvil
if (Deleted)
return;
if (m_Skull != null && m_Skull.Deleted)
if (m_Skull?.Deleted == true)
Skull = null;
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
@ -88,7 +88,7 @@ namespace Server.Engines.CannedEvil
if (Deleted)
return;
if (m_Skull != null && m_Skull.Deleted)
if (m_Skull?.Deleted == true)
Skull = null;
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
@ -181,4 +181,4 @@ namespace Server.Engines.CannedEvil
}
}
}
}
}

View file

@ -86,7 +86,7 @@ namespace Server.Engines.CannedEvil
public bool Validate(ChampionSkullBrazier brazier)
{
return brazier?.Skull != null && !brazier.Skull.Deleted;
return brazier?.Skull?.Deleted == false;
}
public override void Serialize(GenericWriter writer)
@ -125,4 +125,4 @@ namespace Server.Engines.CannedEvil
}
}
}
}
}

View file

@ -348,7 +348,7 @@ namespace Server.Engines.CannedEvil
}
else
{
if (killer.Corpse != null && !killer.Corpse.Deleted)
if (killer?.Corpse.Deleted == false)
killer.Corpse.DropItem(scroll);
else
killer.AddToBackpack(scroll);
@ -421,7 +421,8 @@ namespace Server.Engines.CannedEvil
{
m_Altar.Hue = 0;
if (!Core.ML || Map == Map.Felucca) new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
if (!Core.ML || Map == Map.Felucca)
new StarRoomGate(m_Altar.Location, m_Altar.Map, true);
}
Champion = null;
@ -440,7 +441,9 @@ namespace Server.Engines.CannedEvil
if (m.Deleted)
{
if (m.Corpse != null && !m.Corpse.Deleted) ((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
if (m.Corpse?.Deleted == false)
((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
m_Creatures.RemoveAt(i);
--i;
++m_Kills;
@ -574,6 +577,7 @@ namespace Server.Engines.CannedEvil
}
catch
{
// ignored
}
Champion?.MoveToWorld(new Point3D(X, Y, Z - 15), Map);
@ -919,7 +923,7 @@ namespace Server.Engines.CannedEvil
m_Creatures.Clear();
}
if (Champion != null && !Champion.Player)
if (Champion?.Player == false)
Champion.Delete();
Stop();
@ -950,7 +954,7 @@ namespace Server.Engines.CannedEvil
public void RegisterDamage(Mobile from, int amount)
{
if (from == null || !from.Player)
if (from?.Player != true)
return;
m_DamageEntries[from] = amount + (m_DamageEntries.TryGetValue(from, out int value) ? value : 0);
@ -997,7 +1001,7 @@ namespace Server.Engines.CannedEvil
Container pack = to.Backpack;
if (pack == null || !pack.TryDropItem(to, artifact, false))
if (pack?.TryDropItem(to, artifact, false) != true)
artifact.Delete();
else
to.SendLocalizedMessage(
@ -1006,8 +1010,8 @@ namespace Server.Engines.CannedEvil
public bool IsEligible(Mobile m, Item Artifact)
{
return m.Player && m.Alive && m.Region != null && m.Region == m_Region && m.Backpack != null &&
m.Backpack.CheckHold(m, Artifact, false);
return m.Player && m.Alive && m.Region != null && m.Region == m_Region &&
m.Backpack?.CheckHold(m, Artifact, false) == true;
}
public override void Serialize(GenericWriter writer)

View file

@ -9,19 +9,14 @@ namespace Server.Items
private Timer m_Timer;
[Constructible]
public StarRoomGate() : this(false)
{
}
[Constructible]
public StarRoomGate(bool decays, Point3D loc, Map map) : this(decays)
public StarRoomGate(Point3D loc, Map map, bool decays) : this(decays)
{
MoveToWorld(loc, map);
Effects.PlaySound(loc, map, 0x20E);
}
[Constructible]
public StarRoomGate(bool decays) : base(new Point3D(5143, 1774, 0), Map.Felucca)
public StarRoomGate(bool decays = false) : base(new Point3D(5143, 1774, 0), Map.Felucca)
{
Dispellable = false;
ItemID = 0x1FD4;
@ -101,4 +96,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -116,21 +116,15 @@ namespace Server.Engines.Chat
public bool ValidateAccess(ChatUser from, ChatUser target)
{
if (from != null && target != null && from.Mobile.AccessLevel < target.Mobile.AccessLevel)
{
from.Mobile.SendMessage("Your access level is too low to do this.");
return false;
}
if (from == null || target == null || from.Mobile.AccessLevel >= target.Mobile.AccessLevel)
return true;
from.Mobile.SendMessage("Your access level is too low to do this.");
return false;
return true;
}
public bool AddUser(ChatUser user)
{
return AddUser(user, null);
}
public bool AddUser(ChatUser user, string password)
public bool AddUser(ChatUser user, string password = null)
{
if (Contains(user))
{
@ -188,12 +182,7 @@ namespace Server.Engines.Chat
}
}
public void AdBan(ChatUser user)
{
AddBan(user, null);
}
public void AddBan(ChatUser user, ChatUser moderator)
public void AddBan(ChatUser user, ChatUser moderator = null)
{
if (!ValidateModerator(moderator) || !ValidateAccess(moderator, user))
return;
@ -210,12 +199,7 @@ namespace Server.Engines.Chat
m_Banned.Remove(user);
}
public void Kick(ChatUser user)
{
Kick(user, null);
}
public void Kick(ChatUser user, ChatUser moderator)
public void Kick(ChatUser user, ChatUser moderator = null)
{
Kick(user, moderator, false);
}
@ -248,12 +232,7 @@ namespace Server.Engines.Chat
moderator?.SendMessage(62, user.Username); // You are banning %1 from this conference.
}
public void AddVoiced(ChatUser user)
{
AddVoiced(user, null);
}
public void AddVoiced(ChatUser user, ChatUser moderator)
public void AddVoiced(ChatUser user, ChatUser moderator = null)
{
if (!ValidateModerator(moderator))
return;
@ -291,12 +270,7 @@ namespace Server.Engines.Chat
}
}
public void AddModerator(ChatUser user)
{
AddModerator(user, null);
}
public void AddModerator(ChatUser user, ChatUser moderator)
public void AddModerator(ChatUser user, ChatUser moderator = null)
{
if (!ValidateModerator(moderator))
return;
@ -316,12 +290,7 @@ namespace Server.Engines.Chat
SendCommand(ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username);
}
public void RemoveModerator(ChatUser user)
{
RemoveModerator(user, null);
}
public void RemoveModerator(ChatUser user, ChatUser moderator)
public void RemoveModerator(ChatUser user, ChatUser moderator = null)
{
if (!ValidateModerator(moderator) || !ValidateAccess(moderator, user))
return;
@ -338,32 +307,12 @@ namespace Server.Engines.Chat
}
}
public void SendMessage(int number)
public void SendMessage(int number, string param1 = null)
{
SendMessage(number, null, null, null);
SendMessage(number, null, param1);
}
public void SendMessage(int number, string param1)
{
SendMessage(number, null, param1, null);
}
public void SendMessage(int number, string param1, string param2)
{
SendMessage(number, null, param1, param2);
}
public void SendMessage(int number, ChatUser initiator)
{
SendMessage(number, initiator, null, null);
}
public void SendMessage(int number, ChatUser initiator, string param1)
{
SendMessage(number, initiator, param1, null);
}
public void SendMessage(int number, ChatUser initiator, string param1, string param2)
public void SendMessage(int number, ChatUser initiator, string param1 = null, string param2 = null)
{
for (int i = 0; i < m_Users.Count; ++i)
{
@ -395,32 +344,12 @@ namespace Server.Engines.Chat
}
}
public void SendCommand(ChatCommand command)
{
SendCommand(command, null, null, null);
}
public void SendCommand(ChatCommand command, string param1)
{
SendCommand(command, null, param1, null);
}
public void SendCommand(ChatCommand command, string param1, string param2)
public void SendCommand(ChatCommand command, string param1 = null, string param2 = null)
{
SendCommand(command, null, param1, param2);
}
public void SendCommand(ChatCommand command, ChatUser initiator)
{
SendCommand(command, initiator, null, null);
}
public void SendCommand(ChatCommand command, ChatUser initiator, string param1)
{
SendCommand(command, initiator, param1, null);
}
public void SendCommand(ChatCommand command, ChatUser initiator, string param1, string param2)
public void SendCommand(ChatCommand command, ChatUser initiator, string param1 = null, string param2 = null)
{
for (int i = 0; i < m_Users.Count; ++i)
{
@ -457,12 +386,7 @@ namespace Server.Engines.Chat
}
}
public static Channel AddChannel(string name)
{
return AddChannel(name, null);
}
public static Channel AddChannel(string name, string password)
public static Channel AddChannel(string name, string password = null)
{
Channel channel = FindChannelByName(name);
@ -521,4 +445,4 @@ namespace Server.Engines.Chat
AddChannel(name).AlwaysAvailable = true;
}
}
}
}

View file

@ -16,17 +16,7 @@ namespace Server.Engines.Chat
PacketHandlers.Register(0xB3, 0, true, ChatAction);
}
public static void SendCommandTo(Mobile to, ChatCommand type)
{
SendCommandTo(to, type, null, null);
}
public static void SendCommandTo(Mobile to, ChatCommand type, string param1)
{
SendCommandTo(to, type, param1, null);
}
public static void SendCommandTo(Mobile to, ChatCommand type, string param1, string param2)
public static void SendCommandTo(Mobile to, ChatCommand type, string param1 = null, string param2 = null)
{
to?.Send(new ChatMessagePacket(null, (int)type + 20, param1, param2));
}

View file

@ -180,7 +180,7 @@ namespace Server.Engines.Chat
password = password?.Trim();
if (password != null && password.Length == 0)
if (password?.Length == 0)
password = null;
Channel joined = Channel.FindChannelByName(name);
@ -217,7 +217,7 @@ namespace Server.Engines.Chat
password = password?.Trim();
if (password != null && password.Length == 0)
if (password?.Length == 0)
password = null;
Channel.AddChannel(name, password).AddUser(from, password);
@ -355,4 +355,4 @@ namespace Server.Engines.Chat
channel.VoiceRestricted = !channel.VoiceRestricted;
}
}
}
}

View file

@ -49,17 +49,12 @@ namespace Server.Engines.Chat
public bool IgnorePrivateMessage{ get; set; }
public bool IsModerator => CurrentChannel != null && CurrentChannel.IsModerator(this);
public bool IsModerator => CurrentChannel?.IsModerator(this) == true;
public char GetColorCharacter()
{
if (CurrentChannel != null && CurrentChannel.IsModerator(this))
return ModeratorColorCharacter;
if (CurrentChannel != null && CurrentChannel.IsVoiced(this))
return VoicedColorCharacter;
return NormalColorCharacter;
return IsModerator ? ModeratorColorCharacter :
CurrentChannel?.IsVoiced(this) == true ? VoicedColorCharacter : NormalColorCharacter;
}
public bool CheckOnline()
@ -71,17 +66,7 @@ namespace Server.Engines.Chat
return false;
}
public void SendMessage(int number)
{
SendMessage(number, null, null);
}
public void SendMessage(int number, string param1)
{
SendMessage(number, param1, null);
}
public void SendMessage(int number, string param1, string param2)
public void SendMessage(int number, string param1 = null, string param2 = null)
{
if (Mobile.NetState != null)
Mobile.Send(new ChatMessagePacket(Mobile, number, param1, param2));
@ -135,28 +120,28 @@ namespace Server.Engines.Chat
{
ChatUser user = GetChatUser(from);
if (user == null)
if (user != null)
return user;
user = new ChatUser(from);
m_Users.Add(user);
m_Table[from] = user;
Channel.SendChannelsTo(user);
List<Channel> list = Channel.Channels;
for (int i = 0; i < list.Count; ++i)
{
user = new ChatUser(from);
Channel c = list[i];
m_Users.Add(user);
m_Table[from] = user;
Channel.SendChannelsTo(user);
List<Channel> list = Channel.Channels;
for (int i = 0; i < list.Count; ++i)
{
Channel c = list[i];
if (c.AddUser(user))
break;
}
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
if (c.AddUser(user))
break;
}
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
return user;
}
@ -205,32 +190,12 @@ namespace Server.Engines.Chat
return null;
}
public static void GlobalSendCommand(ChatCommand command)
{
GlobalSendCommand(command, null, null, null);
}
public static void GlobalSendCommand(ChatCommand command, string param1)
{
GlobalSendCommand(command, null, param1, null);
}
public static void GlobalSendCommand(ChatCommand command, string param1, string param2)
public static void GlobalSendCommand(ChatCommand command, string param1, string param2 = null)
{
GlobalSendCommand(command, null, param1, param2);
}
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator)
{
GlobalSendCommand(command, initiator, null, null);
}
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1)
{
GlobalSendCommand(command, initiator, param1, null);
}
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1, string param2)
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator = null, string param1 = null, string param2 = null)
{
for (int i = 0; i < m_Users.Count; ++i)
{
@ -244,4 +209,4 @@ namespace Server.Engines.Chat
}
}
}
}
}

View file

@ -44,11 +44,11 @@ namespace Server.Engines.ConPVP
AddImage(215, -43, 0xEE40);
//AddImage( 330, 141, 0x8BA );
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32), false, false);
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32));
string fmt;
@ -57,37 +57,37 @@ namespace Server.Engines.ConPVP
else
fmt = "You have been challenged to a duel from {0}. Do you accept?";
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868), false, false);
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868));
AddImageTiled(32, 88, 264, 1, 9107);
AddImageTiled(42, 90, 264, 1, 9157);
AddRadio(24, 100, 9727, 9730, true, 1);
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32), false, false);
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32));
AddRadio(24, 135, 9727, 9730, false, 2);
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32), false, false);
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32));
AddRadio(24, 170, 9727, 9730, false, 3);
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32), false, false);
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32));
AddButton(314, 173, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(314, 173, 247, 248, 1);
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
}

View file

@ -86,13 +86,9 @@ namespace Server.Engines.ConPVP
[PropertyObject]
public class ArenaStartPoints
{
public ArenaStartPoints() : this(new Point3D[8])
public ArenaStartPoints(Point3D[] points = null)
{
}
public ArenaStartPoints(Point3D[] points)
{
Points = points;
Points = points ?? new Point3D[8];
}
public ArenaStartPoints(GenericReader reader)
@ -407,7 +403,8 @@ namespace Server.Engines.ConPVP
set
{
m_GateOut = value;
if (Teleporter != null) Teleporter.Location = m_GateOut;
if (Teleporter != null)
Teleporter.Location = m_GateOut;
}
}
@ -664,7 +661,7 @@ namespace Server.Engines.ConPVP
{
ArenaController controller = allControllers[i];
if (controller != null && !controller.Deleted && controller.Arena != null && controller.IsPrivate &&
if (controller?.Deleted == false && controller.Arena != null && controller.IsPrivate &&
controller.Map == first.Map && first.InRange(controller, 24))
{
BaseHouse house = BaseHouse.FindHouseAt(controller);
@ -832,4 +829,4 @@ namespace Server.Engines.ConPVP
#endregion
}
}
}

View file

@ -48,11 +48,7 @@ namespace Server.Engines.ConPVP
private bool m_Yielding;
public DuelContext(Mobile initiator, RulesetLayout layout) : this(initiator, layout, true)
{
}
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew)
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew = true)
{
Initiator = initiator;
Participants = new List<Participant>();
@ -123,13 +119,8 @@ namespace Server.Engines.ConPVP
public static bool AllowSpecialMove(Mobile from, string name, SpecialMove move)
{
if (!(from is PlayerMobile pm))
return true;
DuelContext dc = pm.DuelContext;
// No DuelContext, or InstaAllowSpecialMove
return dc?.InstAllowSpecialMove(from, name, move) != false;
return (from as PlayerMobile)?.DuelContext?.InstAllowSpecialMove(from, name, move) != false;
}
public bool InstAllowSpecialMove(Mobile from, string name, SpecialMove move)
@ -139,7 +130,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (CantDoAnything(from))
@ -165,9 +156,7 @@ namespace Server.Engines.ConPVP
if (!StartedBeginCountdown)
return true;
DuelPlayer pl = Find(from);
if (pl?.Eliminated != false)
if (Find(from)?.Eliminated != false)
return true;
if (CantDoAnything(from))
@ -256,7 +245,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (item is Dagger || CheckItemEquip(from, item))
@ -350,7 +339,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (CantDoAnything(from))
@ -373,7 +362,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (!(item is BaseRefreshPotion))
@ -507,7 +496,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(mob);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return;
if (mob.Map == Map.Internal)
@ -533,30 +522,27 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(mob);
if (pl != null && !pl.Eliminated)
if (pl?.Eliminated == true || m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
return;
pl.Eliminated = true;
if (mob.Poison != null)
mob.Poison = null;
Requip(mob, corpse);
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
Participant winner = CheckCompletion();
if (winner != null)
{
if (m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
return;
pl.Eliminated = true;
if (mob.Poison != null)
mob.Poison = null;
Requip(mob, corpse);
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
Participant winner = CheckCompletion();
if (winner != null)
{
Finish(winner);
}
else if (!m_Yielding)
{
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
}
Finish(winner);
}
else if (!m_Yielding)
{
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
}
}
@ -564,7 +550,7 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
if (p.HasOpenSlot)
return false;
@ -609,7 +595,7 @@ namespace Server.Engines.ConPVP
Mobile killer = from.FindMostRecentDamager(false);
if (killer != null && killer.Player)
if (killer?.Player == true)
killer.AddToBackpack(new Head(m_Tournament == null ? HeadType.Duel : HeadType.Tournament, from.Name));
}
@ -671,7 +657,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer pl = winner.Players[i];
if (pl != null && !pl.Eliminated)
if (pl?.Eliminated == false)
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
}
@ -688,7 +674,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant loser = (Participant)Participants[i];
Participant loser = Participants[i];
if (loser != winner)
{
@ -714,8 +700,8 @@ namespace Server.Engines.ConPVP
if (IsOneVsOne)
{
DuelPlayer dp1 = ((Participant)Participants[0]).Players[0];
DuelPlayer dp2 = ((Participant)Participants[1]).Players[0];
DuelPlayer dp1 = Participants[0].Players[0];
DuelPlayer dp2 = Participants[1].Players[0];
if (dp1 != null && dp2 != null)
{
@ -797,7 +783,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
@ -828,7 +814,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant oldPart = (Participant)Participants[i];
Participant oldPart = Participants[i];
Participant newPart = new Participant(dc, oldPart.Players.Length);
for (int j = 0; j < oldPart.Players.Length; ++j)
@ -858,7 +844,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
DuelPlayer pl = p.Find(mob);
if (pl != null)
@ -873,7 +859,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl1 = Find(m1);
DuelPlayer pl2 = Find(m2);
return pl1 != null && pl2 != null && pl1.Participant == pl2.Participant;
return pl1 != null && pl1.Participant == pl2?.Participant;
}
public Participant CheckCompletion()
@ -885,7 +871,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
if (p.Eliminated)
{
@ -900,10 +886,7 @@ namespace Server.Engines.ConPVP
}
}
if (hasWinner)
return winner ?? (Participant)Participants[0];
return null;
return hasWinner ? winner ?? Participants[0] : null;
}
public void StartCountdown(int count, CountdownCallback cb)
@ -953,13 +936,13 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
DuelPlayer pl = p.Players[j];
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
continue;
pl.Mobile.SendSound(0x1E1);
@ -984,13 +967,13 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
DuelPlayer pl = p.Players[j];
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
continue;
pl.Mobile.SendSound(0x1E1);
@ -1065,7 +1048,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer pl = p.Players[j];
if (pl != null && !pl.Eliminated)
if (pl?.Eliminated == false)
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
}
@ -1511,7 +1494,7 @@ namespace Server.Engines.ConPVP
}
}
}
public void CloseAllGumps(DuelPlayer pl)
{
pl.Mobile.CloseGump<BeginGump>();
@ -1527,7 +1510,7 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
@ -1546,7 +1529,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
@ -1571,7 +1554,7 @@ namespace Server.Engines.ConPVP
else
mob.SendMessage(0x22, "{0} has rejected the {1}.", rejector.Name, Rematch ? "rematch" : page);
}
// Close all of them?
mob.CloseGump<DuelContextGump>();
mob.CloseGump<ReadyUpGump>();
@ -1851,9 +1834,9 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < ruleset.Flavors.Count; ++i)
{
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
defs.Or(ruleset.Flavors[i].Options);
mob.SendMessage(" + {0}", ((Ruleset)ruleset.Flavors[i]).Title);
mob.SendMessage(" + {0}", ruleset.Flavors[i].Title);
}
}
else
@ -2084,10 +2067,7 @@ namespace Server.Engines.ConPVP
}
}
Arena arena = m_OverrideArena;
if (arena == null)
arena = Arena.FindArena(players);
Arena arena = m_OverrideArena ?? Arena.FindArena(players);
if (arena == null)
{
@ -2482,7 +2462,7 @@ namespace Server.Engines.ConPVP
}
else
{
if (m_Teleporter != null && !m_Teleporter.Deleted)
if (m_Teleporter?.Deleted == false)
m_Teleporter.Register(m);
base.UseGate(m);
@ -2512,4 +2492,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -15,12 +15,7 @@ namespace Server.Engines.ConPVP
public class DuelTeleporterAddon : BaseAddon
{
[Constructible]
public DuelTeleporterAddon() : this(DuelTeleporterType.Squares)
{
}
[Constructible]
public DuelTeleporterAddon(DuelTeleporterType type)
public DuelTeleporterAddon(DuelTeleporterType type = DuelTeleporterType.Squares)
{
int itemID = (int)type;
@ -91,4 +86,4 @@ namespace Server.Engines.ConPVP
int version = reader.ReadInt();
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,7 @@ namespace Server.Engines.ConPVP
public DuelContext Context{ get; set; }
public bool InProgress => Context != null && Context.Registered;
public bool InProgress => Context?.Registered == true;
public void Start(Arena arena, Tournament tourney)
{
@ -120,4 +120,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
defs = new BitArray(basedef.Options);
for (int i = 0; i < ruleset.Flavors.Count; ++i)
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
defs.Or(ruleset.Flavors[i].Options);
height += ruleset.Flavors.Count * 18;
}
@ -194,7 +194,7 @@ namespace Server.Engines.ConPVP
y += 20;
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
AddBorderedText(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", LabelColor32, BlackColor32);
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
y += 4;
@ -243,7 +243,7 @@ namespace Server.Engines.ConPVP
y += 35;
y -= 3;
AddButton(314, y, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(314, y, 247, 248, 1);
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
}
@ -270,9 +270,9 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
AddHtml(x, y, width, height, text, false, false);
AddHtml(x, y, width, height, text);
else
AddHtml(x, y, width, height, Color(text, color), false, false);
AddHtml(x, y, width, height, Color(text, color));
}
public void AutoReject()
@ -379,4 +379,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -105,18 +105,13 @@ namespace Server.Engines.ConPVP
AddColumnHeader(325, "Participants");
AddColumnHeader(40, "Obs");
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2);
for (int i = 0; i < list.Count; ++i)
{
Arena ar = list[i];
string name = ar.Name;
if (name == null)
name = "(no name)";
int x = 12;
int y = 32 + i * 31;
@ -125,7 +120,7 @@ namespace Server.Engines.ConPVP
AddRadio(x + 3, y + 1, 9727, 9730, false, i);
x += 35;
AddBorderedText(x + 5, y + 5, 115 - 5, name, color, 0);
AddBorderedText(x + 5, y + 5, 115 - 5, ar.Name ?? "(no name)", color, 0);
x += 115;
StringBuilder sb = new StringBuilder();
@ -271,9 +266,9 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, string text, int color)
{
if (color == 0)
AddHtml(x, y, width, 20, text, false, false);
AddHtml(x, y, width, 20, text);
else
AddHtml(x, y, width, 20, Color(text, color), false, false);
AddHtml(x, y, width, 20, Color(text, color));
}
private void AddColumnHeader(int width, string name)
@ -287,4 +282,4 @@ namespace Server.Engines.ConPVP
m_ColumnX += width;
}
}
}
}

View file

@ -20,32 +20,32 @@ namespace Server.Engines.ConPVP
AddImage(215, -43, 0xEE40);
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32), false, false);
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32));
AddHtml(22 - 1, 50, 294, 80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32), false, false);
BlackColor32));
AddHtml(22 + 1, 50, 294, 80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32), false, false);
BlackColor32));
AddHtml(22, 50 - 1, 294, 80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32), false, false);
BlackColor32));
AddHtml(22, 50 + 1, 294, 80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32), false, false);
BlackColor32));
AddHtml(22, 50, 294, 80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
0xFFCC66), false, false);
0xFFCC66));
/*AddImageTiled( 32, 128, 264, 1, 9107 );
AddImageTiled( 42, 130, 264, 1, 9157 );
@ -56,7 +56,7 @@ namespace Server.Engines.ConPVP
AddHtml( 60, 140+1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
AddHtml( 60, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#FF6666>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", 0x66AACC ), 0x66AACC ), false, false );*/
AddButton(314 - 50, 157 - offset, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(314 - 50, 157 - offset, 247, 248, 1);
}
public string Center(string text)
@ -69,4 +69,4 @@ namespace Server.Engines.ConPVP
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, height, 9250);
AddBackground(10, 10, 280, height - 20, 0xDAC);
AddHtml(35, 25, 230, 20, Center("Duel Setup"), false, false);
AddHtml(35, 25, 230, 20, Center("Duel Setup"));
int x = 35;
int y = 47;
@ -38,12 +38,12 @@ namespace Server.Engines.ConPVP
AddGoldenButtonLabeled(x, y, 3, "Add Participant");
y += 30;
AddHtml(35, y, 230, 20, Center("Participants"), false, false);
AddHtml(35, y, 230, 20, Center("Participants"));
y += 22;
for (int i = 0; i < context.Participants.Count; ++i)
{
Participant p = (Participant)context.Participants[i];
Participant p = context.Participants[i];
AddGoldenButtonLabeled(x, y, 4 + i,
string.Format(p.Count == 1 ? "Player {0}: {3}" : "Team {0}: {1}/{2}: {3}", 1 + i, p.FilledSlots, p.Count,
@ -63,14 +63,14 @@ namespace Server.Engines.ConPVP
public void AddGoldenButton(int x, int y, int bid)
{
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
AddButton(x, y, 0xD2, 0xD2, bid);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
}
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
{
AddGoldenButton(x, y, bid);
AddHtml(x + 25, y, 200, 20, text, false, false);
AddHtml(x + 25, y, 200, 20, text);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -129,11 +129,11 @@ namespace Server.Engines.ConPVP
index -= 4;
if (index >= 0 && index < Context.Participants.Count)
From.SendGump(new ParticipantGump(From, Context, (Participant)Context.Participants[index]));
From.SendGump(new ParticipantGump(From, Context, Context.Participants[index]));
break;
}
}
}
}
}
}

View file

@ -103,18 +103,18 @@ namespace Server.Engines.ConPVP
AddAlphaRegion(10, 10, 479, height - 20);
if (page > 0)
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1, GumpButtonType.Reply, 0);
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1);
else
AddImage(446, height - 12 - 2 - 16, 0x2626);
if ((page + 1) * 15 < lc)
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2);
else
AddImage(466, height - 12 - 2 - 16, 0x2622);
AddHtml(16, height - 12 - 2 - 18, 400, 20,
Color(string.Format("Top {3} of {0:N0} duelists, page {1} of {2}", m_List.Count, page + 1, (lc + 14) / 15, lc),
0xFFC000), false, false);
0xFFC000));
AddColumnHeader(75, "Rank");
AddColumnHeader(115, "Level");
@ -231,9 +231,9 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, string text, int color)
{
if (color == 0)
AddHtml(x, y, width, 20, text, false, false);
AddHtml(x, y, width, 20, text);
else
AddHtml(x, y, width, 20, Color(text, color), false, false);
AddHtml(x, y, width, 20, Color(text, color));
}
private void AddColumnHeader(int width, string name)
@ -245,4 +245,4 @@ namespace Server.Engines.ConPVP
m_ColumnX += width;
}
}
}
}

View file

@ -29,16 +29,16 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, height, 9250);
AddBackground(10, 10, 280, height - 20, 0xDAC);
AddButton(240, 25, 0xFB1, 0xFB3, 3, GumpButtonType.Reply, 0);
AddButton(240, 25, 0xFB1, 0xFB3, 3);
//AddButton( 223, 54, 0x265A, 0x265A, 4, GumpButtonType.Reply, 0 );
//AddButton( 223, 54, 0x265A, 0x265A, 4, );
AddHtml(35, 25, 230, 20, Center("Participant Setup"), false, false);
AddHtml(35, 25, 230, 20, Center("Participant Setup"));
int x = 35;
int y = 47;
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}", false, false);
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}");
y += 22;
AddGoldenButtonLabeled(x + 20, y, 1, "Increase");
@ -46,7 +46,7 @@ namespace Server.Engines.ConPVP
AddGoldenButtonLabeled(x + 20, y, 2, "Decrease");
y += 30;
AddHtml(35, y, 230, 20, Center("Players"), false, false);
AddHtml(35, y, 230, 20, Center("Players"));
y += 22;
for (int i = 0; i < p.Players.Length; ++i)
@ -71,14 +71,14 @@ namespace Server.Engines.ConPVP
public void AddGoldenButton(int x, int y, int bid)
{
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
AddButton(x, y, 0xD2, 0xD2, bid);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
}
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
{
AddGoldenButton(x, y, bid);
AddHtml(x + 25, y, 200, 20, text, false, false);
AddHtml(x + 25, y, 200, 20, text);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -250,4 +250,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 260, height, 9250);
AddBackground(10, 10, 240, height - 20, 0xDAC);
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
AddHtml(35, 25, 190, 20, Center("Rules"));
int y = 25 + 20;
@ -34,37 +34,37 @@ namespace Server.Engines.ConPVP
{
Ruleset cur = m_Defaults[i];
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
AddHtml(35 + 14, y, 176, 20, cur.Title);
if (ruleset.Base == cur && !ruleset.Changed)
AddImage(35, y + 4, 0x939);
else if (ruleset.Base == cur)
AddButton(35, y + 4, 0x93A, 0x939, 2 + i, GumpButtonType.Reply, 0);
AddButton(35, y + 4, 0x93A, 0x939, 2 + i);
else
AddButton(35, y + 4, 0x938, 0x939, 2 + i, GumpButtonType.Reply, 0);
AddButton(35, y + 4, 0x938, 0x939, 2 + i);
y += 22;
}
AddHtml(35 + 14, y, 176, 20, "Custom", false, false);
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1, GumpButtonType.Reply, 0);
AddHtml(35 + 14, y, 176, 20, "Custom");
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1);
y += 22;
y += 6;
AddHtml(35, y, 190, 20, Center("Flavors"), false, false);
AddHtml(35, y, 190, 20, Center("Flavors"));
y += 20;
for (int i = 0; i < m_Flavors.Length; ++i)
{
Ruleset cur = m_Flavors[i];
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
AddHtml(35 + 14, y, 176, 20, cur.Title);
if (ruleset.Flavors.Contains(cur))
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i);
else
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i);
y += 22;
}
@ -77,7 +77,7 @@ namespace Server.Engines.ConPVP
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Context != null && !m_Context.Registered)
if (m_Context?.Registered == false)
return;
switch (info.ButtonID)
@ -123,4 +123,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < parts.Count; ++i)
{
Participant p = (Participant)parts[i];
Participant p = parts[i];
height += 4;
@ -44,19 +44,19 @@ namespace Server.Engines.ConPVP
if (count == -1)
{
AddHtml(35, 25, 190, 20, Center("Ready"), false, false);
AddHtml(35, 25, 190, 20, Center("Ready"));
}
else
{
AddHtml(35, 25, 190, 20, Center("Starting"), false, false);
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count, false, false);
AddHtml(35, 25, 190, 20, Center("Starting"));
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count);
}
int y = 25 + 20;
for (int i = 0; i < parts.Count; ++i)
{
Participant p = (Participant)parts[i];
Participant p = parts[i];
y += 4;
@ -66,7 +66,7 @@ namespace Server.Engines.ConPVP
if (p.Players.Length > 1)
{
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}", false, false);
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}");
y += 22;
offset = 10;
}
@ -75,7 +75,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer pl = p.Players[j];
if (pl != null && pl.Ready)
if (pl?.Ready == true)
{
AddImage(35 + offset, y + 4, 0x939);
}
@ -87,7 +87,7 @@ namespace Server.Engines.ConPVP
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
AddHtml(35 + offset + 14, y, 166, 20, name, false, false);
AddHtml(35 + offset + 14, y, 166, 20, name);
y += 22;
}
@ -106,4 +106,4 @@ namespace Server.Engines.ConPVP
{
}
}
}
}

View file

@ -26,10 +26,10 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 210, height, 9250);
AddBackground(10, 10, 190, height - 20, 0xDAC);
AddHtml(35, 25, 140, 20, Center("Rematch?"), false, false);
AddHtml(35, 25, 140, 20, Center("Rematch?"));
AddButton(35, 55, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(115, 55, 242, 241, 2, GumpButtonType.Reply, 0);
AddButton(35, 55, 247, 248, 1);
AddButton(115, 55, 242, 241, 2);
}
else
{
@ -58,7 +58,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 260, height, 9250);
AddBackground(10, 10, 240, height - 20, 0xDAC);
AddHtml(35, 25, 190, 20, Center("Participants"), false, false);
AddHtml(35, 25, 190, 20, Center("Participants"));
int y = 20 + 25;
@ -72,7 +72,7 @@ namespace Server.Engines.ConPVP
if (p.Players.Length > 1)
{
AddHtml(35, y, 176, 20, $"Team #{i + 1}", false, false);
AddHtml(35, y, 176, 20, $"Team #{i + 1}");
y += 22;
offset = 10;
}
@ -83,7 +83,7 @@ namespace Server.Engines.ConPVP
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
AddHtml(35 + offset, y, 166, 20, name, false, false);
AddHtml(35 + offset, y, 166, 20, name);
y += 22;
}
@ -91,12 +91,12 @@ namespace Server.Engines.ConPVP
y += 8;
AddHtml(35, y, 176, 20, "Continue?", false, false);
AddHtml(35, y, 176, 20, "Continue?");
y -= 2;
AddButton(102, y, 247, 248, 0, GumpButtonType.Page, 2);
AddButton(169, y, 242, 241, 2, GumpButtonType.Reply, 0);
AddButton(169, y, 242, 241, 2);
#endregion
@ -118,7 +118,7 @@ namespace Server.Engines.ConPVP
defs = new BitArray(basedef.Options);
for (int i = 0; i < ruleset.Flavors.Count; ++i)
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
defs.Or(ruleset.Flavors[i].Options);
height += ruleset.Flavors.Count * 18;
}
@ -140,20 +140,20 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 260, height, 9250);
AddBackground(10, 10, 240, height - 20, 0xDAC);
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
AddHtml(35, 25, 190, 20, Center("Rules"));
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}", false, false);
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}");
y = 70;
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
y += 4;
if (changes > 0)
{
AddHtml(35, y, 190, 20, "Modifications:", false, false);
AddHtml(35, y, 190, 20, "Modifications:");
y += 20;
for (int i = 0; i < opts.Length; ++i)
@ -164,7 +164,7 @@ namespace Server.Engines.ConPVP
if (name != null) // sanity
{
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
AddHtml(60, y, 165, 22, name, false, false);
AddHtml(60, y, 165, 22, name);
}
y += 22;
@ -172,18 +172,18 @@ namespace Server.Engines.ConPVP
}
else
{
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
AddHtml(35, y, 190, 20, "Modifications: None");
y += 20;
}
y += 8;
AddHtml(35, y, 176, 20, "Continue?", false, false);
AddHtml(35, y, 176, 20, "Continue?");
y -= 2;
AddButton(102, y, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(169, y, 242, 241, 3, GumpButtonType.Reply, 0);
AddButton(102, y, 247, 248, 1);
AddButton(169, y, 242, 241, 3);
#endregion
}
@ -196,8 +196,8 @@ namespace Server.Engines.ConPVP
public void AddGoldenButton(int x, int y, int bid)
{
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
AddButton(x, y, 0xD2, 0xD2, bid);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -230,4 +230,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -45,7 +45,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 260, height, 9250);
AddBackground(10, 10, 240, height - 20, 0xDAC);
AddHtml(35, 25, 190, 20, Center(page.Title), false, false);
AddHtml(35, 25, 190, 20, Center(page.Title));
int x = 35;
int y = 47;
@ -53,7 +53,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < page.Children.Length; ++i)
{
AddGoldenButton(x, y, 1 + i);
AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false);
AddHtml(x + 25, y, 250, 22, page.Children[i].Title);
y += 22;
}
@ -67,7 +67,7 @@ namespace Server.Engines.ConPVP
else
AddCheck(x, y, 0xD2, 0xD3, enabled, i);
AddHtml(x + 25, y, 250, 22, page.Options[i], false, false);
AddHtml(x + 25, y, 250, 22, page.Options[i]);
y += 22;
}
@ -80,13 +80,13 @@ namespace Server.Engines.ConPVP
public void AddGoldenButton(int x, int y, int bid)
{
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
AddButton(x, y, 0xD2, 0xD2, bid);
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_DuelContext != null && !m_DuelContext.Registered)
if (m_DuelContext?.Registered == false)
return;
if (!m_ReadOnly)
@ -127,4 +127,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -19,7 +19,7 @@ namespace Server.Engines.ConPVP
Match_Info,
Player_Info
}
public class TournamentBracketGump : Gump
{
private const int BlackColor32 = 0x000008;
@ -86,7 +86,7 @@ namespace Server.Engines.ConPVP
sb.Append(" Tournament Bracket");
AddHtml(25, 35, 250, 20, Center(sb.ToString()), false, false);
AddHtml(25, 35, 250, 20, Center(sb.ToString()));
AddRightArrow(25, 53, ToButtonID(0, 4), "Rules");
AddRightArrow(25, 71, ToButtonID(0, 1), "Participants");
@ -117,7 +117,7 @@ namespace Server.Engines.ConPVP
text = "The tournament will begin shortly.";
}
AddHtml(25, 92, 250, 40, text, false, false);
AddHtml(25, 92, 250, 40, text);
}
else
{
@ -138,7 +138,7 @@ namespace Server.Engines.ConPVP
defs = new BitArray(basedef.Options);
for (int i = 0; i < ruleset.Flavors.Count; ++i)
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
defs.Or(ruleset.Flavors[i].Options);
}
else
{
@ -158,7 +158,7 @@ namespace Server.Engines.ConPVP
60 + 18 + 20 + 20 + 20 + 8 + 20 + ruleset.Flavors.Count * 18 + 4 + 20 + changes * 22 + 6, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 0));
AddHtml(25, 35, 250, 20, Center("Rules"), false, false);
AddHtml(25, 35, 250, 20, Center("Rules"));
int y = 53;
@ -177,7 +177,7 @@ namespace Server.Engines.ConPVP
break;
}
AddHtml(35, y, 190, 20, $"Grouping: {groupText}", false, false);
AddHtml(35, y, 190, 20, $"Grouping: {groupText}");
y += 20;
string tieText = null;
@ -201,7 +201,7 @@ namespace Server.Engines.ConPVP
break;
}
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}", false, false);
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}");
y += 20;
string sdText = "Off";
@ -216,22 +216,22 @@ namespace Server.Engines.ConPVP
sdText = $"{sdText} (all rounds)";
}
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}", false, false);
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}");
y += 20;
y += 8;
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}", false, false);
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}");
y += 20;
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
y += 4;
if (changes > 0)
{
AddHtml(35, y, 190, 20, "Modifications:", false, false);
AddHtml(35, y, 190, 20, "Modifications:");
y += 20;
for (int i = 0; i < opts.Length; ++i)
@ -242,7 +242,7 @@ namespace Server.Engines.ConPVP
if (name != null) // sanity
{
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
AddHtml(60, y, 165, 22, name, false, false);
AddHtml(60, y, 165, 22, name);
}
y += 22;
@ -250,7 +250,7 @@ namespace Server.Engines.ConPVP
}
else
{
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
AddHtml(35, y, 190, 20, "Modifications: None");
}
break;
@ -265,8 +265,7 @@ namespace Server.Engines.ConPVP
: new List<TourneyParticipant>(tourney.Participants);
AddLeftArrow(25, 11, ToButtonID(0, 0));
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"), false,
false);
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"));
StartPage(out int index, out int count, out int y, 12);
@ -293,11 +292,11 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 60 + 18 + 20 + part.Players.Count * 18 + 20 + 20 + 160, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 1));
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
AddHtml(25, 35, 250, 20, Center("Participants"));
int y = 53;
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team", false, false);
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team");
y += 20;
for (int i = 0; i < part.Players.Count; ++i)
@ -314,10 +313,10 @@ namespace Server.Engines.ConPVP
}
AddHtml(25, y, 200, 20,
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}", false, false);
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}");
y += 20;
AddHtml(25, y, 200, 20, "Log:", false, false);
AddHtml(25, y, 200, 20, "Log:");
y += 20;
StringBuilder sb = new StringBuilder();
@ -343,7 +342,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 3));
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
AddHtml(25, 35, 250, 20, Center("Participants"));
if (!(obj is Mobile mob))
break;
@ -351,16 +350,13 @@ namespace Server.Engines.ConPVP
Ladder ladder = Ladder.Instance;
LadderEntry entry = ladder?.Find(mob);
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}", false, false);
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}");
AddHtml(25, 73, 250, 20,
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}",
false, false);
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}", false,
false);
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}", false,
false);
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}", false, false);
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}", false, false);
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}");
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}");
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}");
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}");
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}");
break;
}
@ -370,7 +366,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 0));
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
AddHtml(25, 35, 250, 20, Center("Rounds"));
// List<PyramidLevel> levelsList = m_List != null
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
@ -389,11 +385,11 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 2));
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
AddHtml(25, 35, 250, 20, Center("Rounds"));
if (!(m_Object is PyramidLevel level))
break;
List<TourneyMatch> matchesList = m_List != null
? Utility.CastListCovariant<object, TourneyMatch>(m_List)
: new List<TourneyMatch>(level.Matches);
@ -401,7 +397,7 @@ namespace Server.Engines.ConPVP
AddRightArrow(25, 53, ToButtonID(5, 0),
$"Free Advance: {(level.FreeAdvance == null ? "None" : level.FreeAdvance.NameList)}");
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}", false, false);
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}");
StartPage(out int index, out int count, out int y, 10);
@ -529,14 +525,12 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 60 + 18 + 20 + 20 + 20 + ct * 18 + 6, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 5));
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
AddHtml(25, 35, 250, 20, Center("Rounds"));
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}", false,
false);
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}");
AddHtml(25, 73, 250, 20,
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}",
false, false);
AddHtml(25, 93, 250, 20, "Participants:", false, false);
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}");
AddHtml(25, 93, 250, 20, "Participants:");
if (m_Tournament.TourneyType == TourneyType.Standard)
for (int i = 0; i < match.Participants.Count; ++i)
@ -613,7 +607,7 @@ namespace Server.Engines.ConPVP
}
}
else if (m_Tournament.TourneyType == TourneyType.FreeForAll)
AddHtml(25, 113, 250, 20, "Free For All", false, false);
AddHtml(25, 113, 250, 20, "Free For All");
break;
}
@ -642,17 +636,17 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
AddHtml(x, y, width, height, text, false, false);
AddHtml(x, y, width, height, text);
else
AddHtml(x, y, width, height, Color(text, color), false, false);
AddHtml(x, y, width, height, Color(text, color));
}
public void AddRightArrow(int x, int y, int bid, string text)
{
AddButton(x, y, 0x15E1, 0x15E5, bid, GumpButtonType.Reply, 0);
AddButton(x, y, 0x15E1, 0x15E5, bid);
if (text != null)
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
AddHtml(x + 20, y - 1, 230, 20, text);
}
public void AddRightArrow(int x, int y, int bid)
@ -662,10 +656,10 @@ namespace Server.Engines.ConPVP
public void AddLeftArrow(int x, int y, int bid, string text)
{
AddButton(x, y, 0x15E3, 0x15E7, bid, GumpButtonType.Reply, 0);
AddButton(x, y, 0x15E3, 0x15E7, bid);
if (text != null)
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
AddHtml(x + 20, y - 1, 230, 20, text);
}
public void AddLeftArrow(int x, int y, int bid)
@ -859,4 +853,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -52,7 +52,7 @@ namespace Server.Engines.ConPVP
get
{
for (int i = 0; i < Players.Length; ++i)
if (Players[i] != null && !Players[i].Eliminated)
if (Players[i]?.Eliminated == false)
return false;
return true;
@ -96,7 +96,7 @@ namespace Server.Engines.ConPVP
}
for (int i = 0; i < Players.Length; ++i)
if (Players[i] != null && Players[i].Mobile == mob)
if (Players[i]?.Mobile == mob)
return Players[i];
return null;
@ -228,4 +228,4 @@ namespace Server.Engines.ConPVP
public Participant Participant{ get; set; }
}
}
}

View file

@ -198,8 +198,8 @@ namespace Server.Engines.ConPVP
AddColumnHeader(35, null);
AddColumnHeader(115, "Arena");
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2);
for (int i = 0; i < arenas.Count; ++i)
{
@ -258,9 +258,9 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, string text, int color)
{
if (color == 0)
AddHtml(x, y, width, 20, text, false, false);
AddHtml(x, y, width, 20, text);
else
AddHtml(x, y, width, 20, Color(text, color), false, false);
AddHtml(x, y, width, 20, Color(text, color));
}
private void AddColumnHeader(int width, string name)

View file

@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
{
if (m_Root != null)
return m_Root;
List<RulesetLayout> entries = new List<RulesetLayout>
{
new RulesetLayout("Spells",
@ -761,4 +761,4 @@ namespace Server.Engines.ConPVP
return TotalLength;
}
}
}
}

View file

@ -21,10 +21,7 @@ namespace Server.Engines.ConPVP
public override bool AllowHousing(Mobile from, Point3D p)
{
if (from.AccessLevel < AccessLevel.GameMaster)
return false;
return base.AllowHousing(from, p);
return from.AccessLevel >= AccessLevel.GameMaster && base.AllowHousing(from, p);
}
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
@ -35,12 +32,11 @@ namespace Server.Engines.ConPVP
return false;
}
PlayerMobile pm = m as PlayerMobile;
PlayerMobile pm = m as PlayerMobile ??
(m is BaseCreature bc && bc.Summoned ?
bc.SummonMaster as PlayerMobile : null);
if (pm == null && m is BaseCreature bc && bc.Summoned)
pm = bc.SummonMaster as PlayerMobile;
if (pm?.DuelContext != null && pm.DuelContext.StartedBeginCountdown)
if (pm?.DuelContext?.StartedBeginCountdown == true)
return true;
if (DuelContext.CheckCombat(m))
@ -67,4 +63,4 @@ namespace Server.Engines.ConPVP
return false;
}
}
}
}

View file

@ -247,7 +247,7 @@ namespace Server.Engines.ConPVP
sb.Append(remaining.Count == 2 ? "between " : "among ");
sb.Append(remaining.Count);
sb.Append(remaining[0].Players.Count == 1 ? " players: " : " teams: ");
bool hasAppended = false;
@ -370,9 +370,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < part.Context.Participants.Count; ++i)
{
Participant check = part.Context.Participants[i];
if (check != null && !check.Eliminated)
if (part.Context.Participants[i]?.Eliminated == false)
++rem;
}
@ -559,7 +557,7 @@ namespace Server.Engines.ConPVP
{
Mobile mob = players[i];
if (mob == null || mob.Deleted)
if (mob?.Deleted != false)
continue;
Item item = new Trophy(title, rank);
@ -762,7 +760,7 @@ namespace Server.Engines.ConPVP
if (!match.InProgress)
for (int j = 0; j < Arenas.Count; ++j)
{
Arena arena = (Arena)Arenas[j];
Arena arena = Arenas[j];
if (!arena.IsOccupied)
{
@ -794,7 +792,7 @@ namespace Server.Engines.ConPVP
if (!bad)
continue;
for (int j = 0; j < part.Players.Count; ++j)
part.Players[j].SendMessage("You have been disqualified from the tournament.");
@ -882,7 +880,7 @@ namespace Server.Engines.ConPVP
Undefeated.Clear();
break;
}
}
if (Undefeated.Count > 1)
@ -895,7 +893,7 @@ namespace Server.Engines.ConPVP
public void Alert(params string[] alerts)
{
for (int i = 0; i < Arenas.Count; ++i)
Alert((Arena)Arenas[i], alerts);
Alert(Arenas[i], alerts);
}
public void Alert(Arena arena, params string[] alerts)
@ -909,4 +907,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -34,7 +34,7 @@ namespace Server.Engines.ConPVP
{
TournamentController controller = m_Instances[i];
if (controller != null && !controller.Deleted && controller.Tournament != null &&
if (controller?.Deleted == false && controller.Tournament != null &&
controller.Tournament.Stage != TournamentStage.Inactive)
return true;
}
@ -140,4 +140,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -70,7 +70,8 @@ namespace Server.Engines.ConPVP
{
Faction fac = Faction.Find(mob);
if (fac != null) index = fac.Definition.Sort;
if (fac != null)
index = fac.Definition.Sort;
}
else if (partsPerMatch == 2)
{
@ -186,4 +187,4 @@ namespace Server.Engines.ConPVP
public List<TourneyMatch> Matches{ get; set; } = new List<TourneyMatch>();
public TourneyParticipant FreeAdvance{ get; set; }
}
}
}

View file

@ -17,16 +17,7 @@ namespace Server.Engines.Craft
private CraftPage m_Page;
private BaseTool m_Tool;
/*public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool ): this( from, craftSystem, -1, -1, tool, null )
{
}*/
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice) : this(from, craftSystem, tool,
notice, CraftPage.None)
{
}
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40)
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page = CraftPage.None) : base(40, 40)
{
m_From = from;
m_CraftSystem = craftSystem;
@ -50,57 +41,56 @@ namespace Server.Engines.Craft
AddAlphaRegion(10, 10, 510, 417);
if (craftSystem.GumpTitleNumber > 0)
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
else
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER>
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER>
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER>
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor); // <CENTER>CATEGORIES</CENTER>
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor); // <CENTER>SELECTIONS</CENTER>
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor); // <CENTER>NOTICES</CENTER>
AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false); // EXIT
AddButton(15, 402, 4017, 4019, 0);
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor); // EXIT
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0);
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2));
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor); // MAKE LAST
// Mark option
if (craftSystem.MarkOption)
{
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0);
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor,
false, false); // MARK ITEM
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6));
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor); // MARK ITEM
}
// ****************************************
// Resmelt option
if (craftSystem.Resmelt)
{
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1));
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor); // SMELT ITEM
}
// ****************************************
// Repair option
if (craftSystem.Repair)
{
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0);
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5));
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor); // REPAIR ITEM
}
// ****************************************
// Enhance option
if (craftSystem.CanEnhance)
{
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0);
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8));
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor); // ENHANCE ITEM
}
// ****************************************
if (notice is int noticeInt && noticeInt > 0)
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor, false, false);
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor);
else if (notice is string)
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>", false, false);
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>");
// If the system has more than one resource
if (craftSystem.CraftSubRes.Init)
@ -131,10 +121,10 @@ namespace Server.Engines.Craft
resourceCount += items[i].Amount;
}
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0);
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0));
if (nameNumber > 0)
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
else
AddLabel(50, 362, LabelHue, $"{nameString} ({resourceCount} Available)");
}
@ -169,10 +159,10 @@ namespace Server.Engines.Craft
resourceCount += items[i].Amount;
}
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0);
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7));
if (nameNumber > 0)
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
else
AddLabel(50, 385, LabelHue, $"{nameString} ({resourceCount} Available)");
}
@ -184,7 +174,7 @@ namespace Server.Engines.Craft
CreateResList(false, from);
else if (page == CraftPage.PickResource2)
CreateResList(true, from);
else if (context != null && context.LastGroupIndex > -1)
else if (context?.LastGroupIndex > -1)
CreateItemList(context.LastGroupIndex);
}
@ -210,9 +200,9 @@ namespace Server.Engines.Craft
CraftContext context = m_CraftSystem.GetContext(m_From);
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0);
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4));
AddHtmlLocalized(255, 263, 200, 18, context == null || !context.DoNotColor ? 1061591 : 1061590,
LabelColor, false, false);
LabelColor);
}
int resourceCount = 0;
@ -225,11 +215,11 @@ namespace Server.Engines.Craft
resourceCount += items[j].Amount;
}
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0);
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i));
if (subResource.NameNumber > 0)
AddHtmlLocalized(255, 63 + index * 20, 250, 18, subResource.NameNumber, resourceCount.ToString(),
LabelColor, false, false);
LabelColor);
else
AddLabel(255, 60 + index * 20, LabelHue, $"{subResource.NameString} ({resourceCount})");
}
@ -256,7 +246,7 @@ namespace Server.Engines.Craft
if (i > 0)
{
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
}
AddPage(i / 10 + 1);
@ -264,21 +254,21 @@ namespace Server.Engines.Craft
if (i > 0)
{
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
}
}
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i), GumpButtonType.Reply, 0);
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i));
if (craftItem.NameNumber > 0)
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
else
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i), GumpButtonType.Reply, 0);
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i));
}
else
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor, false, false); // You haven't made anything yet.
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor); // You haven't made anything yet.
}
public void CreateItemList(int selectedGroup)
@ -304,7 +294,7 @@ namespace Server.Engines.Craft
if (i > 0)
{
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
}
AddPage(i / 10 + 1);
@ -312,18 +302,18 @@ namespace Server.Engines.Craft
if (i > 0)
{
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
}
}
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i));
if (craftItem.NameNumber > 0)
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
else
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i));
}
}
@ -331,17 +321,17 @@ namespace Server.Engines.Craft
{
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3), GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor, false, false); // LAST TEN
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3));
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor); // LAST TEN
for (int i = 0; i < craftGroupCol.Count; i++)
{
CraftGroup craftGroup = craftGroupCol.GetAt(i);
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i), GumpButtonType.Reply, 0);
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i));
if (craftGroup.NameNumber > 0)
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor, false, false);
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor);
else
AddLabel(50, 80 + i * 20, LabelHue, craftGroup.NameString);
}
@ -608,11 +598,11 @@ namespace Server.Engines.Craft
}
}
private enum CraftPage
public enum CraftPage
{
None,
PickResource,
PickResource2
}
}
}
}

View file

@ -53,41 +53,40 @@ namespace Server.Engines.Craft
AddImageTiled(10, 387, 510, 22, 2624);
AddAlphaRegion(10, 10, 510, 399);
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor, false, false); // ITEM
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor, false, false); // <CENTER>SKILLS</CENTER>
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER>
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor, false, false); // <CENTER>OTHER</CENTER>
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor); // ITEM
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor); // <CENTER>SKILLS</CENTER>
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor); // <CENTER>MATERIALS</CENTER>
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor); // <CENTER>OTHER</CENTER>
if (craftSystem.GumpTitleNumber > 0)
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
else
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor, false, false); // BACK
AddButton(15, 387, 4014, 4016, 0);
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor); // BACK
bool needsRecipe = craftItem.Recipe != null && from is PlayerMobile mobile &&
!mobile.HasRecipe(craftItem.Recipe);
if (needsRecipe)
{
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0);
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor, false, false); // MAKE NOW
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page);
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor); // MAKE NOW
}
else
{
AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor, false, false); // MAKE NOW
AddButton(270, 387, 4005, 4007, 1);
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor); // MAKE NOW
}
if (craftItem.NameNumber > 0)
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false);
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor);
else
AddLabel(330, 40, LabelHue, craftItem.NameString);
if (craftItem.UseAllRes)
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor, false,
false); // Makes as many as possible at once
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor); // Makes as many as possible at once
DrawItem();
DrawSkill();
@ -100,15 +99,14 @@ namespace Server.Engines.Craft
if (craftItem.RequiredExpansion != Expansion.None)
{
bool supportsEx = from.NetState != null && from.NetState.SupportsExpansion(craftItem.RequiredExpansion);
bool supportsEx = from.NetState?.SupportsExpansion(craftItem.RequiredExpansion) == true;
TextDefinition.AddHtmlText(this, 170, 302 + m_OtherCount++ * 20, 310, 18,
RequiredExpansionMessage(craftItem.RequiredExpansion), false, false,
supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue);
}
if (needsRecipe)
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor, false,
false); // You have not learned this recipe.
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor); // You have not learned this recipe.
}
private TextDefinition RequiredExpansionMessage(Expansion expansion)
@ -132,8 +130,7 @@ namespace Server.Engines.Craft
if (m_CraftItem.IsMarkable(type))
{
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor, false,
false); // This item may hold its maker's mark
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor); // This item may hold its maker's mark
m_ShowExceptionalChance = true;
}
}
@ -148,8 +145,7 @@ namespace Server.Engines.Craft
if (minSkill < 0)
minSkill = 0;
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false,
false);
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor);
AddLabel(430, 132 + i * 20, LabelHue, $"{minSkill:F1}");
}
@ -171,7 +167,7 @@ namespace Server.Engines.Craft
else if (chance > 1.0)
chance = 1.0;
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false); // Success Chance:
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor); // Success Chance:
AddLabel(430, 80, LabelHue, $"{chance * 100:F1}%");
if (m_ShowExceptionalChance)
@ -181,7 +177,7 @@ namespace Server.Engines.Craft
else if (excepChance > 1.0)
excepChance = 1.0;
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false); // Exceptional Chance:
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767); // Exceptional Chance:
AddLabel(430, 100, LabelHue, $"{excepChance * 100:F1}%");
}
}
@ -232,13 +228,12 @@ namespace Server.Engines.Craft
if (!retainedColor && m_CraftItem.RetainsColorFrom(m_CraftSystem, type))
{
retainedColor = true;
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor, false,
false); // * The item retains the color of this material
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor); // * The item retains the color of this material
AddLabel(500, 219 + i * 20, LabelHue, "*");
}
if (nameNumber > 0)
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor, false, false);
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor);
else
AddLabel(170, 219 + i * 20, LabelHue, nameString);
@ -247,13 +242,12 @@ namespace Server.Engines.Craft
if (m_CraftItem.NameNumber == 1041267) // runebook
{
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor, false, false);
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor);
AddLabel(430, 219 + m_CraftItem.Resources.Count * 20, LabelHue, "1");
}
if (cropScroll)
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor, false,
false); // Inscribing scrolls also requires a blank scroll and mana.
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor); // Inscribing scrolls also requires a blank scroll and mana.
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -292,4 +286,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Commands;
using Server.Factions;
using Server.Items;
@ -273,16 +274,12 @@ namespace Server.Engines.Craft
return false;
IPooledEnumerable<Item> eable = map.GetItemsInRange(from.Location, 2);
foreach (Item item in eable)
if (item.Z + 16 > from.Z && from.Z + 16 > item.Z && Find(item.ItemID, itemIDs))
{
eable.Free();
return true;
}
bool found = eable.Any(item => item.Z + 16 > item.Z && item.Z + 16 > item.Z && Find(item.ItemID, itemIDs));
eable.Free();
if (found)
return true;
for (int x = -2; x <= 2; ++x)
for (int y = -2; y <= 2; ++y)
{
@ -758,7 +755,7 @@ namespace Server.Engines.Craft
if (from.BeginAction<CraftSystem>())
{
if (RequiredExpansion == Expansion.None ||
from.NetState != null && from.NetState.SupportsExpansion(RequiredExpansion))
from.NetState?.SupportsExpansion(RequiredExpansion) == true)
{
bool allRequiredSkills = true;
double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
@ -860,7 +857,7 @@ namespace Server.Engines.Craft
if (badCraft > 0)
{
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
if (tool?.Deleted == false && tool.UsesRemaining > 0)
from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
else
from.SendLocalizedMessage(badCraft);
@ -876,7 +873,7 @@ namespace Server.Engines.Craft
ref checkMessage)
&& ConsumeAttributes(from, ref checkMessage, false)))
{
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
if (tool?.Deleted == false && tool.UsesRemaining > 0)
from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
else if (checkMessage is int messageInt && messageInt > 0)
from.SendLocalizedMessage(messageInt);
@ -905,7 +902,7 @@ namespace Server.Engines.Craft
if (!(ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)
&& ConsumeAttributes(from, ref message, true)))
{
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
if (tool?.Deleted == false && tool.UsesRemaining > 0)
from.SendGump(new CraftGump(from, craftSystem, tool, message));
else if (message is int messageIn && messageIn > 0)
from.SendLocalizedMessage(messageIn);
@ -992,7 +989,7 @@ namespace Server.Engines.Craft
{
Town town = Town.FromRegion(from.Region);
if (town != null && town.Owner == faction)
if (town?.Owner == faction)
{
Container pack = from.Backpack;
@ -1013,14 +1010,14 @@ namespace Server.Engines.Craft
if (queryFactionImbue)
from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction,
def));
else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
else if (tool?.Deleted == false && tool.UsesRemaining > 0)
from.SendGump(new CraftGump(from, craftSystem, tool, num));
else if (num > 0)
from.SendLocalizedMessage(num);
}
else if (!allRequiredSkills)
{
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
if (tool?.Deleted == false && tool.UsesRemaining > 0)
from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
else
from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
@ -1036,7 +1033,7 @@ namespace Server.Engines.Craft
// Not enough resource to craft it
if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true))
{
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
if (tool?.Deleted == false && tool.UsesRemaining > 0)
from.SendGump(new CraftGump(from, craftSystem, tool, message));
else if (message is int messageInt && messageInt > 0)
from.SendLocalizedMessage(messageInt);
@ -1104,7 +1101,7 @@ namespace Server.Engines.Craft
if (badCraft > 0)
{
if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft));
else
m_From.SendLocalizedMessage(badCraft);

View file

@ -4,14 +4,11 @@ namespace Server.Engines.Craft
{
public class CraftRes
{
public CraftRes(Type type, int amount)
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message = null)
{
ItemType = type;
Amount = amount;
}
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message) : this(type, amount)
{
NameNumber = name;
MessageNumber = message;
@ -41,4 +38,4 @@ namespace Server.Engines.Craft
from.SendLocalizedMessage(502925); // You don't have the resources required to make that item.
}
}
}
}

View file

@ -31,4 +31,4 @@ namespace Server.Engines.Craft
public double RequiredSkill{ get; }
}
}
}

View file

@ -31,13 +31,13 @@ namespace Server.Engines.Craft
AddBackground(0, 0, 220, 170, 5054);
AddBackground(10, 10, 200, 150, 3000);
AddHtmlLocalized(20, 20, 180, 80, 1018317, false, false); // Do you wish to place your maker's mark on this item?
AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false); // CONTINUE
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
AddButton(20, 100, 4005, 4007, 1);
AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL
AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
AddButton(20, 125, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -52,4 +52,4 @@ namespace Server.Engines.Craft
m_CraftItem.CompleteCraft(m_Quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
}
}
}
}

View file

@ -34,16 +34,7 @@ namespace Server.Engines.Craft
public int ID{ get; }
public TextDefinition TextDefinition
{
get
{
if (m_TD == null)
m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString);
return m_TD;
}
}
public TextDefinition TextDefinition => m_TD ?? (m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString));
public static void Initialize()
{

View file

@ -117,6 +117,7 @@ namespace Server.Engines.Craft
}
catch
{
// ignored
}
return SmeltResult.Invalid;

View file

@ -17,16 +17,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044001;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefAlchemy();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefAlchemy());
public override double GetChanceAtMin(CraftItem item)
{
@ -35,8 +26,9 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -180,4 +172,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -30,16 +30,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044002;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefBlacksmithy();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBlacksmithy());
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
@ -111,7 +102,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckTool(tool, from))
return 1048146; // If you have a tool equipped, you must use that tool.
@ -801,4 +792,4 @@ namespace Server.Engines.Craft
public class AnvilAttribute : Attribute
{
}
}
}

View file

@ -15,16 +15,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044006;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefBowFletching();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBowFletching());
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -212,4 +203,4 @@ namespace Server.Engines.Craft
Repair = Core.AOS;
}
}
}
}

View file

@ -15,16 +15,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044004;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefCarpentry();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCarpentry());
public override double GetChanceAtMin(CraftItem item)
{
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -545,4 +536,4 @@ namespace Server.Engines.Craft
AddSubRes(typeof(FrostwoodLog), 1072649, 100.0, 1044041, 1072652);
}
}
}
}

View file

@ -15,16 +15,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044008;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefCartography();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCartography());
public override double GetChanceAtMin(CraftItem item)
{
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -76,4 +67,4 @@ namespace Server.Engines.Craft
AddCraft(typeof(WorldMap), 1044448, 1015233, 39.5, 99.5, typeof(BlankMap), 1044449, 1, 1044450);
}
}
}
}

View file

@ -15,16 +15,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044003;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefCooking();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCooking());
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -292,4 +283,4 @@ namespace Server.Engines.Craft
/* End Chocolatiering */
}
}
}
}

View file

@ -16,28 +16,16 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044622;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefGlassblowing();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefGlassblowing());
public override double GetChanceAtMin(CraftItem item)
{
if (item.ItemType == typeof(HollowPrism))
return 0.5; // 50%
return 0.0; // 0%
return item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
}
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckTool(tool, from))
return 1048146; // If you have a tool equipped, you must use that tool.
@ -48,10 +36,7 @@ namespace Server.Engines.Craft
DefBlacksmithy.CheckAnvilAndForge(from, 2, out _, out bool forge);
if (forge)
return 0;
return 1044628; // You must be near a forge to blow glass.
return forge ? 0 : 1044628; // You must be near a forge to blow glass.
}
public override void PlayCraftEffect(Mobile from)
@ -128,4 +113,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -36,16 +36,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044009;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefInscription();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefInscription());
public override double GetChanceAtMin(CraftItem item)
{
@ -54,7 +45,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -65,9 +56,7 @@ namespace Server.Engines.Craft
if (o is SpellScroll scroll)
{
Spellbook book = Spellbook.Find(from, scroll.SpellID);
bool hasSpell = book != null && book.HasSpell(scroll.SpellID);
bool hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;
scroll.Delete();
@ -121,7 +110,6 @@ namespace Server.Engines.Craft
switch (m_Circle)
{
default:
case 0:
minSkill = -25.0;
maxSkill = 25.0;
break;
@ -409,4 +397,4 @@ namespace Server.Engines.Craft
SpidersSilk
}
}
}
}

View file

@ -16,16 +16,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044500;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefMasonry();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefMasonry());
public override double GetChanceAtMin(CraftItem item)
{
@ -39,7 +30,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckTool(tool, from))
return 1048146; // If you have a tool equipped, you must use that tool.
@ -139,4 +130,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -23,16 +23,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044005;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefTailoring();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefTailoring());
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
@ -43,7 +34,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -427,4 +418,4 @@ namespace Server.Engines.Craft
CanEnhance = Core.AOS;
}
}
}
}

View file

@ -31,16 +31,7 @@ namespace Server.Engines.Craft
public override int GumpTitleNumber => 1044007;
public static CraftSystem CraftSystem
{
get
{
if (m_CraftSystem == null)
m_CraftSystem = new DefTinkering();
return m_CraftSystem;
}
}
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefTinkering());
public override double GetChanceAtMin(CraftItem item)
{
@ -52,7 +43,7 @@ namespace Server.Engines.Craft
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
if (tool?.Deleted != false || tool.UsesRemaining < 0)
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
@ -507,7 +498,7 @@ namespace Server.Engines.Craft
Mobile from = m_TrapCraft.From;
BaseTool tool = m_TrapCraft.Tool;
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
if (tool?.Deleted == false && tool.UsesRemaining > 0)
from.SendGump(new CraftGump(from, m_TrapCraft.CraftSystem, tool, message));
else if (message > 0)
from.SendLocalizedMessage(message);
@ -547,4 +538,4 @@ namespace Server.Engines.Craft
public override TrapType TrapType => TrapType.ExplosionTrap;
}
}
}

View file

@ -27,12 +27,7 @@ namespace Server.Engines.Doom
private Timer m_Timer;
[Constructible]
public GauntletSpawner() : this(null)
{
}
[Constructible]
public GauntletSpawner(string typeName) : base(0x36FE)
public GauntletSpawner(string typeName = null) : base(0x36FE)
{
Visible = false;
Movable = false;
@ -334,7 +329,7 @@ namespace Server.Engines.Doom
{
State = GauntletSpawnerState.InSequence;
if (Sequence != null && !Sequence.Deleted)
if (Sequence?.Deleted == false)
Sequence.RecurseReset();
}
}
@ -353,7 +348,7 @@ namespace Server.Engines.Doom
{
State = GauntletSpawnerState.Completed;
if (Sequence != null && !Sequence.Deleted)
if (Sequence?.Deleted == false)
{
if (Sequence.State == GauntletSpawnerState.Completed)
RecurseReset();
@ -428,7 +423,7 @@ namespace Server.Engines.Doom
public static void CreateTeleporter(int xFrom, int yFrom, int xTo, int yTo)
{
Static telePad = new Static(0x1822);
Teleporter teleItem = new Teleporter(new Point3D(xTo, yTo, -1), Map.Malas, false);
Teleporter teleItem = new Teleporter(new Point3D(xTo, yTo, -1), Map.Malas);
telePad.Hue = 0x482;
telePad.MoveToWorld(new Point3D(xFrom, yFrom, -1), Map.Malas);
@ -652,4 +647,4 @@ namespace Server.Engines.Doom
{
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Commands;
using Server.Mobiles;
using Server.Network;
@ -181,12 +182,11 @@ namespace Server.Engines.Doom
[Description("Generates lamp room and lever puzzle in doom.")]
public static void GenLampPuzzle_OnCommand(CommandEventArgs e)
{
foreach (Item item in Map.Malas.GetItemsInRange(lp_Center, 0))
if (item is LeverPuzzleController)
{
e.Mobile.SendMessage("Lamp room puzzle already exists: please delete the existing controller first ...");
return;
}
if (Map.Malas.GetItemsInRange(lp_Center, 0).OfType<LeverPuzzleController>().Any())
{
e.Mobile.SendMessage("Lamp room puzzle already exists: please delete the existing controller first ...");
return;
}
e.Mobile.SendMessage("Generating Lamp Room puzzle...");
new LeverPuzzleController().MoveToWorld(lp_Center, Map.Malas);
@ -199,10 +199,11 @@ namespace Server.Engines.Doom
public static Item AddLeverPuzzlePart(int[] Loc, Item newitem)
{
if (newitem == null || newitem.Deleted)
if (newitem?.Deleted != false)
installed = false;
else
newitem.MoveToWorld(new Point3D(Loc[0], Loc[1], Loc[2]), Map.Malas);
return newitem;
}
@ -220,16 +221,17 @@ namespace Server.Engines.Doom
m_LampRoom?.Unregister();
if (m_Tiles != null)
foreach (Region region in m_Tiles)
foreach (LeverPuzzleRegion region in m_Tiles)
region.Unregister();
if (m_Box != null && !m_Box.Deleted) m_Box.Delete();
if (m_Box?.Deleted == false)
m_Box.Delete();
}
public static void NukeItemList(List<Item> list)
{
if (list != null && list.Count != 0)
if (list?.Count > 0)
foreach (Item item in list)
if (item != null && !item.Deleted)
if (item?.Deleted == false)
item.Delete();
}
@ -244,31 +246,29 @@ namespace Server.Engines.Doom
public virtual LeverPuzzleStatue GetStatue(int index)
{
LeverPuzzleStatue statue = (LeverPuzzleStatue)m_Statues[index];
if (statue != null && !statue.Deleted) return statue;
return null;
return statue?.Deleted == false ? statue : null;
}
public virtual LeverPuzzleLever GetLever(int index)
{
LeverPuzzleLever lever = (LeverPuzzleLever)m_Levers[index];
if (lever != null && !lever.Deleted) return lever;
return null;
return lever?.Deleted == false ? lever : null;
}
public virtual void PuzzleStatus(int message, string fstring)
public virtual void PuzzleStatus(int message, string fstring = null)
{
for (int i = 0; i < 2; i++)
{
Item s;
if ((s = GetStatue(i)) != null) s.PublicOverheadMessage(MessageType.Regular, 0x3B2, message, fstring);
if ((s = GetStatue(i)) != null)
s.PublicOverheadMessage(MessageType.Regular, 0x3B2, message, fstring);
}
}
public virtual void ResetPuzzle()
{
PuzzleStatus(1062053, null);
PuzzleStatus(1062053);
ResetLevers();
}
@ -289,8 +289,8 @@ namespace Server.Engines.Doom
public virtual void KillTimers()
{
if (l_Timer != null && l_Timer.Running) l_Timer.Stop();
if (m_Timer != null && m_Timer.Running) m_Timer.Stop();
if (l_Timer?.Running == true) l_Timer.Stop();
if (m_Timer?.Running == true) m_Timer.Stop();
}
public virtual void RemoveSuccessful()
@ -300,8 +300,7 @@ namespace Server.Engines.Doom
public virtual void LeverPulled(ushort code)
{
int Correct = 0;
Mobile m_Player;
int correct = 0;
KillTimers();
@ -315,20 +314,21 @@ namespace Server.Engines.Doom
if (!CircleComplete)
{
PuzzleStatus(1050004, null); // The circle is the key...
PuzzleStatus(1050004); // The circle is the key...
}
else
{
Mobile player;
if (TheirKey == MyKey)
{
GenKey();
if ((Successful = m_Player = GetOccupant(0)) != null)
if ((Successful = player = GetOccupant(0)) != null)
{
SendLocationEffect(lp_Center, 0x1153, 0, 60, 1);
PlaySounds(lp_Center, cs1);
Effects.SendBoltEffect(m_Player, true);
m_Player.MoveToWorld(lr_Enter, Map.Malas);
Effects.SendBoltEffect(player, true);
player.MoveToWorld(lr_Enter, Map.Malas);
m_Timer = new LampRoomTimer(this);
m_Timer.Start();
@ -339,16 +339,13 @@ namespace Server.Engines.Doom
{
for (int i = 0; i < 16; i++) /* Count matching SET bits, ie correct codes */
if (((MyKey >> i) & 1) == 1 && ((TheirKey >> i) & 1) == 1)
Correct++;
correct++;
PuzzleStatus(Statue_Msg[Correct], Correct > 0 ? Correct.ToString() : null);
PuzzleStatus(Statue_Msg[correct], correct > 0 ? correct.ToString() : null);
for (int i = 0; i < 5; i++)
if ((m_Player = GetOccupant(i)) != null)
{
Timer smash = new RockTimer(m_Player, this);
smash.Start();
}
if ((player = GetOccupant(i)) != null)
new RockTimer(player, this).Start();
}
}
@ -357,33 +354,25 @@ namespace Server.Engines.Doom
public virtual void GenKey() /* Shuffle & build key */
{
ushort tmp;
int n, i;
ushort[] CA = { 1, 2, 4, 8 };
for (i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
{
n = (n = Utility.Random(0, 3)) == i ? n & ~i : n; /* if (i==n) { return pointless; } */
tmp = CA[i];
int n = (n = Utility.Random(0, 3)) == i ? n & ~i : n;
ushort tmp = CA[i];
CA[i] = CA[n];
CA[n] = tmp;
}
for (i = 0; i < 4; MyKey = (ushort)(CA[i++] | (MyKey <<= 4)))
for (int i = 0; i < 4; MyKey = (ushort)(CA[i++] | (MyKey <<= 4)))
{
}
}
private static bool IsValidDamagable(Mobile m)
{
if (m != null && !m.Deleted)
{
if (m.Player && m.Alive)
return true;
return m is BaseCreature bc && (bc.Controlled || bc.Summoned) && !bc.IsDeadBondedPet;
}
return false;
return m?.Deleted == false &&
(m.Player && m.Alive ||
m is BaseCreature bc && (bc.Controlled || bc.Summoned) && !bc.IsDeadBondedPet);
}
public static void MoveMobileOut(Mobile m)
@ -391,7 +380,7 @@ namespace Server.Engines.Doom
if (m != null)
{
if (m is PlayerMobile && !m.Alive)
if (m.Corpse != null && !m.Corpse.Deleted)
if (m.Corpse?.Deleted == false)
m.Corpse.MoveToWorld(lr_Exit, Map.Malas);
BaseCreature.TeleportPets(m, lr_Exit, Map.Malas);
m.Location = lr_Exit;
@ -401,7 +390,7 @@ namespace Server.Engines.Doom
public static bool AniSafe(Mobile m)
{
return m != null && !TransformationSpellHelper.UnderTransformation(m) && m.BodyMod == 0 && m.Alive;
return m?.BodyMod == 0 && m.Alive && !TransformationSpellHelper.UnderTransformation(m);
}
public static IEntity ZAdjustedIEFromMobile(Mobile m, int ZDelta)
@ -411,7 +400,7 @@ namespace Server.Engines.Doom
public static void DoDamage(Mobile m, int min, int max, bool poison)
{
if (m != null && !m.Deleted && m.Alive)
if (m?.Deleted == false && m.Alive)
{
int damage = Utility.Random(min, max);
AOS.Damage(m, damage, poison ? 0 : 100, 0, 0, poison ? 100 : 0, 0);
@ -559,8 +548,8 @@ namespace Server.Engines.Doom
{
IEntity m_IEntity = new Entity(Serial.Zero, RandomPointIn(m_Player.Location, 10), m_Player.Map);
List<Mobile> mobiles = new List<Mobile>();
foreach (Mobile m in m_IEntity.Map.GetMobilesInRange(m_IEntity.Location, 2)) mobiles.Add(m);
List<Mobile> mobiles = m_IEntity.Map.GetMobilesInRange(m_IEntity.Location, 2).ToList();
for (int k = 0; k < mobiles.Count; k++)
if (IsValidDamagable(mobiles[k]) && mobiles[k] != m_Player)
{
@ -615,7 +604,7 @@ namespace Server.Engines.Doom
if (ticks >= 71 || m_Controller.m_LampRoom.GetPlayerCount() == 0)
{
foreach (Mobile mobile in mobiles)
if (mobile != null && !mobile.Deleted && !mobile.IsDeadBondedPet)
if (mobile?.Deleted == false && !mobile.IsDeadBondedPet)
mobile.Kill();
m_Controller.Enabled = true;
Stop();
@ -637,7 +626,8 @@ namespace Server.Engines.Doom
DoDamage(mobile, 15, 20, true);
}
if (Utility.Random((int)(level & ~0xfffffffc), 3) == 3) mobile.ApplyPoison(mobile, PA2[level]);
if (Utility.Random((int)(level & ~0xfffffffc), 3) == 3)
mobile.ApplyPoison(mobile, PA2[level]);
if (ticks % 12 == 0 && level > 0 && mobile.Player)
mobile.SendLocalizedMessage(PA[level][0], null, PA[level][1]);
}
@ -648,4 +638,4 @@ namespace Server.Engines.Doom
}
}
}
}
}

View file

@ -32,7 +32,7 @@ namespace Server.Engines.Doom
{
m_Wanderer = new WandererOfTheVoid();
m_Wanderer.MoveToWorld(LeverPuzzleController.lr_Enter, Map.Malas);
m_Wanderer.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1060002, ""); // I am the guardian of...
m_Wanderer.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1060002); // I am the guardian of...
Timer.DelayCall(TimeSpan.FromSeconds(5.0), CallBackMessage);
}
}
@ -44,7 +44,7 @@ namespace Server.Engines.Doom
public override void OnAfterDelete()
{
if (m_Controller != null && !m_Controller.Deleted)
if (m_Controller?.Deleted == false)
m_Controller.Delete();
}
@ -80,7 +80,7 @@ namespace Server.Engines.Doom
public override void OnAfterDelete()
{
if (m_Controller != null && !m_Controller.Deleted)
if (m_Controller?.Deleted == false)
m_Controller.Delete();
}
@ -134,7 +134,7 @@ namespace Server.Engines.Doom
public override void OnAfterDelete()
{
if (m_Controller != null && !m_Controller.Deleted)
if (m_Controller?.Deleted == false)
m_Controller.Delete();
}
@ -202,4 +202,4 @@ namespace Server.Engines.Doom
int version = reader.ReadInt();
}
}
}
}

View file

@ -5,12 +5,12 @@ namespace Server.Engines.Doom
{
public class LampRoomRegion : BaseRegion
{
private LeverPuzzleController Controller;
private LeverPuzzleController m_Controller;
public LampRoomRegion(LeverPuzzleController controller)
: base(null, Map.Malas, Find(LeverPuzzleController.lr_Enter, Map.Malas), LeverPuzzleController.lr_Rect)
{
Controller = controller;
m_Controller = controller;
Register();
}
@ -38,13 +38,13 @@ namespace Server.Engines.Doom
if (m.AccessLevel > AccessLevel.Player)
return;
if (Controller.Successful != null)
if (m_Controller.Successful != null)
{
if (m is PlayerMobile)
{
if (m == Controller.Successful) return;
if (m == m_Controller.Successful) return;
}
else if (m is BaseCreature bc && (bc.Controlled && bc.ControlMaster == Controller.Successful ||
else if (m is BaseCreature bc && (bc.Controlled && bc.ControlMaster == m_Controller.Successful ||
bc.Summoned))
{
return;
@ -57,49 +57,36 @@ namespace Server.Engines.Doom
public override void OnExit(Mobile m)
{
if (m != null && m == Controller.Successful)
Controller.RemoveSuccessful();
if (m != null && m == m_Controller.Successful)
m_Controller.RemoveSuccessful();
}
public override void OnDeath(Mobile m)
{
if (m != null && !m.Deleted && !(m is WandererOfTheVoid))
{
Timer kick = new LeverPuzzleController.LampRoomKickTimer(m);
kick.Start();
}
if (m?.Deleted != false || m is WandererOfTheVoid)
return;
Timer kick = new LeverPuzzleController.LampRoomKickTimer(m);
kick.Start();
}
public override bool OnSkillUse(Mobile m, int Skill) /* just in case */
{
if (Controller.Successful == null || m.AccessLevel == AccessLevel.Player && m != Controller.Successful)
return false;
return true;
return m_Controller.Successful != null && (m.AccessLevel != AccessLevel.Player || m == m_Controller.Successful);
}
}
public class LeverPuzzleRegion : BaseRegion
{
private LeverPuzzleController Controller;
public Mobile m_Occupant;
public LeverPuzzleRegion(LeverPuzzleController controller, int[] loc)
: base(null, Map.Malas, Find(LeverPuzzleController.lr_Enter, Map.Malas), new Rectangle2D(loc[0], loc[1], 1, 1))
{
Controller = controller;
Register();
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Occupant
{
get
{
if (m_Occupant != null && m_Occupant.Alive)
return m_Occupant;
return null;
}
}
public Mobile Occupant => m_Occupant?.Alive == true ? m_Occupant : null;
public override void OnEnter(Mobile m)
{
@ -113,4 +100,4 @@ namespace Server.Engines.Doom
m_Occupant = null;
}
}
}
}

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Server.Ethics.Evil;
using Server.Ethics.Hero;
using Server.Items;
@ -126,16 +127,7 @@ namespace Server.Ethics
if (!Insensitive.Equals(ethic.Definition.JoinPhrase.String, e.Speech))
continue;
bool isNearAnkh = false;
foreach (Item item in e.Mobile.GetItemsInRange(2))
if (item is AnkhNorth || item is AnkhWest)
{
isNearAnkh = true;
break;
}
if (!isNearAnkh)
if (!e.Mobile.GetItemsInRange(2).Any(item => item is AnkhNorth || item is AnkhWest))
continue;
pl = new Player(ethic, e.Mobile);
@ -239,4 +231,4 @@ namespace Server.Ethics
m_Players[i].Serialize(writer);
}
}
}
}

View file

@ -8,7 +8,7 @@ namespace Server.Ethics
{
Movable = false;
if (Instance == null || Instance.Deleted)
if (Instance?.Deleted != false)
Instance = this;
else
base.Delete();
@ -56,4 +56,4 @@ namespace Server.Ethics
{
}
}
}
}

View file

@ -104,7 +104,7 @@ namespace Server.Ethics
Player pl = pm.EthicPlayer;
if (pl != null && !pl.Ethic.IsEligible(pl.Mobile))
if (pl?.Ethic.IsEligible(pl.Mobile) == false)
pm.EthicPlayer = pl = null;
return pl;
@ -157,4 +157,4 @@ namespace Server.Ethics
writer.WriteDeltaTime(m_Shield);
}
}
}
}

View file

@ -18,7 +18,7 @@ namespace Server.Ethics.Evil
public override void BeginInvoke(Player from)
{
if (from.Familiar != null && from.Familiar.Deleted)
if (from.Familiar?.Deleted == true)
from.Familiar = null;
if (from.Familiar != null)
@ -43,4 +43,4 @@ namespace Server.Ethics.Evil
}
}
}
}
}

View file

@ -18,7 +18,7 @@ namespace Server.Ethics.Evil
public override void BeginInvoke(Player from)
{
if (from.Steed != null && from.Steed.Deleted)
if (from.Steed?.Deleted == true)
from.Steed = null;
if (from.Steed != null)
@ -43,4 +43,4 @@ namespace Server.Ethics.Evil
}
}
}
}
}

View file

@ -18,7 +18,7 @@ namespace Server.Ethics.Hero
public override void BeginInvoke(Player from)
{
if (from.Steed != null && from.Steed.Deleted)
if (from.Steed?.Deleted == true)
from.Steed = null;
if (from.Steed != null)
@ -43,4 +43,4 @@ namespace Server.Ethics.Hero
}
}
}
}
}

View file

@ -18,7 +18,7 @@ namespace Server.Ethics.Hero
public override void BeginInvoke(Player from)
{
if (from.Familiar != null && from.Familiar.Deleted)
if (from.Familiar?.Deleted == true)
from.Familiar = null;
if (from.Familiar != null)
@ -43,4 +43,4 @@ namespace Server.Ethics.Hero
}
}
}
}
}

View file

@ -550,4 +550,4 @@ namespace Server.Factions
Campaign,
Election
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Accounting;
using Server.Commands;
using Server.Commands.Generic;
@ -239,36 +240,18 @@ namespace Server.Factions
return false;
IPooledEnumerable<IEntity> eable = mob.Map.GetObjectsInRange(mob.Location, range, items, mobs);
foreach (IEntity obj in eable)
if (type.IsInstanceOfType(obj))
{
eable.Free();
return true;
}
bool isInstance = eable.Any(type.IsInstanceOfType);
eable.Free();
return false;
return isInstance;
}
public static bool IsNearType(Mobile mob, Type[] types, int range)
{
IPooledEnumerable<IEntity> eable = mob.GetObjectsInRange(range);
foreach (IEntity obj in eable)
{
Type objType = obj.GetType();
for (int i = 0; i < types.Length; i++)
if (types[i].IsAssignableFrom(objType))
{
eable.Free();
return true;
}
}
bool found = eable.Any(obj => types.Any(t => t.IsInstanceOfType(obj)));
eable.Free();
return false;
return found;
}
public void RemovePlayerState(PlayerState pl)
@ -475,7 +458,7 @@ namespace Server.Factions
pm.SendLocalizedMessage(
1042161); // You cannot join a faction because your guild is an Order or Chaos type.
}
else if (!Guild.NewGuildSystem && guild.Enemies != null && guild.Enemies.Count > 0
else if (!Guild.NewGuildSystem && guild.Enemies?.Count > 0
) //CAN join w/wars in new system
{
pm.SendLocalizedMessage(1005056); // You cannot join a faction with active Wars
@ -1016,7 +999,7 @@ namespace Server.Factions
Player killerEPL = Player.Find(killer);
Player victimEPL = Player.Find(victim);
if (killerEPL != null && victimEPL != null && victimEPL.Power > 0 && victimState.CanGiveSilverTo(killer))
if (killerEPL != null && victimEPL?.Power > 0 && victimState.CanGiveSilverTo(killer))
{
int powerTransfer = Math.Max(1, victimEPL.Power / 5);
@ -1078,7 +1061,7 @@ namespace Server.Factions
Player killerEPL = Player.Find(killer);
Player victimEPL = Player.Find(victim);
if (killerEPL != null && victimEPL != null && victimEPL.Power > 0)
if (killerEPL != null && victimEPL?.Power > 0)
{
int powerTransfer = Math.Max(1, victimEPL.Power / 5);
@ -1385,4 +1368,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -44,7 +44,7 @@ namespace Server.Factions
{
get
{
if (Item == null || Item.Deleted)
if (Item?.Deleted != false)
return true;
return Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration;
@ -77,7 +77,7 @@ namespace Server.Factions
if (Item is IFactionItem item)
item.FactionItemState = null;
if (Faction != null && Faction.State.FactionItems.Contains(this))
if (Faction?.State.FactionItems.Contains(this) == true)
Faction.State.FactionItems.Remove(this);
}
@ -93,13 +93,7 @@ namespace Server.Factions
{
PlayerState pl = PlayerState.Find(mob);
if (pl == null)
return 0;
if (pl.Faction.IsCommander(mob))
return 9;
return pl.Rank.MaxWearables;
return pl == null ? 0 : pl.Faction.IsCommander(mob) ? 9 : pl.Rank.MaxWearables;
}
public static FactionItem Find(Item item)
@ -140,4 +134,4 @@ namespace Server.Factions
return item;
}
}
}
}

View file

@ -8,7 +8,7 @@ namespace Server.Factions
{
Movable = false;
if (Instance == null || Instance.Deleted)
if (Instance?.Deleted == true)
Instance = this;
else
base.Delete();
@ -87,4 +87,4 @@ namespace Server.Factions
Town
}
}
}
}

View file

@ -136,7 +136,7 @@ namespace Server.Factions
{
return Definition.Sort - other.Definition.Sort;
}
public int CompareTo(object obj)
{
return Definition.Sort - ((Town)obj).Definition.Sort;
@ -386,18 +386,14 @@ namespace Server.Factions
public bool IsSheriff(Mobile mob)
{
if (mob == null || mob.Deleted)
return false;
return mob.AccessLevel >= AccessLevel.GameMaster || mob == Sheriff;
return mob?.Deleted == false &&
(mob.AccessLevel >= AccessLevel.GameMaster || mob == Sheriff);
}
public bool IsFinance(Mobile mob)
{
if (mob == null || mob.Deleted)
return false;
return mob.AccessLevel >= AccessLevel.GameMaster || mob == Finance;
return mob?.Deleted == false &&
(mob.AccessLevel >= AccessLevel.GameMaster || mob == Finance);
}
public void Capture(Faction f)
@ -511,4 +507,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -31,16 +31,16 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.PendingPeriod - DateTime.UtcNow;
int days = (int)(toGo.TotalDays + 0.5);
AddHtmlLocalized(20, 40, 380, 20, 1038034, false, false); // A new election campaign is pending
AddHtmlLocalized(20, 40, 380, 20, 1038034); // A new election campaign is pending
if (days > 0)
{
AddHtmlLocalized(20, 60, 280, 20, 1018062, false, false); // Days until next election :
AddHtmlLocalized(20, 60, 280, 20, 1018062); // Days until next election :
AddLabel(300, 60, 0, days.ToString());
}
else
{
AddHtmlLocalized(20, 60, 280, 20, 1018059, false, false); // Election campaigning begins tonight.
AddHtmlLocalized(20, 60, 280, 20, 1018059); // Election campaigning begins tonight.
}
break;
@ -50,31 +50,29 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.CampaignPeriod - DateTime.UtcNow;
int days = (int)(toGo.TotalDays + 0.5);
AddHtmlLocalized(20, 40, 380, 20, 1018058, false, false); // There is an election campaign in progress.
AddHtmlLocalized(20, 40, 380, 20, 1018058); // There is an election campaign in progress.
if (days > 0)
{
AddHtmlLocalized(20, 60, 280, 20, 1038033, false, false); // Days to go:
AddHtmlLocalized(20, 60, 280, 20, 1038033); // Days to go:
AddLabel(300, 60, 0, days.ToString());
}
else
{
AddHtmlLocalized(20, 60, 280, 20, 1018061, false,
false); // Campaign in progress. Voting begins tonight.
AddHtmlLocalized(20, 60, 280, 20, 1018061); // Campaign in progress. Voting begins tonight.
}
if (m_Election.CanBeCandidate(m_From))
{
AddButton(20, 110, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 110, 350, 20, 1011427, false, false); // CAMPAIGN FOR LEADERSHIP
AddButton(20, 110, 4005, 4007, 2);
AddHtmlLocalized(55, 110, 350, 20, 1011427); // CAMPAIGN FOR LEADERSHIP
}
else
{
PlayerState pl = PlayerState.Find(m_From);
if (pl == null || pl.Rank.Rank < Election.CandidateRank)
AddHtmlLocalized(20, 100, 380, 20, 1010118, false,
false); // You must have a higher rank to run for office
AddHtmlLocalized(20, 100, 380, 20, 1010118); // You must have a higher rank to run for office
}
break;
@ -84,20 +82,20 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.VotingPeriod - DateTime.UtcNow;
int days = (int)Math.Ceiling(toGo.TotalDays);
AddHtmlLocalized(20, 40, 380, 20, 1018060, false, false); // There is an election vote in progress.
AddHtmlLocalized(20, 40, 380, 20, 1018060); // There is an election vote in progress.
AddHtmlLocalized(20, 60, 280, 20, 1038033, false, false);
AddHtmlLocalized(20, 60, 280, 20, 1038033);
AddLabel(300, 60, 0, days.ToString());
AddHtmlLocalized(55, 100, 380, 20, 1011428, false, false); // VOTE FOR LEADERSHIP
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 100, 380, 20, 1011428); // VOTE FOR LEADERSHIP
AddButton(20, 100, 4005, 4007, 1);
break;
}
}
AddButton(20, 140, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 140, 350, 20, 1011012, false, false); // CANCEL
AddButton(20, 140, 4005, 4007, 0);
AddHtmlLocalized(55, 140, 350, 20, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -126,4 +124,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -13,11 +13,7 @@ namespace Server.Factions
private Election m_Election;
private int m_Page;
public ElectionManagementGump(Election election) : this(election, null, 0)
{
}
public ElectionManagementGump(Election election, Candidate candidate, int page) : base(40, 40)
public ElectionManagementGump(Election election, Candidate candidate = null, int page = 0) : base(40, 40)
{
m_Election = election;
m_Candidate = candidate;
@ -30,40 +26,39 @@ namespace Server.Factions
AddBackground(0, 0, 448, 354, 9270);
AddAlphaRegion(10, 10, 428, 334);
AddHtml(10, 10, 428, 20, Color(Center("Candidate Management"), LabelColor), false, false);
AddHtml(10, 10, 428, 20, Color(Center("Candidate Management"), LabelColor));
AddHtml(45, 35, 100, 20, Color("Player Name:", LabelColor), false, false);
AddHtml(145, 35, 100, 20, Color(candidate.Mobile == null ? "null" : candidate.Mobile.Name, LabelColor),
false, false);
AddHtml(45, 35, 100, 20, Color("Player Name:", LabelColor));
AddHtml(145, 35, 100, 20, Color(candidate.Mobile == null ? "null" : candidate.Mobile.Name, LabelColor));
AddHtml(45, 55, 100, 20, Color("Vote Count:", LabelColor), false, false);
AddHtml(145, 55, 100, 20, Color(candidate.Votes.ToString(), LabelColor), false, false);
AddHtml(45, 55, 100, 20, Color("Vote Count:", LabelColor));
AddHtml(145, 55, 100, 20, Color(candidate.Votes.ToString(), LabelColor));
AddButton(12, 73, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtml(45, 75, 100, 20, Color("Drop Candidate", LabelColor), false, false);
AddButton(12, 73, 4005, 4007, 1);
AddHtml(45, 75, 100, 20, Color("Drop Candidate", LabelColor));
AddImageTiled(13, 99, 422, 242, 9264);
AddImageTiled(14, 100, 420, 240, 9274);
AddAlphaRegion(14, 100, 420, 240);
AddHtml(14, 100, 420, 20, Color(Center("Voters"), LabelColor), false, false);
AddHtml(14, 100, 420, 20, Color(Center("Voters"), LabelColor));
if (page > 0)
AddButton(397, 104, 0x15E3, 0x15E7, 2, GumpButtonType.Reply, 0);
AddButton(397, 104, 0x15E3, 0x15E7, 2);
else
AddImage(397, 104, 0x25EA);
if ((page + 1) * 10 < candidate.Voters.Count)
AddButton(414, 104, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
AddButton(414, 104, 0x15E1, 0x15E5, 3);
else
AddImage(414, 104, 0x25E6);
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor), false, false);
AddHtml(47, 120, 150, 20, Color("Name", LabelColor), false, false);
AddHtml(195, 120, 100, 20, Color(Center("Address"), LabelColor), false, false);
AddHtml(295, 120, 80, 20, Color(Center("Time"), LabelColor), false, false);
AddHtml(355, 120, 60, 20, Color(Center("Legit"), LabelColor), false, false);
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor));
AddHtml(47, 120, 150, 20, Color("Name", LabelColor));
AddHtml(195, 120, 100, 20, Color(Center("Address"), LabelColor));
AddHtml(295, 120, 80, 20, Color(Center("Time"), LabelColor));
AddHtml(355, 120, 60, 20, Color(Center("Legit"), LabelColor));
int idx = 0;
@ -71,7 +66,7 @@ namespace Server.Factions
{
Voter voter = candidate.Voters[i];
AddButton(13, 138 + idx * 20, 4002, 4004, 4 + i, GumpButtonType.Reply, 0);
AddButton(13, 138 + idx * 20, 4002, 4004, 4 + i);
object[] fields = voter.AcquireFields();
@ -83,23 +78,23 @@ namespace Server.Factions
if (obj is Mobile mobile)
{
AddHtml(x + 2, 140 + idx * 20, 150, 20, Color(mobile.Name, LabelColor), false, false);
AddHtml(x + 2, 140 + idx * 20, 150, 20, Color(mobile.Name, LabelColor));
x += 150;
}
else if (obj is IPAddress)
{
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(obj.ToString()), LabelColor), false, false);
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(obj.ToString()), LabelColor));
x += 100;
}
else if (obj is DateTime time)
{
AddHtml(x, 140 + idx * 20, 80, 20,
Color(Center(FormatTimeSpan(time - election.LastStateTime)), LabelColor), false, false);
Color(Center(FormatTimeSpan(time - election.LastStateTime)), LabelColor));
x += 80;
}
else if (obj is int i1)
{
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center(i1 + "%"), LabelColor), false, false);
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center(i1 + "%"), LabelColor));
x += 60;
}
}
@ -110,23 +105,23 @@ namespace Server.Factions
AddBackground(0, 0, 288, 334, 9270);
AddAlphaRegion(10, 10, 268, 314);
AddHtml(10, 10, 268, 20, Color(Center("Election Management"), LabelColor), false, false);
AddHtml(10, 10, 268, 20, Color(Center("Election Management"), LabelColor));
AddHtml(45, 35, 100, 20, Color("Current State:", LabelColor), false, false);
AddHtml(145, 35, 100, 20, Color(election.State.ToString(), LabelColor), false, false);
AddHtml(45, 35, 100, 20, Color("Current State:", LabelColor));
AddHtml(145, 35, 100, 20, Color(election.State.ToString(), LabelColor));
AddButton(12, 53, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtml(45, 55, 100, 20, Color("Transition Time:", LabelColor), false, false);
AddHtml(145, 55, 100, 20, Color(FormatTimeSpan(election.NextStateTime), LabelColor), false, false);
AddButton(12, 53, 4005, 4007, 1);
AddHtml(45, 55, 100, 20, Color("Transition Time:", LabelColor));
AddHtml(145, 55, 100, 20, Color(FormatTimeSpan(election.NextStateTime), LabelColor));
AddImageTiled(13, 79, 262, 242, 9264);
AddImageTiled(14, 80, 260, 240, 9274);
AddAlphaRegion(14, 80, 260, 240);
AddHtml(14, 80, 260, 20, Color(Center("Candidates"), LabelColor), false, false);
AddHtml(14, 100, 30, 20, Color(Center("-->"), LabelColor), false, false);
AddHtml(47, 100, 150, 20, Color("Name", LabelColor), false, false);
AddHtml(195, 100, 80, 20, Color(Center("Votes"), LabelColor), false, false);
AddHtml(14, 80, 260, 20, Color(Center("Candidates"), LabelColor));
AddHtml(14, 100, 30, 20, Color(Center("-->"), LabelColor));
AddHtml(47, 100, 150, 20, Color("Name", LabelColor));
AddHtml(195, 100, 80, 20, Color(Center("Votes"), LabelColor));
for (int i = 0; i < election.Candidates.Count; ++i)
{
@ -136,9 +131,9 @@ namespace Server.Factions
if (mob == null)
continue;
AddButton(13, 118 + i * 20, 4005, 4007, 2 + i, GumpButtonType.Reply, 0);
AddHtml(47, 120 + i * 20, 150, 20, Color(mob.Name, LabelColor), false, false);
AddHtml(195, 120 + i * 20, 80, 20, Color(Center(cd.Votes.ToString()), LabelColor), false, false);
AddButton(13, 118 + i * 20, 4005, 4007, 2 + i);
AddHtml(47, 120 + i * 20, 150, 20, Color(mob.Name, LabelColor));
AddHtml(195, 120 + i * 20, 80, 20, Color(Center(cd.Votes.ToString()), LabelColor));
}
}
}
@ -181,7 +176,7 @@ namespace Server.Factions
bid -= 2;
if (bid >= 0 && bid < m_Election.Candidates.Count)
from.SendGump(new ElectionManagementGump(m_Election, m_Election.Candidates[bid], 0));
from.SendGump(new ElectionManagementGump(m_Election, m_Election.Candidates[bid]));
}
}
else
@ -216,4 +211,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -37,10 +37,10 @@ namespace Server.Factions
public void AddHtmlText(int x, int y, int width, int height, TextDefinition text, bool back, bool scroll)
{
if (text != null && text.Number > 0)
if (text?.Number > 0)
AddHtmlLocalized(x, y, width, height, text.Number, back, scroll);
else if (text?.String != null)
AddHtml(x, y, width, height, text.String, back, scroll);
}
}
}
}

View file

@ -32,33 +32,33 @@ namespace Server.Factions
AddBackground(0, 0, 320, 270, 5054);
AddBackground(10, 10, 300, 250, 3000);
AddHtmlLocalized(20, 20, 210, 25, 1011569, false, false); // Imbue with Faction properties?
AddHtmlLocalized(20, 20, 210, 25, 1011569); // Imbue with Faction properties?
AddHtmlLocalized(20, 60, 170, 25, 1018302, false, false); // Item quality:
AddHtmlLocalized(175, 60, 100, 25, 1018305 - quality, false, false); // Exceptional, Average, Low
AddHtmlLocalized(20, 60, 170, 25, 1018302); // Item quality:
AddHtmlLocalized(175, 60, 100, 25, 1018305 - quality); // Exceptional, Average, Low
AddHtmlLocalized(20, 80, 170, 25, 1011572, false, false); // Item Cost :
AddHtmlLocalized(20, 80, 170, 25, 1011572); // Item Cost :
AddLabel(175, 80, 0x34, def.SilverCost.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 100, 170, 25, 1011573, false, false); // Your Silver :
AddHtmlLocalized(20, 100, 170, 25, 1011573); // Your Silver :
AddLabel(175, 100, 0x34, availableSilver.ToString("N0")); // NOTE: Added 'N0'
AddRadio(20, 140, 210, 211, true, 1);
AddLabel(55, 140, m_Faction.Definition.HuePrimary - 1, "*****");
AddHtmlLocalized(150, 140, 150, 25, 1011570, false, false); // Primary Color
AddHtmlLocalized(150, 140, 150, 25, 1011570); // Primary Color
AddRadio(20, 160, 210, 211, false, 2);
AddLabel(55, 160, m_Faction.Definition.HueSecondary - 1, "*****");
AddHtmlLocalized(150, 160, 150, 25, 1011571, false, false); // Secondary Color
AddHtmlLocalized(150, 160, 150, 25, 1011571); // Secondary Color
AddHtmlLocalized(55, 200, 200, 25, 1011011, false, false); // CONTINUE
AddButton(20, 200, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 200, 200, 25, 1011011); // CONTINUE
AddButton(20, 200, 4005, 4007, 1);
AddHtmlLocalized(55, 230, 200, 25, 1011012, false, false); // CANCEL
AddButton(20, 230, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 230, 200, 25, 1011012); // CANCEL
AddButton(20, 230, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -89,7 +89,7 @@ namespace Server.Factions
}
}
if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
m_Mobile.SendGump(new CraftGump(m_Mobile, m_CraftSystem, m_Tool, m_Notice));
else if (m_Notice is string s)
m_Mobile.SendMessage(s);
@ -97,4 +97,4 @@ namespace Server.Factions
m_Mobile.SendLocalizedMessage(i);
}
}
}
}

View file

@ -26,25 +26,25 @@ namespace Server.Factions
AddHtmlText(20, 30, 510, 20, faction.Definition.Header, false, false);
AddHtmlLocalized(20, 60, 100, 20, 1011429, false, false); // Led By :
AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody", false, false);
AddHtmlLocalized(20, 60, 100, 20, 1011429); // Led By :
AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody");
AddHtmlLocalized(20, 80, 100, 20, 1011457, false, false); // Tithe rate :
AddHtmlLocalized(20, 80, 100, 20, 1011457); // Tithe rate :
if (faction.Tithe >= 0 && faction.Tithe <= 100 && faction.Tithe % 10 == 0)
AddHtmlLocalized(125, 80, 350, 20, 1011480 + faction.Tithe / 10, false, false);
AddHtmlLocalized(125, 80, 350, 20, 1011480 + faction.Tithe / 10);
else
AddHtml(125, 80, 350, 20, faction.Tithe + "%", false, false);
AddHtml(125, 80, 350, 20, faction.Tithe + "%");
AddHtmlLocalized(20, 100, 100, 20, 1011458, false, false); // Traps placed :
AddHtml(125, 100, 50, 20, faction.Traps.Count.ToString(), false, false);
AddHtmlLocalized(20, 100, 100, 20, 1011458); // Traps placed :
AddHtml(125, 100, 50, 20, faction.Traps.Count.ToString());
AddHtmlLocalized(55, 225, 200, 20, 1011428, false, false); // VOTE FOR LEADERSHIP
AddButton(20, 225, 4005, 4007, ToButtonID(0, 0), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 225, 200, 20, 1011428); // VOTE FOR LEADERSHIP
AddButton(20, 225, 4005, 4007, ToButtonID(0, 0));
AddHtmlLocalized(55, 150, 100, 20, 1011430, false, false); // CITY STATUS
AddHtmlLocalized(55, 150, 100, 20, 1011430); // CITY STATUS
AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(55, 175, 100, 20, 1011444, false, false); // STATISTICS
AddHtmlLocalized(55, 175, 100, 20, 1011444); // STATISTICS
AddButton(20, 175, 4005, 4007, 0, GumpButtonType.Page, 4);
bool isMerchantQualified = MerchantTitles.HasMerchantQualifications(from);
@ -53,31 +53,31 @@ namespace Server.Factions
if (pl != null && pl.MerchantTitle != MerchantTitle.None)
{
AddHtmlLocalized(55, 200, 250, 20, 1011460, false, false); // UNDECLARE FACTION MERCHANT
AddButton(20, 200, 4005, 4007, ToButtonID(1, 0), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 200, 250, 20, 1011460); // UNDECLARE FACTION MERCHANT
AddButton(20, 200, 4005, 4007, ToButtonID(1, 0));
}
else if (isMerchantQualified)
{
AddHtmlLocalized(55, 200, 250, 20, 1011459, false, false); // DECLARE FACTION MERCHANT
AddHtmlLocalized(55, 200, 250, 20, 1011459); // DECLARE FACTION MERCHANT
AddButton(20, 200, 4005, 4007, 0, GumpButtonType.Page, 5);
}
else
{
AddHtmlLocalized(55, 200, 250, 20, 1011467, false, false); // MERCHANT OPTIONS
AddHtmlLocalized(55, 200, 250, 20, 1011467); // MERCHANT OPTIONS
AddImage(20, 200, 4020);
}
AddHtmlLocalized(55, 250, 300, 20, 1011461, false, false); // COMMANDER OPTIONS
AddHtmlLocalized(55, 250, 300, 20, 1011461); // COMMANDER OPTIONS
if (faction.IsCommander(from))
AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 6);
else
AddImage(20, 250, 4020);
AddHtmlLocalized(55, 275, 300, 20, 1011426, false, false); // LEAVE THIS FACTION
AddButton(20, 275, 4005, 4007, ToButtonID(0, 1), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 275, 300, 20, 1011426); // LEAVE THIS FACTION
AddButton(20, 275, 4005, 4007, ToButtonID(0, 1));
AddHtmlLocalized(55, 300, 200, 20, 1011441, false, false); // EXIT
AddButton(20, 300, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 300, 200, 20, 1011441); // EXIT
AddButton(20, 300, 4005, 4007, 0);
#endregion
@ -85,7 +85,7 @@ namespace Server.Factions
AddPage(2);
AddHtmlLocalized(20, 30, 250, 20, 1011430, false, false); // CITY STATUS
AddHtmlLocalized(20, 30, 250, 20, 1011430); // CITY STATUS
List<Town> towns = Town.Towns;
@ -97,11 +97,11 @@ namespace Server.Factions
if (town.Owner == null)
{
AddHtmlLocalized(200, 55 + i * 30, 150, 20, 1011462, false, false); // : Neutral
AddHtmlLocalized(200, 55 + i * 30, 150, 20, 1011462); // : Neutral
}
else
{
AddHtmlLocalized(200, 55 + i * 30, 150, 20, town.Owner.Definition.OwnerLabel, false, false);
AddHtmlLocalized(200, 55 + i * 30, 150, 20, town.Owner.Definition.OwnerLabel);
BaseMonolith monolith = town.Monolith;
@ -111,12 +111,12 @@ namespace Server.Factions
AddImage(20, 300, 2361);
AddHtmlLocalized(45, 295, 300, 20, 1011491, false, false); // sigil may be recaptured
AddHtmlLocalized(45, 295, 300, 20, 1011491); // sigil may be recaptured
AddImage(20, 320, 2360);
AddHtmlLocalized(45, 315, 300, 20, 1011492, false, false); // sigil may not be recaptured
AddHtmlLocalized(45, 315, 300, 20, 1011492); // sigil may not be recaptured
AddHtmlLocalized(55, 350, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 350, 100, 20, 1011447); // BACK
AddButton(20, 350, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -125,18 +125,18 @@ namespace Server.Factions
AddPage(4);
AddHtmlLocalized(20, 30, 150, 20, 1011444, false, false); // STATISTICS
AddHtmlLocalized(20, 30, 150, 20, 1011444); // STATISTICS
AddHtmlLocalized(20, 100, 100, 20, 1011445, false, false); // Name :
AddHtml(120, 100, 150, 20, from.Name, false, false);
AddHtmlLocalized(20, 100, 100, 20, 1011445); // Name :
AddHtml(120, 100, 150, 20, from.Name);
AddHtmlLocalized(20, 130, 100, 20, 1018064, false, false); // score :
AddHtml(120, 130, 100, 20, (pl?.KillPoints ?? 0).ToString(), false, false);
AddHtmlLocalized(20, 130, 100, 20, 1018064); // score :
AddHtml(120, 130, 100, 20, (pl?.KillPoints ?? 0).ToString());
AddHtmlLocalized(20, 160, 100, 20, 1011446, false, false); // Rank :
AddHtml(120, 160, 100, 20, (pl?.Rank.Rank ?? 0).ToString(), false, false);
AddHtmlLocalized(20, 160, 100, 20, 1011446); // Rank :
AddHtml(120, 160, 100, 20, (pl?.Rank.Rank ?? 0).ToString());
AddHtmlLocalized(55, 250, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 250, 100, 20, 1011447); // BACK
AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -147,9 +147,9 @@ namespace Server.Factions
{
AddPage(5);
AddHtmlLocalized(20, 30, 250, 20, 1011467, false, false); // MERCHANT OPTIONS
AddHtmlLocalized(20, 30, 250, 20, 1011467); // MERCHANT OPTIONS
AddHtmlLocalized(20, 80, 300, 20, 1011473, false, false); // Select the title you wish to display
AddHtmlLocalized(20, 80, 300, 20, 1011473); // Select the title you wish to display
MerchantTitleInfo[] infos = MerchantTitles.Info;
@ -158,14 +158,14 @@ namespace Server.Factions
MerchantTitleInfo info = infos[i];
if (MerchantTitles.IsQualified(from, info))
AddButton(20, 100 + i * 30, 4005, 4007, ToButtonID(1, i + 1), GumpButtonType.Reply, 0);
AddButton(20, 100 + i * 30, 4005, 4007, ToButtonID(1, i + 1));
else
AddImage(20, 100 + i * 30, 4020);
AddHtmlText(55, 100 + i * 30, 200, 20, info.Label, false, false);
}
AddHtmlLocalized(55, 340, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 340, 100, 20, 1011447); // BACK
AddButton(20, 340, 4005, 4007, 0, GumpButtonType.Page, 1);
}
@ -179,27 +179,27 @@ namespace Server.Factions
AddPage(6);
AddHtmlLocalized(20, 30, 200, 20, 1011461, false, false); // COMMANDER OPTIONS
AddHtmlLocalized(20, 30, 200, 20, 1011461); // COMMANDER OPTIONS
AddHtmlLocalized(20, 70, 120, 20, 1011457, false, false); // Tithe rate :
AddHtmlLocalized(20, 70, 120, 20, 1011457); // Tithe rate :
if (faction.Tithe >= 0 && faction.Tithe <= 100 && faction.Tithe % 10 == 0)
AddHtmlLocalized(140, 70, 250, 20, 1011480 + faction.Tithe / 10, false, false);
AddHtmlLocalized(140, 70, 250, 20, 1011480 + faction.Tithe / 10);
else
AddHtml(140, 70, 250, 20, faction.Tithe + "%", false, false);
AddHtml(140, 70, 250, 20, faction.Tithe + "%");
AddHtmlLocalized(20, 100, 120, 20, 1011474, false, false); // Silver available :
AddHtml(140, 100, 50, 20, faction.Silver.ToString("N0"), false, false); // NOTE: Added 'N0' formatting
AddHtmlLocalized(20, 100, 120, 20, 1011474); // Silver available :
AddHtml(140, 100, 50, 20, faction.Silver.ToString("N0")); // NOTE: Added 'N0' formatting
AddHtmlLocalized(55, 130, 200, 20, 1011478, false, false); // CHANGE TITHE RATE
AddHtmlLocalized(55, 130, 200, 20, 1011478); // CHANGE TITHE RATE
AddButton(20, 130, 4005, 4007, 0, GumpButtonType.Page, 8);
AddHtmlLocalized(55, 160, 200, 20, 1018301, false, false); // TRANSFER SILVER
AddHtmlLocalized(55, 160, 200, 20, 1018301); // TRANSFER SILVER
if (faction.Silver >= 10000)
AddButton(20, 160, 4005, 4007, 0, GumpButtonType.Page, 7);
else
AddImage(20, 160, 4020);
AddHtmlLocalized(55, 310, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 310, 100, 20, 1011447); // BACK
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -210,9 +210,9 @@ namespace Server.Factions
{
AddPage(7);
AddHtmlLocalized(20, 30, 250, 20, 1011476, false, false); // TOWN FINANCE
AddHtmlLocalized(20, 30, 250, 20, 1011476); // TOWN FINANCE
AddHtmlLocalized(20, 50, 400, 20, 1011477, false, false); // Select a town to transfer 10000 silver to
AddHtmlLocalized(20, 50, 400, 20, 1011477); // Select a town to transfer 10000 silver to
for (int i = 0; i < towns.Count; ++i)
{
@ -221,12 +221,12 @@ namespace Server.Factions
AddHtmlText(55, 75 + i * 30, 200, 20, town.Definition.TownName, false, false);
if (town.Owner == faction)
AddButton(20, 75 + i * 30, 4005, 4007, ToButtonID(2, i), GumpButtonType.Reply, 0);
AddButton(20, 75 + i * 30, 4005, 4007, ToButtonID(2, i));
else
AddImage(20, 75 + i * 30, 4020);
}
AddHtmlLocalized(55, 310, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 310, 100, 20, 1011447); // BACK
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
}
@ -236,7 +236,7 @@ namespace Server.Factions
AddPage(8);
AddHtmlLocalized(20, 30, 400, 20, 1011479, false, false); // Select the % for the new tithe rate
AddHtmlLocalized(20, 30, 400, 20, 1011479); // Select the % for the new tithe rate
int y = 55;
@ -245,8 +245,8 @@ namespace Server.Factions
if (i == 5)
y += 5;
AddHtmlLocalized(55, y, 300, 20, 1011480 + i, false, false);
AddButton(20, y, 4005, 4007, ToButtonID(3, i), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, y, 300, 20, 1011480 + i);
AddButton(20, y, 4005, 4007, ToButtonID(3, i));
y += 20;
@ -254,7 +254,7 @@ namespace Server.Factions
y += 5;
}
AddHtmlLocalized(55, 310, 300, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 310, 300, 20, 1011447); // BACK
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -354,4 +354,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -35,20 +35,20 @@ namespace Server.Factions
AddPage(1);
AddHtmlLocalized(20, 30, 260, 25, 1011541, false, false); // FINANCE MINISTER
AddHtmlLocalized(20, 30, 260, 25, 1011541); // FINANCE MINISTER
AddHtmlLocalized(55, 90, 200, 25, 1011539, false, false); // CHANGE PRICES
AddHtmlLocalized(55, 90, 200, 25, 1011539); // CHANGE PRICES
AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(55, 120, 200, 25, 1011540, false, false); // BUY SHOPKEEPERS
AddHtmlLocalized(55, 120, 200, 25, 1011540); // BUY SHOPKEEPERS
AddButton(20, 120, 4005, 4007, 0, GumpButtonType.Page, 3);
AddHtmlLocalized(55, 150, 200, 25, 1011495, false, false); // VIEW FINANCES
AddHtmlLocalized(55, 150, 200, 25, 1011495); // VIEW FINANCES
AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 4);
AddHtmlLocalized(55, 360, 200, 25, 1011441, false, false); // EXIT
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 360, 200, 25, 1011441); // EXIT
AddButton(20, 360, 4005, 4007, 0);
#endregion
@ -56,7 +56,7 @@ namespace Server.Factions
AddPage(2);
AddHtmlLocalized(20, 30, 200, 25, 1011539, false, false); // CHANGE PRICES
AddHtmlLocalized(20, 30, 200, 25, 1011539); // CHANGE PRICES
for (int i = 0; i < m_PriceOffsets.Length; ++i)
{
@ -74,12 +74,12 @@ namespace Server.Factions
}
AddRadio(20, 270, 208, 209, town.Tax == 0, 0);
AddHtmlLocalized(55, 270, 90, 25, 1011542, false, false); // normal
AddHtmlLocalized(55, 270, 90, 25, 1011542); // normal
AddHtmlLocalized(55, 330, 200, 25, 1011509, false, false); // Set Prices
AddButton(20, 330, 4005, 4007, ToButtonID(0, 0), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 330, 200, 25, 1011509); // Set Prices
AddButton(20, 330, 4005, 4007, ToButtonID(0, 0));
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -88,7 +88,7 @@ namespace Server.Factions
AddPage(3);
AddHtmlLocalized(20, 30, 200, 25, 1011540, false, false); // BUY SHOPKEEPERS
AddHtmlLocalized(20, 30, 200, 25, 1011540); // BUY SHOPKEEPERS
List<VendorList> vendorLists = town.VendorLists;
@ -101,7 +101,7 @@ namespace Server.Factions
AddHtmlText(100, 90 + i * 40, 200, 25, list.Definition.Label, false, false);
}
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -116,24 +116,24 @@ namespace Server.Factions
int netCashFlow = town.NetCashFlow;
AddHtmlLocalized(20, 30, 300, 25, 1011524, false, false); // FINANCE STATEMENT
AddHtmlLocalized(20, 30, 300, 25, 1011524); // FINANCE STATEMENT
AddHtmlLocalized(20, 80, 300, 25, 1011538, false, false); // Current total money for town :
AddHtmlLocalized(20, 80, 300, 25, 1011538); // Current total money for town :
AddLabel(20, 100, 0x44, town.Silver.ToString());
AddHtmlLocalized(20, 130, 300, 25, 1011520, false, false); // Finance Minister Upkeep :
AddHtmlLocalized(20, 130, 300, 25, 1011520); // Finance Minister Upkeep :
AddLabel(20, 150, 0x44, financeUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 300, 25, 1011521, false, false); // Sheriff Upkeep :
AddHtmlLocalized(20, 180, 300, 25, 1011521); // Sheriff Upkeep :
AddLabel(20, 200, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 230, 300, 25, 1011522, false, false); // Town Income :
AddHtmlLocalized(20, 230, 300, 25, 1011522); // Town Income :
AddLabel(20, 250, 0x44, dailyIncome.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 280, 300, 25, 1011523, false, false); // Net Cash flow per day :
AddHtmlLocalized(20, 280, 300, 25, 1011523); // Net Cash flow per day :
AddLabel(20, 300, 0x44, netCashFlow.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -149,31 +149,31 @@ namespace Server.Factions
AddHtmlText(60, 30, 300, 25, vendorList.Definition.Header, false, false);
AddItem(20, 30, vendorList.Definition.ItemID);
AddHtmlLocalized(20, 90, 200, 25, 1011514, false, false); // You have :
AddHtmlLocalized(20, 90, 200, 25, 1011514); // You have :
AddLabel(230, 90, 0x26, vendorList.Vendors.Count.ToString());
AddHtmlLocalized(20, 120, 200, 25, 1011515, false, false); // Maximum :
AddHtmlLocalized(20, 120, 200, 25, 1011515); // Maximum :
AddLabel(230, 120, 0x256, vendorList.Definition.Maximum.ToString());
AddHtmlLocalized(20, 150, 200, 25, 1011516, false, false); // Cost :
AddHtmlLocalized(20, 150, 200, 25, 1011516); // Cost :
AddLabel(230, 150, 0x44, vendorList.Definition.Price.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 200, 25, 1011517, false, false); // Daily Pay :
AddHtmlLocalized(20, 180, 200, 25, 1011517); // Daily Pay :
AddLabel(230, 180, 0x37, vendorList.Definition.Upkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 210, 200, 25, 1011518, false, false); // Current Silver :
AddHtmlLocalized(20, 210, 200, 25, 1011518); // Current Silver :
AddLabel(230, 210, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 240, 200, 25, 1011519, false, false); // Current Payroll :
AddHtmlLocalized(20, 240, 200, 25, 1011519); // Current Payroll :
AddLabel(230, 240, 0x44, financeUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlText(55, 300, 200, 25, vendorList.Definition.Label, false, false);
if (town.Silver >= vendorList.Definition.Price)
AddButton(20, 300, 4005, 4007, ToButtonID(1, i), GumpButtonType.Reply, 0);
AddButton(20, 300, 4005, 4007, ToButtonID(1, i));
else
AddImage(20, 300, 4020);
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
}
@ -289,4 +289,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server.Factions
AddHtmlText(20, 30, 300, 25, faction.Definition.Header, false, false);
AddHtmlLocalized(20, 60, 300, 25, 1018306, false, false); // Purchase a Faction War Horse
AddHtmlLocalized(20, 60, 300, 25, 1018306); // Purchase a Faction War Horse
AddItem(70, 120, 0x3FFE);
AddItem(150, 120, 0xEF2);
@ -31,11 +31,11 @@ namespace Server.Factions
AddItem(150, 150, 0xEEF);
AddLabel(190, 152, 0x3E3, FactionWarHorse.GoldPrice.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(55, 210, 200, 25, 1011011, false, false); // CONTINUE
AddButton(20, 210, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 210, 200, 25, 1011011); // CONTINUE
AddButton(20, 210, 4005, 4007, 1);
AddHtmlLocalized(55, 240, 200, 25, 1011012, false, false); // CANCEL
AddButton(20, 240, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 240, 200, 25, 1011012); // CANCEL
AddButton(20, 240, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -88,4 +88,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -24,21 +24,21 @@ namespace Server.Factions
AddHtmlText(20, 130, 510, 100, faction.Definition.About, true, true);
AddHtmlLocalized(20, 60, 100, 20, 1011429, false, false); // Led By :
AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody", false, false);
AddHtmlLocalized(20, 60, 100, 20, 1011429); // Led By :
AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody");
AddHtmlLocalized(20, 80, 100, 20, 1011457, false, false); // Tithe rate :
AddHtmlLocalized(20, 80, 100, 20, 1011457); // Tithe rate :
if (faction.Tithe >= 0 && faction.Tithe <= 100 && faction.Tithe % 10 == 0)
AddHtmlLocalized(125, 80, 350, 20, 1011480 + faction.Tithe / 10, false, false);
AddHtmlLocalized(125, 80, 350, 20, 1011480 + faction.Tithe / 10);
else
AddHtml(125, 80, 350, 20, faction.Tithe + "%", false, false);
AddHtml(125, 80, 350, 20, faction.Tithe + "%");
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 400, 200, 20, 1011425, false, false); // JOIN THIS FACTION
AddButton(20, 400, 4005, 4007, 1);
AddHtmlLocalized(55, 400, 200, 20, 1011425); // JOIN THIS FACTION
AddButton(300, 400, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(335, 400, 200, 20, 1011012, false, false); // CANCEL
AddButton(300, 400, 4005, 4007, 0);
AddHtmlLocalized(335, 400, 200, 20, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -47,4 +47,4 @@ namespace Server.Factions
m_Faction.OnJoinAccepted(m_From);
}
}
}
}

View file

@ -25,11 +25,11 @@ namespace Server.Factions
else
AddHtmlLocalized(20, 15, 230, 60, 1018063, true, true); // Are you sure you want to leave this faction?
AddHtmlLocalized(55, 80, 75, 20, 1011011, false, false); // CONTINUE
AddButton(20, 80, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 80, 75, 20, 1011011); // CONTINUE
AddButton(20, 80, 4005, 4007, 1);
AddHtmlLocalized(170, 80, 75, 20, 1011012, false, false); // CANCEL
AddButton(135, 80, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(170, 80, 75, 20, 1011012); // CANCEL
AddButton(135, 80, 4005, 4007, 2);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -90,4 +90,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -28,16 +28,16 @@ namespace Server.Factions
AddPage(1);
AddHtmlLocalized(20, 30, 260, 25, 1011431, false, false); // Sheriff
AddHtmlLocalized(20, 30, 260, 25, 1011431); // Sheriff
AddHtmlLocalized(55, 90, 200, 25, 1011494, false, false); // HIRE GUARDS
AddHtmlLocalized(55, 90, 200, 25, 1011494); // HIRE GUARDS
AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 3);
AddHtmlLocalized(55, 120, 200, 25, 1011495, false, false); // VIEW FINANCES
AddHtmlLocalized(55, 120, 200, 25, 1011495); // VIEW FINANCES
AddButton(20, 120, 4005, 4007, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(55, 360, 200, 25, 1011441, false, false); // Exit
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 360, 200, 25, 1011441); // Exit
AddButton(20, 360, 4005, 4007, 0);
#endregion
@ -50,24 +50,24 @@ namespace Server.Factions
int dailyIncome = town.DailyIncome;
int netCashFlow = town.NetCashFlow;
AddHtmlLocalized(20, 30, 300, 25, 1011524, false, false); // FINANCE STATEMENT
AddHtmlLocalized(20, 30, 300, 25, 1011524); // FINANCE STATEMENT
AddHtmlLocalized(20, 80, 300, 25, 1011538, false, false); // Current total money for town :
AddHtmlLocalized(20, 80, 300, 25, 1011538); // Current total money for town :
AddLabel(20, 100, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 130, 300, 25, 1011520, false, false); // Finance Minister Upkeep :
AddHtmlLocalized(20, 130, 300, 25, 1011520); // Finance Minister Upkeep :
AddLabel(20, 150, 0x44, financeUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 300, 25, 1011521, false, false); // Sheriff Upkeep :
AddHtmlLocalized(20, 180, 300, 25, 1011521); // Sheriff Upkeep :
AddLabel(20, 200, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 230, 300, 25, 1011522, false, false); // Town Income :
AddHtmlLocalized(20, 230, 300, 25, 1011522); // Town Income :
AddLabel(20, 250, 0x44, dailyIncome.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 280, 300, 25, 1011523, false, false); // Net Cash flow per day :
AddHtmlLocalized(20, 280, 300, 25, 1011523); // Net Cash flow per day :
AddLabel(20, 300, 0x44, netCashFlow.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -76,7 +76,7 @@ namespace Server.Factions
AddPage(3);
AddHtmlLocalized(20, 30, 300, 25, 1011494, false, false); // HIRE GUARDS
AddHtmlLocalized(20, 30, 300, 25, 1011494); // HIRE GUARDS
List<GuardList> guardLists = town.GuardLists;
@ -90,7 +90,7 @@ namespace Server.Factions
AddHtmlText(120, y, 200, 25, guardList.Definition.Header, false, false);
}
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -106,28 +106,28 @@ namespace Server.Factions
AddHtmlText(90, 30, 300, 25, guardList.Definition.Header, false, false);
CenterItem(guardList.Definition.ItemID, 10, 10, 80, 80);
AddHtmlLocalized(20, 90, 200, 25, 1011514, false, false); // You have :
AddHtmlLocalized(20, 90, 200, 25, 1011514); // You have :
AddLabel(230, 90, 0x26, guardList.Guards.Count.ToString());
AddHtmlLocalized(20, 120, 200, 25, 1011515, false, false); // Maximum :
AddHtmlLocalized(20, 120, 200, 25, 1011515); // Maximum :
AddLabel(230, 120, 0x12A, guardList.Definition.Maximum.ToString());
AddHtmlLocalized(20, 150, 200, 25, 1011516, false, false); // Cost :
AddHtmlLocalized(20, 150, 200, 25, 1011516); // Cost :
AddLabel(230, 150, 0x44, guardList.Definition.Price.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 200, 25, 1011517, false, false); // Daily Pay :
AddHtmlLocalized(20, 180, 200, 25, 1011517); // Daily Pay :
AddLabel(230, 180, 0x37, guardList.Definition.Upkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 210, 200, 25, 1011518, false, false); // Current Silver :
AddHtmlLocalized(20, 210, 200, 25, 1011518); // Current Silver :
AddLabel(230, 210, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 240, 200, 25, 1011519, false, false); // Current Payroll :
AddHtmlLocalized(20, 240, 200, 25, 1011519); // Current Payroll :
AddLabel(230, 240, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlText(55, 300, 200, 25, guardList.Definition.Label, false, false);
AddButton(20, 300, 4005, 4007, 1 + i, GumpButtonType.Reply, 0);
AddButton(20, 300, 4005, 4007, 1 + i);
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
}
@ -185,4 +185,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -24,20 +24,20 @@ namespace Server.Factions
AddHtmlText(25, 30, 250, 25, town.Definition.TownStoneHeader, false, false);
AddHtmlLocalized(55, 60, 150, 25, 1011557, false, false); // Hire Sheriff
AddButton(20, 60, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 60, 150, 25, 1011557); // Hire Sheriff
AddButton(20, 60, 4005, 4007, 1);
AddHtmlLocalized(55, 90, 150, 25, 1011559, false, false); // Hire Finance Minister
AddButton(20, 90, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 90, 150, 25, 1011559); // Hire Finance Minister
AddButton(20, 90, 4005, 4007, 2);
AddHtmlLocalized(55, 120, 150, 25, 1011558, false, false); // Fire Sheriff
AddButton(20, 120, 4005, 4007, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 120, 150, 25, 1011558); // Fire Sheriff
AddButton(20, 120, 4005, 4007, 3);
AddHtmlLocalized(55, 150, 150, 25, 1011560, false, false); // Fire Finance Minister
AddButton(20, 150, 4005, 4007, 4, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 150, 150, 25, 1011560); // Fire Finance Minister
AddButton(20, 150, 4005, 4007, 4);
AddHtmlLocalized(55, 210, 150, 25, 1011441, false, false); // EXIT
AddButton(20, 210, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 210, 150, 25, 1011441); // EXIT
AddButton(20, 210, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -201,4 +201,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -24,23 +24,23 @@ namespace Server.Factions
AddHtmlText(20, 20, 380, 20, election.Faction.Definition.Header, false, false);
if (canVote)
AddHtmlLocalized(20, 60, 380, 20, 1011428, false, false); // VOTE FOR LEADERSHIP
AddHtmlLocalized(20, 60, 380, 20, 1011428); // VOTE FOR LEADERSHIP
else
AddHtmlLocalized(20, 60, 380, 20, 1038032, false, false); // You have already voted in this election.
AddHtmlLocalized(20, 60, 380, 20, 1038032); // You have already voted in this election.
for (int i = 0; i < election.Candidates.Count; ++i)
{
Candidate cd = election.Candidates[i];
if (canVote)
AddButton(20, 100 + i * 20, 4005, 4007, i + 1, GumpButtonType.Reply, 0);
AddButton(20, 100 + i * 20, 4005, 4007, i + 1);
AddLabel(55, 100 + i * 20, 0, cd.Mobile.Name);
AddLabel(300, 100 + i * 20, 0, cd.Votes.ToString());
}
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 310, 100, 20, 1011012, false, false); // CANCEL
AddButton(20, 310, 4005, 4007, 0);
AddHtmlLocalized(55, 310, 100, 20, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -63,4 +63,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -8,7 +8,7 @@ namespace Server.Factions
private Sigil m_Sigil;
private Town m_Town;
public BaseMonolith(Town town, Faction faction) : base(0x1183)
public BaseMonolith(Town town = null, Faction faction = null) : base(0x1183)
{
Movable = false;
Town = town;
@ -80,7 +80,7 @@ namespace Server.Factions
public virtual void UpdateSigil()
{
if (m_Sigil == null || m_Sigil.Deleted)
if (m_Sigil?.Deleted != false)
return;
m_Sigil.MoveToWorld(new Point3D(X, Y, Z + 18), Map);
@ -126,4 +126,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -8,12 +8,7 @@ namespace Server.Factions
private Faction m_Faction;
[Constructible]
public FactionStone() : this(null)
{
}
[Constructible]
public FactionStone(Faction faction) : base(0xEDC)
public FactionStone(Faction faction = null) : base(0xEDC)
{
Movable = false;
Faction = faction;
@ -101,4 +96,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -8,12 +8,7 @@ namespace Server.Factions
private Faction m_Faction;
[Constructible]
public JoinStone() : this(null)
{
}
[Constructible]
public JoinStone(Faction faction) : base(0xEDC)
public JoinStone(Faction faction = null) : base(0xEDC)
{
Movable = false;
Faction = faction;
@ -76,4 +71,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Factions;
using Server.Spells;
using Server.Targeting;
@ -34,64 +35,61 @@ namespace Server
Point3D origin = new Point3D(pt);
Map facet = from.Map;
if (facet != null && facet.CanFit(pt.X, pt.Y, pt.Z, 16, false, false))
{
Movable = false;
if (facet?.CanFit(pt.X, pt.Y, pt.Z, 16, false, false) != true)
return;
Effects.SendMovingEffect(
from, new Entity(Serial.Zero, origin, facet),
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
Movable = false;
Effects.SendMovingEffect(
from, new Entity(Serial.Zero, origin, facet),
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
);
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
{
Delete();
Effects.PlaySound(origin, facet, 530);
Effects.PlaySound(origin, facet, 263);
Effects.SendLocationEffect(
origin, facet,
14284, 96, 1, 0, 2
);
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
{
Delete();
List<Mobile> targets = facet.GetMobilesInRange(origin, 12).Where(mob =>
from.CanBeHarmful(mob, false) && mob.InLOS(new Point3D(origin, origin.Z + 1)) &&
Faction.Find(mob) != null).ToList();
Effects.PlaySound(origin, facet, 530);
Effects.PlaySound(origin, facet, 263);
Effects.SendLocationEffect(
origin, facet,
14284, 96, 1, 0, 2
);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
foreach (Mobile mob in targets)
{
List<Mobile> targets = new List<Mobile>();
int damage = mob.Hits * 6 / 10;
foreach (Mobile mob in facet.GetMobilesInRange(origin, 12))
if (from.CanBeHarmful(mob, false) &&
mob.InLOS(new Point3D(origin, origin.Z + 1)))
if (Faction.Find(mob) != null)
targets.Add(mob);
if (!mob.Player && damage < 10)
damage = 10;
else if (damage > 75)
damage = 75;
foreach (Mobile mob in targets)
{
int damage = mob.Hits * 6 / 10;
Effects.SendMovingEffect(
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
14068, 1, 32, false, false, 1111, 2
);
if (!mob.Player && damage < 10)
damage = 10;
else if (damage > 75) damage = 75;
from.DoHarmful(mob);
Effects.SendMovingEffect(
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
14068, 1, 32, false, false, 1111, 2
);
SpellHelper.Damage(TimeSpan.FromSeconds(0.50), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
from.DoHarmful(mob);
SpellHelper.Damage(TimeSpan.FromSeconds(0.50), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
}
});
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
}
});
}
});
}
});
@ -112,4 +110,4 @@ namespace Server
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -36,7 +36,7 @@ namespace Server
{
Faction.ClearSkillLoss(mob);
mob.SendGump(new ResurrectGump(mob, from, ResurrectMessage.Generic));
mob.SendGump(new ResurrectGump(mob, from));
used = true;
}
}

Some files were not shown because too many files have changed in this diff Show more