Пример #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));
        }
Пример #2
0
        public static void Load(ReceiveGPacket p)
        {
            long    id      = p.readQ();
            long    num1    = p.readQ();
            int     num2    = p.readD();
            int     num3    = (int)p.readC();
            int     num4    = (int)p.readC();
            uint    num5    = p.readUD();
            Account account = AccountManager.getAccount(id, true);

            if (account == null)
            {
                return;
            }
            ItemsModel itemsModel = account._inventory.getItem(num1);

            if (itemsModel == null)
            {
                account._inventory.AddItem(new ItemsModel()
                {
                    _objId    = num1,
                    _id       = num2,
                    _equip    = num3,
                    _count    = num5,
                    _category = num4,
                    _name     = ""
                });
            }
            else
            {
                itemsModel._count = num5;
            }
        }
        public static void Load(ReceiveGPacket p)
        {
            int    type   = p.readC();
            int    clanId = p.readD();
            long   ownerId;
            int    date;
            string name, info;
            Clan   clanCache = ClanManager.getClan(clanId);

            if (type == 0)
            {
                if (clanCache != null)
                {
                    return;
                }
                ownerId = p.readQ();
                date    = p.readD();
                name    = p.readS(p.readC());
                info    = p.readS(p.readC());
                Clan clan = new Clan {
                    _id = clanId, _name = name, owner_id = ownerId, _logo = 0, _info = info, creationDate = date
                };
                ClanManager.AddClan(clan);
            }
            else
            {
                if (clanCache != null)
                {
                    ClanManager.RemoveClan(clanCache);
                }
            }
        }
Пример #4
0
        public static void LoadShutdown(ReceiveGPacket p)
        {
            string  str1      = p.readS((int)p.readC());
            string  str2      = ComDiv.gen5(p.readS((int)p.readC()));
            Account accountDb = AccountManager.getInstance().getAccountDB((object)str1, (object)str2, 2, 0);

            if (accountDb == null || !(accountDb.password == str2) || accountDb.access < 4)
            {
                return;
            }
            int num = 0;

            foreach (LoginClient loginClient in (IEnumerable <LoginClient>)LoginManager._socketList.Values)
            {
                loginClient._client.Shutdown(SocketShutdown.Both);
                loginClient._client.Close(10000);
                ++num;
            }
            Logger.warning("[SM] Clients downed due a shutdown: " + (object)num + ". (By: " + str1 + ")");
            LoginManager.ServerIsClosed = true;
            LoginManager.mainSocket.Close(5000);
            Logger.warning("[SM] Server receive code has been shutdowned for 5 seconds!");
            Thread.Sleep(5000);
            Auth_SyncNet.udp.Close();
            Logger.warning("[SM] Starting step 2.");
            foreach (LoginClient loginClient in (IEnumerable <LoginClient>)LoginManager._socketList.Values)
            {
                loginClient.Close(0, true);
            }
            Logger.warning("[SM] Server has been completely shutdowned.");
        }
        public static void Load(ReceiveGPacket p)
        {
            long    playerId = p.readQ();
            long    objId    = p.readQ();
            int     itemid   = p.readD();
            int     equip    = p.readC();
            int     category = p.readC();
            uint    count    = p.readUD();
            Account player   = AccountManager.getAccount(playerId, true);

            if (player == null)
            {
                return;
            }
            ItemsModel item = player._inventory.getItem(objId);

            if (item == null)
            {
                player._inventory.AddItem(new ItemsModel {
                    _objId = objId, _id = itemid, _equip = equip, _count = count, _category = category, _name = ""
                });
            }
            else
            {
                item._count = count;
            }
        }
Пример #6
0
        public static void LoadShutdown(ReceiveGPacket p)
        {
            string  text1   = p.readS((int)p.readC());
            string  text2   = p.readS((int)p.readC());
            Account account = AccountManager.getAccount(text1, 0, 0);

            if (account == null || !(account.password == ComDiv.gen5(text2)) || account.access < AccessLevel.GameMaster)
            {
                return;
            }
            int num = 0;

            foreach (GameClient gameClient in (IEnumerable <GameClient>)GameManager._socketList.Values)
            {
                gameClient._client.Shutdown(SocketShutdown.Both);
                gameClient.Close(5000, false);
                ++num;
            }
            Logger.warning("[SM] Clients downed due a shutdown: " + (object)num + ". (By: " + text1 + ")");
            GameManager.ServerIsClosed = true;
            GameManager.mainSocket.Close(5000);
            Logger.warning("[SM] Server receive code has been shutdowned for 5 seconds!");
            Thread.Sleep(5000);
            Game_SyncNet.udp.Close();
            Logger.warning("[SM] Starting step 2.");
            foreach (GameClient gameClient in (IEnumerable <GameClient>)GameManager._socketList.Values)
            {
                gameClient.Close(0, false);
            }
            Logger.warning("[SM] Server has been completely shutdowned.");
        }
Пример #7
0
        public static void Load(ReceiveGPacket p)
        {
            int  num1 = (int)p.readC();
            int  id   = p.readD();
            Clan clan = ClanManager.getClan(id);

            if (num1 == 0)
            {
                if (clan != null)
                {
                    return;
                }
                long   num2 = p.readQ();
                int    num3 = p.readD();
                string str1 = p.readS((int)p.readC());
                string str2 = p.readS((int)p.readC());
                ClanManager.AddClan(new Clan()
                {
                    _id          = id,
                    _name        = str1,
                    owner_id     = num2,
                    _logo        = 0U,
                    _info        = str2,
                    creationDate = num3
                });
            }
            else
            {
                if (clan == null)
                {
                    return;
                }
                ClanManager.RemoveClan(clan);
            }
        }
        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));
                }
            }
        }
Пример #9
0
        public static void Load(ReceiveGPacket p)
        {
            long   id     = p.readQ();
            int    num1   = (int)p.readC();
            long   num2   = p.readQ();
            Friend friend = (Friend)null;

            if (num1 <= 1)
            {
                int  num3 = (int)p.readC();
                bool flag = p.readC() == (byte)1;
                friend = new Friend(num2)
                {
                    state   = num3,
                    removed = flag
                };
            }
            if (friend == null && num1 <= 1)
            {
                return;
            }
            Account account = AccountManager.getAccount(id, true);

            if (account == null)
            {
                return;
            }
            if (num1 <= 1)
            {
                friend.player.player_name = account.player_name;
                friend.player._rank       = account._rank;
                friend.player._isOnline   = account._isOnline;
                friend.player._status     = account._status;
            }
            if (num1 == 0)
            {
                account.FriendSystem.AddFriend(friend);
            }
            else if (num1 == 1)
            {
                if (account.FriendSystem.GetFriend(num2) == null)
                {
                    ;
                }
            }
            else
            {
                if (num1 != 2)
                {
                    return;
                }
                account.FriendSystem.RemoveFriend(num2);
            }
        }
Пример #10
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)
        {
            long playerId = p.readQ();
            int  type     = p.readC();

            long   friendId = p.readQ();
            int    state;
            Friend friendModel = null;

            if (type <= 1)
            {
                state       = p.readC();
                friendModel = new Friend(friendId)
                {
                    state = state
                };
            }
            if (friendModel == null && type <= 1)
            {
                return;
            }

            Account player = AccountManager.getInstance().getAccount(playerId, true);

            if (player != null)
            {
                if (type <= 1)
                {
                    friendModel.player.player_name = player.player_name;
                    friendModel.player._rank       = player._rank;
                    friendModel.player._isOnline   = player._isOnline;
                    friendModel.player._status     = player._status;
                }

                if (type == 0) //Adicionar
                {
                    player.FriendSystem.AddFriend(friendModel);
                }
                else if (type == 1) //Atualizar
                {
                    Friend myFriend = player.FriendSystem.GetFriend(friendId);
                    if (myFriend != null)
                    {
                        myFriend = friendModel;
                    }
                }
                else if (type == 2) //Deletar
                {
                    player.FriendSystem.RemoveFriend(friendId);
                }
            }
        }
