Exemple #1
0
        public static void Load(ReceiveGPacket p)
        {
            int  id1  = (int)p.readH();
            int  id2  = (int)p.readH();
            byte num1 = p.readC();
            byte num2 = p.readC();
            byte num3 = p.readC();
            int  num4 = (int)p.readH();

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

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

            if (room == null || room._state != RoomState.Battle)
            {
                return;
            }
            Account playerBySlot = room.getPlayerBySlot((int)num1);

            if (playerBySlot == null)
            {
                return;
            }
            string message = "";

            if (num2 == (byte)10)
            {
                message = Translation.GetLabel("LifeRestored", (object)num4);
            }
            else
            {
                switch (num3)
                {
                case 0:
                    message = Translation.GetLabel("HitMarker1", (object)num4);
                    break;

                case 1:
                    message = Translation.GetLabel("HitMarker2", (object)num4);
                    break;

                case 2:
                    message = Translation.GetLabel("HitMarker3");
                    break;

                case 3:
                    message = Translation.GetLabel("HitMarker4");
                    break;
                }
            }
            playerBySlot.SendPacket((SendPacket) new LOBBY_CHATTING_PAK(Translation.GetLabel("HitMarkerName"), playerBySlot.getSessionId(), 0, true, message));
        }
        public static void Load(ReceiveGPacket p)
        {
            int  roomId    = p.readH();
            int  channelId = p.readH();
            byte killerIdx = p.readC();
            byte deathtype = p.readC();
            byte hitEnum   = p.readC();
            int  damage    = p.readH();

            if (p.getBuffer().Length > 11)
            {
                Printf.warning("Invalid hitMaker");
                SaveLog.warning("[Invalid MARKER: " + BitConverter.ToString(p.getBuffer()) + "]");
                return; // teste
            }


            Channel ch = ChannelsXML.getChannel(channelId);

            if (ch == null)
            {
                return;
            }


            Room room = ch.getRoom(roomId);

            if (room != null && room._state == RoomState.Battle)
            {
                Account player = room.getPlayerBySlot(killerIdx);
                if (player != null)
                {
                    string warn = "";
                    if (deathtype == 10)
                    {
                        warn = Translation.GetLabel("LifeRestored", damage);
                    }
                    else if (hitEnum == 0)
                    {
                        warn = Translation.GetLabel("HitMarker1", damage);
                    }
                    else if (hitEnum == 1)
                    {
                        warn = Translation.GetLabel("HitMarker2", damage);
                    }
                    else if (hitEnum == 2)
                    {
                        warn = Translation.GetLabel("HitMarker3");
                    }
                    else if (hitEnum == 3)
                    {
                        warn = Translation.GetLabel("HitMarker4");
                    }
                    player.SendPacket(new LOBBY_CHATTING_PAK(Translation.GetLabel("HitMarkerName"), player.getSessionId(), 0, true, warn));
                }
            }
        }
Exemple #3
0
        public static void Load(ReceiveGPacket p)
        {
            int   roomId = p.readH();
            int   channelId = p.readH();
            int   type = p.readC();
            int   slotIdx = p.readC();
            int   areaId = 0;
            float x = 0, y = 0, z = 0;

            if (type == 0)
            {
                areaId = p.readC();
                x      = p.readT();
                y      = p.readT();
                z      = p.readT();
                if (p.getBuffer().Length > 21)
                {
                    SaveLog.warning("[Invalid BOMB0: " + BitConverter.ToString(p.getBuffer()) + "]");
                }
            }
            else if (type == 1)
            {
                if (p.getBuffer().Length > 8)
                {
                    SaveLog.warning("[Invalid BOMB1: " + BitConverter.ToString(p.getBuffer()) + "]");
                }
            }
            Channel ch = ChannelsXML.getChannel(channelId);

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

            if (room != null && room.round.Timer == null && room._state == RoomState.Battle)
            {
                SLOT slot = room.getSlot(slotIdx);
                if (slot == null || slot.state != SLOT_STATE.BATTLE)
                {
                    return;
                }
                if (type == 0)
                {
                    InstallBomb(room,slot,areaId,x,y,z);
                }
                else if (type == 1)
                {
                    UninstallBomb(room,slot);
                }
            }
        }
        public static void Load(ReceiveGPacket p)
        {
            int     id1     = (int)p.readH();
            int     id2     = (int)p.readH();
            int     slotIdx = (int)p.readC();
            int     num     = (int)p.readC();
            Channel channel = ChannelsXML.getChannel(id2);

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

            if (room != null && room.round.Timer == null && (room._state == RoomState.Battle && room.room_type == (byte)7))
            {
                SLOT slot = room.getSlot(slotIdx);
                if (slot != null && slot.state == SLOT_STATE.BATTLE)
                {
                    ++slot.passSequence;
                    if (slot._team == 0)
                    {
                        room.red_dino += 5;
                    }
                    else
                    {
                        room.blue_dino += 5;
                    }
                    Net_Room_Pass_Portal.CompleteMission(room,slot);
                    using (BATTLE_MISSION_ESCAPE_PAK missionEscapePak = new BATTLE_MISSION_ESCAPE_PAK(room,slot))
                    {
                        using (BATTLE_DINO_PLACAR_PAK battleDinoPlacarPak = new BATTLE_DINO_PLACAR_PAK(room))
                            room.SendPacketToPlayers((SendPacket)missionEscapePak,(SendPacket)battleDinoPlacarPak,SLOT_STATE.BATTLE,0);
                    }
                }
            }
            if (p.getBuffer().Length <= 8)
            {
                return;
            }
            Logger.warning("[Invalid PORTAL: " + BitConverter.ToString(p.getBuffer()) + "]");
        }
Exemple #5
0
        public static void Load(ReceiveGPacket p)
        {
            int     roomId    = p.readH();
            int     channelId = p.readH();
            int     slotId    = p.readC(); //player
            int     portalId  = p.readC(); //portal
            Channel ch        = ChannelsXML.getChannel(channelId);

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

            if (room != null && room.round.Timer == null && room._state == RoomState.Battle && room.room_type == 7)
            {
                SLOT slot = room.getSlot(slotId);
                if (slot != null && slot.state == SLOT_STATE.BATTLE)
                {
                    ++slot.passSequence;
                    if (slot._team == 0)
                    {
                        room.red_dino += 5;
                    }
                    else
                    {
                        room.blue_dino += 5;
                    }
                    CompleteMission(room,slot);
                    using (BATTLE_MISSION_ESCAPE_PAK packet = new BATTLE_MISSION_ESCAPE_PAK(room,slot))
                        using (BATTLE_DINO_PLACAR_PAK packet2 = new BATTLE_DINO_PLACAR_PAK(room))
                            room.SendPacketToPlayers(packet,packet2,SLOT_STATE.BATTLE,0);
                }
            }
            if (p.getBuffer().Length > 8)
            {
                SaveLog.warning("[Invalid PORTAL] Slot:" + slotId + " " + BitConverter.ToString(p.getBuffer()) + "]");
                Printf.warning("Invalid Portal Slot:" + slotId);
            }
        }
Exemple #6
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;
            }
        }
Exemple #7
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p    = new ReceiveGPacket(buffer);
            short          num1 = p.readH();

            try
            {
                switch (num1)
                {
                case 1:
                    Net_Room_Pass_Portal.Load(p);
                    break;

                case 2:
                    Net_Room_C4.Load(p);
                    break;

                case 3:
                    Net_Room_Death.Load(p);
                    break;

                case 4:
                    Net_Room_HitMarker.Load(p);
                    break;

                case 5:
                    Net_Room_Sabotage_Sync.Load(p);
                    break;

                case 10:
                    Account account1 = AccountManager.getAccount(p.readQ(), true);
                    if (account1 == null)
                    {
                        break;
                    }
                    account1.SendPacket((SendPacket) new AUTH_ACCOUNT_KICK_PAK(1));
                    account1.SendPacket((SendPacket) new SERVER_MESSAGE_ERROR_PAK(2147487744U));
                    account1.Close(1000, false);
                    break;

                case 11:
                    int     num2     = (int)p.readC();
                    int     num3     = (int)p.readC();
                    Account account2 = AccountManager.getAccount(p.readQ(), 0);
                    if (account2 == null)
                    {
                        break;
                    }
                    Account account3 = AccountManager.getAccount(p.readQ(), true);
                    if (account3 == null)
                    {
                        break;
                    }
                    FriendState friendState = num3 == 1 ? FriendState.Online : FriendState.Offline;
                    if (num2 == 0)
                    {
                        int    index  = -1;
                        Friend friend = account3.FriendSystem.GetFriend(account2.player_id, out index);
                        if (index == -1 || friend == null || friend.state != 0)
                        {
                            break;
                        }
                        account3.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, friendState, index));
                        break;
                    }
                    account3.SendPacket((SendPacket) new CLAN_MEMBER_INFO_CHANGE_PAK(account2, friendState));
                    break;

                case 13:
                    long    id1      = p.readQ();
                    byte    num4     = p.readC();
                    byte[]  data     = p.readB((int)p.readUH());
                    Account account4 = AccountManager.getAccount(id1, true);
                    if (account4 == null)
                    {
                        break;
                    }
                    if (num4 == (byte)0)
                    {
                        account4.SendPacket(data);
                        break;
                    }
                    account4.SendCompletePacket(data);
                    break;

                case 15:
                    int             id2    = p.readD();
                    int             num5   = p.readD();
                    GameServerModel server = ServersXML.getServer(id2);
                    if (server == null)
                    {
                        break;
                    }
                    server._LastCount = num5;
                    break;

                case 16:
                    Net_Clan_Sync.Load(p);
                    break;

                case 17:
                    Net_Friend_Sync.Load(p);
                    break;

                case 18:
                    Net_Inventory_Sync.Load(p);
                    break;

                case 19:
                    Net_Player_Sync.Load(p);
                    break;

                case 20:
                    Net_Server_Warning.LoadGMWarning(p);
                    break;

                case 21:
                    Net_Clan_Servers_Sync.Load(p);
                    break;

                case 22:
                    Net_Server_Warning.LoadShopRestart(p);
                    break;

                case 23:
                    Net_Server_Warning.LoadServerUpdate(p);
                    break;

                case 24:
                    Net_Server_Warning.LoadShutdown(p);
                    break;

                case 31:
                    EventLoader.ReloadEvent((int)p.readC());
                    Logger.warning("[Game_SyncNet] Evento re-carregado.");
                    break;

                case 32:
                    ServerConfigSyncer.GenerateConfig((int)p.readC());
                    Logger.warning("[Game_SyncNet] Configurações (DB) resetadas.");
                    break;

                default:
                    Logger.warning("[Game_SyncNet] Tipo de conexão não encontrada: " + (object)num1);
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.error("[Crash/Game_SyncNet] Tipo: " + (object)num1 + "\r\n" + ex.ToString());
                if (p == null)
                {
                    return;
                }
                Logger.error("COMP: " + BitConverter.ToString(p.getBuffer()));
            }
        }
        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);
                    }
                }
            }
        }
Exemple #9
0
        public static void Load(ReceiveGPacket p)
        {
            int   id1  = (int)p.readH();
            int   id2  = (int)p.readH();
            byte  num1 = p.readC();
            byte  num2 = p.readC();
            int   num3 = p.readD();
            float num4 = p.readT();
            float num5 = p.readT();
            float num6 = p.readT();
            byte  num7 = p.readC();
            int   num8 = (int)num7 * 15;

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

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

            if (room == null || room.round.Timer != null || room._state != RoomState.Battle)
            {
                return;
            }
            SLOT slot1 = room.getSlot((int)num1);

            if (slot1 == null || slot1.state != SLOT_STATE.BATTLE)
            {
                return;
            }
            FragInfos kills = new FragInfos()
            {
                killerIdx   = num1,
                killingType = CharaKillType.DEFAULT,
                weapon      = num3,
                x           = num4,
                y           = num5,
                z           = num6,
                flag        = num2
            };
            bool isSuicide = false;

            for (int index = 0; index < (int)num7; ++index)
            {
                byte  num9        = p.readC();
                byte  hitspotInfo = p.readC();
                float num10       = p.readT();
                float num11       = p.readT();
                float num12       = p.readT();
                int   num13       = (int)p.readC();
                int   slotIdx     = (int)hitspotInfo & 15;
                SLOT  slot2       = room.getSlot(slotIdx);
                if (slot2 != null && slot2.state == SLOT_STATE.BATTLE)
                {
                    Frag frag = new Frag(hitspotInfo)
                    {
                        flag = (byte)num13,
                        victimWeaponClass = num9,
                        x = num10,
                        y = num11,
                        z = num12
                    };
                    if ((int)kills.killerIdx == slotIdx)
                    {
                        isSuicide = true;
                    }
                    kills.frags.Add(frag);
                }
            }
            kills.killsCount = (byte)kills.frags.Count;
            Game_SyncNet.genDeath(room,slot1,kills,isSuicide);
        }
