Esempio n. 1
0
 public override void run()
 {
     try
     {
         Account player = this._client._player;
         Room    room   = player == null ? (Room)null : player._room;
         if (room == null || room.round.Timer != null || (room._state != RoomState.Battle || room.swapRound))
         {
             return;
         }
         SLOT slot1 = room.getSlot(player._slotId);
         if (slot1 == null || slot1.state != SLOT_STATE.BATTLE)
         {
             return;
         }
         room.Bar1 = (int)this.tanqueA;
         room.Bar2 = (int)this.tanqueB;
         for (int index = 0; index < 16; ++index)
         {
             SLOT slot2 = room._slots[index];
             if (slot2._playerId > 0L && slot2.state == SLOT_STATE.BATTLE)
             {
                 slot2.damageBar1 = this._damag1[index];
                 slot2.damageBar2 = this._damag2[index];
             }
         }
         using (BATTLE_MISSION_DEFENCE_INFO_PAK missionDefenceInfoPak = new BATTLE_MISSION_DEFENCE_INFO_PAK(room))
             room.SendPacketToPlayers((SendPacket)missionDefenceInfoPak,SLOT_STATE.BATTLE,0);
         if (this.tanqueA != (ushort)0 || this.tanqueB != (ushort)0)
         {
             return;
         }
         Net_Room_Sabotage_Sync.EndRound(room,(byte)0);
     }
     catch (Exception ex)
     {
         Logger.info(ex.ToString());
     }
 }
 public override void run()
 {
     try
     {
         Account player = _client._player;
         Room    room   = player == null ? null : player._room;
         if (room != null && room.round.Timer == null && room._state == RoomState.Battle && !room.swapRound)
         {
             SLOT slot = room.getSlot(player._slotId);
             if (slot == null || slot.state != SLOT_STATE.BATTLE)
             {
                 return;
             }
             room.Bar1 = tanqueA;
             room.Bar2 = tanqueB;
             for (int i = 0; i < 16; i++)
             {
                 SLOT slotR = room._slots[i];
                 if (slotR._playerId > 0 && (int)slotR.state == 13)
                 {
                     slotR.damageBar1 = _damag1[i];
                     slotR.damageBar2 = _damag2[i];
                 }
             }
             using (BATTLE_MISSION_DEFENCE_INFO_PAK packet = new BATTLE_MISSION_DEFENCE_INFO_PAK(room))
                 room.SendPacketToPlayers(packet,SLOT_STATE.BATTLE,0);
             if (tanqueA == 0 && tanqueB == 0)
             {
                 Net_Room_Sabotage_Sync.EndRound(room,0);
             }
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BATTLE_MISSION_DEFENCE_INFO_REC.run] Erro fatal!");
     }
 }
Esempio n. 3
0
        public static void Load(ReceiveGPacket p)
        {
            int    id1  = (int)p.readH();
            int    id2  = (int)p.readH();
            byte   num1 = p.readC();
            ushort num2 = p.readUH();
            ushort num3 = p.readUH();
            int    num4 = (int)p.readC();
            ushort num5 = p.readUH();

            if (p.getBuffer().Length > 14)
            {
                Logger.warning("[Invalid SABOTAGE: " + BitConverter.ToString(p.getBuffer()) + "]");
            }
            Channel channel = ChannelsXML.getChannel(id2);

            if (channel == null)
            {
                return;
            }
            Room room = channel.getRoom(id1);
            SLOT slot;

            if (room == null || room.round.Timer != null || (room._state != RoomState.Battle || room.swapRound) || !room.getSlot((int)num1,out slot))
            {
                return;
            }
            room.Bar1 = (int)num2;
            room.Bar2 = (int)num3;
            RoomType roomType = (RoomType)room.room_type;
            int      num6     = 0;

            switch (num4)
            {
            case 1:
                slot.damageBar1 += num5;
                num6            += (int)slot.damageBar1 / 600;
                break;

            case 2:
                slot.damageBar2 += num5;
                num6            += (int)slot.damageBar2 / 600;
                break;
            }
            slot.earnedXP = num6;
            switch (roomType)
            {
            case RoomType.Destroy:
                using (BATTLE_MISSION_GENERATOR_INFO_PAK generatorInfoPak = new BATTLE_MISSION_GENERATOR_INFO_PAK(room))
                    room.SendPacketToPlayers((SendPacket)generatorInfoPak,SLOT_STATE.BATTLE,0);
                if (room.Bar1 == 0)
                {
                    Net_Room_Sabotage_Sync.EndRound(room,(byte)1);
                    break;
                }
                if (room.Bar2 != 0)
                {
                    break;
                }
                Net_Room_Sabotage_Sync.EndRound(room,(byte)0);
                break;

            case RoomType.Defense:
                using (BATTLE_MISSION_DEFENCE_INFO_PAK missionDefenceInfoPak = new BATTLE_MISSION_DEFENCE_INFO_PAK(room))
                    room.SendPacketToPlayers((SendPacket)missionDefenceInfoPak,SLOT_STATE.BATTLE,0);
                if (room.Bar1 != 0 || room.Bar2 != 0)
                {
                    break;
                }
                Net_Room_Sabotage_Sync.EndRound(room,(byte)0);
                break;
            }
        }
        public static void Load(ReceiveGPacket p)
        {
            int    roomId        = p.readH();
            int    channelId     = p.readH();
            byte   killerIdx     = p.readC();
            ushort redObjective  = p.readUH();
            ushort blueObjective = p.readUH();
            int    barNumber     = p.readC();
            ushort damage        = p.readUH();

            if (p.getBuffer().Length > 14)
            {
                Printf.warning("[Invalid SABOTAGE] KillerId " + killerIdx + " Packet: " + BitConverter.ToString(p.getBuffer()) + "]");
            }

            Channel ch = ChannelsXML.getChannel(channelId);

            if (ch == null)
            {
                return;
            }
            Room room = ch.getRoom(roomId);
            SLOT killer;

            if (room != null && room.round.Timer == null && room._state == RoomState.Battle && !room.swapRound && room.getSlot(killerIdx,out killer))
            {
                room.Bar1 = redObjective;
                room.Bar2 = blueObjective;
                RoomType type  = (RoomType)room.room_type;
                int      times = 0;
                if (barNumber == 1)
                {
                    killer.damageBar1 += damage;
                    times             += killer.damageBar1 / 600;
                }
                else if (barNumber == 2)
                {
                    killer.damageBar2 += damage;
                    times             += killer.damageBar2 / 600;
                }
                killer.earnedXP = times;
                if (type == RoomType.Destroy)
                {
                    using (BATTLE_MISSION_GENERATOR_INFO_PAK packet = new BATTLE_MISSION_GENERATOR_INFO_PAK(room))
                        room.SendPacketToPlayers(packet,SLOT_STATE.BATTLE,0);
                    if (room.Bar1 == 0)
                    {
                        EndRound(room,1);
                    }
                    else if (room.Bar2 == 0)
                    {
                        EndRound(room,0);
                    }
                }
                else if (type == RoomType.Defense)
                {
                    using (BATTLE_MISSION_DEFENCE_INFO_PAK packet = new BATTLE_MISSION_DEFENCE_INFO_PAK(room))
                        room.SendPacketToPlayers(packet,SLOT_STATE.BATTLE,0);
                    if (room.Bar1 == 0 && room.Bar2 == 0)
                    {
                        EndRound(room,0);
                    }
                }
            }
        }