예제 #1
0
        /// <summary>
        /// Sends character list and account information to client.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_COMMANDER_LIST(LoginConnection conn)
        {
            var allCharacters   = conn.Account.GetCharacters();
            var layerCharacters = allCharacters.Where(x => x.BarrackLayer == conn.Account.SelectedBarrackLayer);

            var totalCharacterCount = allCharacters.Length;
            var layerCharacterCount = layerCharacters.Count();

            var packet = new Packet(Op.BC_COMMANDER_LIST);

            packet.PutLong(conn.Account.Id);
            packet.PutByte(0);
            packet.PutByte(0);             // 1 = 5/4 slots?
            packet.PutString(conn.Account.TeamName, 64);
            packet.AddAccountProperties(conn.Account);

            packet.PutShort(1);             // 0 = 15 slots, 1 = 4, 2 = 8, 3+ = 4, only 1 shows correct max values?
            packet.PutInt(11);
            packet.PutShort(layerCharacterCount);
            packet.PutShort(conn.Account.AdditionalSlotCount);
            packet.PutInt(conn.Account.TeamExp);
            packet.PutShort(totalCharacterCount);

            conn.Send(packet);

            if (allCharacters.Length > 0)
            {
                Send.BC_SPLIT_COMMANDER_INFO_LIST(conn, layerCharacters);
            }
        }
예제 #2
0
        /// <summary>
        /// Sends character list and account information to client.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_COMMANDER_LIST(LoginConnection conn)
        {
            var characters        = conn.Account.GetCharacters();
            var barrackCharacters = characters.Where(x => x.BarrackLayer == conn.Account.SelectedBarrackLayer);

            var packet = new Packet(Op.BC_COMMANDER_LIST);

            packet.PutLong(conn.Account.Id);
            packet.PutByte(0);
            packet.PutByte(0);
            packet.PutString(conn.Account.TeamName, 64);
            //packet.AddFullAccountProperties(conn.Account);
            packet.AddAccountProperties(conn.Account);

            packet.PutShort(1);             // Additional Characters
            packet.PutInt(0x0B);            // MapID
            packet.PutInt(barrackCharacters.Count());
            packet.PutInt(100);             // Team Exp
            packet.PutShort(characters.Length);

            conn.Send(packet);

            if (characters.Length > 0)
            {
                Send.BC_SPLIT_COMMANDER_INFO_LIST(conn, barrackCharacters);
            }
        }
예제 #3
0
        /// <summary>
        /// Sends zone traffic list.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_ZoneTraffic(LoginConnection conn)
        {
            var characters        = conn.Account.GetCharacters();
            var mapAvailableCount = characters.Length;
            var zoneServerCount   = 1;
            var zoneMaxPcCount    = 150;

            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.ZoneTraffic);

            packet.Zlib(true, zpacket =>
            {
                zpacket.PutShort(zoneMaxPcCount);
                zpacket.PutShort(mapAvailableCount);
                for (var i = 0; i < mapAvailableCount; ++i)
                {
                    zpacket.PutShort(characters[i].MapId);
                    zpacket.PutShort(zoneServerCount);
                    for (var zone = 0; zone < zoneServerCount; ++zone)
                    {
                        zpacket.PutShort(zone);
                        zpacket.PutShort(1);                         // currentPlayersCount
                    }
                }
            });

            conn.Send(packet);
        }
예제 #4
0
        /// <summary>
        /// Sends zone traffic to the client.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_ZoneTraffic(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(0x0C);             //SubOp

            var characters        = conn.Account.GetCharacters();
            var mapAvailableCount = characters.Count;
            var zoneServerCount   = 1;
            var zoneMaxPcCount    = 150;

            packet.BeginZlib();
            packet.PutShort(zoneMaxPcCount);
            packet.PutShort(mapAvailableCount);
            for (var i = 0; i < mapAvailableCount; ++i)
            {
                packet.PutShort(characters[i].MapId);
                packet.PutShort(zoneServerCount);
                for (var zone = 0; zone < zoneServerCount; ++zone)
                {
                    packet.PutShort(zone);
                    packet.PutShort(1);                     // currentPlayersCount
                }
            }
            packet.EndZlib();

            conn.Send(packet);
        }
예제 #5
0
        /// <summary>
        /// Mailbox
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_MESSAGE_MAIL(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.Message);

            packet.Zlib(true, zpacket =>
            {
                zpacket.PutByte(1);
                zpacket.PutInt(0);
                zpacket.PutInt(1);                 //Message Count?

                var sender  = "GM.";
                var title   = "Compensation on for Temporary Maintenance";
                var message = "";

                zpacket.PutLpString(sender);
                zpacket.PutLpString(title);
                zpacket.PutLpString(message);
                zpacket.PutDate(DateTime.Now);      // Date Sent?
                zpacket.PutDate(DateTime.Now);      // Expiration
                zpacket.PutDate(DateTime.Now);
                zpacket.PutLong(1);                 // Message Id
                zpacket.PutByte(0);
                zpacket.PutShort(3);
                zpacket.PutShort(0);
                zpacket.PutShort(1);
                zpacket.PutByte(0);
                zpacket.PutInt(0);                 // Message Item Count
            });

            conn.Send(packet);
        }
예제 #6
0
        /// <summary>
        /// Sends a list of characters to the client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="layer">This is the number on the left side of the character list in the client.</param>
        public static void BC_COMMANDER_LIST(LoginConnection conn, int layer = 1)
        {
            var characters = conn.Account.GetCharacters().Where(x => x.BarrackLayer == layer);

            var packet = new Packet(Op.BC_COMMANDER_LIST);

            packet.PutLong(conn.Account.Id);
            packet.PutByte(0);
            packet.PutByte((byte)characters.Count());
            packet.PutString(conn.Account.TeamName, 64);
            packet.AddAccountProperties(conn.Account);

            foreach (var character in characters)
            {
                packet.AddBarrackPc(character);
            }

            // Null terminated list of some kind?
            // Example of != 0: 02 00 | 0B 00 00 00 01 00, 0C 00 00 00 00 00
            packet.PutShort(0);             // count?

            packet.PutShort(0);
            packet.PutInt(0);
            packet.PutShort(0);

            conn.Send(packet);
        }
예제 #7
0
        /// <summary>
        /// Sends the cost of a character slot to the client.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_REQ_SLOT_PRICE(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_REQ_SLOT_PRICE);

            packet.PutInt(50);             // move this into database

            conn.Send(packet);
        }
예제 #8
0
        /// <summary>
        /// Sends information about newly created character.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="character"></param>
        public static void BC_COMMANDER_CREATE(LoginConnection conn, Character character)
        {
            var packet = new Packet(Op.BC_COMMANDER_CREATE);

            packet.AddAppearanceBarrackPc(character);

            conn.Send(packet);
        }
예제 #9
0
        /// <summary>
        /// Removes character from barrack.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="index"></param>
        public static void BC_COMMANDER_DESTROY(LoginConnection conn, byte index)
        {
            var packet = new Packet(Op.BC_COMMANDER_DESTROY);

            packet.PutByte(index);

            conn.Send(packet);
        }
예제 #10
0
        /// <summary>
        /// Sends the number of the new character's index.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="character"></param>
        public static void BC_COMMANDER_CREATE_SLOTID(LoginConnection conn, Character character)
        {
            var packet         = new Packet(Op.BC_COMMANDER_CREATE_SLOTID);
            var characterCount = (byte)conn.Account.GetCharacters().Count;

            packet.PutByte(characterCount);
            conn.Send(packet);
        }
예제 #11
0
        /// <summary>
        /// Unknown purpose, maybe logs packets on disconnect?
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_DISCONNECT_PACKET_LOG_COUNT(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_DISCONNECT_PACKET_LOG_COUNT);

            packet.PutInt(0x1E);

            conn.Send(packet);
        }
예제 #12
0
        /// <summary>
        /// Sends pre-defined message to client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="msgType"></param>
        public static void BC_MESSAGE(LoginConnection conn, MsgType msgType)
        {
            var packet = new Packet(Op.BC_MESSAGE);

            packet.PutByte((byte)msgType);

            conn.Send(packet);
        }
예제 #13
0
        /// <summary>
        /// Sends the session key to the client.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_SetSessionKey(LoginConnection conn)
        {
            var packet = new Packet(Op.ZC_NORMAL);

            packet.PutInt(SubOp.Barrack.SetSessionKey);
            packet.PutLpString(conn.SessionKey);
            conn.Send(packet);
        }
예제 #14
0
        /// <summary>
        /// Notifies the client that it has failed the integrity check of its files.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_ClientIntegrityFailure(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.ClientIntegrityFailure);

            conn.Send(packet);
        }
예제 #15
0
        /// <summary>
        /// Invokes a lua function.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="str"></param>
        public static void BC_NORMAL_Run(LoginConnection conn, string str)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.Run);
            packet.PutLpString(str);

            conn.Send(packet);
        }
예제 #16
0
        /// <summary>
        /// Updates character barrack layer
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_LAYER_CHANGE_SYSTEM_MESSAGE(LoginConnection conn, int targetLayer, string script = "MoveBarrackLayer{target}")
        {
            var packet = new Packet(Op.BC_LAYER_CHANGE_SYSTEM_MESSAGE);

            packet.PutInt(targetLayer);
            packet.PutString(script, 64);

            conn.Send(packet);
        }
예제 #17
0
        /// <summary>
        /// Updates the number of purchased character slots.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="count"></param>
        public static void BC_NORMAL_BarrackSlotCount(LoginConnection conn, int count)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.BarrackSlotCount);
            packet.PutInt(count);

            conn.Send(packet);
        }
예제 #18
0
        /// <summary>
        /// Updates the number of purchased character slots.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_RETURN_PC_MARKET_REGISTERED(LoginConnection conn, long characterId, bool hasMarketItems = false)
        {
            var packet = new Packet(Op.BC_RETURN_PC_MARKET_REGISTERED);

            packet.PutLong(characterId);
            packet.PutShort(hasMarketItems ? 1 : 0);             // Has Items in Registered in Market

            conn.Send(packet);
        }
