fix: Convert house gumps to static/dynamic gumps (#1912)
This commit is contained in:
parent
aa68d96807
commit
12a75d3c9c
12 changed files with 462 additions and 476 deletions
|
|
@ -1,181 +0,0 @@
|
|||
using Server.Accounting;
|
||||
using Server.Guilds;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HouseDemolishGump : Gump
|
||||
{
|
||||
private readonly BaseHouse m_House;
|
||||
private readonly Mobile m_Mobile;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public HouseDemolishGump(Mobile mobile, BaseHouse house) : base(110, 100)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_House = house;
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 420, 280, 5054);
|
||||
|
||||
AddImageTiled(10, 10, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 10, 400, 20);
|
||||
|
||||
AddHtmlLocalized(10, 10, 400, 20, 1060635, 30720); // <CENTER>WARNING</CENTER>
|
||||
|
||||
AddImageTiled(10, 40, 400, 200, 2624);
|
||||
AddAlphaRegion(10, 40, 400, 200);
|
||||
|
||||
/* You are about to demolish your house.
|
||||
* You will be refunded the house's value directly to your bank box.
|
||||
* All items in the house will remain behind and can be freely picked up by anyone.
|
||||
* Once the house is demolished, anyone can attempt to place a new house on the vacant land.
|
||||
* This action will not un-condemn any other houses on your account, nor will it end your 7-day waiting period (if it applies to you).
|
||||
* Are you sure you wish to continue?
|
||||
*/
|
||||
AddHtmlLocalized(10, 40, 400, 200, 1061795, 32512, false, true);
|
||||
|
||||
AddImageTiled(10, 250, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
AddButton(10, 250, 4005, 4007, 1);
|
||||
AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
AddButton(210, 250, 4005, 4007, 0);
|
||||
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && !m_House.Deleted)
|
||||
{
|
||||
if (m_House.IsOwner(m_Mobile))
|
||||
{
|
||||
if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Guild.NewGuildSystem && m_House.FindGuildstone() != null)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
|
||||
return;
|
||||
}
|
||||
|
||||
/*else if (m_House.PlayerVendors.Count > 0)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
|
||||
return;
|
||||
}*/
|
||||
if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
|
||||
{
|
||||
// You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
|
||||
m_Mobile.SendLocalizedMessage(1062679);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_House.HasRentedVendors)
|
||||
{
|
||||
// You cannot do that that while you still have contract vendors in your house.
|
||||
m_Mobile.SendLocalizedMessage(1062680);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_House.VendorInventories.Count > 0)
|
||||
{
|
||||
// You cannot do that that while you still have unclaimed contract vendor inventory in your house.
|
||||
m_Mobile.SendLocalizedMessage(1062681);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
|
||||
m_House.RemoveKeys(m_Mobile);
|
||||
m_House.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
Item toGive;
|
||||
|
||||
if (m_House.IsAosRules)
|
||||
{
|
||||
if (m_House.Price > 0)
|
||||
{
|
||||
toGive = new BankCheck(m_House.Price);
|
||||
}
|
||||
else
|
||||
{
|
||||
toGive = m_House.GetDeed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
toGive = m_House.GetDeed();
|
||||
|
||||
if (toGive == null && m_House.Price > 0)
|
||||
{
|
||||
toGive = new BankCheck(m_House.Price);
|
||||
}
|
||||
}
|
||||
|
||||
var check = toGive as BankCheck;
|
||||
|
||||
if (AccountGold.Enabled && check != null)
|
||||
{
|
||||
var worth = check.Worth;
|
||||
|
||||
if (m_Mobile.Account?.DepositGold(worth) == true)
|
||||
{
|
||||
check.Delete();
|
||||
|
||||
// ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
m_Mobile.SendLocalizedMessage(1060397, $"{worth:#,0}");
|
||||
|
||||
m_House.RemoveKeys(m_Mobile);
|
||||
m_House.Delete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (toGive != null)
|
||||
{
|
||||
var box = m_Mobile.BankBox;
|
||||
|
||||
if (box.TryDropItem(m_Mobile, toGive, false))
|
||||
{
|
||||
if (check != null)
|
||||
{
|
||||
// ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
m_Mobile.SendLocalizedMessage(1060397, check.Worth.ToString());
|
||||
}
|
||||
|
||||
m_House.RemoveKeys(m_Mobile);
|
||||
m_House.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
toGive.Delete();
|
||||
m_Mobile.SendLocalizedMessage(500390); // Your bank box is full.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendMessage("Unable to refund house.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HouseTransferGump : Gump
|
||||
{
|
||||
private readonly Mobile m_From;
|
||||
private readonly BaseHouse m_House;
|
||||
private readonly Mobile m_To;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public HouseTransferGump(Mobile from, Mobile to, BaseHouse house) : base(110, 100)
|
||||
{
|
||||
m_From = from;
|
||||
m_To = to;
|
||||
m_House = house;
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 420, 280, 5054);
|
||||
|
||||
AddImageTiled(10, 10, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 10, 400, 20);
|
||||
|
||||
AddHtmlLocalized(10, 10, 400, 20, 1060635, 30720); // <CENTER>WARNING</CENTER>
|
||||
|
||||
AddImageTiled(10, 40, 400, 200, 2624);
|
||||
AddAlphaRegion(10, 40, 400, 200);
|
||||
|
||||
/* Another player is attempting to initiate a house trade with you.
|
||||
* In order for you to see this window, both you and the other person are standing within two paces of the house to be traded.
|
||||
* If you click OKAY below, a house trade scroll will appear in your trade window and you can complete the transaction.
|
||||
* This scroll is a distinctive blue color and will show the name of the house, the name of the owner of that house, and the sextant coordinates of the center of the house when you hover your mouse over it.
|
||||
* In order for the transaction to be successful, you both must accept the trade and you both must remain within two paces of the house sign.
|
||||
* <BR><BR>Accepting this house in trade will <a href = "?ForceTopic97">condemn</a> any and all of your other houses that you may have.
|
||||
* All of your houses on <U>all shards</U> will be affected.
|
||||
* <BR><BR>In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.<BR><BR>
|
||||
* Once you accept these terms, these effects cannot be reversed.
|
||||
* Re-deeding or transferring your new house will <U>not</U> uncondemn your other house(s) nor will the one week timer be removed.<BR><BR>
|
||||
* If you are absolutely certain you wish to proceed, click the button next to OKAY below.
|
||||
* If you do not wish to trade for this house, click CANCEL.
|
||||
*/
|
||||
AddHtmlLocalized(10, 40, 400, 200, 1062086, 32512, false, true);
|
||||
|
||||
AddImageTiled(10, 250, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
AddButton(10, 250, 4005, 4007, 1);
|
||||
AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
AddButton(210, 250, 4005, 4007, 0);
|
||||
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && !m_House.Deleted)
|
||||
{
|
||||
m_House.EndConfirmTransfer(m_From, m_To);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
Projects/UOContent/Gumps/Houses/AcceptHouseTransferGump.cs
Normal file
68
Projects/UOContent/Gumps/Houses/AcceptHouseTransferGump.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class AcceptHouseTransferGump : StaticGump<AcceptHouseTransferGump>
|
||||
{
|
||||
private readonly Mobile _transferor;
|
||||
private readonly BaseHouse _house;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public AcceptHouseTransferGump(Mobile transferor, BaseHouse house) : base(110, 100)
|
||||
{
|
||||
_transferor = transferor;
|
||||
_house = house;
|
||||
}
|
||||
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
builder.SetNoClose();
|
||||
|
||||
builder.AddPage();
|
||||
|
||||
builder.AddBackground(0, 0, 420, 280, 5054);
|
||||
|
||||
builder.AddImageTiled(10, 10, 400, 20, 2624);
|
||||
builder.AddAlphaRegion(10, 10, 400, 20);
|
||||
|
||||
builder.AddHtmlLocalized(10, 10, 400, 20, 1060635, 30720); // <CENTER>WARNING</CENTER>
|
||||
|
||||
builder.AddImageTiled(10, 40, 400, 200, 2624);
|
||||
builder.AddAlphaRegion(10, 40, 400, 200);
|
||||
|
||||
/*
|
||||
* Another player is attempting to initiate a house trade with you.
|
||||
* In order for you to see this window, both you and the other person are standing within two paces of the house to be traded.
|
||||
* If you click OKAY below, a house trade scroll will appear in your trade window and you can complete the transaction.
|
||||
* This scroll is a distinctive blue color and will show the name of the house, the name of the owner of that house, and the sextant coordinates of the center of the house when you hover your mouse over it.
|
||||
* In order for the transaction to be successful, you both must accept the trade and you both must remain within two paces of the house sign.
|
||||
* <BR><BR>Accepting this house in trade will <a href = "?ForceTopic97">condemn</a> any and all of your other houses that you may have.
|
||||
* All of your houses on <U>all shards</U> will be affected.
|
||||
* <BR><BR>In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.<BR><BR>
|
||||
* Once you accept these terms, these effects cannot be reversed.
|
||||
* Re-deeding or transferring your new house will <U>not</U> uncondemn your other house(s) nor will the one week timer be removed.<BR><BR>
|
||||
* If you are absolutely certain you wish to proceed, click the button next to OKAY below.
|
||||
* If you do not wish to trade for this house, click CANCEL.
|
||||
*/
|
||||
builder.AddHtmlLocalized(10, 40, 400, 200, 1062086, 32512, false, true);
|
||||
|
||||
builder.AddImageTiled(10, 250, 400, 20, 2624);
|
||||
builder.AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
builder.AddButton(10, 250, 4005, 4007, 1);
|
||||
builder.AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
builder.AddButton(210, 250, 4005, 4007, 0);
|
||||
builder.AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && !_house.Deleted)
|
||||
{
|
||||
_house.EndConfirmTransfer(_transferor, state.Mobile);
|
||||
}
|
||||
}
|
||||
}
|
||||
134
Projects/UOContent/Gumps/Houses/ConfirmDemolishHouseGump.cs
Normal file
134
Projects/UOContent/Gumps/Houses/ConfirmDemolishHouseGump.cs
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
using Server.Guilds;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class ConfirmDemolishHouseGump : StaticGump<ConfirmDemolishHouseGump>
|
||||
{
|
||||
private readonly BaseHouse _house;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public ConfirmDemolishHouseGump(BaseHouse house) : base(110, 100) => _house = house;
|
||||
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
builder.SetNoClose();
|
||||
|
||||
builder.AddPage();
|
||||
|
||||
builder.AddBackground(0, 0, 420, 280, 5054);
|
||||
|
||||
builder.AddImageTiled(10, 10, 400, 20, 2624);
|
||||
builder.AddAlphaRegion(10, 10, 400, 20);
|
||||
|
||||
builder.AddHtmlLocalized(10, 10, 400, 20, 1060635, 30720); // <CENTER>WARNING</CENTER>
|
||||
|
||||
builder.AddImageTiled(10, 40, 400, 200, 2624);
|
||||
builder.AddAlphaRegion(10, 40, 400, 200);
|
||||
|
||||
/*
|
||||
* You are about to demolish your house.
|
||||
* You will be refunded the house's value directly to your bank box.
|
||||
* All items in the house will remain behind and can be freely picked up by anyone.
|
||||
* Once the house is demolished, anyone can attempt to place a new house on the vacant land.
|
||||
* This action will not un-condemn any other houses on your account, nor will it end your 7-day waiting period (if it applies to you).
|
||||
* Are you sure you wish to continue?
|
||||
*/
|
||||
builder.AddHtmlLocalized(10, 40, 400, 200, 1061795, 32512, false, true);
|
||||
|
||||
builder.AddImageTiled(10, 250, 400, 20, 2624);
|
||||
builder.AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
builder.AddButton(10, 250, 4005, 4007, 1);
|
||||
builder.AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
builder.AddButton(210, 250, 4005, 4007, 0);
|
||||
builder.AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID != 1 || _house.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_house.IsOwner(state.Mobile))
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_house.MovingCrate != null || _house.InternalizedVendors.Count > 0)
|
||||
{
|
||||
state.Mobile.SendLocalizedMessage(501320); // Only the house owner may do this.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Guild.NewGuildSystem && _house.FindGuildstone() != null)
|
||||
{
|
||||
state.Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
|
||||
return;
|
||||
}
|
||||
|
||||
/*else if (m_House.PlayerVendors.Count > 0)
|
||||
{
|
||||
state.Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
|
||||
return;
|
||||
}*/
|
||||
if (_house.HasRentedVendors && _house.VendorInventories.Count > 0)
|
||||
{
|
||||
// You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
|
||||
state.Mobile.SendLocalizedMessage(1062679);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_house.HasRentedVendors)
|
||||
{
|
||||
// You cannot do that that while you still have contract vendors in your house.
|
||||
state.Mobile.SendLocalizedMessage(1062680);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_house.VendorInventories.Count > 0)
|
||||
{
|
||||
// You cannot do that that while you still have unclaimed contract vendor inventory in your house.
|
||||
state.Mobile.SendLocalizedMessage(1062681);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.Mobile.AccessLevel > AccessLevel.Player)
|
||||
{
|
||||
state.Mobile.SendMessage("You do not get a refund for your house as you are not a player");
|
||||
_house.RemoveKeys(state.Mobile);
|
||||
_house.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
var toGive = !_house.IsAosRules || _house.Price <= 0 ? _house.GetDeed() : null;
|
||||
|
||||
if (toGive != null && !state.Mobile.BankBox.TryDropItem(state.Mobile, toGive, false))
|
||||
{
|
||||
toGive.Delete();
|
||||
state.Mobile.SendLocalizedMessage(500390); // Your bank box is full.
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_house.Price <= 0 || !Banker.Deposit(state.Mobile, _house.Price))
|
||||
{
|
||||
state.Mobile.SendMessage("Unable to refund house.");
|
||||
return;
|
||||
}
|
||||
|
||||
// ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
state.Mobile.SendLocalizedMessage(1060397, _house.Price.ToString());
|
||||
}
|
||||
|
||||
_house.RemoveKeys(state.Mobile);
|
||||
_house.Delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,13 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class ConfirmHouseResizeGump : StaticGump<ConfirmHouseResizeGump>
|
||||
public class ConfirmResizeHouseGump : StaticGump<ConfirmResizeHouseGump>
|
||||
{
|
||||
private readonly BaseHouse _house;
|
||||
|
||||
public ConfirmHouseResizeGump(BaseHouse house) : base(110, 100) => _house = house;
|
||||
public override bool Singleton => true;
|
||||
|
||||
public ConfirmResizeHouseGump(BaseHouse house) : base(110, 100) => _house = house;
|
||||
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
|
|
@ -18,9 +20,12 @@ public class ConfirmHouseResizeGump : StaticGump<ConfirmHouseResizeGump>
|
|||
builder.AddPage();
|
||||
|
||||
builder.AddBackground(0, 0, 420, 280, 0x13BE);
|
||||
|
||||
builder.AddImageTiled(10, 10, 400, 20, 0xA40);
|
||||
builder.AddAlphaRegion(10, 10, 400, 20);
|
||||
|
||||
builder.AddHtmlLocalized(10, 10, 400, 20, 1060635, 0x7800); // <CENTER>WARNING</CENTER>
|
||||
|
||||
builder.AddImageTiled(10, 40, 400, 200, 0xA40);
|
||||
builder.AddAlphaRegion(10, 40, 400, 200);
|
||||
|
||||
|
|
@ -38,8 +43,10 @@ public class ConfirmHouseResizeGump : StaticGump<ConfirmHouseResizeGump>
|
|||
|
||||
builder.AddImageTiled(10, 250, 400, 20, 0xA40);
|
||||
builder.AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
builder.AddButton(10, 250, 0xFA5, 0xFA7, 1);
|
||||
builder.AddButton(210, 250, 0xFA5, 0xFA7, 0);
|
||||
|
||||
builder.AddHtmlLocalized(40, 250, 170, 20, 1011036, 0x7FFF); // OKAY
|
||||
builder.AddHtmlLocalized(240, 250, 170, 20, 1011012, 0x7FFF); // CANCEL
|
||||
}
|
||||
|
|
@ -6,52 +6,61 @@ using Server.Prompts;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HouseListGump : Gump
|
||||
public class HouseListGump : DynamicGump
|
||||
{
|
||||
private readonly BaseHouse m_House;
|
||||
private readonly BaseHouse _house;
|
||||
private readonly bool _accountOf;
|
||||
private readonly List<Mobile> _list;
|
||||
private readonly int _number;
|
||||
|
||||
public HouseListGump(int number, List<Mobile> list, BaseHouse house, bool accountOf) : base(20, 30)
|
||||
{
|
||||
if (house.Deleted)
|
||||
_accountOf = accountOf;
|
||||
_list = list;
|
||||
_number = number;
|
||||
_house = house;
|
||||
}
|
||||
|
||||
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||
{
|
||||
if (_house.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_House = house;
|
||||
builder.AddPage();
|
||||
|
||||
AddPage(0);
|
||||
builder.AddBackground(0, 0, 420, 430, 5054);
|
||||
builder.AddBackground(10, 10, 400, 410, 3000);
|
||||
|
||||
AddBackground(0, 0, 420, 430, 5054);
|
||||
AddBackground(10, 10, 400, 410, 3000);
|
||||
builder.AddButton(20, 388, 4005, 4007, 0);
|
||||
builder.AddHtmlLocalized(55, 388, 300, 20, 1011104); // Return to previous menu
|
||||
|
||||
AddButton(20, 388, 4005, 4007, 0);
|
||||
AddHtmlLocalized(55, 388, 300, 20, 1011104); // Return to previous menu
|
||||
builder.AddHtmlLocalized(20, 20, 350, 20, _number);
|
||||
|
||||
AddHtmlLocalized(20, 20, 350, 20, number);
|
||||
|
||||
if (list == null)
|
||||
if (_list == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < list.Count; ++i)
|
||||
for (var i = 0; i < _list.Count; ++i)
|
||||
{
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, i / 16 + 1);
|
||||
builder.AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, i / 16 + 1);
|
||||
}
|
||||
|
||||
AddPage(i / 16 + 1);
|
||||
builder.AddPage(i / 16 + 1);
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(340, 20, 4014, 4016, 0, GumpButtonType.Page, i / 16);
|
||||
builder.AddButton(340, 20, 4014, 4016, 0, GumpButtonType.Page, i / 16);
|
||||
}
|
||||
}
|
||||
|
||||
var m = list[i];
|
||||
var m = _list[i];
|
||||
|
||||
string name;
|
||||
|
||||
|
|
@ -60,11 +69,11 @@ namespace Server.Gumps
|
|||
continue;
|
||||
}
|
||||
|
||||
AddLabel(
|
||||
builder.AddLabel(
|
||||
55,
|
||||
55 + i % 16 * 20,
|
||||
0,
|
||||
accountOf && m.Player && m.Account != null
|
||||
_accountOf && m.Player && m.Account != null
|
||||
? $"Account of {name}"
|
||||
: name
|
||||
);
|
||||
|
|
@ -73,24 +82,24 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
if (m_House.Deleted)
|
||||
if (_house.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var from = state.Mobile;
|
||||
|
||||
from.SendGump(new HouseGump(from, m_House));
|
||||
from.SendGump(new HouseGump(from, _house));
|
||||
}
|
||||
}
|
||||
|
||||
public class HouseRemoveGump : Gump
|
||||
public class HouseRemoveGump : DynamicGump
|
||||
{
|
||||
private readonly bool m_AccountOf;
|
||||
private readonly List<Mobile> m_Copy;
|
||||
private readonly BaseHouse m_House;
|
||||
private readonly List<Mobile> m_List;
|
||||
private readonly int m_Number;
|
||||
private readonly bool _accountOf;
|
||||
private readonly List<Mobile> _copy;
|
||||
private readonly BaseHouse _house;
|
||||
private readonly List<Mobile> _list;
|
||||
private readonly int _number;
|
||||
|
||||
public HouseRemoveGump(int number, List<Mobile> list, BaseHouse house, bool accountOf) : base(20, 30)
|
||||
{
|
||||
|
|
@ -99,49 +108,60 @@ namespace Server.Gumps
|
|||
return;
|
||||
}
|
||||
|
||||
m_House = house;
|
||||
m_List = list;
|
||||
m_Number = number;
|
||||
m_AccountOf = accountOf;
|
||||
_house = house;
|
||||
_list = list;
|
||||
_number = number;
|
||||
_accountOf = accountOf;
|
||||
|
||||
AddPage(0);
|
||||
if (list != null)
|
||||
{
|
||||
_copy = new List<Mobile>(list);
|
||||
}
|
||||
}
|
||||
|
||||
AddBackground(0, 0, 420, 430, 5054);
|
||||
AddBackground(10, 10, 400, 410, 3000);
|
||||
|
||||
AddButton(20, 388, 4005, 4007, 0);
|
||||
AddHtmlLocalized(55, 388, 300, 20, 1011104); // Return to previous menu
|
||||
|
||||
AddButton(20, 365, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 365, 300, 20, 1011270); // Remove now!
|
||||
|
||||
AddHtmlLocalized(20, 20, 350, 20, number);
|
||||
|
||||
if (list == null)
|
||||
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||
{
|
||||
if (_house.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_Copy = new List<Mobile>(list);
|
||||
builder.AddPage();
|
||||
|
||||
for (var i = 0; i < list.Count; ++i)
|
||||
builder.AddBackground(0, 0, 420, 430, 5054);
|
||||
builder.AddBackground(10, 10, 400, 410, 3000);
|
||||
|
||||
builder.AddButton(20, 388, 4005, 4007, 0);
|
||||
builder.AddHtmlLocalized(55, 388, 300, 20, 1011104); // Return to previous menu
|
||||
|
||||
builder.AddButton(20, 365, 4005, 4007, 1);
|
||||
builder.AddHtmlLocalized(55, 365, 300, 20, 1011270); // Remove now!
|
||||
|
||||
builder.AddHtmlLocalized(20, 20, 350, 20, _number);
|
||||
|
||||
if (_list == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < _list.Count; ++i)
|
||||
{
|
||||
if (i % 15 == 0)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, i / 15 + 1);
|
||||
builder.AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, i / 15 + 1);
|
||||
}
|
||||
|
||||
AddPage(i / 15 + 1);
|
||||
builder.AddPage(i / 15 + 1);
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(340, 20, 4014, 4016, 0, GumpButtonType.Page, i / 15);
|
||||
builder.AddButton(340, 20, 4014, 4016, 0, GumpButtonType.Page, i / 15);
|
||||
}
|
||||
}
|
||||
|
||||
var m = list[i];
|
||||
var m = _list[i];
|
||||
|
||||
string name;
|
||||
|
||||
|
|
@ -150,12 +170,12 @@ namespace Server.Gumps
|
|||
continue;
|
||||
}
|
||||
|
||||
AddCheck(34, 52 + i % 15 * 20, 0xD2, 0xD3, false, i);
|
||||
AddLabel(
|
||||
builder.AddCheckbox(34, 52 + i % 15 * 20, 0xD2, 0xD3, false, i);
|
||||
builder.AddLabel(
|
||||
55,
|
||||
52 + i % 15 * 20,
|
||||
0,
|
||||
accountOf && m.Player && m.Account != null
|
||||
_accountOf && m.Player && m.Account != null
|
||||
? $"Account of {name}"
|
||||
: name
|
||||
);
|
||||
|
|
@ -164,14 +184,14 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
if (m_House.Deleted)
|
||||
if (_house.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var from = state.Mobile;
|
||||
|
||||
if (m_List != null && info.ButtonID == 1) // Remove now
|
||||
if (_list != null && info.ButtonID == 1) // Remove now
|
||||
{
|
||||
var switches = info.Switches;
|
||||
|
||||
|
|
@ -181,32 +201,32 @@ namespace Server.Gumps
|
|||
{
|
||||
var index = switches[i];
|
||||
|
||||
if (index >= 0 && index < m_Copy.Count)
|
||||
if (index >= 0 && index < _copy.Count)
|
||||
{
|
||||
m_List.Remove(m_Copy[index]);
|
||||
_list.Remove(_copy[index]);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_List.Count > 0)
|
||||
if (_list.Count > 0)
|
||||
{
|
||||
var gumps = from.GetGumps();
|
||||
|
||||
gumps.Close<HouseGump>();
|
||||
gumps.Close<HouseListGump>();
|
||||
gumps.Close<HouseRemoveGump>();
|
||||
gumps.Send(new HouseRemoveGump(m_Number, m_List, m_House, m_AccountOf));
|
||||
gumps.Send(new HouseRemoveGump(_number, _list, _house, _accountOf));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
from.SendGump(new HouseGump(from, m_House));
|
||||
from.SendGump(new HouseGump(from, _house));
|
||||
}
|
||||
}
|
||||
|
||||
public class HouseGump : Gump
|
||||
{
|
||||
private readonly BaseHouse m_House;
|
||||
private readonly BaseHouse _house;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
|
|
@ -217,7 +237,7 @@ namespace Server.Gumps
|
|||
return;
|
||||
}
|
||||
|
||||
m_House = house;
|
||||
_house = house;
|
||||
|
||||
var gumps = from.GetGumps();
|
||||
|
||||
|
|
@ -226,9 +246,9 @@ namespace Server.Gumps
|
|||
|
||||
var isCombatRestricted = house.IsCombatRestricted(from);
|
||||
|
||||
var isOwner = m_House.IsOwner(from);
|
||||
var isCoOwner = isOwner || m_House.IsCoOwner(from);
|
||||
var isFriend = isCoOwner || m_House.IsFriend(from);
|
||||
var isOwner = _house.IsOwner(from);
|
||||
var isCoOwner = isOwner || _house.IsCoOwner(from);
|
||||
var isFriend = isCoOwner || _house.IsFriend(from);
|
||||
|
||||
if (isCombatRestricted)
|
||||
{
|
||||
|
|
@ -245,9 +265,9 @@ namespace Server.Gumps
|
|||
|
||||
AddImage(130, 0, 100);
|
||||
|
||||
if (m_House.Sign != null)
|
||||
if (_house.Sign != null)
|
||||
{
|
||||
var lines = m_House.Sign.GetName().Wrap(10, 6);
|
||||
var lines = _house.Sign.GetName().Wrap(10, 6);
|
||||
|
||||
for (int i = 0, y = (101 - lines.Count * 14) / 2; i < lines.Count; ++i, y += 14)
|
||||
{
|
||||
|
|
@ -284,25 +304,25 @@ namespace Server.Gumps
|
|||
AddHtml(120, 135, 100, 20, GetOwnerName());
|
||||
|
||||
AddHtmlLocalized(20, 170, 275, 20, 1011237); // Number of locked down items:
|
||||
AddHtml(320, 170, 50, 20, m_House.LockDownCount.ToString());
|
||||
AddHtml(320, 170, 50, 20, _house.LockDownCount.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 190, 275, 20, 1011238); // Maximum locked down items:
|
||||
AddHtml(320, 190, 50, 20, m_House.MaxLockDowns.ToString());
|
||||
AddHtml(320, 190, 50, 20, _house.MaxLockDowns.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 210, 275, 20, 1011239); // Number of secure containers:
|
||||
AddHtml(320, 210, 50, 20, m_House.SecureCount.ToString());
|
||||
AddHtml(320, 210, 50, 20, _house.SecureCount.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 230, 275, 20, 1011240); // Maximum number of secure containers:
|
||||
AddHtml(320, 230, 50, 20, m_House.MaxSecures.ToString());
|
||||
AddHtml(320, 230, 50, 20, _house.MaxSecures.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 260, 400, 20, 1018032); // This house is properly placed.
|
||||
AddHtmlLocalized(20, 280, 400, 20, 1018035); // This house is of modern design.
|
||||
|
||||
if (m_House.Public)
|
||||
if (_house.Public)
|
||||
{
|
||||
// TODO: Validate exact placement
|
||||
AddHtmlLocalized(20, 305, 275, 20, 1011241); // Number of visits this building has had
|
||||
AddHtml(320, 305, 50, 20, m_House.Visits.ToString());
|
||||
AddHtml(320, 305, 50, 20, _house.Visits.ToString());
|
||||
}
|
||||
|
||||
// Friends page
|
||||
|
|
@ -353,7 +373,7 @@ namespace Server.Gumps
|
|||
AddHtmlLocalized(45, 180, 355, 30, 1011249); // Demolish house and get deed back
|
||||
AddButton(20, 180, 2714, 2715, 15);
|
||||
|
||||
if (!m_House.Public)
|
||||
if (!_house.Public)
|
||||
{
|
||||
AddHtmlLocalized(45, 210, 355, 30, 1011247); // Change the house locks
|
||||
AddButton(20, 210, 2714, 2715, 16);
|
||||
|
|
@ -409,7 +429,7 @@ namespace Server.Gumps
|
|||
|
||||
private string GetOwnerName()
|
||||
{
|
||||
var m = m_House.Owner;
|
||||
var m = _house.Owner;
|
||||
|
||||
if (m == null)
|
||||
{
|
||||
|
|
@ -428,18 +448,18 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
if (m_House.Deleted)
|
||||
if (_house.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var from = sender.Mobile;
|
||||
|
||||
var isCombatRestricted = m_House.IsCombatRestricted(from);
|
||||
var isCombatRestricted = _house.IsCombatRestricted(from);
|
||||
|
||||
var isOwner = m_House.IsOwner(from);
|
||||
var isCoOwner = isOwner || m_House.IsCoOwner(from);
|
||||
var isFriend = isCoOwner || m_House.IsFriend(from);
|
||||
var isOwner = _house.IsOwner(from);
|
||||
var isCoOwner = isOwner || _house.IsCoOwner(from);
|
||||
var isFriend = isCoOwner || _house.IsFriend(from);
|
||||
|
||||
if (isCombatRestricted)
|
||||
{
|
||||
|
|
@ -451,7 +471,7 @@ namespace Server.Gumps
|
|||
return;
|
||||
}
|
||||
|
||||
Item sign = m_House.Sign;
|
||||
Item sign = _house.Sign;
|
||||
|
||||
if (sign == null || from.Map != sign.Map || !from.InRange(sign.GetWorldLocation(), 18))
|
||||
{
|
||||
|
|
@ -464,7 +484,7 @@ namespace Server.Gumps
|
|||
{
|
||||
case 1: // Rename sign
|
||||
{
|
||||
from.Prompt = new RenamePrompt(m_House);
|
||||
from.Prompt = new RenamePrompt(_house);
|
||||
from.SendLocalizedMessage(501302); // What dost thou wish the sign to say?
|
||||
|
||||
break;
|
||||
|
|
@ -474,7 +494,7 @@ namespace Server.Gumps
|
|||
gumps.Close<HouseGump>();
|
||||
gumps.Close<HouseRemoveGump>();
|
||||
gumps.Close<HouseListGump>();
|
||||
gumps.Send(new HouseListGump(1011275, m_House.CoOwners, m_House, false));
|
||||
gumps.Send(new HouseListGump(1011275, _house.CoOwners, _house, false));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -485,7 +505,7 @@ namespace Server.Gumps
|
|||
from.SendLocalizedMessage(
|
||||
501328
|
||||
); // Target the person you wish to name a co-owner of your household.
|
||||
from.Target = new CoOwnerTarget(true, m_House);
|
||||
from.Target = new CoOwnerTarget(true, _house);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -501,7 +521,7 @@ namespace Server.Gumps
|
|||
gumps.Close<HouseGump>();
|
||||
gumps.Close<HouseListGump>();
|
||||
gumps.Close<HouseRemoveGump>();
|
||||
gumps.Send(new HouseRemoveGump(1011274, m_House.CoOwners, m_House, false));
|
||||
gumps.Send(new HouseRemoveGump(1011274, _house.CoOwners, _house, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -514,7 +534,7 @@ namespace Server.Gumps
|
|||
{
|
||||
if (isOwner)
|
||||
{
|
||||
m_House.CoOwners?.Clear();
|
||||
_house.CoOwners?.Clear();
|
||||
|
||||
from.SendLocalizedMessage(501333); // All co-owners have been removed from this house.
|
||||
}
|
||||
|
|
@ -530,7 +550,7 @@ namespace Server.Gumps
|
|||
gumps.Close<HouseGump>();
|
||||
gumps.Close<HouseRemoveGump>();
|
||||
gumps.Close<HouseListGump>();
|
||||
gumps.Send(new HouseListGump(1011273, m_House.Friends, m_House, false));
|
||||
gumps.Send(new HouseListGump(1011273, _house.Friends, _house, false));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -541,7 +561,7 @@ namespace Server.Gumps
|
|||
from.SendLocalizedMessage(
|
||||
501317
|
||||
); // Target the person you wish to name a friend of your household.
|
||||
from.Target = new HouseFriendTarget(true, m_House);
|
||||
from.Target = new HouseFriendTarget(true, _house);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -557,7 +577,7 @@ namespace Server.Gumps
|
|||
gumps.Close<HouseGump>();
|
||||
gumps.Close<HouseListGump>();
|
||||
gumps.Close<HouseRemoveGump>();
|
||||
gumps.Send(new HouseRemoveGump(1011272, m_House.Friends, m_House, false));
|
||||
gumps.Send(new HouseRemoveGump(1011272, _house.Friends, _house, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -570,7 +590,7 @@ namespace Server.Gumps
|
|||
{
|
||||
if (isCoOwner)
|
||||
{
|
||||
m_House.Friends?.Clear();
|
||||
_house.Friends?.Clear();
|
||||
|
||||
from.SendLocalizedMessage(501332); // All friends have been removed from this house.
|
||||
}
|
||||
|
|
@ -584,14 +604,14 @@ namespace Server.Gumps
|
|||
case 10: // Ban
|
||||
{
|
||||
from.SendLocalizedMessage(501325); // Target the individual to ban from this house.
|
||||
from.Target = new HouseBanTarget(true, m_House);
|
||||
from.Target = new HouseBanTarget(true, _house);
|
||||
|
||||
break;
|
||||
}
|
||||
case 11: // Eject
|
||||
{
|
||||
from.SendLocalizedMessage(501326); // Target the individual to eject from this house.
|
||||
from.Target = new HouseKickTarget(m_House);
|
||||
from.Target = new HouseKickTarget(_house);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -600,7 +620,7 @@ namespace Server.Gumps
|
|||
gumps.Close<HouseGump>();
|
||||
gumps.Close<HouseRemoveGump>();
|
||||
gumps.Close<HouseListGump>();
|
||||
gumps.Send(new HouseListGump(1011271, m_House.Bans, m_House, true));
|
||||
gumps.Send(new HouseListGump(1011271, _house.Bans, _house, true));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -609,7 +629,7 @@ namespace Server.Gumps
|
|||
gumps.Close<HouseGump>();
|
||||
gumps.Close<HouseListGump>();
|
||||
gumps.Close<HouseRemoveGump>();
|
||||
gumps.Send(new HouseRemoveGump(1011269, m_House.Bans, m_House, true));
|
||||
gumps.Send(new HouseRemoveGump(1011269, _house.Bans, _house, true));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -618,7 +638,7 @@ namespace Server.Gumps
|
|||
if (isOwner)
|
||||
{
|
||||
from.SendLocalizedMessage(501309); // Target the person to whom you wish to give this house.
|
||||
from.Target = new HouseOwnerTarget(m_House);
|
||||
from.Target = new HouseOwnerTarget(_house);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -631,13 +651,13 @@ namespace Server.Gumps
|
|||
{
|
||||
if (isOwner)
|
||||
{
|
||||
if (!Guild.NewGuildSystem && m_House.FindGuildstone() != null)
|
||||
if (!Guild.NewGuildSystem && _house.FindGuildstone() != null)
|
||||
{
|
||||
from.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
|
||||
}
|
||||
else
|
||||
{
|
||||
gumps.Send(new HouseDemolishGump(from, m_House));
|
||||
gumps.Send(new ConfirmDemolishHouseGump(_house));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -649,7 +669,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 16: // Change locks
|
||||
{
|
||||
if (m_House.Public)
|
||||
if (_house.Public)
|
||||
{
|
||||
from.SendLocalizedMessage(501669); // Public houses are always unlocked.
|
||||
}
|
||||
|
|
@ -657,8 +677,8 @@ namespace Server.Gumps
|
|||
{
|
||||
if (isOwner)
|
||||
{
|
||||
m_House.RemoveKeys(from);
|
||||
m_House.ChangeLocks(from);
|
||||
_house.RemoveKeys(from);
|
||||
_house.ChangeLocks(from);
|
||||
|
||||
from.SendLocalizedMessage(
|
||||
501306
|
||||
|
|
@ -676,7 +696,7 @@ namespace Server.Gumps
|
|||
{
|
||||
if (isOwner)
|
||||
{
|
||||
if (m_House.Public && m_House.PlayerVendors.Count > 0)
|
||||
if (_house.Public && _house.PlayerVendors.Count > 0)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
501887
|
||||
|
|
@ -684,10 +704,10 @@ namespace Server.Gumps
|
|||
break;
|
||||
}
|
||||
|
||||
m_House.Public = !m_House.Public;
|
||||
if (!m_House.Public)
|
||||
_house.Public = !_house.Public;
|
||||
if (!_house.Public)
|
||||
{
|
||||
m_House.ChangeLocks(from);
|
||||
_house.ChangeLocks(from);
|
||||
|
||||
from.SendLocalizedMessage(501888); // This house is now private.
|
||||
from.SendLocalizedMessage(
|
||||
|
|
@ -696,8 +716,8 @@ namespace Server.Gumps
|
|||
}
|
||||
else
|
||||
{
|
||||
m_House.RemoveKeys(from);
|
||||
m_House.RemoveLocks();
|
||||
_house.RemoveKeys(from);
|
||||
_house.RemoveLocks();
|
||||
from.SendLocalizedMessage(
|
||||
501886
|
||||
); // This house is now public. Friends of the house my now have vendors working out of this building.
|
||||
|
|
@ -714,13 +734,13 @@ namespace Server.Gumps
|
|||
{
|
||||
if (isOwner)
|
||||
{
|
||||
if (m_House.Public && info.Switches.Length > 0)
|
||||
if (_house.Public && info.Switches.Length > 0)
|
||||
{
|
||||
var index = info.Switches[0] - 1;
|
||||
|
||||
if (index >= 0 && index < 53)
|
||||
{
|
||||
m_House.ChangeSignType(2980 + index * 2);
|
||||
_house.ChangeSignType(2980 + index * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ namespace Server.Gumps
|
|||
private List<Mobile> m_List;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
|
||||
public HouseGumpAOS(HouseGumpPageAOS page, Mobile from, BaseHouse house) : base(50, 40)
|
||||
{
|
||||
m_House = house;
|
||||
|
|
@ -1425,7 +1425,7 @@ namespace Server.Gumps
|
|||
}
|
||||
else
|
||||
{
|
||||
from.SendGump(new HouseDemolishGump(from, m_House), true);
|
||||
from.SendGump(new ConfirmDemolishHouseGump(m_House));
|
||||
}
|
||||
}
|
||||
|
||||
94
Projects/UOContent/Gumps/Houses/SetSecureLevelGump.cs
Normal file
94
Projects/UOContent/Gumps/Houses/SetSecureLevelGump.cs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Server.Guilds;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps;
|
||||
|
||||
public interface ISecurable
|
||||
{
|
||||
SecureLevel Level { get; set; }
|
||||
}
|
||||
|
||||
public class SetSecureLevelGump : DynamicGump
|
||||
{
|
||||
private readonly ISecurable _info;
|
||||
private readonly BaseHouse _house;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public SetSecureLevelGump(ISecurable info, BaseHouse house) : base(50, 50)
|
||||
{
|
||||
_house = house;
|
||||
_info = info;
|
||||
}
|
||||
|
||||
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||
{
|
||||
builder.AddPage();
|
||||
|
||||
var offset = Guild.NewGuildSystem ? 20 : 0;
|
||||
|
||||
builder.AddBackground(0, 0, 220, 160 + offset, 5054);
|
||||
|
||||
builder.AddImageTiled(10, 10, 200, 20, 5124);
|
||||
builder.AddImageTiled(10, 40, 200, 20, 5124);
|
||||
builder.AddImageTiled(10, 70, 200, 80 + offset, 5124);
|
||||
|
||||
builder.AddAlphaRegion(10, 10, 200, 140);
|
||||
|
||||
builder.AddHtmlLocalized(10, 10, 200, 20, 1061276, 32767); // <CENTER>SET ACCESS</CENTER>
|
||||
builder.AddHtmlLocalized(10, 40, 100, 20, 1041474, 32767); // Owner:
|
||||
|
||||
builder.AddLabel(110, 40, 1152, _house.Owner.Name.DefaultIfNullOrEmpty(""));
|
||||
|
||||
builder.AddButton(10, 70, GetFirstID(SecureLevel.Owner), 4007, 1);
|
||||
builder.AddHtmlLocalized(45, 70, 150, 20, 1061277, GetColor(SecureLevel.Owner)); // Owner Only
|
||||
|
||||
builder.AddButton(10, 90, GetFirstID(SecureLevel.CoOwners), 4007, 2);
|
||||
builder.AddHtmlLocalized(45, 90, 150, 20, 1061278, GetColor(SecureLevel.CoOwners)); // Co-Owners
|
||||
|
||||
builder.AddButton(10, 110, GetFirstID(SecureLevel.Friends), 4007, 3);
|
||||
builder.AddHtmlLocalized(45, 110, 150, 20, 1061279, GetColor(SecureLevel.Friends)); // Friends
|
||||
|
||||
var houseOwner = _house.Owner;
|
||||
// Only the actual House owner AND guild master can set guild secures
|
||||
if (Guild.NewGuildSystem && houseOwner?.Guild is Guild guild && guild.Leader == houseOwner)
|
||||
{
|
||||
builder.AddButton(10, 130, GetFirstID(SecureLevel.Guild), 4007, 5);
|
||||
builder.AddHtmlLocalized(45, 130, 150, 20, 1063455, GetColor(SecureLevel.Guild)); // Guild Members
|
||||
}
|
||||
|
||||
builder.AddButton(10, 130 + offset, GetFirstID(SecureLevel.Anyone), 4007, 4);
|
||||
builder.AddHtmlLocalized(45, 130 + offset, 150, 20, 1061626, GetColor(SecureLevel.Anyone)); // Anyone
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private int GetColor(SecureLevel level) => _info.Level == level ? 0x7F18 : 0x7FFF;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private int GetFirstID(SecureLevel level) => _info.Level == level ? 4006 : 4005;
|
||||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
var level = info.ButtonID switch
|
||||
{
|
||||
1 => SecureLevel.Owner,
|
||||
2 => SecureLevel.CoOwners,
|
||||
3 => SecureLevel.Friends,
|
||||
4 => SecureLevel.Anyone,
|
||||
5 => SecureLevel.Guild,
|
||||
_ => _info.Level
|
||||
};
|
||||
|
||||
if (_info.Level == level)
|
||||
{
|
||||
state.Mobile.SendLocalizedMessage(1061281); // Access level unchanged.
|
||||
}
|
||||
else
|
||||
{
|
||||
_info.Level = level;
|
||||
state.Mobile.SendLocalizedMessage(1061280); // New access level set.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
using Server.Guilds;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public interface ISecurable
|
||||
{
|
||||
SecureLevel Level { get; set; }
|
||||
}
|
||||
|
||||
public class SetSecureLevelGump : Gump
|
||||
{
|
||||
private readonly ISecurable m_Info;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public SetSecureLevelGump(Mobile owner, ISecurable info, BaseHouse house) : base(50, 50)
|
||||
{
|
||||
m_Info = info;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
var offset = Guild.NewGuildSystem ? 20 : 0;
|
||||
|
||||
AddBackground(0, 0, 220, 160 + offset, 5054);
|
||||
|
||||
AddImageTiled(10, 10, 200, 20, 5124);
|
||||
AddImageTiled(10, 40, 200, 20, 5124);
|
||||
AddImageTiled(10, 70, 200, 80 + offset, 5124);
|
||||
|
||||
AddAlphaRegion(10, 10, 200, 140);
|
||||
|
||||
AddHtmlLocalized(10, 10, 200, 20, 1061276, 32767); // <CENTER>SET ACCESS</CENTER>
|
||||
AddHtmlLocalized(10, 40, 100, 20, 1041474, 32767); // Owner:
|
||||
|
||||
AddLabel(110, 40, 1152, owner == null ? "" : owner.Name);
|
||||
|
||||
AddButton(10, 70, GetFirstID(SecureLevel.Owner), 4007, 1);
|
||||
AddHtmlLocalized(45, 70, 150, 20, 1061277, GetColor(SecureLevel.Owner)); // Owner Only
|
||||
|
||||
AddButton(10, 90, GetFirstID(SecureLevel.CoOwners), 4007, 2);
|
||||
AddHtmlLocalized(45, 90, 150, 20, 1061278, GetColor(SecureLevel.CoOwners)); // Co-Owners
|
||||
|
||||
AddButton(10, 110, GetFirstID(SecureLevel.Friends), 4007, 3);
|
||||
AddHtmlLocalized(45, 110, 150, 20, 1061279, GetColor(SecureLevel.Friends)); // Friends
|
||||
|
||||
var houseOwner = house.Owner;
|
||||
if (Guild.NewGuildSystem && houseOwner?.Guild != null &&
|
||||
((Guild)houseOwner.Guild).Leader == houseOwner
|
||||
) // Only the actual House owner AND guild master can set guild secures
|
||||
{
|
||||
AddButton(10, 130, GetFirstID(SecureLevel.Guild), 4007, 5);
|
||||
AddHtmlLocalized(45, 130, 150, 20, 1063455, GetColor(SecureLevel.Guild)); // Guild Members
|
||||
}
|
||||
|
||||
AddButton(10, 130 + offset, GetFirstID(SecureLevel.Anyone), 4007, 4);
|
||||
AddHtmlLocalized(45, 130 + offset, 150, 20, 1061626, GetColor(SecureLevel.Anyone)); // Anyone
|
||||
}
|
||||
|
||||
public int GetColor(SecureLevel level) => m_Info.Level == level ? 0x7F18 : 0x7FFF;
|
||||
|
||||
public int GetFirstID(SecureLevel level) => m_Info.Level == level ? 4006 : 4005;
|
||||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
{
|
||||
var level = info.ButtonID switch
|
||||
{
|
||||
1 => SecureLevel.Owner,
|
||||
2 => SecureLevel.CoOwners,
|
||||
3 => SecureLevel.Friends,
|
||||
4 => SecureLevel.Anyone,
|
||||
5 => SecureLevel.Guild,
|
||||
_ => m_Info.Level
|
||||
};
|
||||
|
||||
if (m_Info.Level == level)
|
||||
{
|
||||
state.Mobile.SendLocalizedMessage(1061281); // Access level unchanged.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Info.Level = level;
|
||||
state.Mobile.SendLocalizedMessage(1061280); // New access level set.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -251,7 +251,7 @@ namespace Server.Gumps
|
|||
case 3:
|
||||
{
|
||||
m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection));
|
||||
m_From.SendGump(new HouseDemolishGump(m_From, m_Selection));
|
||||
m_From.SendGump(new ConfirmDemolishHouseGump(m_Selection));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2248,7 +2248,7 @@ namespace Server.Multis
|
|||
}
|
||||
else
|
||||
{
|
||||
to.SendGump(new HouseTransferGump(from, to, this));
|
||||
to.SendGump(new AcceptHouseTransferGump(from, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2271,22 +2271,22 @@ namespace Server.Multis
|
|||
}
|
||||
}
|
||||
|
||||
private void ConfirmTransfer_Callback(Mobile to, bool ok, Mobile from)
|
||||
private void ConfirmTransfer_Callback(Mobile transferee, bool ok, Mobile transferor)
|
||||
{
|
||||
if (!ok || Deleted || !from.CheckAlive() || !IsOwner(from))
|
||||
if (!ok || Deleted || !transferor.CheckAlive() || !IsOwner(transferor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (CheckTransferPosition(from, to))
|
||||
if (CheckTransferPosition(transferor, transferee))
|
||||
{
|
||||
to.SendGump(new HouseTransferGump(from, to, this));
|
||||
transferee.SendGump(new AcceptHouseTransferGump(transferor, this));
|
||||
}
|
||||
}
|
||||
|
||||
public void EndConfirmTransfer(Mobile from, Mobile to)
|
||||
public void EndConfirmTransfer(Mobile transferor, Mobile transferee)
|
||||
{
|
||||
if (Deleted || !from.CheckAlive() || !IsOwner(from))
|
||||
if (Deleted || !transferor.CheckAlive() || !IsOwner(transferor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -2294,42 +2294,42 @@ namespace Server.Multis
|
|||
if (NewVendorSystem && HasPersonalVendors)
|
||||
{
|
||||
// You cannot trade this house while you still have personal vendors inside.
|
||||
from.SendLocalizedMessage(1062467);
|
||||
transferor.SendLocalizedMessage(1062467);
|
||||
}
|
||||
else if (DecayLevel == DecayLevel.DemolitionPending)
|
||||
{
|
||||
// This house has been marked for demolition, and it cannot be transferred.
|
||||
from.SendLocalizedMessage(1005321);
|
||||
transferor.SendLocalizedMessage(1005321);
|
||||
}
|
||||
else if (from == to)
|
||||
else if (transferor == transferee)
|
||||
{
|
||||
from.SendLocalizedMessage(1005330); // You cannot transfer a house to yourself, silly.
|
||||
transferor.SendLocalizedMessage(1005330); // You cannot transfer a house to yourself, silly.
|
||||
}
|
||||
else if (HasAccountHouse(to))
|
||||
else if (HasAccountHouse(transferee))
|
||||
{
|
||||
from.SendLocalizedMessage(501388); // You cannot transfer ownership to another house owner or co-owner!
|
||||
transferor.SendLocalizedMessage(501388); // You cannot transfer ownership to another house owner or co-owner!
|
||||
}
|
||||
else if (CheckTransferPosition(from, to))
|
||||
else if (CheckTransferPosition(transferor, transferee))
|
||||
{
|
||||
var fromState = from.NetState;
|
||||
var toState = to.NetState;
|
||||
var fromState = transferor.NetState;
|
||||
var toState = transferee.NetState;
|
||||
|
||||
if (fromState != null && toState != null)
|
||||
{
|
||||
if (from.HasTrade)
|
||||
if (transferor.HasTrade)
|
||||
{
|
||||
// You cannot trade a house while you have other trades pending.
|
||||
from.SendLocalizedMessage(1062071);
|
||||
transferor.SendLocalizedMessage(1062071);
|
||||
}
|
||||
else if (to.HasTrade)
|
||||
else if (transferee.HasTrade)
|
||||
{
|
||||
// You cannot trade a house while you have other trades pending.
|
||||
to.SendLocalizedMessage(1062071);
|
||||
transferee.SendLocalizedMessage(1062071);
|
||||
}
|
||||
else if (!to.Alive)
|
||||
else if (!transferee.Alive)
|
||||
{
|
||||
// TODO: Check if the message is correct.
|
||||
from.SendLocalizedMessage(1062069); // You cannot transfer this house to that person.
|
||||
transferor.SendLocalizedMessage(1062069); // You cannot transfer this house to that person.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2399,7 +2399,7 @@ namespace Server.Multis
|
|||
|
||||
if (info != null)
|
||||
{
|
||||
m.SendGump(new SetSecureLevelGump(m_Owner, info, this));
|
||||
m.SendGump(new SetSecureLevelGump(info, this));
|
||||
}
|
||||
else if (item.Parent != null)
|
||||
{
|
||||
|
|
@ -2434,7 +2434,7 @@ namespace Server.Multis
|
|||
LockDowns.Remove(item);
|
||||
item.Movable = false;
|
||||
|
||||
m.SendGump(new SetSecureLevelGump(m_Owner, info, this));
|
||||
m.SendGump(new SetSecureLevelGump(info, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4364,7 +4364,7 @@ namespace Server.Multis
|
|||
|
||||
if (sec != null)
|
||||
{
|
||||
from.SendGump(new SetSecureLevelGump(from, sec, BaseHouse.FindHouseAt(item)));
|
||||
from.SendGump(new SetSecureLevelGump(sec, BaseHouse.FindHouseAt(item)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,9 +255,8 @@ public class HouseRegion : BaseRegion
|
|||
else if (isOwner)
|
||||
{
|
||||
var gumps = from.GetGumps();
|
||||
gumps.Close<ConfirmHouseResizeGump>();
|
||||
gumps.Close<HouseGumpAOS>();
|
||||
gumps.Send(new ConfirmHouseResizeGump(House));
|
||||
gumps.Send(new ConfirmResizeHouseGump(House));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue