Formatting #2 (#59)

This commit is contained in:
Kamron Batman 2019-10-05 00:37:03 -07:00 committed by GitHub
parent 096d39609e
commit 8e9221bb5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
400 changed files with 3688 additions and 5969 deletions

View file

@ -79,21 +79,13 @@ namespace Server.Factions
{
get
{
TimeSpan period;
switch (CurrentState)
var period = CurrentState switch
{
default:
case ElectionState.Pending:
period = PendingPeriod;
break;
case ElectionState.Election:
period = VotingPeriod;
break;
case ElectionState.Campaign:
period = CampaignPeriod;
break;
}
ElectionState.Pending => PendingPeriod,
ElectionState.Election => VotingPeriod,
ElectionState.Campaign => CampaignPeriod,
_ => PendingPeriod
};
TimeSpan until = LastStateTime + period - DateTime.UtcNow;
@ -104,21 +96,13 @@ namespace Server.Factions
}
set
{
TimeSpan period;
switch (CurrentState)
var period = CurrentState switch
{
default:
case ElectionState.Pending:
period = PendingPeriod;
break;
case ElectionState.Election:
period = VotingPeriod;
break;
case ElectionState.Campaign:
period = CampaignPeriod;
break;
}
ElectionState.Pending => PendingPeriod,
ElectionState.Election => VotingPeriod,
ElectionState.Campaign => CampaignPeriod,
_ => PendingPeriod
};
LastStateTime = DateTime.UtcNow - period + value;
}

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Server.Accounting;
using Server.Commands;
using Server.Commands.Generic;
using Server.Engines.ConPVP;
using Server.Ethics;
@ -381,7 +380,7 @@ namespace Server.Factions
else
{
AddMember(mob);
mob.SendLocalizedMessage(1042756, true, " " + m_Definition.FriendlyName); // You are now joining a faction:
mob.SendLocalizedMessage(1042756, true, $" {m_Definition.FriendlyName}"); // You are now joining a faction:
}
}
@ -424,7 +423,7 @@ namespace Server.Factions
{
pm.SendLocalizedMessage(1010104); // You cannot join a faction as a young player
}
else if (pl != null && pl.IsLeaving)
else if (pl?.IsLeaving == true)
{
pm.SendLocalizedMessage(
1005051); // You cannot use the faction stone until you have finished quitting your current faction
@ -505,7 +504,7 @@ namespace Server.Factions
{
PlayerState pl = PlayerState.Find(mob);
if (pl == null || !pl.IsLeaving)
if (pl?.IsLeaving != true)
return false;
if (pl.Leaving + LeavePeriod >= DateTime.UtcNow)

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Commands;
namespace Server.Factions
{

View file

@ -29,7 +29,7 @@ namespace Server.Factions
{
Town town = Town.FromRegion(from.Region);
if (town == null || !town.IsFinance(from) || !from.Alive)
if (town?.IsFinance(from) != true || !from.Alive)
break;
if (FactionGump.Exists(from))
@ -43,7 +43,7 @@ namespace Server.Factions
{
Town town = Town.FromRegion(from.Region);
if (town == null || !town.IsSheriff(from) || !from.Alive)
if (town?.IsSheriff(from) != true || !from.Alive)
break;
if (FactionGump.Exists(from))
@ -123,7 +123,7 @@ namespace Server.Factions
{
Faction faction = Faction.Find(from);
if (faction == null || !faction.IsCommander(from))
if (faction?.IsCommander(from) != true)
break;
if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady)
@ -151,4 +151,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Commands;
using Server.Targeting;
namespace Server.Factions