Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -8,8 +8,8 @@ namespace Server.Guilds
public class GuildAdvancedSearchGump : BaseGuildGump
{
private SearchSelectionCallback m_Callback;
private GuildDisplayType m_Display;
private readonly SearchSelectionCallback m_Callback;
private readonly GuildDisplayType m_Display;
public GuildAdvancedSearchGump(PlayerMobile pm, Guild g, GuildDisplayType display, SearchSelectionCallback callback)
: base(pm, g)
@ -45,7 +45,6 @@ namespace Server.Guilds
AddHtmlLocalized(370, 373, 60, 26, 1006045, 0x0); // Cancel
}
public override void OnResponse(NetState sender, RelayInfo info)
{
base.OnResponse(sender, info);

View file

@ -15,11 +15,11 @@ namespace Server.Guilds
pm.CloseGump<BaseGuildGump>();
}
protected Guild guild{ get; }
protected Guild guild { get; }
protected PlayerMobile player{ get; }
protected PlayerMobile player { get; }
//There's prolly a way to have all the vars set of inherited classes before something is called in the Ctor... but... I can't think of it right now, and I can't use Timer.DelayCall here :<
// There's prolly a way to have all the vars set of inherited classes before something is called in the Ctor... but... I can't think of it right now, and I can't use Timer.DelayCall here :<
public virtual void PopulateGump()
{
@ -40,7 +40,8 @@ namespace Server.Guilds
public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (!(sender.Mobile is PlayerMobile pm))
return;
if (!IsMember(pm, guild))
return;
@ -48,36 +49,36 @@ namespace Server.Guilds
switch (info.ButtonID)
{
case 1:
{
pm.SendGump(new GuildInfoGump(pm, guild));
break;
}
{
pm.SendGump(new GuildInfoGump(pm, guild));
break;
}
case 2:
{
pm.SendGump(new GuildRosterGump(pm, guild));
break;
}
{
pm.SendGump(new GuildRosterGump(pm, guild));
break;
}
case 3:
{
pm.SendGump(new GuildDiplomacyGump(pm, guild));
break;
}
{
pm.SendGump(new GuildDiplomacyGump(pm, guild));
break;
}
}
}
public static bool IsLeader(Mobile m, Guild g) =>
!(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
m.AccessLevel < AccessLevel.GameMaster && g.Leader != m);
(m.AccessLevel < AccessLevel.GameMaster && g.Leader != m));
public static bool IsMember(Mobile m, Guild g) =>
!(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m));
(m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m)));
public static bool CheckProfanity(string s, int maxLength = 50)
{
//return NameVerification.Validate( s, 1, 50, true, true, false, int.MaxValue, ProfanityProtection.Exceptions, ProfanityProtection.Disallowed, ProfanityProtection.StartDisallowed ); //What am I doing wrong, this still allows chars like the <3 symbol... 3 AM. someone change this to use this
// return NameVerification.Validate( s, 1, 50, true, true, false, int.MaxValue, ProfanityProtection.Exceptions, ProfanityProtection.Disallowed, ProfanityProtection.StartDisallowed ); //What am I doing wrong, this still allows chars like the <3 symbol... 3 AM. someone change this to use this
//With testing on OSI, Guild stuff seems to follow a 'simpler' method of profanity protection
// With testing on OSI, Guild stuff seems to follow a 'simpler' method of profanity protection
if (s.Length < 1 || s.Length > maxLength)
return false;

View file

@ -10,9 +10,9 @@ namespace Server.Guilds
{
private const int itemsPerPage = 8;
private bool m_Ascending;
private IComparer<T> m_Comparer;
private InfoField<T>[] m_Fields;
private string m_Filter;
private readonly IComparer<T> m_Comparer;
private readonly InfoField<T>[] m_Fields;
private readonly string m_Filter;
private List<T> m_List;
private int m_StartNumber;
@ -51,10 +51,9 @@ namespace Server.Guilds
m_List.Sort(m_Comparer);
m_StartNumber = Math.Max(Math.Min(m_StartNumber, m_List.Count - 1), 0);
AddBackground(130, 75, 385, 30, 0xBB8);
AddTextEntry(135, 80, 375, 30, 0x481, 1, m_Filter);
AddButton(520, 75, 0x867, 0x868, 5); //Filter Button
AddButton(520, 75, 0x867, 0x868, 5); // Filter Button
int width = 0;
for (int i = 0; i < m_Fields.Length; i++)
@ -84,13 +83,12 @@ namespace Server.Guilds
else
AddButton(95, 80, 0x15E1, 0x15E5, 7); // Forward
int itemNumber = 0;
if (m_Ascending)
for (int i = m_StartNumber; i < m_StartNumber + itemsPerPage && i < m_List.Count; i++)
DrawEntry(m_List[i], i, itemNumber++);
else //descending, go from bottom of list to the top
else // descending, go from bottom of list to the top
for (int i = m_List.Count - 1 - m_StartNumber;
i >= 0 && i >= m_List.Count - itemsPerPage - m_StartNumber;
i--)
@ -121,9 +119,9 @@ namespace Server.Guilds
}
if (HasRelationship(o))
AddButton(40, 143 + itemNumber * 28, 0x8AF, 0x8AF, 200 + index); //Info Button
AddButton(40, 143 + itemNumber * 28, 0x8AF, 0x8AF, 200 + index); // Info Button
else
AddButton(40, 143 + itemNumber * 28, 0x4B9, 0x4BA, 200 + index); //Info Button
AddButton(40, 143 + itemNumber * 28, 0x4B9, 0x4BA, 200 + index); // Info Button
}
protected abstract TextDefinition[] GetValuesFor(T o, int aryLength);
@ -140,24 +138,24 @@ namespace Server.Guilds
switch (id)
{
case 5: //Filter
{
TextRelay t = info.GetTextEntry(1);
pm.SendGump(GetResentGump(player, guild, m_Comparer, m_Ascending, t == null ? "" : t.Text, 0));
break;
}
case 6: //Back
{
pm.SendGump(
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber - itemsPerPage));
break;
}
case 7: //Forward
{
pm.SendGump(
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber + itemsPerPage));
break;
}
case 5: // Filter
{
TextRelay t = info.GetTextEntry(1);
pm.SendGump(GetResentGump(player, guild, m_Comparer, m_Ascending, t == null ? "" : t.Text, 0));
break;
}
case 6: // Back
{
pm.SendGump(
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber - itemsPerPage));
break;
}
case 7: // Forward
{
pm.SendGump(
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber + itemsPerPage));
break;
}
}
if (id >= 100 && id < 100 + m_Fields.Length)
@ -175,7 +173,6 @@ namespace Server.Guilds
}
}
public abstract Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<T> comparer, bool ascending, string filter,
int startNumber);
@ -189,11 +186,11 @@ namespace Server.Guilds
public struct InfoField<T>
{
public TextDefinition Name{ get; }
public TextDefinition Name { get; }
public int Width{ get; }
public int Width { get; }
public IComparer<T> Comparer{ get; }
public IComparer<T> Comparer { get; }
public InfoField(TextDefinition name, int width, IComparer<T> comparer)
{

View file

@ -38,74 +38,74 @@ namespace Server.Guilds
public override void OnResponse(NetState sender, RelayInfo info)
{
if (!(sender.Mobile is PlayerMobile pm) || pm.Guild != null)
return; //Sanity
return; // Sanity
switch (info.ButtonID)
{
case 1:
{
TextRelay tName = info.GetTextEntry(5);
TextRelay tAbbrev = info.GetTextEntry(6);
{
TextRelay tName = info.GetTextEntry(5);
TextRelay tAbbrev = info.GetTextEntry(6);
string guildName = tName == null ? "" : tName.Text;
string guildAbbrev = tAbbrev == null ? "" : tAbbrev.Text;
string guildName = tName == null ? "" : tName.Text;
string guildAbbrev = tAbbrev == null ? "" : tAbbrev.Text;
guildName = Utility.FixHtml(guildName.Trim());
guildAbbrev = Utility.FixHtml(guildAbbrev.Trim());
guildName = Utility.FixHtml(guildName.Trim());
guildAbbrev = Utility.FixHtml(guildAbbrev.Trim());
if (guildName.Length <= 0)
{
pm.SendLocalizedMessage(1070884); // Guild name cannot be blank.
}
else if (guildAbbrev.Length <= 0)
{
pm.SendLocalizedMessage(1070885); // You must provide a guild abbreviation.
}
else if (guildName.Length > Guild.NameLimit)
{
pm.SendLocalizedMessage(1063036,
Guild.NameLimit.ToString()); // A guild name cannot be more than ~1_val~ characters in length.
}
else if (guildAbbrev.Length > Guild.AbbrevLimit)
{
pm.SendLocalizedMessage(1063037,
Guild.AbbrevLimit.ToString()); // An abbreviation cannot exceed ~1_val~ characters in length.
}
else if (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev))
{
pm.SendLocalizedMessage(501153); // That abbreviation is not available.
}
else if (BaseGuild.FindByName(guildName) != null || !BaseGuildGump.CheckProfanity(guildName))
{
pm.SendLocalizedMessage(1063000); // That guild name is not available.
}
else if (!Banker.Withdraw(pm, Guild.RegistrationFee))
{
pm.SendLocalizedMessage(1063001,
Guild.RegistrationFee
.ToString()); // You do not possess the ~1_val~ gold piece fee required to create a guild.
}
else
{
pm.SendLocalizedMessage(1060398,
Guild.RegistrationFee.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
pm.SendLocalizedMessage(1063238); // Your new guild has been founded.
pm.Guild = new Guild(pm, guildName, guildAbbrev);
}
if (guildName.Length <= 0)
{
pm.SendLocalizedMessage(1070884); // Guild name cannot be blank.
}
else if (guildAbbrev.Length <= 0)
{
pm.SendLocalizedMessage(1070885); // You must provide a guild abbreviation.
}
else if (guildName.Length > Guild.NameLimit)
{
pm.SendLocalizedMessage(1063036,
Guild.NameLimit.ToString()); // A guild name cannot be more than ~1_val~ characters in length.
}
else if (guildAbbrev.Length > Guild.AbbrevLimit)
{
pm.SendLocalizedMessage(1063037,
Guild.AbbrevLimit.ToString()); // An abbreviation cannot exceed ~1_val~ characters in length.
}
else if (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev))
{
pm.SendLocalizedMessage(501153); // That abbreviation is not available.
}
else if (BaseGuild.FindByName(guildName) != null || !BaseGuildGump.CheckProfanity(guildName))
{
pm.SendLocalizedMessage(1063000); // That guild name is not available.
}
else if (!Banker.Withdraw(pm, Guild.RegistrationFee))
{
pm.SendLocalizedMessage(1063001,
Guild.RegistrationFee
.ToString()); // You do not possess the ~1_val~ gold piece fee required to create a guild.
}
else
{
pm.SendLocalizedMessage(1060398,
Guild.RegistrationFee.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
pm.SendLocalizedMessage(1063238); // Your new guild has been founded.
pm.Guild = new Guild(pm, guildName, guildAbbrev);
}
break;
}
break;
}
case 2:
{
pm.AcceptGuildInvites = !pm.AcceptGuildInvites;
{
pm.AcceptGuildInvites = !pm.AcceptGuildInvites;
if (pm.AcceptGuildInvites)
pm.SendLocalizedMessage(1070699); // You are now accepting guild invitations.
else
pm.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
if (pm.AcceptGuildInvites)
pm.SendLocalizedMessage(1070699); // You are now accepting guild invitations.
else
pm.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
break;
}
break;
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Guilds
public class GuildDiplomacyGump : BaseGuildListGump<Guild>
{
private GuildDisplayType m_Display;
private TextDefinition m_LowerText;
private readonly TextDefinition m_LowerText;
public GuildDiplomacyGump(PlayerMobile pm, Guild g)
: this(pm, g, NameComparer.Instance, true, "", 0, GuildDisplayType.All,
@ -49,9 +49,9 @@ namespace Server.Guilds
: base(pm, g, list, currentComparer, ascending, filter, startNumber,
new[]
{
new InfoField<Guild>(1062954, 280, NameComparer.Instance), //Guild Name
new InfoField<Guild>(1062957, 50, AbbrevComparer.Instance), //Abbrev
new InfoField<Guild>(1062958, 120, new StatusComparer(g)) //Guild Title
new InfoField<Guild>(1062954, 280, NameComparer.Instance), // Guild Name
new InfoField<Guild>(1062957, 50, AbbrevComparer.Instance), // Abbrev
new InfoField<Guild>(1062958, 120, new StatusComparer(g)) // Guild Title
})
{
m_Display = display;
@ -86,8 +86,7 @@ namespace Server.Guilds
defs[0] = g == guild ? Color(g.Name, 0x006600) : g.Name;
defs[1] = g.Abbreviation;
defs[2] = 3000085; //Peace
defs[2] = 3000085; // Peace
if (guild.IsAlly(g))
{
@ -120,7 +119,7 @@ namespace Server.Guilds
if (leader != null)
{
if (guild == leader && alliance.IsPendingMember(g) || g == leader && alliance.IsPendingMember(guild))
if ((guild == leader && alliance.IsPendingMember(g)) || (g == leader && alliance.IsPendingMember(guild)))
return true;
}
else if (alliance.IsPendingMember(g))
@ -134,8 +133,8 @@ namespace Server.Guilds
public override void DrawEndingEntry(int itemNumber)
{
//AddHtmlLocalized( 66, 153 + itemNumber * 28, 280, 26, 1063136 + (int)m_Display, 0xF, false, false ); // Showing All Guilds/Awaiting Action/ w/Relation Ship
//AddHtmlText( 66, 153 + itemNumber * 28, 280, 26, m_LowerText, false, false );
// AddHtmlLocalized( 66, 153 + itemNumber * 28, 280, 26, 1063136 + (int)m_Display, 0xF, false, false ); // Showing All Guilds/Awaiting Action/ w/Relation Ship
// AddHtmlText( 66, 153 + itemNumber * 28, 280, 26, m_LowerText, false, false );
if (m_LowerText?.Number > 0)
AddHtmlLocalized(66, 153 + itemNumber * 28, 280, 26, m_LowerText.Number, 0xF);
@ -150,7 +149,6 @@ namespace Server.Guilds
}
}
protected override bool IsFiltered(Guild g, string filter)
{
if (g == null)
@ -159,25 +157,23 @@ namespace Server.Guilds
switch (m_Display)
{
case GuildDisplayType.Relations:
{
//if ( !( guild.IsWar( g ) || guild.IsAlly( g ) ) )
{
// if (!( guild.IsWar( g ) || guild.IsAlly( g ) ))
if (!(guild.FindActiveWar(g) != null || guild.IsAlly(g))
) //As per OSI, only the guild leader wars show up under the sorting by relation
return true;
if (!(guild.FindActiveWar(g) != null || guild.IsAlly(g))) // As per OSI, only the guild leader wars show up under the sorting by relation
return true;
return false;
}
return false;
}
case GuildDisplayType.AwaitingAction:
{
return !HasRelationship(g);
}
{
return !HasRelationship(g);
}
}
return !(Insensitive.Contains(g.Name, filter) || Insensitive.Contains(g.Abbreviation, filter));
}
public override Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<Guild> comparer, bool ascending,
string filter, int startNumber) =>
new GuildDiplomacyGump(pm, g, comparer, ascending, filter, startNumber, m_Display);
@ -207,8 +203,6 @@ namespace Server.Guilds
ResendGump();
}
#region Comparers
private class NameComparer : IComparer<Guild>
{
public static readonly IComparer<Guild> Instance = new NameComparer();
@ -228,7 +222,7 @@ namespace Server.Guilds
private class StatusComparer : IComparer<Guild>
{
private Guild m_Guild;
private readonly Guild m_Guild;
public StatusComparer(Guild g) => m_Guild = g;
@ -249,7 +243,6 @@ namespace Server.Guilds
else if (m_Guild.IsWar(x))
aStatus = GuildCompareStatus.War;
if (m_Guild.IsAlly(y))
bStatus = GuildCompareStatus.Ally;
else if (m_Guild.IsWar(y))
@ -282,7 +275,5 @@ namespace Server.Guilds
return Insensitive.Compare(x.Abbreviation, y.Abbreviation);
}
}
#endregion
}
}

View file

@ -7,7 +7,7 @@ namespace Server.Guilds
{
public class GuildInfoGump : BaseGuildGump
{
private bool m_IsResigning;
private readonly bool m_IsResigning;
public GuildInfoGump(PlayerMobile pm, Guild g, bool isResigning = false) : base(pm, g)
{
@ -34,7 +34,7 @@ namespace Server.Guilds
if (guild.Alliance?.IsMember(guild) == true)
{
AddHtml(233, 118, 320, 26, guild.Alliance.Name);
AddButton(40, 120, 0x4B9, 0x4BA, 6); //Alliance Roster
AddButton(40, 120, 0x4B9, 0x4BA, 6); // Alliance Roster
}
if (Guild.OrderChaos && isLeader)
@ -54,21 +54,20 @@ namespace Server.Guilds
AddImageTiled(65, 196, 480, 4, 0x238D);
string s = guild.Charter;
if (string.IsNullOrEmpty(s))
s = "The guild leader has not yet set the guild charter.";
AddHtml(65, 216, 480, 80, s, true, true);
if (isLeader)
AddButton(40, 251, 0x4B9, 0x4BA, 4); //Charter Edit button
AddButton(40, 251, 0x4B9, 0x4BA, 4); // Charter Edit button
s = guild.Website;
if (string.IsNullOrEmpty(s))
s = "Guild website not yet set.";
AddHtml(65, 306, 480, 30, s, true);
if (isLeader)
AddButton(40, 313, 0x4B9, 0x4BA, 5); //Website Edit button
AddButton(40, 313, 0x4B9, 0x4BA, 5); // Website Edit button
AddCheck(65, 370, 0xD2, 0xD3, player.DisplayGuildTitle, 0);
AddHtmlLocalized(95, 370, 150, 26, 1063085, 0x0); // Show Guild Title
@ -87,69 +86,68 @@ namespace Server.Guilds
if (!IsMember(pm, guild))
return;
pm.DisplayGuildTitle = info.IsSwitched(0);
switch (info.ButtonID)
{
//1-3 handled by base.OnResponse
// 1-3 handled by base.OnResponse
case 4:
{
if (IsLeader(pm, guild))
{
pm.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
if (IsLeader(pm, guild))
{
pm.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
pm.BeginPrompt(SetCharter_Callback,
true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
pm.BeginPrompt(SetCharter_Callback,
true); // Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
}
break;
}
break;
}
case 5:
{
if (IsLeader(pm, guild))
{
pm.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
pm.BeginPrompt(SetWebsite_Callback,
true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
}
if (IsLeader(pm, guild))
{
pm.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
pm.BeginPrompt(SetWebsite_Callback,
true); // Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
}
break;
}
break;
}
case 6:
{
//Alliance Roster
if (guild.Alliance?.IsMember(guild) == true)
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, guild.Alliance));
{
// Alliance Roster
if (guild.Alliance?.IsMember(guild) == true)
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, guild.Alliance));
break;
}
break;
}
case 7:
{
//Resign
if (!m_IsResigning)
{
pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild?
pm.SendGump(new GuildInfoGump(pm, guild, true));
}
else
{
guild.RemoveMember(pm, 1063411); // You resign from your guild.
}
// Resign
if (!m_IsResigning)
{
pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild?
pm.SendGump(new GuildInfoGump(pm, guild, true));
}
else
{
guild.RemoveMember(pm, 1063411); // You resign from your guild.
}
break;
}
break;
}
case 100: // Custom code to support Order/Chaos in the new guild system
{
// Guild Faction
if (Guild.OrderChaos && IsLeader(pm, guild))
{
pm.CloseGump<GuildChangeTypeGump>();
pm.SendGump(new GuildChangeTypeGump(pm, guild));
}
// Guild Faction
if (Guild.OrderChaos && IsLeader(pm, guild))
{
pm.CloseGump<GuildChangeTypeGump>();
pm.SendGump(new GuildChangeTypeGump(pm, guild));
}
break;
}
break;
}
}
}

View file

@ -6,7 +6,7 @@ namespace Server.Guilds
{
public class GuildInvitationRequest : BaseGuildGump
{
private PlayerMobile m_Inviter;
private readonly PlayerMobile m_Inviter;
public GuildInvitationRequest(PlayerMobile pm, Guild g, PlayerMobile inviter) : base(pm, g)
{
@ -28,7 +28,6 @@ namespace Server.Guilds
AddHtmlLocalized(45, 130, 150, 30, 1062943, 0x0); // <i>Ignore Guild Invites</i>
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (guild.Disbanded || player.Guild != null)
@ -37,27 +36,27 @@ namespace Server.Guilds
switch (info.ButtonID)
{
case 0:
{
m_Inviter.SendLocalizedMessage(1063250,
$"{player.Name}\t{guild.Name}"); // ~1_val~ has declined your invitation to join ~2_val~.
break;
}
{
m_Inviter.SendLocalizedMessage(1063250,
$"{player.Name}\t{guild.Name}"); // ~1_val~ has declined your invitation to join ~2_val~.
break;
}
case 1:
{
guild.AddMember(player);
player.SendLocalizedMessage(1063056, guild.Name); // You have joined ~1_val~.
m_Inviter.SendLocalizedMessage(1063249,
$"{player.Name}\t{guild.Name}"); // ~1_val~ has accepted your invitation to join ~2_val~.
{
guild.AddMember(player);
player.SendLocalizedMessage(1063056, guild.Name); // You have joined ~1_val~.
m_Inviter.SendLocalizedMessage(1063249,
$"{player.Name}\t{guild.Name}"); // ~1_val~ has accepted your invitation to join ~2_val~.
break;
}
break;
}
case 2:
{
player.AcceptGuildInvites = false;
player.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
{
player.AcceptGuildInvites = false;
player.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
break;
}
break;
}
}
}
}

View file

@ -6,11 +6,11 @@ namespace Server.Guilds
{
public class GuildMemberInfoGump : BaseGuildGump
{
private PlayerMobile m_Member;
private bool m_ToLeader, m_toKick;
private readonly PlayerMobile m_Member;
private readonly bool m_ToLeader;
private readonly bool m_toKick;
public GuildMemberInfoGump(PlayerMobile pm, Guild g, PlayerMobile member, bool toKick, bool toPromoteToLeader) :
base(pm, g, 10, 40)
public GuildMemberInfoGump(PlayerMobile pm, Guild g, PlayerMobile member, bool toKick, bool toPromoteToLeader) : base(pm, g, 10, 40)
{
m_ToLeader = toPromoteToLeader;
m_toKick = toKick;
@ -68,146 +68,145 @@ namespace Server.Guilds
switch (info.ButtonID)
{
case 1: //Promote
{
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) &&
(playerRank.Rank - 1 > targetRank.Rank ||
playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank))
case 1: // Promote
{
targetRank = RankDefinition.Ranks[targetRank.Rank + 1];
if (targetRank == RankDefinition.Leader)
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) &&
(playerRank.Rank - 1 > targetRank.Rank ||
(playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank)))
{
if (m_ToLeader)
targetRank = RankDefinition.Ranks[targetRank.Rank + 1];
if (targetRank == RankDefinition.Leader)
{
if (m_ToLeader)
{
m_Member.GuildRank = targetRank;
pm.SendLocalizedMessage(1063156,
m_Member.Name); // The guild information for ~1_val~ has been updated.
pm.SendLocalizedMessage(1063156,
pm.Name); // The guild information for ~1_val~ has been updated.
guild.Leader = m_Member;
}
else
{
pm.SendLocalizedMessage(
1063144); // Are you sure you wish to make this member the new guild leader?
pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, false, true));
}
}
else
{
m_Member.GuildRank = targetRank;
pm.SendLocalizedMessage(1063156,
m_Member.Name); // The guild information for ~1_val~ has been updated.
pm.SendLocalizedMessage(1063156,
pm.Name); // The guild information for ~1_val~ has been updated.
guild.Leader = m_Member;
}
}
else
{
pm.SendLocalizedMessage(1063143); // You don't have permission to promote this member.
}
break;
}
case 2: // Demote
{
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && playerRank.Rank > targetRank.Rank)
{
if (targetRank == RankDefinition.Lowest)
{
if (RankDefinition.Lowest.Name.Number == 1062963)
pm.SendLocalizedMessage(1063333); // You can't demote a ronin.
else
pm.SendMessage("You can't demote a {0}.", RankDefinition.Lowest.Name);
}
else
{
pm.SendLocalizedMessage(
1063144); // Are you sure you wish to make this member the new guild leader?
pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, false, true));
m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
pm.SendLocalizedMessage(1063156,
m_Member.Name); // The guild information for ~1_val~ has been updated.
}
}
else
{
m_Member.GuildRank = targetRank;
pm.SendLocalizedMessage(1063156,
m_Member.Name); // The guild information for ~1_val~ has been updated.
pm.SendLocalizedMessage(1063146); // You don't have permission to demote this member.
}
}
else
{
pm.SendLocalizedMessage(1063143); // You don't have permission to promote this member.
}
break;
}
case 2: //Demote
{
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && playerRank.Rank > targetRank.Rank)
break;
}
case 3: // Set Guild title
{
if (targetRank == RankDefinition.Lowest)
if (playerRank.GetFlag(RankFlags.CanSetGuildTitle) &&
(playerRank.Rank > targetRank.Rank || m_Member == player))
{
if (RankDefinition.Lowest.Name.Number == 1062963)
pm.SendLocalizedMessage(1063333); // You can't demote a ronin.
pm.SendLocalizedMessage(
1011128); // Enter the new title for this guild member or 'none' to remove a title:
pm.BeginPrompt(SetTitle_Callback);
}
else if (m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0)
{
pm.SendLocalizedMessage(1070746); // You don't have the permission to set that member's guild title.
}
else
{
pm.SendLocalizedMessage(1063148); // You don't have permission to change this member's guild title.
}
break;
}
case 4: // Vote
{
if (m_Member == pm.GuildFealty && guild.Leader != m_Member)
{
pm.SendLocalizedMessage(1063158); // You have cleared your vote for guild leader.
}
else if (guild.CanVote(m_Member))
{
if (m_Member == guild.Leader)
{
pm.SendLocalizedMessage(1063424); // You can't vote for the current guild leader.
}
else if (!guild.CanBeVotedFor(m_Member))
{
pm.SendLocalizedMessage(1063425); // You can't vote for an inactive guild member.
}
else
pm.SendMessage("You can't demote a {0}.", RankDefinition.Lowest.Name);
{
pm.GuildFealty = m_Member;
pm.SendLocalizedMessage(1063159,
m_Member.Name); // You cast your vote for ~1_val~ for guild leader.
}
}
else
{
m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
pm.SendLocalizedMessage(1063156,
m_Member.Name); // The guild information for ~1_val~ has been updated.
pm.SendLocalizedMessage(1063149); // You don't have permission to vote.
}
}
else
{
pm.SendLocalizedMessage(1063146); // You don't have permission to demote this member.
}
break;
}
case 3: //Set Guild title
{
if (playerRank.GetFlag(RankFlags.CanSetGuildTitle) &&
(playerRank.Rank > targetRank.Rank || m_Member == player))
{
pm.SendLocalizedMessage(
1011128); // Enter the new title for this guild member or 'none' to remove a title:
pm.BeginPrompt(SetTitle_Callback);
break;
}
else if (m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0)
case 5: // Kick
{
pm.SendLocalizedMessage(1070746); // You don't have the permission to set that member's guild title.
}
else
{
pm.SendLocalizedMessage(1063148); // You don't have permission to change this member's guild title.
}
break;
}
case 4: //Vote
{
if (m_Member == pm.GuildFealty && guild.Leader != m_Member)
{
pm.SendLocalizedMessage(1063158); // You have cleared your vote for guild leader.
}
else if (guild.CanVote(m_Member)) //( playerRank.GetFlag( RankFlags.CanVote ) )
{
if (m_Member == guild.Leader)
if ((playerRank.GetFlag(RankFlags.RemovePlayers) && playerRank.Rank > targetRank.Rank) ||
(playerRank.GetFlag(RankFlags.RemoveLowestRank) && targetRank == RankDefinition.Lowest))
{
pm.SendLocalizedMessage(1063424); // You can't vote for the current guild leader.
}
else if (!guild.CanBeVotedFor(m_Member))
{
pm.SendLocalizedMessage(1063425); // You can't vote for an inactive guild member.
if (m_toKick)
{
guild.RemoveMember(m_Member);
pm.SendLocalizedMessage(1063157); // The member has been removed from your guild.
}
else
{
pm.SendLocalizedMessage(1063152); // Are you sure you wish to kick this member from the guild?
pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, true, false));
}
}
else
{
pm.GuildFealty = m_Member;
pm.SendLocalizedMessage(1063159,
m_Member.Name); // You cast your vote for ~1_val~ for guild leader.
pm.SendLocalizedMessage(1063151); // You don't have permission to remove this member.
}
}
else
{
pm.SendLocalizedMessage(1063149); // You don't have permission to vote.
}
break;
}
case 5: //Kick
{
if (playerRank.GetFlag(RankFlags.RemovePlayers) && playerRank.Rank > targetRank.Rank ||
playerRank.GetFlag(RankFlags.RemoveLowestRank) && targetRank == RankDefinition.Lowest)
{
if (m_toKick)
{
guild.RemoveMember(m_Member);
pm.SendLocalizedMessage(1063157); // The member has been removed from your guild.
}
else
{
pm.SendLocalizedMessage(1063152); // Are you sure you wish to kick this member from the guild?
pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, true, false));
}
break;
}
else
{
pm.SendLocalizedMessage(1063151); // You don't have permission to remove this member.
}
break;
}
}
}
@ -228,7 +227,6 @@ namespace Server.Guilds
return;
}
string title = Utility.FixHtml(text.Trim());
if (title.Length > 20)

View file

@ -9,12 +9,12 @@ namespace Server.Guilds
{
public class GuildRosterGump : BaseGuildListGump<PlayerMobile>
{
private static InfoField<PlayerMobile>[] m_Fields =
private static readonly InfoField<PlayerMobile>[] m_Fields =
{
new InfoField<PlayerMobile>(1062955, 130, NameComparer.Instance), //Name
new InfoField<PlayerMobile>(1062956, 80, RankComparer.Instance), //Rank
new InfoField<PlayerMobile>(1062952, 80, LastOnComparer.Instance), //Last On
new InfoField<PlayerMobile>(1062953, 150, TitleComparer.Instance) //Guild Title
new InfoField<PlayerMobile>(1062955, 130, NameComparer.Instance), // Name
new InfoField<PlayerMobile>(1062956, 80, RankComparer.Instance), // Rank
new InfoField<PlayerMobile>(1062952, 80, LastOnComparer.Instance), // Last On
new InfoField<PlayerMobile>(1062953, 150, TitleComparer.Instance) // Guild Title
};
public GuildRosterGump(PlayerMobile pm, Guild g) : this(pm, g, LastOnComparer.Instance)
@ -130,14 +130,10 @@ namespace Server.Guilds
{
pm.SendLocalizedMessage(1063051, targ.Name); // ~1_val~ is already a member of a guild.
}
else if (targ.HasGump<BaseGuildGump>() || targ.HasGump<CreateGuildGump>()
) //TODO: Check message if CreateGuildGump Open
else if (targ.HasGump<BaseGuildGump>() || targ.HasGump<CreateGuildGump>()) // TODO: Check message if CreateGuildGump Open
{
pm.SendLocalizedMessage(1063052, targ.Name); // ~1_val~ is currently considering another guild invitation.
}
#region Factions
else if (targ.Young && guildFaction != null)
{
pm.SendLocalizedMessage(1070766); // You cannot invite a young player to your faction-aligned guild.
@ -156,9 +152,6 @@ namespace Server.Guilds
// OSI does this quite strangely, so we'll just do it this way
pm.SendMessage("That person is quitting their faction and so you may not recruit them.");
}
#endregion
else
{
pm.SendLocalizedMessage(1063053, targ.Name); // You invite ~1_val~ to join your guild.
@ -166,8 +159,6 @@ namespace Server.Guilds
}
}
#region Comparers
private class NameComparer : IComparer<PlayerMobile>
{
public static readonly IComparer<PlayerMobile> Instance = new NameComparer();
@ -244,7 +235,5 @@ namespace Server.Guilds
return x.GuildRank.Rank.CompareTo(y.GuildRank.Rank);
}
}
#endregion
}
}

