fix: Cleans up create guild gump (#1326)
This commit is contained in:
parent
b11ca29987
commit
8b3a2f9f5f
2 changed files with 20 additions and 32 deletions
|
|
@ -71,7 +71,7 @@ public abstract class BaseGuild : ISerializable
|
||||||
{
|
{
|
||||||
foreach (var g in World.Guilds.Values)
|
foreach (var g in World.Guilds.Values)
|
||||||
{
|
{
|
||||||
if (g.Name == name)
|
if (g.Name.InsensitiveEquals(name))
|
||||||
{
|
{
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +84,7 @@ public abstract class BaseGuild : ISerializable
|
||||||
{
|
{
|
||||||
foreach (var g in World.Guilds.Values)
|
foreach (var g in World.Guilds.Values)
|
||||||
{
|
{
|
||||||
if (g.Abbreviation == abbr)
|
if (g.Abbreviation.InsensitiveEquals(abbr))
|
||||||
{
|
{
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,10 @@ namespace Server.Guilds
|
||||||
|
|
||||||
AddBackground(0, 0, 500, 300, 0x2422);
|
AddBackground(0, 0, 500, 300, 0x2422);
|
||||||
AddHtmlLocalized(25, 20, 450, 25, 1062939, 0x0, true); // <center>GUILD MENU</center>
|
AddHtmlLocalized(25, 20, 450, 25, 1062939, 0x0, true); // <center>GUILD MENU</center>
|
||||||
AddHtmlLocalized(
|
|
||||||
25,
|
// As you are not a member of any guild, you can create your own by providing a unique guild name and paying the standard guild registration fee.
|
||||||
60,
|
AddHtmlLocalized(25, 60, 450, 60, 1062940, 0x0);
|
||||||
450,
|
|
||||||
60,
|
|
||||||
1062940,
|
|
||||||
0x0
|
|
||||||
); // As you are not a member of any guild, you can create your own by providing a unique guild name and paying the standard guild registration fee.
|
|
||||||
AddHtmlLocalized(25, 135, 120, 25, 1062941, 0x0); // Registration Fee:
|
AddHtmlLocalized(25, 135, 120, 25, 1062941, 0x0); // Registration Fee:
|
||||||
AddLabel(155, 135, 0x481, Guild.RegistrationFee.ToString());
|
AddLabel(155, 135, 0x481, Guild.RegistrationFee.ToString());
|
||||||
AddHtmlLocalized(25, 165, 120, 25, 1011140, 0x0); // Enter Guild Name:
|
AddHtmlLocalized(25, 165, 120, 25, 1011140, 0x0); // Enter Guild Name:
|
||||||
|
|
@ -48,7 +44,7 @@ namespace Server.Guilds
|
||||||
|
|
||||||
public override void OnResponse(NetState sender, RelayInfo info)
|
public override void OnResponse(NetState sender, RelayInfo info)
|
||||||
{
|
{
|
||||||
if (sender.Mobile is not PlayerMobile pm || pm.Guild != null)
|
if (sender.Mobile is not PlayerMobile { Guild: null } pm)
|
||||||
{
|
{
|
||||||
return; // Sanity
|
return; // Sanity
|
||||||
}
|
}
|
||||||
|
|
@ -60,11 +56,11 @@ namespace Server.Guilds
|
||||||
var tName = info.GetTextEntry(5);
|
var tName = info.GetTextEntry(5);
|
||||||
var tAbbrev = info.GetTextEntry(6);
|
var tAbbrev = info.GetTextEntry(6);
|
||||||
|
|
||||||
var guildName = tName == null ? "" : tName.Text;
|
var guildName = tName?.Text?.Trim() ?? "";
|
||||||
var guildAbbrev = tAbbrev == null ? "" : tAbbrev.Text;
|
var guildAbbrev = tAbbrev?.Text?.Trim() ?? "";
|
||||||
|
|
||||||
guildName = Utility.FixHtml(guildName.Trim());
|
guildName = Utility.FixHtml(guildName);
|
||||||
guildAbbrev = Utility.FixHtml(guildAbbrev.Trim());
|
guildAbbrev = Utility.FixHtml(guildAbbrev);
|
||||||
|
|
||||||
if (guildName.Length <= 0)
|
if (guildName.Length <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -76,17 +72,13 @@ namespace Server.Guilds
|
||||||
}
|
}
|
||||||
else if (guildName.Length > Guild.NameLimit)
|
else if (guildName.Length > Guild.NameLimit)
|
||||||
{
|
{
|
||||||
pm.SendLocalizedMessage(
|
// A guild name cannot be more than ~1_val~ characters in length.
|
||||||
1063036,
|
pm.SendLocalizedMessage(1063036, Guild.NameLimit.ToString());
|
||||||
Guild.NameLimit.ToString()
|
|
||||||
); // A guild name cannot be more than ~1_val~ characters in length.
|
|
||||||
}
|
}
|
||||||
else if (guildAbbrev.Length > Guild.AbbrevLimit)
|
else if (guildAbbrev.Length > Guild.AbbrevLimit)
|
||||||
{
|
{
|
||||||
pm.SendLocalizedMessage(
|
// An abbreviation cannot exceed ~1_val~ characters in length.
|
||||||
1063037,
|
pm.SendLocalizedMessage(1063037, Guild.AbbrevLimit.ToString());
|
||||||
Guild.AbbrevLimit.ToString()
|
|
||||||
); // An abbreviation cannot exceed ~1_val~ characters in length.
|
|
||||||
}
|
}
|
||||||
else if (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev))
|
else if (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev))
|
||||||
{
|
{
|
||||||
|
|
@ -98,18 +90,14 @@ namespace Server.Guilds
|
||||||
}
|
}
|
||||||
else if (!Banker.Withdraw(pm, Guild.RegistrationFee))
|
else if (!Banker.Withdraw(pm, Guild.RegistrationFee))
|
||||||
{
|
{
|
||||||
pm.SendLocalizedMessage(
|
// You do not possess the ~1_val~ gold piece fee required to create a guild.
|
||||||
1063001,
|
pm.SendLocalizedMessage(1063001, Guild.RegistrationFee.ToString());
|
||||||
Guild.RegistrationFee
|
|
||||||
.ToString()
|
|
||||||
); // You do not possess the ~1_val~ gold piece fee required to create a guild.
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pm.SendLocalizedMessage(
|
// ~1_AMOUNT~ gold has been withdrawn from your bank box.
|
||||||
1060398,
|
pm.SendLocalizedMessage(1060398, Guild.RegistrationFee.ToString());
|
||||||
Guild.RegistrationFee.ToString()
|
|
||||||
); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
|
|
||||||
pm.SendLocalizedMessage(1063238); // Your new guild has been founded.
|
pm.SendLocalizedMessage(1063238); // Your new guild has been founded.
|
||||||
pm.Guild = new Guild(pm, guildName, guildAbbrev);
|
pm.Guild = new Guild(pm, guildName, guildAbbrev);
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue