Exemplo n.º 1
0
 public static MaplePakcet Ping()
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 2
0
 public static MaplePakcet ShowRegister(bool isShow)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <bool>(isShow);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 3
0
 public static MaplePakcet RemovePlayer(int cid)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <int>(cid);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 4
0
        public static MaplePakcet RegisterAccount(bool Success)
        {
            using (MapleBuffer buffer = new MapleBuffer())
            {
                buffer.add(Success);

                return(new MaplePakcet(buffer.ToArray()));
            }
        }
Exemplo n.º 5
0
 public static MaplePakcet AddPlayer(CMapleClient client, CCharacter chr)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <byte>(0);
         addCharEntry(buffer, chr, client);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 6
0
        public static MaplePakcet getEndOfServerList()
        {
            using (MapleBuffer buffer = new MapleBuffer())
            {
                buffer.add <byte>(0xFF);//世界ID

                return(new MaplePakcet(buffer.ToArray()));
            }
        }
Exemplo n.º 7
0
 public static MaplePakcet CheckAccount(string Name, bool Success)
 {
     using (MapleBuffer buff = new MapleBuffer())
     {
         buff.add <string>(Name);
         buff.add <bool>(Success);
         return(new MaplePakcet(buff.ToArray()));
     }
 }
Exemplo n.º 8
0
 public static MaplePakcet CharNameResponse(string Name, bool ret)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <string>(Name);
         buffer.add <bool>(ret);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 9
0
 public static MaplePakcet ShowNumber()
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <byte>(1);
         buffer.add <int>(5);
         buffer.add <int>(5 + (3 - 5 % 3));
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 10
0
 public static MaplePakcet GetChatText(int cid, string Text, bool whiteBG = false)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <int>(cid);
         buffer.add <byte>(whiteBG ? (byte)1 : (byte)0);//是否显示说话对话框
         buffer.add <string>(Text);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 11
0
 public static MaplePakcet getLoginFailed(byte type)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <byte>(type);
         buffer.add <byte>(0);
         buffer.add(new byte[1000]);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 12
0
 public static MaplePakcet getServerStatus(byte status)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <byte>(status);
         if (status != 0)
         {
             buffer.add(new byte[6]);
         }
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 验证版本
        /// </summary>
        /// <returns></returns>
        public static byte[] GetHello(short mapleVersion, byte[] sendIv, byte[] recvIv)
        {
            using (MapleBuffer mapleBuffer = new MapleBuffer())
            {
                mapleBuffer.add((short)0x0E);
                mapleBuffer.add <short>(mapleVersion);
                mapleBuffer.add(recvIv);
                mapleBuffer.add(sendIv);
                mapleBuffer.add(4);

                return(mapleBuffer.ToArray());
            }
        }
Exemplo n.º 14
0
        public static MaplePakcet getServerIP(byte[] IPaddr, short port, int chrid)
        {
            using (MapleBuffer buffer = new MapleBuffer())
            {
                buffer.add <short>(0);
                buffer.add(IPaddr);
                buffer.add <short>(port);
                buffer.add <int>(chrid);
                buffer.add <byte>(0);

                return(new MaplePakcet(buffer.ToArray()));
            }
        }
Exemplo n.º 15
0
 public static MaplePakcet ShowPlayList(CMapleClient client, Dictionary <CCharacter, Dictionary <short, CItem> > PlayerList, byte worldid)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <byte>(0);
         buffer.add <int>(0);
         buffer.add <byte>((byte)PlayerList.Count);
         foreach (KeyValuePair <CCharacter, Dictionary <short, CItem> > chr in PlayerList)
         {
             addCharEntry(buffer, chr.Key, client, chr.Value);
         }
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 16
0
 public static MaplePakcet GetChannelChange(string Address, short port)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <byte>(1);
         string[] adds = Address.Split(".");
         foreach (string add in adds)
         {
             buffer.add(byte.Parse(add.ToString()));//IP地址
         }
         buffer.add <short>(port);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 17
0
        public static MaplePakcet GetCharInfo(int Channelid, CCharacter chr, CMapleClient client)
        {
            using (MapleBuffer buffer = new MapleBuffer())
            {
                buffer.add <int>(Channelid);//频道
                buffer.add <byte>(0);
                buffer.add <byte>(1);
                buffer.add <int>(new System.Random().Next());
                buffer.add <int>(new System.Random().Next());
                buffer.add <int>(new System.Random().Next());
                buffer.add <int>(0);

                AddCharacterInfo(buffer, chr, client);
                return(new MaplePakcet(buffer.ToArray()));
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 游戏版本封包
        /// </summary>
        /// <param name="mapleVersion"></param>
        /// <param name="sendIv"></param>
        /// <param name="recvIv"></param>
        /// <returns></returns>
        public static MaplePakcet GetHello(short mapleVersion, byte[] sendIv, byte[] recvIv)
        {
            using (MapleBuffer mapleBuffer = new MapleBuffer())
            {
                System.Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);
                mapleBuffer.add((short)0x0E);
                mapleBuffer.add <short>(mapleVersion);
                mapleBuffer.add <short>(1);
                mapleBuffer.add <byte>(0x31);
                mapleBuffer.add(recvIv);
                mapleBuffer.add(sendIv);
                mapleBuffer.add <byte>(4);

                return(new MaplePakcet(mapleBuffer.ToArray()));
            }
        }
Exemplo n.º 19
0
 public static MaplePakcet ServerMessage(int type, string Message, int channel = 0, bool megaEar = false)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <byte>((byte)type);
         buffer.add <string>(Message);
         switch (type)
         {
         case 3:
             buffer.add <byte>((byte)channel);
             buffer.add <byte>(megaEar ? (byte)1 : (byte)0);
             break;
         }
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 20
0
        public static MaplePakcet getAuthSuccessRequest(CUser user)
        {
            //01 00 01 00 00 00 00 00 06 00 78 7A 6B 6D 78 64 01 00 00 00 01
            //01 04 01 00 00 00 00 00 06 00 78 7A 6B 6D 78 64 01 00 00 00 01
            using (MapleBuffer buffer = new MapleBuffer())
            {
                buffer.add <byte>(0);
                buffer.add <int>(user.Id);
                buffer.add <byte>(0);
                buffer.add <byte>((byte)(user.Gm ?? 0));//是否管理员
                buffer.add <string>(user.Name);
                buffer.add <int>(user.Id);
                buffer.add <byte>(0);

                return(new MaplePakcet(buffer.ToArray()));
            }
        }
Exemplo n.º 21
0
 public static MaplePakcet SpawnPlayer(CMapleCharacter chr)
 {
     using (MapleBuffer buffer = new MapleBuffer())
     {
         buffer.add <int>(chr.character.Id + 1);
         buffer.add <string>(chr.character.Name);
         buffer.add <int>(0);//Buffmask
         addCharLook(buffer, chr);
         buffer.add <int>(0);
         buffer.add <int>(0);//getItemEffect
         buffer.add <int>(0);
         buffer.add <short>((short)chr.GetPoint().X);
         buffer.add <short>((short)chr.GetPoint().Y);
         buffer.add <byte>(chr.GetStance());
         buffer.add <short>(0);
         buffer.add(new byte[3]);
         return(new MaplePakcet(buffer.ToArray()));
     }
 }
Exemplo n.º 22
0
        public static MaplePakcet getServerList()
        {
            //05 00 05 00 C3 B0 58 B5 BA 02 08 00 C0 B6 CE CF C5 A3 2D 31 00 00 00 00 00 00 00 08 00 C0 B6 CE CF C5 A3 2D 32 00 00 00 00 00 01 00
            using (MapleBuffer buffer = new MapleBuffer())
            {
                buffer.add <byte>(0);       //小区名称(0:蓝蜗牛,1: 蘑菇仔,2: 绿水灵...)
                buffer.add <string>("027"); //世界名称
                buffer.add <byte>(2);       //频道个数
                for (int i = 0; i < 2; i++)
                {
                    buffer.add <string>("Chal1-" + i); //广告牌
                    buffer.add <int>(0);               //在线人数.
                    buffer.add <byte>(0);              //世界ID
                    buffer.add <byte>(0);              //频道ID
                    buffer.add <byte>(0);
                }

                return(new MaplePakcet(buffer.ToArray()));
            }
        }
Exemplo n.º 23
0
        public static MaplePakcet getServerList(WorldInfo worldModel)
        {
            //05 00 05 00 C3 B0 58 B5 BA 02 08 00 C0 B6 CE CF C5 A3 2D 31 00 00 00 00 00 00 00 08 00 C0 B6 CE CF C5 A3 2D 32 00 00 00 00 00 01 00
            using (MapleBuffer buffer = new MapleBuffer())
            {
                buffer.add <byte>((byte)worldModel.WorldId);           //小区名称(0:蓝蜗牛,1: 蘑菇仔,2: 绿水灵...)
                buffer.add <string>("027");                            //世界名称
                buffer.add <byte>((byte)worldModel.channelInfo.Count); //频道个数
                for (int i = 0; i < worldModel.channelInfo.Count; i++)
                {
                    ChannelInfo info = worldModel.channelInfo[i];
                    buffer.add <string>(info.Name + "_" + i);    //广告牌
                    buffer.add <int>(info.Players);              //在线人数.
                    buffer.add <byte>((byte)worldModel.WorldId); //世界ID
                    buffer.add <byte>((byte)i);                  //频道ID
                    buffer.add <byte>(0);
                }

                return(new MaplePakcet(buffer.ToArray()));
            }
        }