Пример #1
0
        /// <summary>
        /// Sends a custom message dialog to the 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);
        }
Пример #2
0
        /// <summary>
        /// Sends a changed team name to the client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="result"></param>
        public static void BC_BARRACKNAME_CHANGE(LoginConnection conn, TeamNameChangeResult result)
        {
            var packet = new Packet(Op.BC_BARRACKNAME_CHANGE);

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

            conn.Send(packet);
        }
Пример #3
0
        /// <summary>
        /// Sends 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 characterCount = conn.Account.CharacterCount;

            var packet = new Packet(Op.BC_COMMANDER_CREATE_SLOTID);

            packet.PutByte((byte)characterCount);

            conn.Send(packet);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
0
        /// <summary>
        /// Moves a character in the barrack.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="index"></param>
        /// <param name="position"></param>
        public static void BC_NORMAL_SetPosition(LoginConnection conn, byte index, Position position)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.SetPosition);
            packet.PutLong(conn.Account.Id);
            packet.PutByte(index);
            packet.PutFloat(position.X);
            packet.PutFloat(position.Y);
            packet.PutFloat(position.Z);

            conn.Send(packet);
        }
Пример #12
0
        public static void BC_LOGINOK(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_LOGINOK);

            packet.PutShort(0);
            packet.PutLong(conn.Account.Id);
            packet.PutString(conn.Account.Name, 33);
            packet.PutInt(3);             // accountPrivileges? <= 3 enables a kind of debug context menu
            packet.PutString(conn.SessionKey, 64);
            packet.PutInt(4475);          // [i10725 (2015-11-03)] ?

            conn.Send(packet);
        }
Пример #13
0
        /// <summary>
        /// Sends message to client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="msgType"></param>
        /// <param name="msg"></param>
        public static void BC_MESSAGE(LoginConnection conn, MsgType msgType, string msg)
        {
            var packet = new Packet(Op.BC_MESSAGE);

            packet.PutByte((byte)msgType);

            if (msg != null)
            {
                packet.PutEmptyBin(40);
                packet.PutString(msg);
            }

            conn.Send(packet);
        }
Пример #14
0
        /// <summary>
        /// Sends positive response to login attempt.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_LOGINOK(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_LOGINOK);

            packet.PutShort(0);
            packet.PutLong(conn.Account.Id);
            packet.PutString(conn.Account.Name, 33);
            packet.PutInt(3);             // accountPrivileges? <= 3 enables a kind of debug context menu
            packet.PutString(conn.SessionKey, 64);
            packet.PutInt(4475);          // [i10725 (2015-11-03)] ?
            packet.PutLong(0);            // This is appears to be a checksum of some sort. It is set globally and never checked.

            conn.Send(packet);
        }
Пример #15
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, string teamName)
        {
            var packet = new Packet(Op.BC_BARRACKNAME_CHANGE);

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

            // Filler bytes, official packet sends something here,
            // that I have no clue what it does, but this works
            packet.PutEmptyBin(79 - (16 + teamName.Length));

            conn.Send(packet);
        }
Пример #16
0
        /// <summary>
        /// Sends information related to the team to be displayed in the barrack.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_TeamUI(LoginConnection conn)
        {
            var characters = conn.Account.GetCharacters();

            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.TeamUI);
            packet.PutLong(conn.Account.Id);
            packet.PutShort(conn.Account.AdditionalSlotCount);
            packet.PutInt(conn.Account.TeamExp);
            packet.PutShort(conn.Account.CharacterCount);

            conn.Send(packet);
        }
Пример #17
0
        /// <summary>
        /// Sends positive response to game start request.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="character"></param>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        public static void BC_START_GAMEOK(LoginConnection conn, Character character, string ip, int port)
        {
            var packet = new Packet(Op.BC_START_GAMEOK);

            packet.PutInt(0);             // Zone ID.
            packet.PutInt(IPAddress.Parse(ip).ToInt32());
            packet.PutInt(port);
            packet.PutInt(character.MapId);
            packet.PutByte(1);             // Channel ID.
            packet.PutLong(character.Id);
            packet.PutByte(0);             // Only connects if 0
            packet.PutByte(1);             // Passed to a function if ^ is 0

            conn.Send(packet);
        }
Пример #18
0
        /// <summary>
        /// Sends positive response to login attempt.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_LOGINOK(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_LOGINOK);

            packet.PutShort(1001);             // Server Group Id
            packet.PutLong(conn.Account.Id);
            packet.PutString(conn.Account.Name, 33);
            packet.PutEmptyBin(23);
            packet.PutInt(3);             // accountPrivileges? <= 3 enables a kind of debug context menu
            packet.PutString(conn.SessionKey, 64);
            packet.PutInt(4475);
            packet.PutLong(0);

            conn.Send(packet);
        }
Пример #19
0
        public static void BC_COMMANDER_LIST(LoginConnection conn)
        {
            var characters = conn.Account.GetCharacters();

            var packet = new Packet(Op.BC_COMMANDER_LIST);

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

            packet.AddAccountProperties(conn.Account);

            foreach (var character in characters)
            {
                packet.AddCharacter(character);

                // Equip properties, short->length
                for (int i = 0; i < Items.EquipSlotCount; ++i)
                {
                    packet.PutShort(0);
                }

                // Job history?
                // While this short existed in iCBT1, it might not have
                // been used, couldn't find a log.
                // Example: A Mage that switched to Pyromancer has two
                //   elements in this list, 2001 and 2002.
                packet.PutShort(0);                 // count
                // loop
                //   short jobId

                // [i11025 (2016-02-26)] ?
                {
                    packet.PutInt(0);
                }
            }

            // 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?

            conn.Send(packet);
        }
