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

@ -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;
}
}
}
}