Exemple #10
0
        public static void Load(ReceiveGPacket p)
        {
            int   id1     = (int)p.readH();
            int   id2     = (int)p.readH();
            int   num     = (int)p.readC();
            int   slotIdx = (int)p.readC();
            int   areaId  = 0;
            float x       = 0.0f;
            float y       = 0.0f;
            float z       = 0.0f;

            switch (num)
            {
            case 0:
                areaId = (int)p.readC();
                x      = p.readT();
                y      = p.readT();
                z      = p.readT();
                if (p.getBuffer().Length > 21)
                {
                    Logger.warning("[Invalid BOMB0: " + BitConverter.ToString(p.getBuffer()) + "]");
                    break;
                }
                break;

            case 1:
                if (p.getBuffer().Length > 8)
                {
                    Logger.warning("[Invalid BOMB1: " + BitConverter.ToString(p.getBuffer()) + "]");
                    break;
                }
                break;
            }
            Channel channel = ChannelsXML.getChannel(id2);

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

            if (room == null || room.round.Timer != null || room._state != RoomState.Battle)
            {
                return;
            }
            SLOT slot = room.getSlot(slotIdx);

            if (slot == null || slot.state != SLOT_STATE.BATTLE)
            {
                return;
            }
            if (num == 0)
            {
                Net_Room_C4.InstallBomb(room,slot,areaId,x,y,z);
            }
            else
            {
                if (num != 1)
                {
                    return;
                }
                Net_Room_C4.UninstallBomb(room,slot);
            }
        }
        public static void Load(ReceiveGPacket p)
        {
            int   roomId      = p.readH();
            int   channelId   = p.readH();
            byte  killerId    = p.readC();
            byte  dieObjectId = p.readC();
            int   weaponId    = p.readD();
            float killerX     = p.readT();
            float killerY     = p.readT();
            float killerZ     = p.readT();
            byte  killsCount  = p.readC();
            int   estimado    = (killsCount * 15);

            if (p.getBuffer().Length > (25 + estimado))
            {
                SaveLog.warning("[Invalid DEATH] Lenght > " + (25 + estimado) + " KillerId " + killerId + " Packet:" + BitConverter.ToString(p.getBuffer()) + "]");
                Printf.warning("Invalid death Killer Id " + killerId);
            }

            Channel ch = ChannelsXML.getChannel(channelId);

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

            if (room != null && room.round.Timer == null && room._state == RoomState.Battle)
            {
                SLOT killer = room.getSlot(killerId);
                if (killer != null && killer.state == SLOT_STATE.BATTLE)
                {
                    FragInfos info = new FragInfos
                    {
                        killerIdx   = killerId,
                        killingType = 0, //1 - piercing | 2 - mass
                        weapon      = weaponId,
                        x           = killerX,
                        y           = killerY,
                        z           = killerZ,
                        flag        = dieObjectId
                    };
                    bool isSuicide = false;
                    for (int i = 0; i < killsCount; i++)
                    {
                        byte  weaponClass = p.readC();
                        byte  deathInfo   = p.readC();
                        float vicX        = p.readT();
                        float vicY        = p.readT();
                        float vicZ        = p.readT();
                        int   vicFlag     = p.readC();
                        int   victimId    = deathInfo & 15;
                        SLOT  victim      = room.getSlot(victimId);
                        if (victim != null && victim.state == SLOT_STATE.BATTLE)
                        {
                            Frag frag = new Frag(deathInfo)
                            {
                                flag = (byte)vicFlag,victimWeaponClass = weaponClass,x = vicX,y = vicY,z = vicZ
                            };
                            if (info.killerIdx == victimId)
                            {
                                isSuicide = true;
                            }
                            info.frags.Add(frag);
                        }
                    }
                    info.killsCount = (byte)info.frags.Count;
                    Game_SyncNet.genDeath(room,killer,info,isSuicide);
                }
            }
        }