Server.Guilds.Guild.CheckExpiredWars C# (CSharp) Méthode

CheckExpiredWars() public méthode

public CheckExpiredWars ( ) : void
Résultat void
		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 ) );
					}
				}
			}
		}

Usage Example

Exemple #1
0
        public static void HandleDeath(Mobile victim, Mobile killer)
        {
            if (killer == null)
            {
                killer = victim.FindMostRecentDamager(false);
            }

            if (killer == null || victim.Guild == null || killer.Guild == null)
            {
                return;
            }

            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)
            {
                killerGuild.CheckExpiredWars();
            }
            else
            {
                victimGuild.CheckExpiredWars();
            }
        }
All Usage Examples Of Server.Guilds.Guild::CheckExpiredWars