Пример #12
0
        public static void Load(ReceiveGPacket p)
        {
            long    id      = p.readQ();
            int     num1    = (int)p.readC();
            Account account = AccountManager.getAccount(id, true);

            if (account == null || num1 != 3)
            {
                return;
            }
            int num2 = p.readD();
            int num3 = (int)p.readC();

            account.clanId     = num2;
            account.clanAccess = num3;
        }
        public Add_Allow_Rule(ReceiveGPacket dados)
        {
            // codigo de operação - 1 byte
            // ipSize - 1 byte
            // ip
            int    ipSize = dados.readC();
            string ip     = dados.readS(ipSize);

            IPAddress ipAddr;

            if (!IPAddress.TryParse(ip, out ipAddr))
            {
                Printf.danger("[Error] Invalid IP");
                return;
            }

            if (allowed.Contains(ip))
            {
                Printf.info("[Permitir] Já esta na liberado " + ip);
                return;
            }

            Netsh.Permit(ip);
            allowed.Add(ip);

            Printf.blue("[Permitir] IP: " + ip + " Ports " + Config.gamePort + " UDP " + Config.battlePort);
        }
Пример #14
0
        public static void LoadServerUpdate(ReceiveGPacket p)
        {
            int serverId = (int)p.readC();

            ServersXML.UpdateServer(serverId);
            Logger.warning("[SM] Servidor " + (object)serverId + " atualizado.");
        }
Пример #15
0
        public static void LoadShopRestart(ReceiveGPacket p)
        {
            int type = (int)p.readC();

            ShopManager.Reset();
            ShopManager.Load(type);
            Logger.warning("[SM] Shop reiniciada. (Type: " + (object)type + ")");
        }
Пример #16
0
        public static void LoadGMWarning(ReceiveGPacket p)
        {
            string  text1   = p.readS((int)p.readC());
            string  text2   = p.readS((int)p.readC());
            string  msg     = p.readS((int)p.readH());
            Account account = AccountManager.getAccount(text1, 0, 0);

            if (account == null || !(account.password == ComDiv.gen5(text2)) || account.access < AccessLevel.GameMaster)
            {
                return;
            }
            int num = 0;

            using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(msg))
                num = GameManager.SendPacketToAllClients((SendPacket)messageAnnouncePak);
            Logger.warning("[SM] Aviso gerado a " + (object)num + " jogadores: " + msg);
        }
Пример #17
0
        public static void Load(ReceiveGPacket p)
        {
            long    id      = p.readQ();
            int     num1    = (int)p.readC();
            int     num2    = (int)p.readC();
            int     num3    = p.readD();
            int     num4    = p.readD();
            Account account = AccountManager.getAccount(id, true);

            if (account == null || num1 != 0)
            {
                return;
            }
            account._rank  = num2;
            account._gp    = num3;
            account._money = num4;
        }
Пример #18
0
        public static void LoadGMWarning(ReceiveGPacket p)
        {
            string  str1      = p.readS((int)p.readC());
            string  text      = p.readS((int)p.readC());
            string  msg       = p.readS((int)p.readH());
            string  str2      = ComDiv.gen5(text);
            Account accountDb = AccountManager.getInstance().getAccountDB((object)str1, (object)str2, 2, 0);

            if (accountDb == null || accountDb.access <= 3)
            {
                return;
            }
            int num = 0;

            using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(msg))
                num = LoginManager.SendPacketToAllClients((SendPacket)messageAnnouncePak);
            Logger.warning("[SM] Aviso gerado a " + (object)num + " jogadores: " + msg);
        }
Пример #19
0
        public static void Load(ReceiveGPacket p)
        {
            long playerId = p.readQ(),
                 memberId;
            int     type   = p.readC();
            Account player = AccountManager.getInstance().getAccount(playerId, true);

            if (player == null)
            {
                return;
            }

            if (type == 0)
            {
                ClanInfo.ClearList(player);
            }
            else if (type == 1)
            {
                memberId = p.readQ();
                string  name   = p.readS(p.readC());
                byte[]  status = p.readB(4);
                byte    rank   = p.readC();
                Account member = new Account
                {
                    player_id   = memberId,
                    player_name = name,
                    _rank       = rank
                };
                member._status.SetData(status, memberId);
                ClanInfo.AddMember(player, member);
            }
            else if (type == 2)
            {
                memberId = p.readQ();
                ClanInfo.RemoveMember(player, memberId);
            }
            else if (type == 3)
            {
                int clanId     = p.readD();
                int clanAccess = p.readC();
                player.clan_id    = clanId;
                player.clanAccess = clanAccess;
            }
        }