예제 #19
0
        /// <summary>
        /// Updates account's properties on the client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="account"></param>
        public static void BC_ACCOUNT_PROP(LoginConnection conn, Account account)
        {
            var packet = new Packet(Op.BC_ACCOUNT_PROP);

            packet.PutLong(account.Id);
            packet.AddAccountProperties(account);

            conn.Send(packet);
        }
예제 #20
0
        /// <summary>
        /// Sends custom message to client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="msg"></param>
        public static void BC_MESSAGE(LoginConnection conn, string msg)
        {
            var packet = new Packet(Op.BC_MESSAGE);

            packet.PutByte((byte)MsgType.Text);
            packet.PutEmptyBin(40);
            packet.PutString(msg);

            conn.Send(packet);
        }
예제 #21
0
        /// <summary>
        /// Sends response to team name change request.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="result"></param>
        public static void BC_BARRACKNAME_CHANGE(LoginConnection conn, TeamNameChangeResult result)
        {
            var response = new Packet(Op.BC_BARRACKNAME_CHANGE);

            response.PutByte(result == TeamNameChangeResult.Okay);
            response.PutInt((int)result);
            response.PutString(conn.Account.TeamName, 64);

            conn.Send(response);
        }
예제 #22
0
        /// <summary>
        /// Sends response to team name change request.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="result"></param>
        /// <param name="teamName"></param>
        public static void BC_BARRACKNAME_CHANGE(LoginConnection conn, TeamNameChangeResult result, string teamName)
        {
            var packet = new Packet(Op.BC_BARRACKNAME_CHANGE);

            packet.PutInt(1);
            packet.PutByte((byte)result);
            packet.PutString(teamName, 64);

            conn.Send(packet);
        }
예제 #23
0
        /// <summary>
        /// Sends response to team name change request.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="result"></param>
        /// <param name="teamName"></param>
        /// <param name="message"></param>
        public static void BC_BARRACKNAME_CHECK_RESULT(LoginConnection conn, TeamNameChangeResult result, string teamName, string message)
        {
            var response = new Packet(Op.BC_BARRACKNAME_CHECK_RESULT);

            response.PutInt((int)result);
            response.PutString(message, 256);
            response.PutString(teamName, 64);

            conn.Send(response);
        }
예제 #24
0
        /// <summary>
        /// Updates the state of a postbox message.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="messageId"></param>
        /// <param name="state"></param>
        public static void BC_NORMAL_UpdatePostBoxState(LoginConnection conn, long messageId, PostBoxMessageState state)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.PostBoxState);
            packet.PutLong(messageId);
            packet.PutByte((byte)state);

            conn.Send(packet);
        }
예제 #25
0
        /// <summary>
        /// Sets the barrack, but not working for some reason.
        /// Use the account property to do this.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="id"></param>
        public static void BC_NORMAL_SetBarrack(LoginConnection conn, int id)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.SetBarrack);
            packet.PutLong(conn.Account.Id);
            packet.PutInt(id);
            packet.PutByte(0);
            packet.PutInt(0);
            conn.Send(packet);
        }
예제 #26
0
        public static void BC_NORMAL_Run(LoginConnection conn, string str)
        {
            // Probably runs a lua function? Example string: THEMA_BUY_SUCCESS

            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(0x0E);
            packet.PutLpString(str);

            conn.Send(packet);
        }
예제 #27
0
        /// <summary>
        /// Sets the character for the barrack
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="id"></param>
        public static void BC_NORMAL_SetBarrackCharacter(LoginConnection conn, Character character)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.SetBarrackCharacter);
            packet.PutLong(conn.Account.Id);
            packet.PutLong(conn.Account.Id);
            packet.AddBarrackPc(character);

            conn.Send(packet);
        }
예제 #28
0
        /// <summary>
        /// Sends social server connection information?
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="ip1"></param>
        /// <param name="port1"></param>
        /// <param name="ip2"></param>
        /// <param name="port2"></param>
        public static void BC_SERVER_ENTRY(LoginConnection conn, string ip1, int port1, string ip2, int port2)
        {
            var packet = new Packet(Op.BC_SERVER_ENTRY);

            packet.PutInt(IPAddress.Parse(ip1).ToInt32());
            packet.PutInt(IPAddress.Parse(ip2).ToInt32());
            packet.PutShort(port1);
            packet.PutShort(port2);

            conn.Send(packet);
        }
예제 #29
0
        /// <summary>
        /// Sends unknown packet in the barrack.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_UpdateTeamUI(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.Unknown_0C);
            packet.PutLong(conn.Account.Id);
            packet.PutShort(0);                           // Number of additional character slots
            packet.PutInt(0);                             // Team experience. Displayed under "Team Info"
            packet.PutShort(conn.Account.CharacterCount); // Sum of characters and pets.

            conn.Send(packet);
        }
예제 #30
0
        /// <summary>
        /// Sets the selected barrack after login.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_SelectedBarrack(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(0x04);             // subop
            packet.PutLong(conn.Account.Id);
            packet.PutInt(conn.Account.SelectedBarrack);
            packet.PutByte(0);            // unk
            packet.PutInt(0);             // unk

            conn.Send(packet);
        }