Пример #20
0
        /// <summary>
        /// Updates the number of purchased character slots.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_CharacterInfo(LoginConnection conn)
        {
            var characters = conn.Account.GetCharacters();

            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.CharacterInfo);

            packet.PutLong(conn.Account.Id);
            packet.PutInt(characters.Length);
            foreach (var character in characters)
            {
                packet.PutLong(character.Id);
                packet.PutString(character.Name, 64);
                packet.PutEmptyBin(24);
            }

            conn.Send(packet);
        }
Пример #21
0
        /// <summary>
        /// Sends a list of characters to the client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="characters"></param>
        public static void BC_SPLIT_COMMANDER_INFO_LIST(LoginConnection conn, IEnumerable <Character> characters)
        {
            var characterCount = characters.Count();

            var packet = new Packet(Op.BC_SPLIT_COMMANDER_INFO_LIST);

            packet.PutInt(characterCount);
            packet.PutLong(conn.Account.Id);

            packet.PutByte(0);
            packet.PutByte(characterCount != 0);
            packet.PutByte(1);

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

            conn.Send(packet);
        }
Пример #22
0
        /// <summary>
        /// Sends a newly created character to the client.
        /// </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.AddAppearancePC(character);


            packet.PutLong(character.Id);

            // [i11025 (2016-02-26)]
            // Index was previously stored as a short, now there seem
            // to be two byte, with the first being the index.
            {
                packet.PutByte(character.GetIndex());
                packet.PutByte(181);
            }

            packet.PutShort(character.MapId);
            packet.PutInt(0);
            packet.PutInt(0);
            packet.PutInt(0);             // maxXP ?
            packet.PutInt(0);

            // Position?
            packet.PutFloat(character.BarrackPosition.X);
            packet.PutFloat(character.BarrackPosition.Y);
            packet.PutFloat(character.BarrackPosition.Z);
            packet.PutFloat(0);             // Vector direction
            packet.PutFloat(0);             // Vector direction

            // ?
            packet.PutFloat(character.BarrackPosition.X);
            packet.PutFloat(character.BarrackPosition.Y);
            packet.PutFloat(character.BarrackPosition.Z);
            packet.PutFloat(0);             // Vector direction
            packet.PutFloat(0);             // Vector direction

            packet.PutInt(0);

            conn.Send(packet);
        }
Пример #23
0
        /// <summary>
        /// Instructs the client that it may continue with starting the game.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="character"></param>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        public static void BC_START_GAMEOK(LoginConnection conn, Character character)
        {
            var packet = new Packet(Op.BC_START_GAMEOK);

            packet.PutInt(0);
            packet.PutInt(IPAddress.Parse(Settings.Default.ZoneServerIP).ToInt32());
            packet.PutInt(Int32.Parse(Settings.Default.ZoneServerPort));
            packet.PutInt(character.MapId);
            packet.PutByte(0);
            packet.PutLong(character.Id);
            packet.PutByte(0);             // Only connects if 0
            packet.PutByte(1);             // Passed to a function if ^ is 0

            // Force FNH to treat data as dirty since the channel server will handle it.
            using (var session = SessionFactory.OpenSession())
            {
                session.Clear();
            }

            conn.Send(packet);
        }
Пример #24
0
        /// <summary>
        /// Sends information related to the team to be displayed in the barrack.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_NORMAL_TeamUI(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(0x0B);             // SubOp

            packet.PutLong(conn.Account.Id);

            // Need to check the number of slots bought.
            // slots = (mapDefault - 4 + bought)
            packet.PutShort(0);

            // Team experience? Displayed under "Team Info"
            packet.PutInt(0);

            // Sum of characters and pets.
            var characters = conn.Account.GetCharacters();

            packet.PutShort(characters.Count);

            conn.Send(packet);
        }
Пример #25
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    = 100;

            var packet = new Packet(Op.BC_NORMAL);

            packet.PutInt(SubOp.Barrack.ZoneTraffic);

            packet.Zlib(true, zpacket =>
            {
                if (mapAvailableCount == 0)
                {
                    zpacket.PutShort(0);
                    zpacket.PutInt(100);
                }
                else
                {
                    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
                            zpacket.PutShort(zoneMaxPcCount);
                        }
                    }
                }
            });

            conn.Send(packet);
        }
Пример #26
0
        /// <summary>
        /// Sends positive response to logout attempt.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_LOGOUTOK(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_LOGOUTOK);

            conn.Send(packet);
        }
Пример #27
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)
 => BC_MESSAGE(conn, msgType, null);
Пример #28
0
        /// <summary>
        /// Sends negative response to slot swap request.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_CHARACTER_SLOT_SWAP_FAIL(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_CHARACTER_SLOT_SWAP_FAIL);

            conn.Send(packet);
        }
Пример #29
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)
 => BC_MESSAGE(conn, MsgType.Text, msg);
Пример #30
0
        /// <summary>
        /// Sends notification that login packet was received.
        /// </summary>
        /// <param name="conn"></param>
        public static void BC_LOGIN_PACKET_RECEIVED(LoginConnection conn)
        {
            var packet = new Packet(Op.BC_LOGIN_PACKET_RECEIVED);

            conn.Send(packet);
        }