public void CheckExpiredWars()
{
for( int i = 0; i < AcceptedWars.Count; i++ )
{
WarDeclaration w = AcceptedWars[i];
Guild g = w.Opponent;
WarStatus status = w.Status;
if( status != WarStatus.InProgress )
{
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 ) );
if( inAlliance )
{
myAlliance.AllianceMessage( 1070739 + (int)status, (g == null) ? "a deleted opponent" : (otherInAlliance ? otherAlliance.Name : g.Name) );
myAlliance.InvalidateMemberProperties();
}
else
{
GuildMessage( 1070739 + (int)status, (g == null) ? "a deleted opponent" : (otherInAlliance ? otherAlliance.Name : g.Name) );
InvalidateMemberProperties();
}
this.AcceptedWars.Remove( w );
if( g != null )
{
if( status != WarStatus.Draw )
status = (WarStatus)((int)status + 1 % 2);
if( otherInAlliance )
{
otherAlliance.AllianceMessage( 1070739 + (int)status, ( inAlliance ? this.Alliance.Name : this.Name ) );
otherAlliance.InvalidateMemberProperties();
}
else
{
g.GuildMessage( 1070739 + (int)status, (inAlliance ? this.Alliance.Name : this.Name) );
g.InvalidateMemberProperties();
}
g.AcceptedWars.Remove( g.FindActiveWar( this ) );
}
}
}
for( int i = 0; i < PendingWars.Count; i++ )
{
WarDeclaration w = PendingWars[i];
Guild g = w.Opponent;
if( w.Status != WarStatus.Pending )
{
//All sanity in here
this.PendingWars.Remove( w );
if( g != null )
{
g.PendingWars.Remove( g.FindPendingWar( this ) );
}
}
}
}