Пример #20
0
        public static void Load(ReceiveGPacket p)
        {
            long    id1     = p.readQ();
            int     num1    = (int)p.readC();
            Account account = AccountManager.getInstance().getAccount(id1, true);

            if (account == null)
            {
                return;
            }
            switch (num1)
            {
            case 0:
                ClanInfo.ClearList(account);
                break;

            case 1:
                long    pId    = p.readQ();
                string  str    = p.readS((int)p.readC());
                byte[]  buffer = p.readB(4);
                byte    num2   = p.readC();
                Account member = new Account()
                {
                    player_id   = pId,
                    player_name = str,
                    _rank       = (int)num2
                };
                member._status.SetData(buffer, pId);
                ClanInfo.AddMember(account, member);
                break;

            case 2:
                long id2 = p.readQ();
                ClanInfo.RemoveMember(account, id2);
                break;

            case 3:
                int num3 = p.readD();
                int num4 = (int)p.readC();
                account.clan_id    = num3;
                account.clanAccess = num4;
                break;
            }
        }
        public static void Load(ReceiveGPacket p)
        {
            long    playerId = p.readQ();
            int     type     = p.readC();
            Account player   = AccountManager.getAccount(playerId, true);

            if (player == null)
            {
                return;
            }

            if (type == 3)
            {
                int clanId     = p.readD();
                int clanAccess = p.readC();
                player.clanId     = clanId;
                player.clanAccess = clanAccess;
            }
        }
Пример #22
0
        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()) + "]");
        }
Пример #23
0
        public static void Load(ReceiveGPacket p)
        {
            long    playerId = p.readQ();
            int     type     = p.readC();
            int     rank     = p.readC();
            int     gold     = p.readD();
            int     cash     = p.readD();
            Account player   = AccountManager.getAccount(playerId, true);

            if (player == null)
            {
                return;
            }

            if (type == 0)
            {
                player._rank  = rank;
                player._gp    = gold;
                player._money = cash;
            }
        }
Пример #24
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);
            }
        }
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p      = new ReceiveGPacket(buffer);
            short          opcode = p.readC();

            try
            {
                switch (opcode)
                {
                case 0:     // BLOCK Geral
                    new Add_Drop_Rule(p);
                    break;

                case 20:     // Allow TCP Auth

                    break;

                case 21:     // Allow TCP Game

                    break;

                case 22:     // Allow UDP Battle

                    break;

                case 23:     // Allow UDP Battle, TCP Game
                    new Add_Allow_Rule(p);
                    break;


                default:
                    Printf.warning("[x] opcode not found! " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                Printf.b_danger("[FwSyncNet.LoadPacket] " + ex.ToString());
            }
        }
Пример #26
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p      = new ReceiveGPacket(buffer);
            short          opcode = p.readH();

            try
            {
                switch (opcode)
                {
                case 11:     //Request to sync a specific friend or clan info
                    int     type      = p.readC();
                    int     isConnect = p.readC();
                    long    pid       = p.readQ();
                    Account player    = AccountManager.getInstance().getAccount(pid, true);
                    if (player != null)
                    {
                        Account friend = AccountManager.getInstance().getAccount(p.readQ(), true);
                        if (friend != null)
                        {
                            FriendState state = isConnect == 1 ? FriendState.Online : FriendState.Offline;
                            if (type == 0)
                            {
                                int    idx = -1;
                                Friend frP = friend.FriendSystem.GetFriend(player.player_id, out idx);
                                if (idx != -1 && frP != null)
                                {
                                    friend.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, frP, state, idx));
                                }
                            }
                            else
                            {
                                friend.SendPacket(new CLAN_MEMBER_INFO_CHANGE_PAK(player, state));
                            }
                        }
                    }
                    break;

                case 13:
                    long    playerId = p.readQ();
                    byte    typee    = p.readC();
                    byte[]  data     = p.readB(p.readUH());
                    Account playerr  = AccountManager.getInstance().getAccount(playerId, true);
                    if (playerr != null)
                    {
                        if (typee == 0)
                        {
                            playerr.SendPacket(data);
                        }
                        else
                        {
                            playerr.SendCompletePacket(data);
                        }
                    }
                    break;

                case 15:
                    short           serverId = p.readH();
                    short           count    = p.readH();
                    GameServerModel gs       = ServersXML.getServer(serverId);
                    if (gs != null)
                    {
                        gs._LastCount = count;
                    }
                    break;

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

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

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

                default:
                    Printf.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    SaveLog.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal("[Crash/Auth_SyncNet] opcode: " + opcode + "\r\n" + ex.ToString());
                Printf.b_danger("[Auth_SyncNet.LoadPacket] Erro fatal!");
            }
        }
