fix: Converts ConfirmHouseResizeGump, ConfirmDryDockGump to StaticGump (#1909)

### Summary
- Converts ConfirmHouseResizeGump, ConfirmDryDockGump to StaticGump
- ConfirmHouseResizeGump now supports the account gold system.
This commit is contained in:
Guyute 2024-08-07 19:54:45 -04:00 committed by GitHub
parent f5c980b28f
commit 883d873c1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 170 additions and 205 deletions

View file

@ -1,172 +0,0 @@
using Server.Guilds;
using Server.Items;
using Server.Multis;
using Server.Network;
namespace Server.Gumps
{
public class ConfirmHouseResize : Gump
{
private readonly BaseHouse m_House;
private readonly Mobile m_Mobile;
public ConfirmHouseResize(Mobile mobile, BaseHouse house) : base(110, 100)
{
m_Mobile = mobile;
m_House = house;
mobile.CloseGump<ConfirmHouseResize>();
Closable = false;
AddPage(0);
AddBackground(0, 0, 420, 280, 0x13BE);
AddImageTiled(10, 10, 400, 20, 0xA40);
AddAlphaRegion(10, 10, 400, 20);
AddHtmlLocalized(10, 10, 400, 20, 1060635, 0x7800); // <CENTER>WARNING</CENTER>
AddImageTiled(10, 40, 400, 200, 0xA40);
AddAlphaRegion(10, 40, 400, 200);
/* You are attempting to resize 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, however,
only this account will be able to place on the land for one hour. This *will*
circumvent the normal 7-day waiting period (if it applies to you). This action
will not un-condemn any other houses on your account. If you have other,
grandfathered houses, this action *WILL* condemn them. Are you sure you wish
to continue?*/
AddHtmlLocalized(10, 40, 400, 200, 1080196, 0x7F00, false, true);
AddImageTiled(10, 250, 400, 20, 0xA40);
AddAlphaRegion(10, 250, 400, 20);
AddButton(10, 250, 0xFA5, 0xFA7, 1);
AddButton(210, 250, 0xFA5, 0xFA7, 0);
AddHtmlLocalized(40, 250, 170, 20, 1011036, 0x7FFF); // OKAY
AddHtmlLocalized(240, 250, 170, 20, 1011012, 0x7FFF); // 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)
{
m_Mobile.SendLocalizedMessage(
1080455
); // You can not resize your house at this time. Please remove all items fom the moving crate and try again.
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)
{
m_Mobile.SendLocalizedMessage(
1062679
); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
return;
}
if (m_House.HasRentedVendors)
{
m_Mobile.SendLocalizedMessage(
1062680
); // You cannot do that that while you still have contract vendors in your house.
return;
}
if (m_House.VendorInventories.Count > 0)
{
m_Mobile.SendLocalizedMessage(
1062681
); // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
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);
new TempNoHousingRegion(m_House, 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);
}
}
if (toGive != null)
{
var box = m_Mobile.BankBox;
if (box.TryDropItem(m_Mobile, toGive, false))
{
if (toGive is BankCheck check)
{
m_Mobile.SendLocalizedMessage(
1060397,
check.Worth.ToString()
); // ~1_AMOUNT~ gold has been deposited into your bank box.
}
m_House.RemoveKeys(m_Mobile);
new TempNoHousingRegion(m_House, 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.
}
}
else if (info.ButtonID == 0)
{
m_Mobile.CloseGump<ConfirmHouseResize>();
m_Mobile.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, m_Mobile, m_House));
}
}
}
}

View file

