Пример #1
0
 public bool TryStartDissmisProgress(Character initer, Character dissmiser)
 {
     lock (this)
     {
         if (IsDismissInProgress)
         {
             if (DissmissTimeouted < DateTime.Now)
             {
                 Asda2BattlegroundHandler.SendDissmissResultResponse(this, DismissPlayerResult.Fail,
                                                                     DissmissingCharacter.SessionId, (int)DissmissingCharacter.AccId);
             }
             else
             {
                 return(false);
             }
         }
         IsDismissInProgress = true;
         Asda2BattlegroundHandler.SendQuestionDismissPlayerOrNotResponse(this, initer, dissmiser);
         DissmissingCharacter = dissmiser;
         DissmissYes.Clear();
         DissmissNo.Clear();
         DissmissTimeouted = DateTime.Now.AddMinutes(1);
         DissmisFaction    = initer.Asda2FactionId;
         return(true);
     }
 }
Пример #2
0
 public void AnswerDismiss(bool kick, Character answerer)
 {
     lock (this)
     {
         if (!this.IsDismissInProgress || (int)answerer.Asda2FactionId != (int)this.DissmisFaction ||
             answerer == this.DissmissingCharacter)
         {
             return;
         }
         if (kick)
         {
             if (this.DissmissYes.Contains(answerer))
             {
                 return;
             }
             this.DissmissYes.Add(answerer);
             if ((double)this.DissmissYes.Count <= (this.DissmisFaction == (short)0
                     ? (double)this.LightTeam.Count * 0.65
                     : (double)this.DarkTeam.Count * 0.65))
             {
                 return;
             }
             Asda2BattlegroundHandler.SendDissmissResultResponse(this, DismissPlayerResult.Ok,
                                                                 this.DissmissingCharacter.SessionId, (int)this.DissmissingCharacter.AccId);
             this.Leave(this.DissmissingCharacter);
             this.IsDismissInProgress  = false;
             this.DissmissingCharacter = (Character)null;
         }
         else
         {
             if (this.DissmissNo.Contains(answerer))
             {
                 return;
             }
             this.DissmissNo.Add(answerer);
             if ((double)this.DissmissNo.Count <= (this.DissmisFaction == (short)0
                     ? (double)this.LightTeam.Count * 0.3
                     : (double)this.DarkTeam.Count * 0.3))
             {
                 return;
             }
             Asda2BattlegroundHandler.SendDissmissResultResponse(this, DismissPlayerResult.Fail,
                                                                 this.DissmissingCharacter.SessionId, (int)this.DissmissingCharacter.AccId);
             this.IsDismissInProgress  = false;
             this.DissmissingCharacter = (Character)null;
         }
     }
 }
Пример #3
0
 public void AnswerDismiss(bool kick, Character answerer)
 {
     lock (this)
     {
         if (!IsDismissInProgress || answerer.Asda2FactionId != DissmisFaction || answerer == DissmissingCharacter)
         {
             return;
         }
         if (kick)
         {
             if (DissmissYes.Contains(answerer))
             {
                 return;
             }
             DissmissYes.Add(answerer);
             if (DissmissYes.Count > (DissmisFaction == 0 ? LightTeam.Count * 0.65 : DarkTeam.Count * 0.65))
             {
                 //kick him
                 Asda2BattlegroundHandler.SendDissmissResultResponse(this, DismissPlayerResult.Ok,
                                                                     DissmissingCharacter.SessionId,
                                                                     (int)DissmissingCharacter.AccId);
                 Leave(DissmissingCharacter);
                 IsDismissInProgress  = false;
                 DissmissingCharacter = null;
             }
         }
         else
         {
             if (DissmissNo.Contains(answerer))
             {
                 return;
             }
             DissmissNo.Add(answerer);
             if (DissmissNo.Count > (DissmisFaction == 0 ? LightTeam.Count * 0.3 : DarkTeam.Count * 0.3))
             {
                 //CANcel dissmis
                 Asda2BattlegroundHandler.SendDissmissResultResponse(this, DismissPlayerResult.Fail,
                                                                     DissmissingCharacter.SessionId,
                                                                     (int)DissmissingCharacter.AccId);
                 IsDismissInProgress  = false;
                 DissmissingCharacter = null;
             }
         }
     }
 }