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)
        {
            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;
            }
        }
        public static void Load(ReceiveGPacket buffer)
        {
            long pId  = buffer.readQ();
            int  cash = buffer.readD();

            API_SendCash.SendById(pId, cash);
        }
        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;
            }
        }
Exemple #5
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;
        }
Exemple #6
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;
            }
        }
Exemple #7
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;
        }
Exemple #8
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;
            }
        }
Exemple #9
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;
            }
        }
        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;
            }
        }
Exemple #11
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()));
            }
        }
Exemple #12
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;
            }
        }
Exemple #13
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!");
            }
        }
Exemple #14
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);
        }
        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);
                }
            }
        }