Upgrades code style - First batch (#22)

This commit is contained in:
Kamron Batman 2018-08-14 06:16:50 +08:00 committed by GitHub
parent 8ee42c8ea2
commit 632e8b4757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1834 changed files with 10245 additions and 10437 deletions

View file

@ -55,7 +55,7 @@ namespace Server.Guilds
public RankDefinition( TextDefinition name, int rank, RankFlags flags )
{
m_Name = name;
m_Name = name;
m_Rank = rank;
m_Flags = flags;
}
@ -90,7 +90,7 @@ namespace Server.Guilds
private Guild m_Leader;
private List<Guild> m_Members;
private List<Guild> m_PendingMembers;
public string Name
{
get{ return m_Name; }
@ -117,7 +117,7 @@ namespace Server.Guilds
get
{
CheckLeader();
return m_Leader;
return m_Leader;
}
set
{
@ -222,7 +222,7 @@ namespace Server.Guilds
{
m_PendingMembers.Remove( g );
}
if( m_Members.Contains( g ) ) //Sanity, just incase someone with a custom script adds a character to BOTH arrays
{
m_Members.Remove( g );
@ -262,10 +262,7 @@ namespace Server.Guilds
for( int i = 0; i < m_Members.Count; i++ )
m_Members[i].Alliance = null;
AllianceInfo aInfo = null;
m_Alliances.TryGetValue( m_Name.ToLower(), out aInfo );
m_Alliances.TryGetValue( m_Name.ToLower(), out AllianceInfo aInfo );
if( aInfo == this )
m_Alliances.Remove( m_Name.ToLower() );
@ -432,7 +429,7 @@ namespace Server.Guilds
public int Kills
{
get{ return m_Kills; }
get{ return m_Kills; }
set{ m_Kills = value; }
}
public int MaxKills
@ -455,7 +452,7 @@ namespace Server.Guilds
}
public DateTime WarBeginning
{
get{ return m_WarBeginning; }
get{ return m_WarBeginning; }
set{ m_WarBeginning = value; }
}
public bool WarRequester
@ -568,7 +565,7 @@ namespace Server.Guilds
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()
protected override void OnTick()
{
foreach( Guild g in Guild.List.Values )
g.CheckExpiredWars();
@ -680,7 +677,7 @@ namespace Server.Guilds
PlayerMobile pm = args.Mobile as PlayerMobile;
if( !NewGuildSystem || pm == null )
return;
if( pm.Guild == null )
pm.SendGump( new CreateGuildGump( pm ) );
else
@ -729,7 +726,7 @@ namespace Server.Guilds
if( value != null )
{
if( value.Leader == this )
m_AllianceInfo = value;
else
@ -799,14 +796,14 @@ namespace Server.Guilds
return false;
}
}
public static Guild GetAllianceLeader( Guild g )
{
AllianceInfo alliance = g.Alliance;
if ( alliance != null && alliance.Leader != null && alliance.IsMember( g ) )
return alliance.Leader;
return g;
}
@ -820,7 +817,7 @@ namespace Server.Guilds
}
public List<WarDeclaration> AcceptedWars
{
get{ return m_AcceptedWars; }
get{ return m_AcceptedWars; }
}
@ -863,7 +860,7 @@ namespace Server.Guilds
{
AllianceInfo myAlliance = this.Alliance;
bool inAlliance = ( myAlliance != null && myAlliance.IsMember( this ) );
AllianceInfo otherAlliance = ((g != null) ? g.Alliance : null);
bool otherInAlliance = ( otherAlliance != null && otherAlliance.IsMember( this ) );
@ -937,12 +934,12 @@ namespace Server.Guilds
Guild victimGuild = GetAllianceLeader( victim.Guild as Guild );
Guild killerGuild = GetAllianceLeader( killer.Guild as Guild );
WarDeclaration war = killerGuild.FindActiveWar( victimGuild );
if( war == null )
return;
war.Kills++;
if ( war.Opponent == victimGuild )
@ -1049,7 +1046,7 @@ namespace Server.Guilds
m_Members[i].Delta( MobileDelta.Noto );
}
}
public void InvalidateWarNotoriety()
{
Guild g = GetAllianceLeader( this );
@ -1058,14 +1055,14 @@ namespace Server.Guilds
g.Alliance.InvalidateMemberNotoriety();
else
g.InvalidateMemberNotoriety();
if ( g.AcceptedWars == null )
return;
foreach ( WarDeclaration warDec in g.AcceptedWars )
{
Guild opponent = warDec.Opponent;
if ( opponent.Alliance != null )
opponent.Alliance.InvalidateMemberNotoriety();
else
@ -1340,7 +1337,7 @@ namespace Server.Guilds
m_Members = reader.ReadStrongMobileList();
m_Candidates = reader.ReadStrongMobileList();
m_Accepted = reader.ReadStrongMobileList();
m_Accepted = reader.ReadStrongMobileList();
m_Guildstone = reader.ReadItem();
m_Teleporter = reader.ReadItem();
@ -1388,7 +1385,7 @@ namespace Server.Guilds
alliance = this.Alliance; //CheckLeader could possibly change the value of this.Alliance
if( alliance != null && !alliance.IsMember( this ) && !alliance.IsPendingMember( this ) ) //This block is there to fix a bug in the code in an older version.
if( alliance != null && !alliance.IsMember( this ) && !alliance.IsPendingMember( this ) ) //This block is there to fix a bug in the code in an older version.
this.Alliance = null; //Will call Alliance.RemoveGuild which will set it null & perform all the pertient checks as far as alliacne disbanding
}
@ -1413,7 +1410,7 @@ namespace Server.Guilds
if( m is PlayerMobile )
((PlayerMobile)m).GuildRank = RankDefinition.Lowest;
Guild guild = m.Guild as Guild;
if ( guild != null )
@ -1430,9 +1427,9 @@ namespace Server.Guilds
if ( m_Members.Contains( m ) )
{
m_Members.Remove( m );
Guild guild = m.Guild as Guild;
m.Guild = null;
if( m is PlayerMobile )
@ -1451,10 +1448,10 @@ namespace Server.Guilds
if ( m_Members.Count == 0 )
Disband();
if ( guild != null )
guild.InvalidateWarNotoriety();
m.Delta( MobileDelta.Noto );
}
}
@ -1624,20 +1621,18 @@ namespace Server.Guilds
{
if ( m_Leader != null && !m_Leader.Deleted && m_Leader.Guild == this )
m = m_Leader;
else
else
m = memb;
}
if ( m == null )
continue;
int v;
if( !votes.TryGetValue( m, out v ) )
if( !votes.TryGetValue( m, out int v ) )
votes[m] = 1;
else
votes[m] = v + 1;
votingMembers++;
}