Example #1
0
        public bool RemovePlayer(Account p)
        {
            Channel ch = ServersManager.GetChannel(channelId);

            if (ch == null)
            {
                return(false);
            }
            BaseRemovePlayer(p);
            if (GetCountPlayers() == 0)
            {
                ch.RemoveMatch(matchId);
            }
            else
            {
                if (p.matchSlot == leader)
                {
                    SetNewLeader(-1, -1);
                }
                using (CLAN_WAR_REGIST_MERCENARY_PAK packet = new CLAN_WAR_REGIST_MERCENARY_PAK(this))
                {
                    SendPacketToPlayers(packet);
                }
            }
            p.matchSlot = -1;
            p.match     = null;
            return(true);
        }
Example #2
0
        public bool RemovePlayer(Account p)
        {
            Channel channel = ChannelsXML.getChannel(this.channelId);

            if (channel == null)
            {
                return(false);
            }
            this.BaseRemovePlayer(p);
            if (this.getCountPlayers() == 0)
            {
                channel.RemoveMatch(this._matchId);
            }
            else
            {
                if (p.matchSlot == this._leader)
                {
                    this.setNewLeader(-1, -1);
                }
                using (CLAN_WAR_REGIST_MERCENARY_PAK registMercenaryPak = new CLAN_WAR_REGIST_MERCENARY_PAK(this))
                    this.SendPacketToPlayers((SendPacket)registMercenaryPak);
            }
            p.matchSlot = -1;
            p._match    = (Match)null;
            return(true);
        }
Example #3
0
 private bool serverCommands(Account player, Match match)
 {
     try
     {
         if (!player.HaveGMLevel() || !(text.StartsWith(";") || text.StartsWith(@"\") || text.StartsWith(".")))
         {
             return(false);
         }
         string str = text.Substring(1);
         if (str.StartsWith("o") && (int)player.access >= 3)
         {
             if (match != null)
             {
                 AccountManager.getAccountDB((long)2, 2);
                 for (int i = 0; i < match.formação; i++)
                 {
                     SLOT_MATCH slot = match._slots[i];
                     if (slot._playerId == 0)
                     {
                         slot._playerId = 2;
                         slot.state     = SlotMatchState.Normal;
                     }
                 }
                 using (CLAN_WAR_REGIST_MERCENARY_PAK packet = new CLAN_WAR_REGIST_MERCENARY_PAK(match))
                     match.SendPacketToPlayers(packet);
                 text = "Disputa preenchida. [Servidor]";
             }
             else
             {
                 text = "Falha ao encher a disputa. [Servidor]";
             }
         }
         else if (str.StartsWith("gg"))
         {
             match._state = MatchState.Play;
             match._slots[player.matchSlot].state = SlotMatchState.Ready;
             _client.SendPacket(new CLAN_WAR_ENEMY_INFO_PAK(match));
             _client.SendPacket(new CLAN_WAR_CREATED_ROOM_PAK(match));
         }
         else
         {
             text = "Falha ao encontrar o comando digitado. [Servidor]";
         }
         return(true);
     }
     catch (OverflowException ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[CLAN_WAR_TEAM_CHATTING_REC.serverCommands] Erro fatal!");  // Teste
         return(true);
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[CLAN_WAR_TEAM_CHATTING_REC.serverCommands] Erro fatal!");
         return(true);
     }
 }
 private bool serverCommands(Account player, Match match)
 {
     try
     {
         if (!player.HaveGMLevel() || !this.text.StartsWith(";") && !this.text.StartsWith("\\") && !this.text.StartsWith("."))
         {
             return(false);
         }
         string str = this.text.Substring(1);
         if (str.StartsWith("o") && player.access >= AccessLevel.Moderator)
         {
             if (match != null)
             {
                 AccountManager.getAccountDB((object)2L, 2);
                 for (int index = 0; index < match.formação; ++index)
                 {
                     SLOT_MATCH slot = match._slots[index];
                     if (slot._playerId == 0L)
                     {
                         slot._playerId = 2L;
                         slot.state     = SlotMatchState.Normal;
                     }
                 }
                 using (CLAN_WAR_REGIST_MERCENARY_PAK registMercenaryPak = new CLAN_WAR_REGIST_MERCENARY_PAK(match))
                     match.SendPacketToPlayers((SendPacket)registMercenaryPak);
                 this.text = "Disputa preenchida. [Servidor]";
             }
             else
             {
                 this.text = "Falha ao encher a disputa. [Servidor]";
             }
         }
         else if (str.StartsWith("gg"))
         {
             match._state = MatchState.Play;
             match._slots[player.matchSlot].state = SlotMatchState.Ready;
             this._client.SendPacket((SendPacket) new CLAN_WAR_ENEMY_INFO_PAK(match));
             this._client.SendPacket((SendPacket) new CLAN_WAR_CREATED_ROOM_PAK(match));
         }
         else
         {
             this.text = "Falha ao encontrar o comando digitado. [Servidor]";
         }
         return(true);
     }
     catch (OverflowException ex)
     {
         return(true);
     }
     catch (Exception ex)
     {
         Logger.warning(ex.ToString());
         return(true);
     }
 }
 private void JoinPlayer(Account p, Match mt)
 {
     if (!mt.addPlayer(p))
     {
         erro = 0x80000000;
     }
     _client.SendPacket(new CLAN_WAR_JOIN_TEAM_PAK(erro, mt));
     if (erro == 0)
     {
         using (CLAN_WAR_REGIST_MERCENARY_PAK packet = new CLAN_WAR_REGIST_MERCENARY_PAK(mt))
             mt.SendPacketToPlayers(packet);
     }
 }
 private void JoinPlayer(Account p, Match mt)
 {
     if (!mt.addPlayer(p))
     {
         this.erro = 2147483648U;
     }
     this._client.SendPacket((SendPacket) new CLAN_WAR_JOIN_TEAM_PAK(this.erro, mt));
     if (this.erro != 0U)
     {
         return;
     }
     using (CLAN_WAR_REGIST_MERCENARY_PAK registMercenaryPak = new CLAN_WAR_REGIST_MERCENARY_PAK(mt))
         mt.SendPacketToPlayers((SendPacket)registMercenaryPak);
 }