Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 • committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -16,7 +16,7 @@ namespace Server.Gumps
{
public enum AdminGumpPage
{
Information_General = 0,
Information_General,
Information_Perf,
Administer,
Clients,
@ -39,8 +39,7 @@ namespace Server.Gumps
AccountDetails_Tags,
AccountDetails_ChangePassword,
AccountDetails_ChangeAccess,
FirewallInfo,
Invalid = -1
FirewallInfo
}
public class AdminGump : Gump
@ -588,7 +587,8 @@ namespace Server.Gumps
}
case AdminGumpPage.Accounts:
{
m_List ??= new List<object>();
if (m_List == null)
m_List = new List<object>();
List<Account> rads = state as List<Account>;
@ -1182,10 +1182,11 @@ namespace Server.Gumps
if (totalBytes > 1000000)
return $"{(double)totalBytes / 1048576:F1} MB";
public static string FormatByteAmount(long totalBytes) =>
totalBytes > 1000000000 ? $"{(double)totalBytes / 1073741824:F1} GB" :
totalBytes > 1000000 ? $"{(double)totalBytes / 1048576:F1} MB" :
totalBytes > 1000 ? $"{(double)totalBytes / 1024:F1} KB" : $"{totalBytes} Bytes";
if (totalBytes > 1000)
return $"{(double)totalBytes / 1024:F1} KB";
return $"{totalBytes} Bytes";
}
public static void Initialize()
{
@ -1524,7 +1525,7 @@ namespace Server.Gumps
{
IPAddress[] ips = a.LoginIPs;
if (ips.Length != 0 && ip.Equals(ips[0]) && AccountHandler.IPTable.ContainsKey(ips[0]))
if (ips.Length != 0 && ip == ips[0] && AccountHandler.IPTable.ContainsKey(ips[0]))
--AccountHandler.IPTable[ip];
List<IPAddress> newList = new List<IPAddress>(ips);
@ -1607,19 +1608,30 @@ namespace Server.Gumps
{
case 0:
{
AdminGumpPage page = index switch
{
0 => AdminGumpPage.Information_General,
1 => AdminGumpPage.Administer,
2 => AdminGumpPage.Clients,
3 => AdminGumpPage.Accounts,
4 => AdminGumpPage.Firewall,
5 => AdminGumpPage.Information_Perf,
_ => AdminGumpPage.Invalid,
};
AdminGumpPage page;
if (page == AdminGumpPage.Invalid)
return;
switch (index)
{
case 0:
page = AdminGumpPage.Information_General;
break;
case 1:
page = AdminGumpPage.Administer;
break;
case 2:
page = AdminGumpPage.Clients;
break;
case 3:
page = AdminGumpPage.Accounts;
break;
case 4:
page = AdminGumpPage.Firewall;
break;
case 5:
page = AdminGumpPage.Information_Perf;
break;
default: return;
}
from.SendGump(new AdminGump(from, page));
break;
@ -1939,7 +1951,12 @@ namespace Server.Gumps
hasAccess = true;
else
for (int j = 0; !hasAccess && j < a.Length; ++j)
hasAccess |= a[j]?.AccessLevel >= level;
{
Mobile m = a[j];
if (m?.AccessLevel >= level)
hasAccess = true;
}
if (!hasAccess)
{
@ -2483,7 +2500,11 @@ namespace Server.Gumps
}
case 31: // View all inactive accounts
{
List<object> results = Accounts.GetAccounts().Cast<Account>().Where(acct => acct.Inactive).Cast<object>().ToList();
List<object> results = new List<object>();
foreach (Account acct in Accounts.GetAccounts())
if (acct.Inactive)
results.Add(acct);
if (results.Count == 1)
from.SendGump(new AdminGump(from, AdminGumpPage.AccountDetails_Information, 0, null,
@ -2496,7 +2517,11 @@ namespace Server.Gumps
}
case 32: // View all banned accounts
{
List<object> results = Accounts.GetAccounts().Cast<Account>().Where(acct => acct.Banned).Cast<object>().ToList();
List<object> results = new List<object>();
foreach (Account acct in Accounts.GetAccounts())
if (acct.Banned)
results.Add(acct);
if (results.Count == 1)
from.SendGump(new AdminGump(from, AdminGumpPage.AccountDetails_Information, 0, null,
@ -2527,7 +2552,8 @@ namespace Server.Gumps
bool hasHouse = false;
for (int i = 0; i < acct.Length && !hasHouse; ++i)
hasHouse |= acct[i] != null && BaseHouse.HasHouse(acct[i]);
if (acct[i] != null && BaseHouse.HasHouse(acct[i]))
hasHouse = true;
if (!hasHouse)
newRads.Add(acct);
@ -2946,7 +2972,8 @@ namespace Server.Gumps
if (check.AccessLevel > accessLevel)
accessLevel = check.AccessLevel;
online |= check.NetState != null;
if (check.NetState != null)
online = true;
}
}

View file

@ -50,14 +50,14 @@ namespace Server.Gumps
public virtual int LabelNumber // Are you sure you wish to select this?
=> 1074975;
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == (int)Buttons.Confirm)
{
if (info.IsSwitched((int)Buttons.Break))
Confirm(sender.Mobile);
Confirm(state.Mobile);
else
Refuse(sender.Mobile);
Refuse(state.Mobile);
}
}

View file

@ -110,7 +110,7 @@ namespace Server.Gumps
public override string Caption => Title;
public static CAGCategory Root => m_Root ??= Load("Data/objects.xml");
public static CAGCategory Root => m_Root ?? (m_Root = Load("Data/objects.xml"));
public override void OnClick(Mobile from, int page)
{
@ -184,8 +184,7 @@ namespace Server.Gumps
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
private static bool PrevLabel = false;
private static bool NextLabel = false;
private static bool PrevLabel = false, NextLabel = false;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
@ -334,7 +333,7 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = m_Owner;

View file

@ -128,13 +128,13 @@ namespace Server.Gumps
to.SendGump(new ClientGump(to, m_State, te == null ? "" : te.Text));
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_State == null)
return;
Mobile focus = m_State.Mobile;
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (focus == null)
{

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using Server.Accounting;
using Server.Network;
using Server.Prompts;
using Server.Targeting;
namespace Server.Gumps
@ -77,12 +78,12 @@ namespace Server.Gumps
from.SendGump(new CommentsGump((Account)m.Account));
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 0x7F)
{
sender.Mobile.SendMessage("Enter the text for the account comment (or press [Esc] to cancel):");
sender.Mobile.Prompt = new CommentPrompt(m_Acct);
state.Mobile.SendMessage("Enter the text for the account comment (or press [Esc] to cancel):");
state.Mobile.Prompt = new CommentPrompt(m_Acct);
}
}

View file

@ -46,7 +46,7 @@ namespace Server.Gumps
AddHtmlLocalized(240, 250, 170, 20, 1011012, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && !m_House.Deleted)
{
@ -100,7 +100,7 @@ namespace Server.Gumps
}
else
{
Item toGive;
Item toGive = null;
if (m_House.IsAosRules)
{

View file

@ -187,9 +187,9 @@ namespace Server.Gumps
from.SendGump(new GoGump(0, from, tree, branch));
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
switch (info.ButtonID)
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;
@ -38,7 +38,7 @@ namespace Server.Gumps
Mobile m = m_List[index];
if (m?.Deleted == false)
sender.Mobile.GuildFealty = m;
state.Mobile.GuildFealty = m;
}
}
}

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,4 +1,5 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -21,7 +21,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1013077); // Refuse
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -17,7 +17,7 @@ namespace Server.Gumps
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -41,7 +41,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 360, 150, 30, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (Guild.NewGuildSystem && !BaseGuildGump.IsLeader(m_Mobile, m_Guild) ||
!Guild.NewGuildSystem && GuildGump.BadLeader(m_Mobile, m_Guild))

View file

@ -41,7 +41,7 @@ namespace Server.Gumps
AddHtml(55, 220, 300, 20, website);
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -1,4 +1,5 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -23,7 +23,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,5 +1,6 @@
using System.Collections.Generic;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,4 +1,5 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -17,7 +17,7 @@ namespace Server.Gumps
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -1,4 +1,5 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -63,7 +63,7 @@ namespace Server.Gumps
AddHtmlLocalized(55, 400, 400, 35, 1011104); // Return to the previous menu.
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -86,7 +86,7 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -1,4 +1,5 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -82,7 +82,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 360, 100, 30, 1011441); // EXIT
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,4 +1,3 @@
using System.Linq;
using Server.Gumps;
using Server.Misc;
using Server.Mobiles;
@ -41,7 +40,9 @@ namespace Server.Guilds
public override void OnResponse(NetState sender, RelayInfo info)
{
if (!(sender.Mobile is PlayerMobile pm &&IsMember(pm, guild)))
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (!IsMember(pm, guild))
return;
switch (info.ButtonID)
@ -84,12 +85,30 @@ namespace Server.Guilds
s = s.ToLower();
if (s.Any(c => (c < 'a' || c > 'z') && (c < '0' || c > '9') && exceptions.All(exception => exception != c)))
return false;
for (int i = 0; i < s.Length; ++i)
{
char c = s[i];
if ((c < 'a' || c > 'z') && (c < '0' || c > '9'))
{
bool except = false;
for (int j = 0; !except && j < exceptions.Length; j++)
if (c == exceptions[j])
except = true;
if (!except)
return false;
}
}
string[] disallowed = ProfanityProtection.Disallowed;
return disallowed.All(t => s.IndexOf(t) == -1);
for (int i = 0; i < disallowed.Length; i++)
if (s.IndexOf(disallowed[i]) != -1)
return false;
return true;
}
public void AddHtmlText(int x, int y, int width, int height, TextDefinition text, bool back, bool scroll)

View file

@ -108,7 +108,9 @@ namespace Server.Guilds
if (PendingWar)
{
if (war.WarRequester)
{
number = 1063027; // <div align=center>You have challenged this guild to war!</div>
}
else
{
number = 1062969; // <div align=center>This guild has challenged you to war!</div>
@ -209,7 +211,9 @@ namespace Server.Guilds
if (war?.WarRequester == false && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -272,7 +276,9 @@ namespace Server.Guilds
if (war?.WarRequester == false && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -281,7 +287,9 @@ namespace Server.Guilds
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, otherGuild));
}
}
break;
@ -291,7 +299,9 @@ namespace Server.Guilds
if (war != null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -314,7 +324,9 @@ namespace Server.Guilds
case 8: //Surrender
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -372,7 +384,9 @@ namespace Server.Guilds
if (war == null && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -388,7 +402,9 @@ namespace Server.Guilds
otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, m_Other));
}
}
break;
@ -403,10 +419,14 @@ namespace Server.Guilds
if (alliance == null)
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
}
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
{
pm.SendLocalizedMessage(
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(m_Other))
@ -416,9 +436,13 @@ namespace Server.Guilds
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
}
else
{
pm.SendLocalizedMessage(1063439); // Enter a name for the new alliance:
@ -433,10 +457,14 @@ namespace Server.Guilds
else
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(m_Other))
@ -446,15 +474,23 @@ namespace Server.Guilds
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (alliance.IsPendingMember(guild))
{
pm.SendLocalizedMessage(1063416,
guild.Name); // ~1_val~ is currently considering another alliance proposal.
}
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
}
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
{
pm.SendLocalizedMessage(
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else
{
pm.SendLocalizedMessage(1070750,
@ -481,7 +517,9 @@ namespace Server.Guilds
case 11: //Leave Alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance?.IsMember(guild) == true)
{
guild.Alliance = null; //Calls alliance.Removeguild
@ -497,10 +535,14 @@ namespace Server.Guilds
case 12: //Remove Guild from alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
{
m_Other.Alliance = null;
@ -515,10 +557,14 @@ namespace Server.Guilds
case 13: //Promote to Alliance leader
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
{
pm.SendLocalizedMessage(1063434,
@ -532,7 +578,9 @@ namespace Server.Guilds
case 14: //Withdraw Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader == guild && alliance.IsPendingMember(m_Other))
{
m_Other.Alliance = null;
@ -544,7 +592,9 @@ namespace Server.Guilds
case 15: //Deny Alliance Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && otherAlliance != null && alliance.Leader == m_Other &&
otherAlliance.IsPendingMember(guild))
{
@ -559,7 +609,9 @@ namespace Server.Guilds
case 16: //Accept Alliance Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (otherAlliance != null && otherAlliance.Leader == m_Other &&
otherAlliance.IsPendingMember(guild))
{
@ -588,15 +640,20 @@ namespace Server.Guilds
if (!IsMember(from, guild) || alliance != null)
return;
RankDefinition playerRank = pm.GuildRank;
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
}
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
{
//Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later.
pm.SendLocalizedMessage(
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(m_Other))
@ -606,20 +663,30 @@ namespace Server.Guilds
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
}
else
{
string name = Utility.FixHtml(text.Trim());
if (!CheckProfanity(name))
{
pm.SendLocalizedMessage(1070886); // That alliance name is not allowed.
}
else if (name.Length > Guild.NameLimit)
{
pm.SendLocalizedMessage(1070887,
Guild.NameLimit.ToString()); // An alliance name cannot exceed ~1_val~ characters in length.
}
else if (AllianceInfo.Alliances.ContainsKey(name.ToLower()))
{
pm.SendLocalizedMessage(1063428); // That alliance name is not available.
}
else
{
pm.SendLocalizedMessage(1070750,

View file

@ -1,3 +1,4 @@
using Server.Accounting;
using Server.Guilds;
using Server.Items;
using Server.Multis;
@ -31,14 +32,13 @@ namespace Server.Gumps
AddImageTiled(10, 40, 400, 200, 2624);
AddAlphaRegion(10, 40, 400, 200);
AddHtmlLocalized(10, 40, 400, 200, 1061795, 32512, false, true);
/* 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); /* 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?
*/
AddImageTiled(10, 250, 400, 20, 2624);
AddAlphaRegion(10, 250, 400, 20);
@ -50,7 +50,7 @@ namespace Server.Gumps
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && !m_House.Deleted)
{

View file

@ -54,12 +54,12 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_House.Deleted)
return;
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
from.SendGump(new HouseGump(from, m_House));
}
@ -125,12 +125,12 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_House.Deleted)
return;
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (m_List != null && info.ButtonID == 1) // Remove now
{

View file

@ -672,92 +672,92 @@ namespace Server.Gumps
if (e == null)
return;
int cost = e.Cost - house.Price;
int cost = e.Cost - house.Price;
if (cost > 0)
{
if (Banker.Withdraw(from, cost))
if (cost > 0)
{
from.SendLocalizedMessage(1060398,
cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
if (Banker.Withdraw(from, cost))
{
from.SendLocalizedMessage(1060398,
cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
else
{
from.SendLocalizedMessage(
1061624); // You do not have enough funds in your bank to cover the difference between your old house and your new one.
return;
}
}
else
else if (cost < 0)
{
from.SendLocalizedMessage(
1061624); // You do not have enough funds in your bank to cover the difference between your old house and your new one.
if (Banker.Deposit(from, -cost))
from.SendLocalizedMessage(1060397,
(-cost).ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
else
return;
}
BaseHouse newHouse = e.ConstructHouse(from);
if (newHouse != null)
{
newHouse.Price = e.Cost;
house.MoveAllToCrate();
newHouse.Friends = new List<Mobile>(house.Friends);
newHouse.CoOwners = new List<Mobile>(house.CoOwners);
newHouse.Bans = new List<Mobile>(house.Bans);
newHouse.Access = new List<Mobile>(house.Access);
newHouse.BuiltOn = house.BuiltOn;
newHouse.LastTraded = house.LastTraded;
newHouse.Public = house.Public;
newHouse.VendorInventories.AddRange(house.VendorInventories);
house.VendorInventories.Clear();
foreach (VendorInventory inventory in newHouse.VendorInventories) inventory.House = newHouse;
newHouse.InternalizedVendors.AddRange(house.InternalizedVendors);
house.InternalizedVendors.Clear();
foreach (Mobile mobile in newHouse.InternalizedVendors)
if (mobile is PlayerVendor vendor)
vendor.House = newHouse;
else if (mobile is PlayerBarkeeper barkeeper)
barkeeper.House = newHouse;
if (house.MovingCrate != null)
{
newHouse.MovingCrate = house.MovingCrate;
newHouse.MovingCrate.House = newHouse;
house.MovingCrate = null;
}
List<Item> items = house.GetItems();
List<Mobile> mobiles = house.GetMobiles();
newHouse.MoveToWorld(
new Point3D(house.X + house.ConvertOffsetX, house.Y + house.ConvertOffsetY,
house.Z + house.ConvertOffsetZ), house.Map);
house.Delete();
foreach (Item item in items) item.Location = newHouse.BanLocation;
foreach (Mobile mobile in mobiles) mobile.Location = newHouse.BanLocation;
/* You have successfully replaced your original house with a new house.
* The value of the replaced house has been deposited into your bank box.
* All of the items in your original house have been relocated to a Moving Crate in the new house.
* Any deed-based house add-ons have been converted back into deeds.
* Vendors and barkeeps in the house, if any, have been stored in the Moving Crate as well.
* Use the <B>Get Vendor</B> context-sensitive menu option on your character to retrieve them.
* These containers can be used to re-create the vendor in a new location.
* Any barkeepers have been converted into deeds.
*/
from.SendGump(new NoticeGump(1060637, 30720, 1060012, 32512, 420, 280));
return;
}
}
else if (cost < 0)
{
if (Banker.Deposit(from, -cost))
from.SendLocalizedMessage(1060397,
(-cost).ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
else
return;
}
BaseHouse newHouse = e.ConstructHouse(from);
if (newHouse != null)
{
newHouse.Price = e.Cost;
house.MoveAllToCrate();
newHouse.Friends = new List<Mobile>(house.Friends);
newHouse.CoOwners = new List<Mobile>(house.CoOwners);
newHouse.Bans = new List<Mobile>(house.Bans);
newHouse.Access = new List<Mobile>(house.Access);
newHouse.BuiltOn = house.BuiltOn;
newHouse.LastTraded = house.LastTraded;
newHouse.Public = house.Public;
newHouse.VendorInventories.AddRange(house.VendorInventories);
house.VendorInventories.Clear();
foreach (VendorInventory inventory in newHouse.VendorInventories) inventory.House = newHouse;
newHouse.InternalizedVendors.AddRange(house.InternalizedVendors);
house.InternalizedVendors.Clear();
foreach (Mobile mobile in newHouse.InternalizedVendors)
if (mobile is PlayerVendor vendor)
vendor.House = newHouse;
else if (mobile is PlayerBarkeeper barkeeper)
barkeeper.House = newHouse;
if (house.MovingCrate != null)
{
newHouse.MovingCrate = house.MovingCrate;
newHouse.MovingCrate.House = newHouse;
house.MovingCrate = null;
}
List<Item> items = house.GetItems();
List<Mobile> mobiles = house.GetMobiles();
newHouse.MoveToWorld(
new Point3D(house.X + house.ConvertOffsetX, house.Y + house.ConvertOffsetY,
house.Z + house.ConvertOffsetZ), house.Map);
house.Delete();
foreach (Item item in items) item.Location = newHouse.BanLocation;
foreach (Mobile mobile in mobiles) mobile.Location = newHouse.BanLocation;
/* You have successfully replaced your original house with a new house.
* The value of the replaced house has been deposited into your bank box.
* All of the items in your original house have been relocated to a Moving Crate in the new house.
* Any deed-based house add-ons have been converted back into deeds.
* Vendors and barkeeps in the house, if any, have been stored in the Moving Crate as well.
* Use the <B>Get Vendor</B> context-sensitive menu option on your character to retrieve them.
* These containers can be used to re-create the vendor in a new location.
* Any barkeepers have been converted into deeds.
*/
from.SendGump(new NoticeGump(1060637, 30720, 1060012, 32512, 420, 280));
return;
}
}
from.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Security, from, house));

View file

@ -53,7 +53,7 @@ namespace Server.Gumps
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && !m_House.Deleted)
m_House.EndConfirmTransfer(m_From, m_To);

View file

@ -33,12 +33,12 @@ namespace Server.Gumps
AddButton(110, 105, 0x819, 0x818, 0x2); // Cancel
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Pet.Deleted || !m_Pet.IsBonded || !m_Pet.IsDeadPet)
return;
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (info.ButtonID == 1)
{

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Server.HuePickers;
using Server.Items;
using Server.Mobiles;
using Server.Network;
@ -36,9 +37,9 @@ namespace Server.Gumps
AddHtmlLocalized(152, 130, 100, 24, 1011036); // OKAY
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (!m_Vendor.CanInteractWith(from, false))
return;
@ -134,9 +135,9 @@ namespace Server.Gumps
AddLabel(300, 48, 0, ((int)(days / 12.0)).ToString());
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (!m_Vendor.CanInteractWith(from, true))
return;
@ -475,12 +476,12 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Vendor.Deleted)
return;
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (m_Vendor is PlayerVendor vendor && !vendor.CanInteractWith(from, true))
return;
@ -580,11 +581,11 @@ namespace Server.Gumps
if (category.Layer == Layer.Hair)
{
new PVHairHuePicker(false, m_Vendor, from).SendTo(sender);
new PVHairHuePicker(false, m_Vendor, from).SendTo(state);
}
else if (category.Layer == Layer.FacialHair)
{
new PVHairHuePicker(true, m_Vendor, from).SendTo(sender);
new PVHairHuePicker(true, m_Vendor, from).SendTo(state);
}
else
{
@ -603,7 +604,7 @@ namespace Server.Gumps
}
if (item != null)
new PVHuePicker(item, m_Vendor, from).SendTo(sender);
new PVHuePicker(item, m_Vendor, from).SendTo(state);
}
}
}

View file

@ -120,7 +120,7 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && info.Switches.Length > 0)
{

View file

@ -153,7 +153,9 @@ namespace Server.Gumps
if (parent != null)
{
m_Stack ??= new Stack<StackEntry>();
if (m_Stack == null)
m_Stack = new Stack<StackEntry>();
m_Stack.Push(parent);
}
@ -279,9 +281,9 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (!BaseCommand.IsAccessible(from, m_Object))
{

View file

@ -127,6 +127,7 @@ namespace Server.Gumps
switch (index)
{
default:
case 0:
type = ModelBodyType.Monsters;
list = m_Monster;
break;
@ -203,17 +204,24 @@ namespace Server.Gumps
if (((Body)bodyID).IsEmpty)
continue;
List<InternalEntry> list = oldEntry.BodyType switch
{
ModelBodyType.Monsters => m_Monster,
ModelBodyType.Animals => m_Animal,
ModelBodyType.Sea => m_Sea,
ModelBodyType.Human => m_Human,
_ => null
};
List<InternalEntry> list;
if (list == null)
return;
switch (oldEntry.BodyType)
{
default: continue;
case ModelBodyType.Monsters:
list = m_Monster;
break;
case ModelBodyType.Animals:
list = m_Animal;
break;
case ModelBodyType.Sea:
list = m_Sea;
break;
case ModelBodyType.Human:
list = m_Human;
break;
}
int itemID = ShrinkTable.Lookup(bodyID, -1);
@ -279,7 +287,7 @@ namespace Server.Gumps
int v = Name.CompareTo(comp.Name);
if (v == 0)
v = Body.CompareTo(comp.Body);
Body.CompareTo(comp.Body);
return v;
}

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Reflection;
using Server.Commands;
using Server.HuePickers;
using Server.Network;
namespace Server.Gumps

View file

@ -4,6 +4,7 @@ using System.Reflection;
using Server.Commands;
using Server.Commands.Generic;
using Server.Network;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -2,6 +2,7 @@ using System.Collections.Generic;
using Server.Items;
using Server.Multis;
using Server.Network;
using Server.Prompts;
using Server.Spells.Chivalry;
using Server.Spells.Fourth;
using Server.Spells.Seventh;
@ -202,9 +203,9 @@ namespace Server.Gumps
public static bool HasSpell(Mobile from, int spellID) => Spellbook.Find(from, spellID)?.HasSpell(spellID) == true;
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = sender.Mobile;
Mobile from = state.Mobile;
if (Book.Deleted || !from.InRange(Book.GetWorldLocation(), Core.ML ? 3 : 1) || !DesignContext.Check(from))
{

View file

@ -60,7 +60,7 @@ namespace Server.Gumps
public int GetFirstID(SecureLevel level) => m_Info.Level == level ? 4006 : 4005;
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState state, RelayInfo info)
{
var level = info.ButtonID switch
{
@ -74,12 +74,12 @@ namespace Server.Gumps
if (m_Info.Level == level)
{
sender.Mobile.SendLocalizedMessage(1061281); // Access level unchanged.
state.Mobile.SendLocalizedMessage(1061281); // Access level unchanged.
}
else
{
m_Info.Level = level;
sender.Mobile.SendLocalizedMessage(1061280); // New access level set.
state.Mobile.SendLocalizedMessage(1061280); // New access level set.
}
}
}

View file

@ -306,6 +306,7 @@ namespace Server.Gumps
switch (sk.Lock)
{
default:
case SkillLock.Up:
buttonID1 = 0x983;
buttonID2 = 0x983;
xOffset = 6;

View file

@ -1,5 +1,6 @@
using Server.Items;
using Server.Network;
using Server.Prompts;
using Server.Mobiles;
using Server.Targeting;
using Server.Multis;