View file

@ -8,7 +8,7 @@ namespace Server.Guilds
{
public class OtherGuildInfo : BaseGuildGump
{
private Guild m_Other;
private readonly Guild m_Other;
public OtherGuildInfo(PlayerMobile pm, Guild g, Guild otherGuild) : base(pm, g, 10, 40)
{
@ -36,7 +36,7 @@ namespace Server.Guilds
AllianceInfo alliance = guild.Alliance;
AllianceInfo otherAlliance = m_Other.Alliance;
//NOTE TO SELF: Only only alliance leader can see pending guild alliance statuses
// NOTE TO SELF: Only only alliance leader can see pending guild alliance statuses
bool PendingWar = war != null;
bool ActiveWar = activeWar != null;
@ -50,14 +50,12 @@ namespace Server.Guilds
AddHtmlLocalized(20, 80, 120, 26, 1063025, 0x0, true); // <i>Alliance</i>
if (otherAlliance != null)
if (otherAlliance.IsMember(m_Other))
AddHtml(150, 83, 360, 26, otherAlliance.Name);
if (otherAlliance?.IsMember(m_Other) == true)
AddHtml(150, 83, 360, 26, otherAlliance.Name);
AddHtmlLocalized(20, 110, 120, 26, 1063139, 0x0, true); // <i>Abbreviation</i>
AddHtml(150, 113, 120, 26, m_Other.Abbreviation);
string kills = "0/0";
string time = "00:00";
string otherKills = "0/0";
@ -73,7 +71,6 @@ namespace Server.Guilds
if (activeWar.WarLength != TimeSpan.Zero && activeWar.WarBeginning + activeWar.WarLength > DateTime.UtcNow)
timeRemaining = activeWar.WarBeginning + activeWar.WarLength - DateTime.UtcNow;
//time = String.Format( "{0:D2}:{1:D2}", timeRemaining.Hours.ToString(), timeRemaining.Subtract( TimeSpan.FromHours( timeRemaining.Hours ) ).Minutes ); //Is there a formatter for htis? it's 2AM and I'm tired and can't find it
time = $"{timeRemaining.Hours:D2}:{DateTime.MinValue + timeRemaining:mm}";
otherWar = m_Other.FindActiveWar(guild);
@ -83,7 +80,7 @@ namespace Server.Guilds
else if (PendingWar)
{
kills = Color($"{war.Kills}/{war.MaxKills}", 0x990000);
//time = Color( String.Format( "{0}:{1}", war.WarLength.Hours, ((TimeSpan)(war.WarLength - TimeSpan.FromHours( war.WarLength.Hours ))).Minutes ), 0xFF0000 );
// time = Color( String.Format( "{0}:{1}", war.WarLength.Hours, ((TimeSpan)(war.WarLength - TimeSpan.FromHours( war.WarLength.Hours ))).Minutes ), 0xFF0000 );
time = Color($"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}", 0x990000);
otherWar = m_Other.FindPendingWar(guild);
@ -104,7 +101,6 @@ namespace Server.Guilds
int number = 1062973; // <div align=center>You are at peace with this guild.</div>
if (PendingWar)
{
if (war.WarRequester)
@ -116,7 +112,7 @@ namespace Server.Guilds
number = 1062969; // <div align=center>This guild has challenged you to war!</div>
AddButtonAndBackground(20, 260, 5, 1062981); // Accept Challenge
AddButtonAndBackground(275, 260, 6, 1062983); //Modify Terms
AddButtonAndBackground(275, 260, 6, 1062983); // Modify Terms
}
AddButtonAndBackground(20, 290, 7, 1062982); // Dismiss Challenge
@ -126,9 +122,9 @@ namespace Server.Guilds
number = 1062965; // <div align=center>You are at war with this guild!</div>
AddButtonAndBackground(20, 290, 8, 1062980); // Surrender
}
else if (alliance != null && alliance == otherAlliance) //alliance, Same Alliance
else if (alliance != null && alliance == otherAlliance) // alliance, Same Alliance
{
if (alliance.IsMember(guild) && alliance.IsMember(m_Other)) //Both in Same alliance, full members
if (alliance.IsMember(guild) && alliance.IsMember(m_Other)) // Both in Same alliance, full members
{
number = 1062970; // <div align=center>You are allied with this guild.</div>
@ -137,21 +133,21 @@ namespace Server.Guilds
AddButtonAndBackground(20, 260, 12, 1062984); // Remove Guild from Alliance
AddButtonAndBackground(275, 260, 13,
1063433); // Promote to Alliance Leader //Note: No 'confirmation' like the other leader guild promotion things
//Remove guild from alliance //Promote to Alliance Leader
// Remove guild from alliance //Promote to Alliance Leader
}
//Show roster, Centered, up
AddButtonAndBackground(148, 215, 10, 1063164); //Show Alliance Roster
//Leave Alliance
// Show roster, Centered, up
AddButtonAndBackground(148, 215, 10, 1063164); // Show Alliance Roster
// Leave Alliance
AddButtonAndBackground(20, 290, 11, 1062985); // Leave Alliance
}
else if (alliance.Leader == guild && alliance.IsPendingMember(m_Other))
{
number = 1062971; // <div align=center>You have requested an alliance with this guild.</div>
//Show Alliance Roster, Centered, down.
AddButtonAndBackground(148, 245, 10, 1063164); //Show Alliance Roster
//Withdraw Request
// Show Alliance Roster, Centered, down.
AddButtonAndBackground(148, 245, 10, 1063164); // Show Alliance Roster
// Withdraw Request
AddButtonAndBackground(20, 290, 14, 1062986); // Withdraw Request
AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99));
@ -160,10 +156,10 @@ namespace Server.Guilds
{
number = 1062972; // <div align=center>This guild has requested an alliance.</div>
//Show alliance Roster, top
AddButtonAndBackground(148, 215, 10, 1063164); //Show Alliance Roster
//Deny Request
//Accept Request
// Show alliance Roster, top
AddButtonAndBackground(148, 215, 10, 1063164); // Show Alliance Roster
// Deny Request
// Accept Request
AddButtonAndBackground(20, 260, 15, 1062988); // Deny Request
AddButtonAndBackground(20, 290, 16, 1062987); // Accept Request
@ -176,13 +172,12 @@ namespace Server.Guilds
AddButtonAndBackground(20, 290, 1, 1062989); // Declare War!
}
AddButtonAndBackground(275, 290, 0, 3000091); //Cancel
AddButtonAndBackground(275, 290, 0, 3000091); // Cancel
AddHtmlLocalized(20, 180, 480, 30, number, 0x0, true);
AddImageTiled(20, 245, 480, 2, 0x2711);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (!(sender.Mobile is PlayerMobile pm && IsMember(pm, guild)))
@ -202,11 +197,122 @@ namespace Server.Guilds
switch (info.ButtonID)
{
#region War
case 5: // Accept the war
{
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
// Accept the war
guild.PendingWars.Remove(war);
war.WarBeginning = DateTime.UtcNow;
guild.AcceptedWars.Add(war);
case 5: //Accept the war
{
if (war?.WarRequester == false && activeWar == null)
if (alliance?.IsMember(guild) == true)
{
alliance.AllianceMessage(1070769,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
alliance.InvalidateMemberProperties();
}
else
{
guild.GuildMessage(1070769,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
guild.InvalidateMemberProperties();
}
// Technically SHOULD say Your guild is now at war w/out any info, intentional diff.
otherGuild.PendingWars.Remove(otherWar);
otherWar.WarBeginning = DateTime.UtcNow;
otherGuild.AcceptedWars.Add(otherWar);
if (otherAlliance != null && m_Other.Alliance.IsMember(m_Other))
{
otherAlliance.AllianceMessage(1070769,
alliance != null
? alliance.Name
: guild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
otherAlliance.InvalidateMemberProperties();
}
else
{
otherGuild.GuildMessage(1070769,
alliance != null
? alliance.Name
: guild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
otherGuild.InvalidateMemberProperties();
}
}
}
break;
}
case 6: // Modify war terms
{
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, otherGuild));
}
}
break;
}
case 7: // Dismiss war
{
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
// Dismiss the war
guild.PendingWars.Remove(war);
otherGuild.PendingWars.Remove(otherWar);
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
// Messages to opposing guild? (Testing on OSI says no)
}
}
break;
}
case 8: // Surrender
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
@ -216,421 +322,299 @@ namespace Server.Guilds
{
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
//Accept the war
guild.PendingWars.Remove(war);
war.WarBeginning = DateTime.UtcNow;
guild.AcceptedWars.Add(war);
if (activeWar != null)
{
if (alliance?.IsMember(guild) == true)
{
alliance.AllianceMessage(1070740,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // You have lost the war with ~1_val~.
alliance.InvalidateMemberProperties();
}
else
{
guild.GuildMessage(1070740,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // You have lost the war with ~1_val~.
guild.InvalidateMemberProperties();
}
if (alliance?.IsMember(guild) == true)
{
alliance.AllianceMessage(1070769,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
alliance.InvalidateMemberProperties();
}
else
{
guild.GuildMessage(1070769,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
guild.InvalidateMemberProperties();
}
//Technically SHOULD say Your guild is now at war w/out any info, intentional diff.
guild.AcceptedWars.Remove(activeWar);
otherGuild.PendingWars.Remove(otherWar);
otherWar.WarBeginning = DateTime.UtcNow;
otherGuild.AcceptedWars.Add(otherWar);
if (otherAlliance?.IsMember(otherGuild) == true)
{
otherAlliance.AllianceMessage(1070739,
guild.Alliance != null
? guild.Alliance.Name
: guild.Name); // You have won the war against ~1_val~!
otherAlliance.InvalidateMemberProperties();
}
else
{
otherGuild.GuildMessage(1070739,
guild.Alliance != null
? guild.Alliance.Name
: guild.Name); // You have won the war against ~1_val~!
otherGuild.InvalidateMemberProperties();
}
if (otherAlliance != null && m_Other.Alliance.IsMember(m_Other))
{
otherAlliance.AllianceMessage(1070769,
alliance != null
? alliance.Name
: guild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
otherAlliance.InvalidateMemberProperties();
}
else
{
otherGuild.GuildMessage(1070769,
alliance != null
? alliance.Name
: guild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
otherGuild.InvalidateMemberProperties();
otherGuild.AcceptedWars.Remove(otherGuild.FindActiveWar(guild));
}
}
break;
}
case 1: // Declare War
{
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else if (otherAlliance != null && otherAlliance.Leader != m_Other)
{
pm.SendLocalizedMessage(1063239,
$"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, m_Other));
}
}
break;
}
break;
}
case 6: //Modify war terms
{
if (war?.WarRequester == false && activeWar == null)
case 2: // Request Alliance
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
if (alliance == null)
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
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.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
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))
pm.SendLocalizedMessage(1063416,
m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
else
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:
pm.BeginPrompt(CreateAlliance_Callback);
}
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, otherGuild));
}
}
break;
}
case 7: //Dismiss war
{
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
//Dismiss the war
guild.PendingWars.Remove(war);
otherGuild.PendingWars.Remove(otherWar);
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
//Messages to opposing guild? (Testing on OSI says no)
}
}
break;
}
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
if (activeWar != null)
{
if (alliance?.IsMember(guild) == true)
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
alliance.AllianceMessage(1070740,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // You have lost the war with ~1_val~.
alliance.InvalidateMemberProperties();
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else
else if (alliance.Leader != guild)
{
guild.GuildMessage(1070740,
otherAlliance != null
? otherAlliance.Name
: otherGuild.Name); // You have lost the war with ~1_val~.
guild.InvalidateMemberProperties();
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
guild.AcceptedWars.Remove(activeWar);
if (otherAlliance?.IsMember(otherGuild) == true)
else if (otherAlliance != null)
{
otherAlliance.AllianceMessage(1070739,
guild.Alliance != null
? guild.Alliance.Name
: guild.Name); // You have won the war against ~1_val~!
otherAlliance.InvalidateMemberProperties();
if (otherAlliance.IsPendingMember(m_Other))
pm.SendLocalizedMessage(1063416,
m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else
else if (alliance.IsPendingMember(guild))
{
otherGuild.GuildMessage(1070739,
guild.Alliance != null
? guild.Alliance.Name
: guild.Name); // You have won the war against ~1_val~!
otherGuild.InvalidateMemberProperties();
}
otherGuild.AcceptedWars.Remove(otherGuild.FindActiveWar(guild));
}
}
break;
}
case 1: //Declare War
{
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else if (otherAlliance != null && otherAlliance.Leader != m_Other)
{
pm.SendLocalizedMessage(1063239,
$"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, m_Other));
}
}
break;
}
#endregion
case 2: //Request Alliance
{
#region New alliance
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))
pm.SendLocalizedMessage(1063416,
m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
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(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:
pm.BeginPrompt(CreateAlliance_Callback);
{
pm.SendLocalizedMessage(1070750,
m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.
m_Other.GuildMessage(1070780, guild.Name); // ~1_val~ has proposed an alliance.
m_Other.Alliance = alliance; // Calls addPendingGuild
// alliance.AddPendingGuild( m_Other );
}
}
break;
}
case 10: // Show Alliance Roster
{
if (alliance != null && alliance == otherAlliance)
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, alliance));
#endregion
#region Existing Alliance
else
break;
}
case 11: // Leave Alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance.Leader != guild)
else if (alliance?.IsMember(guild) == true)
{
guild.Alliance = null; // Calls alliance.Removeguild
// alliance.RemoveGuild( guild );
m_Other.InvalidateWarNotoriety();
guild.InvalidateMemberNotoriety();
}
break;
}
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 (otherAlliance != null)
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
{
if (otherAlliance.IsPendingMember(m_Other))
pm.SendLocalizedMessage(1063416,
m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
m_Other.Alliance = null;
m_Other.InvalidateMemberNotoriety();
guild.InvalidateWarNotoriety();
}
else if (alliance.IsPendingMember(guild))
break;
}
case 13: // Promote to Alliance leader
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063416,
guild.Name); // ~1_val~ is currently considering another alliance proposal.
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
{
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
pm.SendLocalizedMessage(1063434,
$"{m_Other.Name}\t{alliance.Name}"); // ~1_val~ is now the leader of ~2_val~.
alliance.Leader = m_Other;
}
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
break;
}
case 14: // Withdraw Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else
else if (alliance != null && alliance.Leader == guild && alliance.IsPendingMember(m_Other))
{
pm.SendLocalizedMessage(1070750,
m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.
m_Other.GuildMessage(1070780, guild.Name); // ~1_val~ has proposed an alliance.
m_Other.Alliance = alliance; //Calls addPendingGuild
//alliance.AddPendingGuild( m_Other );
m_Other.Alliance = null;
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
}
break;
}
#endregion
break;
}
case 10: //Show Alliance Roster
{
if (alliance != null && alliance == otherAlliance)
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, alliance));
break;
}
case 11: //Leave Alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
case 15: // Deny Alliance Request
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
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))
{
// The proposal has been updated.
// m_Other.GuildMessage( 1070782 );
// // ~1_val~ has responded to your proposal.
// //Per OSI commented out.
pm.SendLocalizedMessage(1070752);
guild.Alliance = null;
}
break;
}
else if (alliance?.IsMember(guild) == true)
case 16: // Accept Alliance Request
{
guild.Alliance = null; //Calls alliance.Removeguild
// alliance.RemoveGuild( guild );
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))
{
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
m_Other.InvalidateWarNotoriety();
otherAlliance
.TurnToMember(
m_Other); // No need to verify it's in the guild or already a member, the function does this
guild.InvalidateMemberNotoriety();
otherAlliance.TurnToMember(guild);
}
break;
}
break;
}
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;
m_Other.InvalidateMemberNotoriety();
guild.InvalidateWarNotoriety();
}
break;
}
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,
$"{m_Other.Name}\t{alliance.Name}"); // ~1_val~ is now the leader of ~2_val~.
alliance.Leader = m_Other;
}
break;
}
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;
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
}
break;
}
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))
{
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal. //Per OSI commented out.
guild.Alliance = null;
}
break;
}
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))
{
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
otherAlliance
.TurnToMember(
m_Other); //No need to verify it's in the guild or already a member, the function does this
otherAlliance.TurnToMember(guild);
}
break;
}
}
}
public void CreateAlliance_Callback(Mobile from, string text)
{
PlayerMobile pm = from as PlayerMobile;
if (!(from is PlayerMobile pm))
return;
AllianceInfo alliance = guild.Alliance;
AllianceInfo otherAlliance = m_Other.Alliance;
@ -638,17 +622,15 @@ 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.
// 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.
}

