当前位置: 首页>>代码示例>>C#>>正文


C# PacketWriter.Text方法代码示例

本文整理汇总了C#中CLFramework.PacketWriter.Text方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.Text方法的具体用法?C# PacketWriter.Text怎么用?C# PacketWriter.Text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CLFramework.PacketWriter的用法示例。


在下文中一共展示了PacketWriter.Text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NewsPacket

        public static byte[] NewsPacket()
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Opcodes.SERVER.SERVER_MAIN);
            Writer.Byte(0);
            Writer.Byte((byte)Definitions.Serverdef.News_List.Count);

            foreach (Definitions.Serverdef.NewsList n in Definitions.Serverdef.News_List)
            {
                Writer.Text(n.Title);
                Writer.Text(n.Article);
                Writer.Word(n.Year);
                Writer.Word(n.Month);
                Writer.Word(n.Day);
                Writer.Word(0); // Hour
                Writer.Word(0); // Minute
                Writer.Word(0); // Second
                Writer.Word(0); // MiliSecond
            }

            Writer.Word(0);

            return Writer.GetBytes();
        }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:25,代码来源:News.cs

示例2: FriendData

 public static byte[] FriendData(int target, byte type, string name, WorldMgr.character c, bool state)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_FRIEND_DATA);
     switch (type)
     {
         case 2:
             //Friend invite accepted
             Writer.Byte(2);
             Writer.DWord(target); //Id
             Writer.Text(c.Information.Name);  //Name
             Writer.DWord(c.Information.Model); //Model
             break;
         case 3:
             //Remove friend from own list
             Writer.Byte(3);
             Writer.DWord(target);
             break;
         case 4:
             //Fried online / offline update
             Writer.Byte(4);
             Writer.DWord(target);
             Writer.Byte(state);
             break;
         case 5:
             //Send private message..
             Writer.Byte(8);
             Writer.Text(name);
             Writer.DWord(0);
             Writer.DWord(0);//time info
             break;
     }
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:34,代码来源:FriendsPackets.cs

示例3: ServerListPacket

 public static byte[] ServerListPacket(int cliVersion)
 {
     //Create a new packet writer to create our packet
     PacketWriter W = new PacketWriter();
     //Write the opcode from server to client
     W.Create(Opcodes.SERVER.SERVER_SERVERLIST);
     //Structure of packet below
     W.Word(0x0201);
     W.Text("CLOWEN_DEV_PROJECT");
     W.Byte(0);
     //Repeat the following packet data below for each server in the list
     foreach (KeyValuePair<int, Definitions.Serverdef.ServerDetails> Gameservers in Definitions.Serverdef.Serverlist)
     {
         if (cliVersion == Definitions.Serverdef.SilkroadClientVersion)
         {
             W.Bool(true);
             W.Word(Gameservers.Value.id);
             W.Text(Gameservers.Value.name);
             W.Word(Gameservers.Value.usedSlots);
             W.Word(Gameservers.Value.maxSlots);
             W.Byte(Gameservers.Value.status);
         }
     }
     //Static 0 byte
     W.Byte(0);
     //Send the created packet back to the request (client).
     return W.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:28,代码来源:Serverlist.cs

示例4: GuildSetTitle

 public static byte[] GuildSetTitle(int charid, string charname, string title)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_GUILD_SET_TITLE);
     Writer.DWord(charid);
     Writer.Text(charname);
     Writer.Text(title);
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:9,代码来源:Packets.cs

示例5: JoinFormedRequest

 public static byte[] JoinFormedRequest(WorldMgr.character requesting, WorldMgr.character owner)
 {
     //Create new packet writer
     PacketWriter Writer = new PacketWriter();
     //Add opcode for packet
     Writer.Create(OperationCode.SERVER_PARTY_JOIN_FORMED);
     //Character model information (Req).
     Writer.DWord(requesting.Information.Model);
     //Leader id
     Writer.DWord(requesting.Information.UniqueID);
     //Party id
     Writer.DWord(owner.Network.Party.ptid);
     //Static
     Writer.DWord(0);
     Writer.DWord(0);
     Writer.Byte(0);
     Writer.Byte(0xFF);
     //Write character unique id
     Writer.DWord(requesting.Information.UniqueID);
     //Write character name
     Writer.Text(requesting.Information.Name);
     //Write model information
     Writer.DWord(requesting.Information.Model);
     //Write level information
     Writer.Byte(requesting.Information.Level);
     //Static
     Writer.Byte(0xAA);
     //X and Y Sector
     Writer.Byte(requesting.Position.xSec);
     Writer.Byte(requesting.Position.ySec);
     //Static
     Writer.Word(0);
     Writer.Word(0);
     Writer.Word(0);
     Writer.Word(1);
     Writer.Word(1);
     //If character is in a guild
     if (requesting.Network.Guild != null)
         //Write guild name
         Writer.Text(requesting.Network.Guild.Name);
     //If character is not in a guild
     else
         //Write word value 0
         Writer.Word(0);
     //Static
     Writer.Byte(0);
     Writer.DWord(0);
     Writer.DWord(0);
     //Return all bytes to send
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:51,代码来源:JoinFormedRequests.cs

示例6: PrivateMessageCheck

        public static byte[] PrivateMessageCheck(WorldMgr.character c)
        {
            DB ms = new DB("SELECT * FROM message WHERE receiver='" + c.Information.Name + "'");
            PacketWriter Writer = new PacketWriter();
            int count = ms.Count();

            Writer.Create(OperationCode.SERVER_PM_MESSAGE);
            Writer.Byte(1);//Static
            Writer.Byte(Convert.ToByte(count));//Total count
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    string pmfrom       = reader.GetString(1);
                    string pmto         = reader.GetString(2);
                    string pmmessage    = reader.GetString(3);
                    byte pmstatus       = reader.GetByte(4);
                    DateTime pmdate     = Convert.ToDateTime(reader.GetDateTime(5));

                    Writer.Text(pmfrom);            // Message From
                    Writer.DWord(0x8A070000);       // date
                    Writer.DWord(0xC7058401);       // date
                    Writer.Byte(pmstatus);          // Status (0 = Unread) (1 = Read)
                }
                ms.Close();
            }
            return Writer.GetBytes();
        }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:28,代码来源:PrivateMessagePackets.cs