@ -0,0 +1,139 @@
using Server.Guilds;
using Server.Items;
using Server.Mobiles;
using Server.Multis;
using Server.Network;
namespace Server.Gumps;
public class ConfirmHouseResizeGump : StaticGump<ConfirmHouseResizeGump>
{
private readonly BaseHouse _house;
public ConfirmHouseResizeGump(BaseHouse house) : base(110, 100) => _house = house;
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.SetNoClose();
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);
/*
* You are attempting to resize 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, however,
* only this account will be able to place on the land for one hour. This *will*
* circumvent the normal 7-day waiting period (if it applies to you). This action
* will not un-condemn any other houses on your account. If you have other,
* grandfathered houses, this action *WILL* condemn them. Are you sure you wish
* to continue?
*/
builder.AddHtmlLocalized(10, 40, 400, 200, 1080196, 0x7F00, false, true);
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
}
public override void OnResponse(NetState state, in RelayInfo info)
{
if (info.ButtonID > 1 || _house.Deleted)
{
return;
}
var from = state.Mobile;
if (info.ButtonID == 0)
{
from.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, from, _house));
return;
}
if (!_house.IsOwner(from))
{
from.SendLocalizedMessage(501320); // Only the house owner may do this.
return;
}
if (_house.MovingCrate != null || _house.InternalizedVendors.Count > 0)
{
// You can not resize your house at this time. Please remove all items fom the moving crate and try again.
from.SendLocalizedMessage(1080455);
return;
}
if (!Guild.NewGuildSystem && _house.FindGuildstone() != null)
{
from.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
return;
}
/*
if (_house.PlayerVendors.Count > 0)
{
from.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.
from.SendLocalizedMessage(1062679);
return;
}
if (_house.HasRentedVendors)
{
// You cannot do that that while you still have contract vendors in your house.
from.SendLocalizedMessage(1062680);
return;
}
if (_house.VendorInventories.Count > 0)
{
// You cannot do that that while you still have unclaimed contract vendor inventory in your house.
from.SendLocalizedMessage(1062681);
return;
}
if (from.AccessLevel > AccessLevel.Player)
{
from.SendMessage("You do not get a refund for your house as you are not a player.");
}
else
{
var toGive = !_house.IsAosRules || _house.Price <= 0 ? _house.GetDeed() : null;
if (toGive != null && !from.BankBox.TryDropItem(from, toGive, false))
{
toGive.Delete();
from.SendLocalizedMessage(500390); // Your bank box is full.
return;
}
if (_house.Price <= 0 || !Banker.Deposit(from, _house.Price))
{
from.SendMessage("Unable to refund house.");
return;
}
// ~1_AMOUNT~ gold has been deposited into your bank box.
from.SendLocalizedMessage(1060397, _house.Price.ToString());
}
_house.RemoveKeys(from);
new TempNoHousingRegion(_house, from);
_house.Delete();
}
}

View file

@ -707,7 +707,7 @@ namespace Server.Multis
}
else if (result == DryDockResult.Valid)
{
from.SendGump(new ConfirmDryDockGump(from, this));
from.SendGump(new ConfirmDryDockGump(this));
}
}

View file

@ -1,40 +1,38 @@
using Server.Gumps;
using Server.Network;
namespace Server.Multis
namespace Server.Multis;
public class ConfirmDryDockGump : StaticGump<ConfirmDryDockGump>
{
public class ConfirmDryDockGump : Gump
private readonly BaseBoat _boat;
public ConfirmDryDockGump(BaseBoat boat) : base(150, 200)
{
private readonly BaseBoat m_Boat;
private readonly Mobile m_From;
_boat = boat;
}
public ConfirmDryDockGump(Mobile from, BaseBoat boat) : base(150, 200)
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.AddPage();
builder.AddBackground(0, 0, 220, 170, 5054);
builder.AddBackground(10, 10, 200, 150, 3000);
builder.AddHtmlLocalized(20, 20, 180, 80, 1018319, true); // Do you wish to dry dock this boat?
builder.AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
builder.AddButton(20, 100, 4005, 4007, 2);
builder.AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
builder.AddButton(20, 125, 4005, 4007, 1);
}
public override void OnResponse(NetState state, in RelayInfo info)
{
if (info.ButtonID == 2)
{
m_From = from;
m_Boat = boat;
m_From.CloseGump<ConfirmDryDockGump>();
AddPage(0);
AddBackground(0, 0, 220, 170, 5054);
AddBackground(10, 10, 200, 150, 3000);
AddHtmlLocalized(20, 20, 180, 80, 1018319, true); // Do you wish to dry dock this boat?
AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
AddButton(20, 100, 4005, 4007, 2);
AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
AddButton(20, 125, 4005, 4007, 1);
}
public override void OnResponse(NetState state, in RelayInfo info)
{
if (info.ButtonID == 2)
{
m_Boat.EndDryDock(m_From);
}
_boat.EndDryDock(state.Mobile);
}
}
}

View file

@ -254,9 +254,9 @@ public class HouseRegion : BaseRegion
}
else if (isOwner)
{
from.CloseGump<ConfirmHouseResize>();
from.CloseGump<ConfirmHouseResizeGump>();
from.CloseGump<HouseGumpAOS>();
from.SendGump(new ConfirmHouseResize(from, House));
from.SendGump(new ConfirmHouseResizeGump(House));
}
else
{