View file

@ -7,7 +7,7 @@ namespace Server.Guilds
{
public class WarDeclarationGump : BaseGuildGump
{
private Guild m_Other;
private readonly Guild m_Other;
public WarDeclarationGump(PlayerMobile pm, Guild g, Guild otherGuild) : base(pm, g)
{
@ -48,91 +48,91 @@ namespace Server.Guilds
switch (info.ButtonID)
{
case 1:
{
AllianceInfo alliance = guild.Alliance;
AllianceInfo otherAlliance = m_Other.Alliance;
{
AllianceInfo alliance = guild.Alliance;
AllianceInfo otherAlliance = m_Other.Alliance;
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,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else if (otherAlliance != null && otherAlliance.Leader != m_Other)
{
pm.SendLocalizedMessage(1063239,
$"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
WarDeclaration activeWar = guild.FindActiveWar(m_Other);
if (activeWar == null)
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
WarDeclaration war = guild.FindPendingWar(m_Other);
WarDeclaration otherWar = m_Other.FindPendingWar(guild);
//Note: OSI differs from what it says on website. unlimited war = 0 kills/ 0 hrs. Not > 999. (sidenote: they both cap at 65535, 7.5 years, but, still.)
TextRelay tKills = info.GetTextEntry(11);
TextRelay tWarLength = info.GetTextEntry(10);
int maxKills = tKills == null
? 0
: Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(11).Text), 0xFFFF), 0);
TimeSpan warLength = TimeSpan.FromHours(tWarLength == null
? 0
: Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(10).Text), 0xFFFF), 0));
if (war != null)
{
war.MaxKills = maxKills;
war.WarLength = warLength;
war.WarRequester = true;
}
else
{
guild.PendingWars.Add(new WarDeclaration(guild, m_Other, maxKills, warLength, true));
}
if (otherWar != null)
{
otherWar.MaxKills = maxKills;
otherWar.WarLength = warLength;
otherWar.WarRequester = false;
}
else
{
m_Other.PendingWars.Add(new WarDeclaration(m_Other, guild, maxKills, warLength, false));
}
if (war != null)
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
else
m_Other.GuildMessage(1070781,
guild.Alliance != null
? guild.Alliance.Name
: guild.Name); // ~1_val~ has proposed a war.
pm.SendLocalizedMessage(1070751,
m_Other.Alliance != null
? m_Other.Alliance.Name
: m_Other.Name); // War proposal has been sent to ~1_val~.
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
}
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.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else if (otherAlliance != null && otherAlliance.Leader != m_Other)
{
pm.SendLocalizedMessage(1063239,
$"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707,
otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
WarDeclaration activeWar = guild.FindActiveWar(m_Other);
break;
}
if (activeWar == null)
{
WarDeclaration war = guild.FindPendingWar(m_Other);
WarDeclaration otherWar = m_Other.FindPendingWar(guild);
// Note: OSI differs from what it says on website. unlimited war = 0 kills/ 0 hrs. Not > 999. (sidenote: they both cap at 65535, 7.5 years, but, still.)
TextRelay tKills = info.GetTextEntry(11);
TextRelay tWarLength = info.GetTextEntry(10);
int maxKills = tKills == null
? 0
: Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(11).Text), 0xFFFF), 0);
TimeSpan warLength = TimeSpan.FromHours(tWarLength == null
? 0
: Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(10).Text), 0xFFFF), 0));
if (war != null)
{
war.MaxKills = maxKills;
war.WarLength = warLength;
war.WarRequester = true;
}
else
{
guild.PendingWars.Add(new WarDeclaration(guild, m_Other, maxKills, warLength, true));
}
if (otherWar != null)
{
otherWar.MaxKills = maxKills;
otherWar.WarLength = warLength;
otherWar.WarRequester = false;
}
else
{
m_Other.PendingWars.Add(new WarDeclaration(m_Other, guild, maxKills, warLength, false));
}
if (war != null)
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
else
m_Other.GuildMessage(1070781,
guild.Alliance != null
? guild.Alliance.Name
: guild.Name); // ~1_val~ has proposed a war.
pm.SendLocalizedMessage(1070751,
m_Other.Alliance != null
? m_Other.Alliance.Name
: m_Other.Name); // War proposal has been sent to ~1_val~.
}
}
break;
}
default:
{
pm.SendGump(new OtherGuildInfo(pm, guild, m_Other));
break;
}
{
pm.SendGump(new OtherGuildInfo(pm, guild, m_Other));
break;
}
}
}
}