fix: Converts ConfirmRelease, Tithing, Young gumps to static (#1854)
This commit is contained in:
parent
8b1014f395
commit
ed0ce4a292
5 changed files with 238 additions and 227 deletions
|
|
@ -1,45 +1,52 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class ConfirmReleaseGump : StaticGump<ConfirmReleaseGump>
|
||||
{
|
||||
public class ConfirmReleaseGump : Gump
|
||||
private readonly Mobile _from;
|
||||
private readonly BaseCreature _pet;
|
||||
|
||||
public ConfirmReleaseGump(Mobile from, BaseCreature pet) : base(50, 50)
|
||||
{
|
||||
private readonly Mobile m_From;
|
||||
private readonly BaseCreature m_Pet;
|
||||
_from = from;
|
||||
_pet = pet;
|
||||
}
|
||||
|
||||
public ConfirmReleaseGump(Mobile from, BaseCreature pet) : base(50, 50)
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
builder.AddPage();
|
||||
|
||||
builder.AddBackground(0, 0, 270, 120, 5054);
|
||||
builder.AddBackground(10, 10, 250, 100, 3000);
|
||||
|
||||
// Are you sure you want to release your pet?
|
||||
builder.AddHtmlLocalized(20, 15, 230, 60, 1046257, true, true);
|
||||
|
||||
builder.AddButton(20, 80, 4005, 4007, 2);
|
||||
builder.AddHtmlLocalized(55, 80, 75, 20, 1011011); // CONTINUE
|
||||
|
||||
builder.AddButton(135, 80, 4005, 4007, 1);
|
||||
builder.AddHtmlLocalized(170, 80, 75, 20, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void SendTo(NetState ns)
|
||||
{
|
||||
_from.CloseGump<ConfirmReleaseGump>();
|
||||
base.SendTo(ns);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID != 2 || _pet.Deleted ||
|
||||
!(_pet.Controlled && _from == _pet.ControlMaster &&
|
||||
_from.CheckAlive() && _pet.Map == _from.Map && _pet.InRange(_from, 14)))
|
||||
{
|
||||
m_From = from;
|
||||
m_Pet = pet;
|
||||
|
||||
m_From.CloseGump<ConfirmReleaseGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 270, 120, 5054);
|
||||
AddBackground(10, 10, 250, 100, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 15, 230, 60, 1046257, true, true); // Are you sure you want to release your pet?
|
||||
|
||||
AddButton(20, 80, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 80, 75, 20, 1011011); // CONTINUE
|
||||
|
||||
AddButton(135, 80, 4005, 4007, 1);
|
||||
AddHtmlLocalized(170, 80, 75, 20, 1011012); // CANCEL
|
||||
return;
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID != 2 || m_Pet.Deleted ||
|
||||
!(m_Pet.Controlled && m_From == m_Pet.ControlMaster &&
|
||||
m_From.CheckAlive() && m_Pet.Map == m_From.Map && m_Pet.InRange(m_From, 14)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_Pet.ControlTarget = null;
|
||||
m_Pet.ControlOrder = OrderType.Release;
|
||||
}
|
||||
_pet.ControlTarget = null;
|
||||
_pet.ControlOrder = OrderType.Release;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,125 +2,129 @@ using System;
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class TithingGump : StaticGump<TithingGump>
|
||||
{
|
||||
public class TithingGump : Gump
|
||||
// TODO: What's the maximum?
|
||||
private const int MaxTitheAmount = 100000;
|
||||
private readonly Mobile _from;
|
||||
private int _offer;
|
||||
|
||||
public TithingGump(Mobile from) : base(160, 40) => _from = from;
|
||||
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
private readonly Mobile m_From;
|
||||
private int m_Offer;
|
||||
builder.AddPage();
|
||||
|
||||
public TithingGump(Mobile from, int offer) : base(160, 40)
|
||||
builder.AddImage(30, 30, 102);
|
||||
|
||||
// May your wealth bring blessings to those in need, if tithed upon this most sacred site.
|
||||
builder.AddHtmlLocalized(95, 100, 120, 100, 1060198, 0);
|
||||
|
||||
builder.AddHtmlLocalized(57, 274, 50, 20, 3000311); // Gold:
|
||||
// AddLabel(57, 274, 0, "Gold:");
|
||||
builder.AddLabelPlaceholder(87, 274, 53, "goldOffer");
|
||||
|
||||
builder.AddHtmlLocalized(57, 274, 50, 20, 1079251); // Tithe:
|
||||
// AddLabel(137, 274, 0, "Tithe:");
|
||||
builder.AddLabelPlaceholder(172, 274, 53, "titheOffer");
|
||||
|
||||
builder.AddButton(105, 230, 5220, 5220, 2);
|
||||
builder.AddButton(113, 230, 5222, 5222, 2);
|
||||
builder.AddLabel(108, 228, 0, "<");
|
||||
builder.AddLabel(112, 228, 0, "<");
|
||||
|
||||
builder.AddButton(127, 230, 5223, 5223, 1);
|
||||
builder.AddLabel(131, 228, 0, "<");
|
||||
|
||||
builder.AddButton(147, 230, 5224, 5224, 3);
|
||||
builder.AddLabel(153, 228, 0, ">");
|
||||
|
||||
builder.AddButton(168, 230, 5220, 5220, 4);
|
||||
builder.AddButton(176, 230, 5222, 5222, 4);
|
||||
builder.AddLabel(172, 228, 0, ">");
|
||||
builder.AddLabel(176, 228, 0, ">");
|
||||
|
||||
builder.AddButton(217, 272, 4023, 4024, 5);
|
||||
}
|
||||
|
||||
protected override void BuildStrings(ref GumpStringsBuilder builder)
|
||||
{
|
||||
var totalGold = _from.TotalGold;
|
||||
|
||||
// Just in case
|
||||
_offer = Math.Clamp(_offer, 0, totalGold);
|
||||
|
||||
builder.SetStringSlot("goldOffer", (totalGold - _offer).ToString("N0"));
|
||||
builder.SetStringSlot("titheOffer", _offer.ToString("N0"));
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
var totalGold = from.TotalGold;
|
||||
case 0:
|
||||
{
|
||||
// You have decided to tithe no gold to the shrine.
|
||||
_from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
_offer = info.ButtonID switch
|
||||
{
|
||||
1 => _offer - 100,
|
||||
2 => 0,
|
||||
3 => _offer + 100,
|
||||
4 => _from.TotalGold,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
offer = Math.Clamp(offer, 0, totalGold);
|
||||
_from.SendGump(this);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
var totalGold = _from.TotalGold;
|
||||
|
||||
m_From = from;
|
||||
m_Offer = offer;
|
||||
_offer = Math.Clamp(_offer, 0, totalGold);
|
||||
|
||||
AddPage(0);
|
||||
if (_from.TithingPoints + _offer > MaxTitheAmount)
|
||||
{
|
||||
_offer = MaxTitheAmount - _from.TithingPoints;
|
||||
}
|
||||
|
||||
AddImage(30, 30, 102);
|
||||
|
||||
AddHtmlLocalized(
|
||||
95,
|
||||
100,
|
||||
120,
|
||||
100,
|
||||
1060198,
|
||||
0
|
||||
); // May your wealth bring blessings to those in need, if tithed upon this most sacred site.
|
||||
|
||||
AddLabel(57, 274, 0, "Gold:");
|
||||
AddLabel(87, 274, 53, (totalGold - offer).ToString());
|
||||
|
||||
AddLabel(137, 274, 0, "Tithe:");
|
||||
AddLabel(172, 274, 53, offer.ToString());
|
||||
|
||||
AddButton(105, 230, 5220, 5220, 2);
|
||||
AddButton(113, 230, 5222, 5222, 2);
|
||||
AddLabel(108, 228, 0, "<");
|
||||
AddLabel(112, 228, 0, "<");
|
||||
|
||||
AddButton(127, 230, 5223, 5223, 1);
|
||||
AddLabel(131, 228, 0, "<");
|
||||
|
||||
AddButton(147, 230, 5224, 5224, 3);
|
||||
AddLabel(153, 228, 0, ">");
|
||||
|
||||
AddButton(168, 230, 5220, 5220, 4);
|
||||
AddButton(176, 230, 5222, 5222, 4);
|
||||
AddLabel(172, 228, 0, ">");
|
||||
AddLabel(176, 228, 0, ">");
|
||||
|
||||
AddButton(217, 272, 4023, 4024, 5);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
if (_offer <= 0)
|
||||
{
|
||||
// You have decided to tithe no gold to the shrine.
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
|
||||
_from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
|
||||
var pack = _from.Backpack;
|
||||
|
||||
// TODO: At some point this was changed on OSI to only work from bank/account funds
|
||||
if (pack?.ConsumeTotal(typeof(Gold), _offer) == true)
|
||||
{
|
||||
var offer = info.ButtonID switch
|
||||
{
|
||||
1 => m_Offer - 100,
|
||||
2 => 0,
|
||||
3 => m_Offer + 100,
|
||||
4 => m_From.TotalGold,
|
||||
_ => 0
|
||||
};
|
||||
// You tithe gold to the shrine as a sign of devotion.
|
||||
_from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060195);
|
||||
_from.TithingPoints += _offer;
|
||||
|
||||
m_From.SendGump(new TithingGump(m_From, offer));
|
||||
break;
|
||||
_from.PlaySound(0x243);
|
||||
_from.PlaySound(0x2E6);
|
||||
}
|
||||
case 5:
|
||||
else
|
||||
{
|
||||
var totalGold = m_From.TotalGold;
|
||||
|
||||
m_Offer = Math.Clamp(m_Offer, 0, totalGold);
|
||||
|
||||
if (m_From.TithingPoints + m_Offer > 100000) // TODO: What's the maximum?
|
||||
{
|
||||
m_Offer = 100000 - m_From.TithingPoints;
|
||||
}
|
||||
|
||||
if (m_Offer <= 0)
|
||||
{
|
||||
// You have decided to tithe no gold to the shrine.
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
|
||||
break;
|
||||
}
|
||||
|
||||
var pack = m_From.Backpack;
|
||||
|
||||
if (pack?.ConsumeTotal(typeof(Gold), m_Offer) == true)
|
||||
{
|
||||
// You tithe gold to the shrine as a sign of devotion.
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060195);
|
||||
m_From.TithingPoints += m_Offer;
|
||||
|
||||
m_From.PlaySound(0x243);
|
||||
m_From.PlaySound(0x2E6);
|
||||
}
|
||||
else
|
||||
{
|
||||
// You do not have enough gold to tithe that amount!
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060194);
|
||||
}
|
||||
|
||||
break;
|
||||
// You do not have enough gold to tithe that amount!
|
||||
_from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060194);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,101 +1,101 @@
|
|||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class YoungDungeonWarningGump : StaticGump<YoungDungeonWarningGump>
|
||||
{
|
||||
public class YoungDungeonWarning : Gump
|
||||
public YoungDungeonWarningGump() : base(150, 200)
|
||||
{
|
||||
public YoungDungeonWarning() : base(150, 200)
|
||||
{
|
||||
AddBackground(0, 0, 250, 170, 0xA28);
|
||||
|
||||
AddHtmlLocalized(
|
||||
20,
|
||||
43,
|
||||
215,
|
||||
70,
|
||||
1018030,
|
||||
true,
|
||||
true
|
||||
); // Warning: monsters may attack you on site down here in the dungeons!
|
||||
|
||||
AddButton(70, 123, 0xFA5, 0xFA7, 0);
|
||||
AddHtmlLocalized(105, 125, 100, 35, 1011036); // OKAY
|
||||
}
|
||||
}
|
||||
|
||||
public class YoungDeathNotice : Gump
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
public YoungDeathNotice() : base(100, 15)
|
||||
{
|
||||
Closable = false;
|
||||
builder.AddBackground(0, 0, 250, 170, 0xA28);
|
||||
|
||||
AddBackground(25, 10, 425, 444, 0x13BE);
|
||||
// Warning: monsters may attack you on site down here in the dungeons!
|
||||
builder.AddHtmlLocalized(20, 43, 215, 70, 1018030, true, true);
|
||||
|
||||
AddImageTiled(33, 20, 407, 425, 0xA40);
|
||||
AddAlphaRegion(33, 20, 407, 425);
|
||||
|
||||
AddHtmlLocalized(190, 24, 120, 20, 1046287, 0x7D00); // You have died.
|
||||
|
||||
// As a ghost you cannot interact with the world. You cannot touch items nor can you use them.
|
||||
AddHtmlLocalized(50, 50, 380, 40, 1046288, 0x7FFF);
|
||||
// You can pass through doors as though they do not exist. However, you cannot pass through walls.
|
||||
AddHtmlLocalized(50, 100, 380, 45, 1046289, 0x7FFF);
|
||||
// Since you are a new player, any items you had on your person at the time of your death will be in your backpack upon resurrection.
|
||||
AddHtmlLocalized(50, 140, 380, 60, 1046291, 0x7FFF);
|
||||
// To be resurrected you must find a healer in town or wandering in the wilderness. Some powerful players may also be able to resurrect you.
|
||||
AddHtmlLocalized(50, 204, 380, 65, 1046292, 0x7FFF);
|
||||
// While you are still in young status, you will be transported to the nearest healer (along with your items) at the time of your death.
|
||||
AddHtmlLocalized(50, 269, 380, 65, 1046293, 0x7FFF);
|
||||
// To rejoin the world of the living simply walk near one of the NPC healers, and they will resurrect you as long as you are not marked as a criminal.
|
||||
AddHtmlLocalized(50, 334, 380, 70, 1046294, 0x7FFF);
|
||||
|
||||
AddButton(195, 410, 0xF8, 0xF9, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public class RenounceYoungGump : Gump
|
||||
{
|
||||
public RenounceYoungGump() : base(150, 50)
|
||||
{
|
||||
AddBackground(0, 0, 450, 400, 0xA28);
|
||||
|
||||
AddHtmlLocalized(0, 30, 450, 35, 1013004); // <center> Renouncing 'Young Player' Status</center>
|
||||
|
||||
/* As a 'Young' player, you are currently under a system of protection that prevents
|
||||
* you from being attacked by other players and certain monsters.<br><br>
|
||||
*
|
||||
* If you choose to renounce your status as a 'Young' player, you will lose this protection.
|
||||
* You will become vulnerable to other players, and many monsters that had only glared
|
||||
* at you menacingly before will now attack you on sight!<br><br>
|
||||
*
|
||||
* Select OKAY now if you wish to renounce your status as a 'Young' player, otherwise
|
||||
* press CANCEL.
|
||||
*/
|
||||
AddHtmlLocalized(30, 70, 390, 210, 1013005, true, true);
|
||||
|
||||
AddButton(45, 298, 0xFA5, 0xFA7, 1);
|
||||
AddHtmlLocalized(78, 300, 100, 35, 1011036); // OKAY
|
||||
|
||||
AddButton(178, 298, 0xFA5, 0xFA7, 0);
|
||||
AddHtmlLocalized(211, 300, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
var from = sender.Mobile;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
if (from.Account is Account acc)
|
||||
{
|
||||
acc.RemoveYoungStatus(502085); // You have chosen to renounce your `Young' player status.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502086); // You have chosen not to renounce your `Young' player status.
|
||||
}
|
||||
}
|
||||
builder.AddButton(70, 123, 0xFA5, 0xFA7, 0);
|
||||
builder.AddHtmlLocalized(105, 125, 100, 35, 1011036); // OKAY
|
||||
}
|
||||
}
|
||||
|
||||
public class YoungDeathNoticeGump : StaticGump<YoungDeathNoticeGump>
|
||||
{
|
||||
public YoungDeathNoticeGump() : base(100, 15)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
builder.SetNoClose();
|
||||
|
||||
builder.AddBackground(25, 10, 425, 444, 0x13BE);
|
||||
|
||||
builder.AddImageTiled(33, 20, 407, 425, 0xA40);
|
||||
builder.AddAlphaRegion(33, 20, 407, 425);
|
||||
|
||||
builder.AddHtmlLocalized(190, 24, 120, 20, 1046287, 0x7D00); // You have died.
|
||||
|
||||
// As a ghost you cannot interact with the world. You cannot touch items nor can you use them.
|
||||
builder.AddHtmlLocalized(50, 50, 380, 40, 1046288, 0x7FFF);
|
||||
// You can pass through doors as though they do not exist. However, you cannot pass through walls.
|
||||
builder.AddHtmlLocalized(50, 100, 380, 45, 1046289, 0x7FFF);
|
||||
// Since you are a new player, any items you had on your person at the time of your death will be in your backpack upon resurrection.
|
||||
builder.AddHtmlLocalized(50, 140, 380, 60, 1046291, 0x7FFF);
|
||||
// To be resurrected you must find a healer in town or wandering in the wilderness. Some powerful players may also be able to resurrect you.
|
||||
builder.AddHtmlLocalized(50, 204, 380, 65, 1046292, 0x7FFF);
|
||||
// While you are still in young status, you will be transported to the nearest healer (along with your items) at the time of your death.
|
||||
builder.AddHtmlLocalized(50, 269, 380, 65, 1046293, 0x7FFF);
|
||||
// To rejoin the world of the living simply walk near one of the NPC healers, and they will resurrect you as long as you are not marked as a criminal.
|
||||
builder.AddHtmlLocalized(50, 334, 380, 70, 1046294, 0x7FFF);
|
||||
|
||||
builder.AddButton(195, 410, 0xF8, 0xF9, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public class RenounceYoungGump : StaticGump<RenounceYoungGump>
|
||||
{
|
||||
public RenounceYoungGump() : base(150, 50)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
builder.AddBackground(0, 0, 450, 400, 0xA28);
|
||||
|
||||
builder.AddHtmlLocalized(0, 30, 450, 35, 1013004); // <center> Renouncing 'Young Player' Status</center>
|
||||
|
||||
/* As a 'Young' player, you are currently under a system of protection that prevents
|
||||
* you from being attacked by other players and certain monsters.<br><br>
|
||||
*
|
||||
* If you choose to renounce your status as a 'Young' player, you will lose this protection.
|
||||
* You will become vulnerable to other players, and many monsters that had only glared
|
||||
* at you menacingly before will now attack you on sight!<br><br>
|
||||
*
|
||||
* Select OKAY now if you wish to renounce your status as a 'Young' player, otherwise
|
||||
* press CANCEL.
|
||||
*/
|
||||
builder.AddHtmlLocalized(30, 70, 390, 210, 1013005, true, true);
|
||||
|
||||
builder.AddButton(45, 298, 0xFA5, 0xFA7, 1);
|
||||
builder. AddHtmlLocalized(78, 300, 100, 35, 1011036); // OKAY
|
||||
|
||||
builder.AddButton(178, 298, 0xFA5, 0xFA7, 0);
|
||||
builder.AddHtmlLocalized(211, 300, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
var from = sender.Mobile;
|
||||
|
||||
if (info.ButtonID != 1)
|
||||
{
|
||||
from.SendLocalizedMessage(502086); // You have chosen not to renounce your `Young' player status.
|
||||
return;
|
||||
}
|
||||
|
||||
(from.Account as Account)?.RemoveYoungStatus(502085); // You have chosen to renounce your `Young' player status.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4431,7 +4431,7 @@ namespace Server.Mobiles
|
|||
|
||||
private void SendYoungDeathNotice()
|
||||
{
|
||||
SendGump(new YoungDeathNotice());
|
||||
SendGump(new YoungDeathNoticeGump());
|
||||
}
|
||||
|
||||
public override void OnSpeech(SpeechEventArgs e)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class BaseRegion : Region
|
|||
{
|
||||
if (m is PlayerMobile mobile && mobile.Young && !YoungProtected)
|
||||
{
|
||||
mobile.SendGump(new YoungDungeonWarning());
|
||||
mobile.SendGump(new YoungDungeonWarningGump());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue