LobbyServer.WORLD_LIST.Send C# (CSharp) Method

Send() public static method

public static Send ( LobbyClient client ) : void
client LobbyClient
return void
        public static void Send(LobbyClient client)
        {
            PacketOut Out = new PacketOut((UInt32)Opcodes.WORLD_LIST);
            Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS);
            lock (Program.worldListener.Worlds)
            {
                Out.WriteUInt16Reverse((UInt16)Program.worldListener.Worlds.Count);
                foreach (KeyValuePair<UInt32, World.World> info in Program.worldListener.Worlds)
                {
                    Out.WriteUInt32Reverse((UInt32)info.Key);
                    Out.WriteParsedString(info.Value.Name, 32);
                    Out.WriteByte((Byte)info.Value.Id);
                    Out.WriteByte(info.Value.Population);
                    Out.WriteByte(1);
                    Out.WriteByte(1);
                }
            }
            client.Send(Out);
        }

Usage Example

        static public void Send(LobbyClient client)
        {
            Program.CharMgr.LoadCharacters(client.Account.Id);

            CharacterInfo[] _Chars = Program.CharMgr.GetInfos(client.Account.Id);
            WorldInfo       Info   = Program.CharMgr.GetWorldInfo(client.Account.WorldId);

            PacketOut Out = new PacketOut((UInt32)Opcodes.CHARACTER_LIST);

            Out.WriteByte((byte)_Chars.Length);
            foreach (CharacterInfo Char in _Chars)
            {
                Out.WriteByte(Char.Character.SlotId);
                Out.WriteByte(Char.Character.Faction);
                Out.WriteByte((byte)(Info.RpcID == 0 ? 0 : 1));
                Out.WriteUInt32R((UInt32)Info._Info.Id);
                Out.WriteUnicodeString(Info._Info.Name, 32);
                Out.WriteUnicodeString(Char.Character.Name, 32);
            }

            client.SendTCP(Out);

            if (_Chars.Length <= 0)
            {
                WORLD_LIST.Send(client);
            }
        }
All Usage Examples Of LobbyServer.WORLD_LIST::Send
WORLD_LIST