Example #1
0
        public static void Ping(NetConnection connection)
        {
            var buffer = GameServerNetwork.Socket.CreateMessage();

            buffer.Write((int)PacketList.Ping);
            GameServerNetwork.SendDataTo(connection, buffer, NetDeliveryMethod.ReliableUnordered);
        }
        /// <summary>
        /// Envia membros de guild.
        /// </summary>
        /// <param name="hexID"></param>
        public static void SendMember(string hexID)
        {
            var pData = Authentication.FindByHexID(hexID);

            if (pData.GuildID == 0)
            {
                return;
            }

            var gData = Guild.FindGuildByID(pData.GuildID);

            var buffer = GameServerNetwork.Socket.CreateMessage();

            buffer.Write((int)PacketList.WorldServer_Client_GuildMemberInfo);

            buffer.Write(gData.Member.Count - 1);

            foreach (var mData in gData.Member)
            {
                buffer.Write(mData.Name);
                buffer.Write(mData.SelfIntro);
                buffer.Write(mData.Status);
            }

            GameServerNetwork.SendDataTo(hexID, buffer, NetDeliveryMethod.ReliableOrdered);
        }
        public static void Message(NetConnection connection, int value)
        {
            var buffer = GameServerNetwork.Socket.CreateMessage(4);

            buffer.Write(value);
            GameServerNetwork.SendDataTo(connection, buffer, NetDeliveryMethod.ReliableOrdered);
        }
        /// <summary>
        /// Envia mensagens sem conteúdo
        /// </summary>
        /// <param name="index"></param>
        /// <param name="value"></param>
        public static void Message(string hexID, int value)
        {
            var buffer = GameServerNetwork.Socket.CreateMessage(8);

            buffer.Write(value);
            GameServerNetwork.SendDataTo(hexID, buffer, NetDeliveryMethod.ReliableOrdered);
        }
        /// <summary>
        /// Envia o pedido de hexid
        /// </summary>
        /// <param name="index"></param>
        public static void NeedHexID(NetConnection connection)
        {
            var buffer = GameServerNetwork.Socket.CreateMessage(4);

            buffer.Write((int)PacketList.GameServer_Client_NeedHexID);
            GameServerNetwork.SendDataTo(connection, buffer, NetDeliveryMethod.ReliableOrdered);
        }
        /// <summary>
        /// Envia informações de guild.
        /// </summary>
        /// <param name="hexID"></param>
        public static void SendGuild(string hexID)
        {
            var pData = Authentication.FindByHexID(hexID);

            if (pData.GuildID == 0)
            {
                return;
            }

            var gData = Guild.FindGuildByID(pData.GuildID);

            var buffer = GameServerNetwork.Socket.CreateMessage();

            buffer.Write((int)PacketList.WorldServer_Client_GuildInfo);
            buffer.Write(gData.OwnerName);
            buffer.Write(gData.Name);
            buffer.Write(gData.Member.Count);
            buffer.Write(gData.OnlineMember);
            buffer.Write(gData.Announcement);

            GameServerNetwork.SendDataTo(hexID, buffer, NetDeliveryMethod.ReliableOrdered);
        }