示例7: PetSpawn

 ///////////////////////////////////////////////////////////////////////////
 // Despawn Pet
 ///////////////////////////////////////////////////////////////////////////
 public static byte[] PetSpawn(int petid, byte type, CLGameServer.WorldMgr.pet_obj o)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_PLAYER_SPAWN_PET);   //Select Opcode
     Writer.DWord(petid);                              //Pet ID
     switch (type)
     {
         case 1:
             //Despawn pet
             Writer.Byte(1);
             break;
         case 2:
             //Rename pet respawn
             Writer.Byte(5);
             Writer.Text(o.Petname);
             break;
         case 3:
             //Attack pet respawn for exp info
             Writer.Byte(3);//Static
             Writer.LWord(o.exp);//New exp
             Writer.DWord(o.OwnerID);//Owner id
             break;
     }
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:28,代码来源:GrabpetPackets.cs

示例8: FriendGroupManage

 public static byte[] FriendGroupManage(string type,string groupname, short groupid, int targetid)
 {
     PacketWriter Writer = new PacketWriter();
     switch (type)
     {
         case "ADD":
             Writer.Create(OperationCode.SERVER_FRIEND_GROUP);
             Writer.Byte(1);
             Writer.Text(groupname);
             Writer.Word(groupid);
             break;
         case "REMOVE":
             Writer.Create(OperationCode.SERVER_FRIEND_GROUP_REMOVE);
             Writer.Byte(1);
             Writer.Word(groupid);
             break;
         case "MOVE":
             Writer.Create(OperationCode.SERVER_FRIEND_GROUP_MANAGE_FRIEND);
             Writer.Byte(1);
             Writer.DWord(targetid);
             Writer.Word(groupid);
             break;
     }
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:25,代码来源:FriendsPackets.cs

示例9: AgentServer

 public static byte[] AgentServer()
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_AGENTSERVER);
     Writer.Text("AgentServer");
     Writer.Bool(true);
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:8,代码来源:LoginPackets.cs

示例10: GateWayPacket

 public static byte[] GateWayPacket()
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Opcodes.SERVER.SERVER_INFO);
     Writer.Text("GatewayServer");
     Writer.Byte(0);
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:8,代码来源:Connect.cs

示例11: PrivateMessageOpen

 public static byte[] PrivateMessageOpen(byte type, string Messageinfo)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_PM_OPEN);
     Writer.Byte(0x01);
     Writer.Byte(type);
     Writer.Text(Messageinfo);
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:9,代码来源:PrivateMessagePackets.cs

示例12: HonorRank

        public static byte[] HonorRank(WorldMgr.character c)
        {
            DB ms = new DB("SELECT * FROM rank_honor");
            PacketWriter Writer = new PacketWriter();
            int countinfo = ms.Count();

            Writer.Create(OperationCode.SERVER_HONOR_RANK);
            Writer.Byte(1);
            int i = 0;
            Writer.Byte(Convert.ToByte(countinfo));
            using (SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    byte rankicon = reader.GetByte(1);
                    string rankname = reader.GetString(2);
                    byte ranklevel = reader.GetByte(3);
                    byte ranklevelc = reader.GetByte(4);
                    int graduatesc = reader.GetInt32(5);
                    int rankposc = reader.GetInt32(6);

                    Writer.DWord(i + 1);
                    Writer.Byte(rankicon);
                    Writer.Text(rankname);
                    Writer.Byte(ranklevel);
                    Writer.Byte(ranklevelc);
                    Writer.DWord(graduatesc);
                    //If player has no guild, we write a 0 word value
                    if (c.Network.Guild.Name == null)
                    {
                        Writer.Word(0);
                    }
                    //If player has a guild we write the guild name.
                    else
                    {
                        Writer.Text(c.Network.Guild.Name);
                    }
                    i++;
                }
                ms.Close();
            }
            return Writer.GetBytes();
        }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:43,代码来源:RankListeningPackets.cs

示例13: MakeAliasError

 public static byte[] MakeAliasError(string name, byte switchinfo)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_MAKE_ALIAS);
     Writer.Byte(2);
     Writer.Word(0);
     Writer.Byte(0);
     Writer.Text(name);
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:10,代码来源:JobSystemPackets.cs

示例14: FriendDecline

 public static byte[] FriendDecline(string name)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_FRIEND_INVITE);
     Writer.Byte(2);
     Writer.Word(0x640B);
     Writer.Byte(0);
     Writer.Word(0x000B);
     Writer.Text(name);
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:11,代码来源:FriendsPackets.cs

示例15: ConnectSucces

 public static byte[] ConnectSucces(string ip, short port, byte type)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Opcodes.SERVER.SERVER_GATEWAY_LOGIN_RESPONSE);
     Writer.Byte(1);
     Writer.Byte(type);
     Writer.Byte(0);
     Writer.Word(0);
     Writer.Text(ip);
     Writer.Word(port);
     Writer.Byte(3);
     return Writer.GetBytes();
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:13,代码来源:Login.cs


注:本文中的CLFramework.PacketWriter.Text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。