예제 #1
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;
            }
        }
예제 #2
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;
            }
        }
예제 #3
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!");
            }
        }
예제 #4
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()));
            }
        }
예제 #5
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;
            }
        }
예제 #6
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!");
            }
        }
예제 #7
0
        private static void parse(string path, string missionName, int typeLoad)
        {
            int missionId = ConvertStringToInt(missionName);

            if (missionId == 0)
            {
                SaveLog.warning("[INVALID]: " + missionName);
            }
            byte[] buffer;
            try
            {
                buffer = File.ReadAllBytes(path);
            }
            catch
            {
                buffer = new byte[0];
            }
            if (buffer.Length == 0)
            {
                return;
            }
            try
            {
                ReceiveGPacket r = new ReceiveGPacket(buffer);
                r.readS(4);
                int questType = r.readD();
                r.readB(16);
                int valor1 = 0, valor2 = 0;
                for (int i = 0; i < 40; i++)
                {
                    int missionBId = valor2++,
                        cardBId    = valor1;
                    if (valor2 == 4)
                    {
                        valor2 = 0;
                        valor1++;
                    }
                    int       reqType     = r.readUH();
                    int       type        = r.readC();
                    int       mapId       = r.readC();
                    byte      limitCount  = r.readC();
                    ClassType weaponClass = (ClassType)r.readC();
                    int       weaponId    = r.readUH();
                    Card      nc          = new Card(cardBId, missionBId)
                    {
                        _mapId        = mapId,
                        _weaponReq    = weaponClass,
                        _weaponReqId  = weaponId,
                        _missionType  = (MISSION_TYPE)type,
                        _missionLimit = limitCount,
                        _missionId    = missionId
                    };
                    list.Add(nc);
                    if (questType == 1)
                    {
                        r.readB(24);
                    }
                }
                int vai = (questType == 2 ? 5 : 1);
                for (int i = 0; i < 10; i++)
                {
                    int gp     = r.readD();
                    int xp     = r.readD();
                    int medals = r.readD();
                    for (int i2 = 0; i2 < vai; i2++)
                    {
                        int unk       = r.readD();
                        int type      = r.readD();
                        int itemId    = r.readD();
                        int itemCount = r.readD();
                    }
                    if (typeLoad == 1)
                    {
                        CardAwards card = new CardAwards {
                            _id = missionId, _card = i, _exp = (questType == 1 ? (xp * 10) : xp), _gp = gp
                        };
                        GetCardMedalInfo(card, medals);
                        if (!card.Unusable())
                        {
                            awards.Add(card);
                        }
                    }
                }
                if (questType == 2)
                {
                    int goldResult = r.readD();
                    r.readB(8);
                    for (int i = 0; i < 5; i++)
                    {
                        int unkI      = r.readD();
                        int typeI     = r.readD(); //1 - unidade | 2 - dias
                        int itemId    = r.readD();
                        int itemCount = r.readD();
                        if (unkI > 0 && typeLoad == 1)
                        {
                            _items.Add(new MissionItemAward {
                                _missionId = missionId, item = new ItemsModel(itemId)
                                {
                                    _equip = 1, _count = (uint)itemCount, _name = "Mission item"
                                }
                            });
                        }
                    }
                }
            }
            catch (XmlException ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[MissionCardXML.parse] Erro fatal!");
            }
        }