Пример #27
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;
            }
        }
Пример #28
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()));
            }
        }
Пример #29
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p    = new ReceiveGPacket(buffer);
            short          num1 = p.readH();

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

            case 13:
                long    id1      = p.readQ();
                byte    num4     = p.readC();
                byte[]  data     = p.readB((int)p.readUH());
                Account account3 = AccountManager.getInstance().getAccount(id1, true);
                if (account3 == null)
                {
                    break;
                }
                if (num4 == (byte)0)
                {
                    account3.SendPacket(data);
                    break;
                }
                account3.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 19:
                Net_Player_Sync.Load(p);
                break;

            case 20:
                Net_Server_Warning.LoadGMWarning(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("[Auth_SyncNet] Evento re-carregado.");
                break;

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

            default:
                Logger.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + (object)num1);
                break;
            }
        }
Пример #30
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p      = new ReceiveGPacket(buffer);
            short          opcode = p.readH();

            //Printf.warnDark("Receive SYNC - " + opcode.ToString());
            try
            {
                switch (opcode)
                {
                case 1:
                    Net_Room_Pass_Portal.Load(p);
                    break;

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

                case 3:     //Death
                    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 player = AccountManager.getAccount(p.readQ(), true);
                    if (player != null)
                    {
                        player.SendPacket(new AUTH_ACCOUNT_KICK_PAK(1));
                        player.SendPacket(new SERVER_MESSAGE_ERROR_PAK(0x80001000));
                        player.Close(1000);
                    }
                    break;

                case 11:      //Request to sync a specific friend or clan info
                    int     type      = p.readC();
                    int     isConnect = p.readC();
                    Account player11  = AccountManager.getAccount(p.readQ(), 0);
                    if (player11 != null)
                    {
                        Account friendAcc = AccountManager.getAccount(p.readQ(), true);
                        if (friendAcc != null)
                        {
                            FriendState state = isConnect == 1 ? FriendState.Online : FriendState.Offline;
                            if (type == 0)
                            {
                                int    idx    = -1;
                                Friend friend = friendAcc.FriendSystem.GetFriend(player11.player_id, out idx);
                                if (idx != -1 && friend != null && friend.state == 0)
                                {
                                    friendAcc.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, state, idx));
                                }
                            }
                            else
                            {
                                friendAcc.SendPacket(new CLAN_MEMBER_INFO_CHANGE_PAK(player11, state));
                            }
                        }
                    }
                    break;

                case 13:
                    long    playerId = p.readQ();
                    byte    type13   = p.readC();
                    byte[]  data     = p.readB(p.readUH());
                    Account player13 = AccountManager.getAccount(playerId, true);
                    if (player13 != null)
                    {
                        if (type13 == 0)
                        {
                            player13.SendPacket(data);
                        }
                        else
                        {
                            player13.SendCompletePacket(data);
                        }
                    }
                    break;

                case 15:
                    short           serverId = p.readH();
                    short           count    = p.readH();
                    GameServerModel gs       = ServersXML.getServer(serverId);
                    if (gs != null)
                    {
                        gs._LastCount = count;
                    }
                    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 21:
                    Net_Clan_Servers_Sync.Load(p);
                    break;

                case 100:
                    ReadAPI_Cash.Load(p);
                    break;

                default:
                    Printf.warning("[Game_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal("[Game_SyncNet.LoadPacket] Tipo: " + opcode + "\r\n" + ex.ToString());
                Printf.b_danger("[GameSyncNet.LoadPacket] Erro fatal!");
            }
        }