fix: Adds static warning/notice gumps. (#1741)

### Summary
* Adds `StaticNoticeGump<T>` and `StaticWarningGump<T>`
* Converts NoticeGump/WarningGump to use `DynamicGump`
* Changes various uses of notice gump and warning gump to their static counterpart.
This commit is contained in:
Kamron Batman 2024-04-26 17:19:16 -07:00 committed by GitHub
parent 65532ea887
commit bb7bc57e42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 713 additions and 430 deletions

View file

@ -2240,22 +2240,8 @@ namespace Server.Multis
if (HasRentedVendors)
{
/* You are about to be traded a home that has active vendor contracts.
* While there are active vendor contracts in this house, you
* <strong>cannot</strong> demolish <strong>OR</strong> customize the home.
* When you accept this house, you also accept landlordship for every
* contract vendor in the house.
*/
to.SendGump(
new WarningGump(
1060635,
30720,
1062487,
32512,
420,
280,
okay => ConfirmTransfer_Callback(to, okay, from)
)
new TradeHouseWarningGump(okay => ConfirmTransfer_Callback(to, okay, from))
);
}
else
@ -2266,6 +2252,24 @@ namespace Server.Multis
}
}
private class TradeHouseWarningGump : StaticWarningGump<TradeHouseWarningGump>
{
/*
* You are about to be traded a home that has active vendor contracts.
* While there are active vendor contracts in this house, you
* <strong>cannot</strong> demolish <strong>OR</strong> customize the home.
* When you accept this house, you also accept landlordship for every contract vendor in the house.
*/
public override int StaticLocalizedContent => 1062487;
public override int Width => 420;
public override int Height => 280;
public TradeHouseWarningGump(Action<bool> callback) : base(callback)
{
}
}
private void ConfirmTransfer_Callback(Mobile to, bool ok, Mobile from)
{
if (!ok || Deleted || !from.CheckAlive() || !IsOwner(from))

View file

@ -1996,11 +1996,7 @@ namespace Server.Items
if (prevHouse.Deleted)
{
/* Too much time has passed and the test house you created has been deleted.
* Please try again!
*/
from.SendGump(new NoticeGump(1060637, 30720, 1060647, 32512, 320, 180));
from.SendGump(new HousePlacementTimeoutNoticeGump());
return;
}
@ -2040,18 +2036,15 @@ namespace Server.Items
{
if (Banker.Withdraw(from, Cost))
{
from.SendLocalizedMessage(
1060398,
Cost.ToString()
); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
// ~1_AMOUNT~ gold has been withdrawn from your bank box.
from.SendLocalizedMessage(1060398, Cost.ToString());
}
else
{
house.RemoveKeys(from);
house.Delete();
from.SendLocalizedMessage(
1060646
); // You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box.
// You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box.
from.SendLocalizedMessage(1060646);
return;
}
}
@ -2081,9 +2074,8 @@ namespace Server.Items
case HousePlacementResult.BadRegionHidden:
case HousePlacementResult.NoSurface:
{
from.SendLocalizedMessage(
1043287
); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
// The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
from.SendLocalizedMessage(1043287);
break;
}
case HousePlacementResult.BadRegion:
@ -2093,16 +2085,14 @@ namespace Server.Items
}
case HousePlacementResult.BadRegionTemp:
{
from.SendLocalizedMessage(
501270
); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
// Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
from.SendLocalizedMessage(501270);
break;
}
case HousePlacementResult.BadRegionRaffle:
{
from.SendLocalizedMessage(
1150493
); // You must have a deed for this plot of land in order to build here.
// You must have a deed for this plot of land in order to build here.
from.SendLocalizedMessage(1150493);
break;
}
case HousePlacementResult.InvalidCastleKeep:
@ -2170,28 +2160,8 @@ namespace Server.Items
prev.MoveToWorld(center, from.Map);
/* You are about to place a new house.
* Placing this house will condemn any and all of your other houses that you may have.
* All of your houses on all shards will be affected.
*
* In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
*
* Once you accept these terms, these effects cannot be reversed.
* Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
*
* 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.
*/
from.SendGump(
new WarningGump(
1060635,
30720,
1049583,
32512,
420,
280,
okay => PlacementWarning_Callback(from, okay, prev)
)
new CondemnWarningGump(okay => PlacementWarning_Callback(from, okay, prev))
);
return true;
@ -2205,9 +2175,8 @@ namespace Server.Items
case HousePlacementResult.BadRegionHidden:
case HousePlacementResult.NoSurface:
{
from.SendLocalizedMessage(
1043287
); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
// The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
from.SendLocalizedMessage(1043287);
break;
}
case HousePlacementResult.BadRegion:
@ -2217,16 +2186,14 @@ namespace Server.Items
}
case HousePlacementResult.BadRegionTemp:
{
from.SendLocalizedMessage(
501270
); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
// Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
from.SendLocalizedMessage(501270);
break;
}
case HousePlacementResult.BadRegionRaffle:
{
from.SendLocalizedMessage(
1150493
); // You must have a deed for this plot of land in order to build here.
// You must have a deed for this plot of land in order to build here.
from.SendLocalizedMessage(1150493);
break;
}
case HousePlacementResult.InvalidCastleKeep:
@ -2311,5 +2278,35 @@ namespace Server.Items
}
}
}
private class CondemnWarningGump : StaticWarningGump<CondemnWarningGump>
{
/*
* You are about to place a new house.
* Placing this house 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.
*/
public override int StaticLocalizedContent => 1049583;
public override int Width => 420;
public override int Height => 280;
public CondemnWarningGump(Action<bool> callback) : base(callback)
{
}
}
private class HousePlacementTimeoutNoticeGump : StaticWarningGump<HousePlacementTimeoutNoticeGump>
{
// Too much time has passed and the test house you created has been deleted. Please try again!
public override int StaticLocalizedContent => 1060647;
public override int Width => 320;
public override int Height => 180;
}
}
}

View file

@ -168,7 +168,7 @@ namespace Server.Multis
if (canClaim && !BaseHouse.HasAccountHouse(m))
{
m.SendGump(
new WarningGump(501036, 32512, 1049719, 32512, 420, 280, okay => ClaimGump_Callback(m, okay))
new ClaimHouseWarningGump(okay => ClaimGump_Callback(m, okay))
);
}
}
@ -176,6 +176,28 @@ namespace Server.Multis
ShowSign(m);
}
private class ClaimHouseWarningGump : StaticWarningGump<ClaimHouseWarningGump>
{
public override int Header => 501036; // Claim house
public override int HeaderColor => 0x7F00;
/*
* You do not currently own any house on any shard with this account, and this house currently does not have an owner.
* If you wish, you may choose to claim this house and become its rightful owner.
* If you do this, it will become your Primary house and automatically refresh.
* If you claim this house, you will be unable to place another house or have another house transferred to you for the next 7 days.
* Do you wish to claim this house?
*/
public override int StaticLocalizedContent => 1049719;
public override int Width => 420;
public override int Height => 280;
public ClaimHouseWarningGump(Action<bool> callback) : base(callback)
{
}
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);