sm

立即登录 | 账号注册

积分: 0 |用户组: 游客

搜索
服务器租用 传奇3一条龙 支付平台源码 无法下载点击此处反馈
查看: 1608|回复: 6

[传奇3源码] 新1.4C登录器Delphi源码冷雨夜适配King1.4c插件

[复制链接]

826

主题

36

回帖

23万

积分

霸王教主

积分
235497
发表于 2022-9-12 16:52:25 | 显示全部楼层 |阅读模式
lyy冷雨夜登录器主程序源码,新1.4c可用,编译通过,可正常使用。

新1.4c.png
unit EDcode;
//编码/解码函数库
interface

uses
  Windows, SysUtils, Classes;

const
  BUFFERSIZE        = 6400;

  CM_CheckNet       = 1;                //检查服务器状态,包含检测版本登命令
  CM_GetRenStr      = 2;                //获取随机验证码
  CM_Reg            = 3;                //用户注册
  CM_ModPass        = 4;                //修改密码
  CM_GetQuest       = 5;                //获取密码提示问题
  CM_ReSetPass      = 6;                //重设密码

  PM_VerOk          = 11;               //客户端版本符合
  PM_VerNo          = 12;               //客户端版本不符合
  PM_SMess          = 13;               //仅弹出公告
  PM_SMessButt      = 14;               //弹出公告+更新按钮

  PM_UserRep        = 31;               //用户名称已经存在
  PM_PwsError       = 41;               //老密码错误
  PM_NotUser        = 51;               //ID不存在
  PM_InfoError      = 61;               //资料不符合

  PM_RenError       = 3451;             //随机验证码错误
  PM_Disable        = 3452;             //管理员禁止使用
  PM_SqlError       = 3453;             //服务器数据库连接错误
  PM_StrError       = 3454;             //字符串包含非法字符
  PM_StrBlank       = 3455;             //字符串中包含有空格
  PM_UnError        = 3456;             //发生未知异常
  PM_UserOK         = 3457;             //用户操作成功

  1. type
  2.   TEnDecodeType = (edtMir2, edtMirWorld);

  3.   TLongMsg = packed record
  4.     Comm: Word;
  5.     param: Word;
  6.   end;

  7.   TRegUser = packed record
  8.     UserID: string[15];
  9.     UserPass: string[15];
  10.     PQ1: string[30];
  11.     PA1: string[30];
  12.     PQ2: string[30];
  13.     PA2: string[15];
  14.     UserEmail: string[40];
  15.     EnRenKey: string[8];
  16.   end;



  17. function EncodeString(str: string; EnDecodeType: TEnDecodeType): string;
  18. function DecodeString(str: string; EnDecodeType: TEnDecodeType): string;
  19. function EncodeBuffer(buf: pChar; bufsize: integer; EnDecodeType: TEnDecodeType): string;
  20. procedure DecodeBuffer(src: string; buf: pChar; bufsize: integer; EnDecodeType: TEnDecodeType);
  21. //传世封包加/解密方法
  22. function MirDecode(pIn: string; Size: Word; pOut: pChar): Word;
  23. function MirEncode(pIn: pChar; Size: Word; pOut: pChar): Word;

  24. var
  25.   CSEncode          : TRTLCriticalSection;

  26. implementation

  27. uses math;
  28. var
  29.   EncBuf, TempBuf   : pChar;

  30. procedure Encode6BitBuf(src, dest: pChar; srclen, destlen: integer; EnDecodeType: TEnDecodeType);
  31. var
  32.   i, restcount, destpos: integer;
  33.   made, ch, rest    : byte;
  34. begin
  35.   if EnDecodeType = edtMirWorld then
  36.   begin
  37.     //fillchar(dest,destlen,0);
  38.     MirEncode(src, srclen, dest);
  39.   end
  40.   else
  41.   try
  42.     restcount := 0;
  43.     rest := 0;
  44.     destpos := 0;
  45.     for i := 0 to srclen - 1 do
  46.     begin
  47.       if destpos >= destlen then break;
  48.       ch := byte(src<i>);
  49.       made := byte((rest or (ch shr (2 + restcount))) and $3F);
  50.       rest := byte(((ch shl (8 - (2 + restcount))) shr 2) and $3F);
  51.       Inc(restcount, 2);

  52.       if restcount < 6 then
  53.       begin
  54.         dest[destpos] := char(made + $3C);
  55.         Inc(destpos);
  56.       end
  57.       else
  58.       begin
  59.         if destpos < destlen - 1 then
  60.         begin
  61.           dest[destpos] := char(made + $3C);
  62.           dest[destpos + 1] := char(rest + $3C);
  63.           Inc(destpos, 2);
  64.         end
  65.         else
  66.         begin
  67.           dest[destpos] := char(made + $3C);
  68.           Inc(destpos);
  69.         end;
  70.         restcount := 0;
  71.         rest := 0;
  72.       end;

  73.     end;
  74.     if restcount > 0 then
  75.     begin
  76.       dest[destpos] := char(rest + $3C);
  77.       Inc(destpos);
  78.     end;
  79.     dest[destpos] := #0;
  80.   except
  81.   end;
  82. end;

  83. //解码

  84. procedure Decode6BitBuf(source: string; buf: pChar; buflen: integer; EnDecodeType: TEnDecodeType);
  85. const
  86.   Masks             : array[2..6] of byte = ($FC, $F8, $F0, $E0, $C0);
  87.   //($FE, $FC, $F8, $F0, $E0, $C0, $80, $00);
  88. var
  89.   i, len, bitpos, madebit, bufpos: integer;
  90.   ch, tmp, _byte    : byte;
  91. begin
  92.   if EnDecodeType = edtMirWorld then
  93.   begin
  94.     //fillchar(buf,buflen,0);
  95.     MirDecode(source, length(source), buf);
  96.     i := round(length(source) * 3 / 4);
  97.     buf<i> := #$0;
  98.   end
  99.   else
  100.   try
  101.     len := length(source);
  102.     bitpos := 2;
  103.     madebit := 0;
  104.     bufpos := 0;
  105.     tmp := 0;
  106.     for i := 1 to len do
  107.     begin
  108.       if integer(source<i>) - $3C >= 0 then
  109.         ch := byte(source<i>) - $3C
  110.       else
  111.       begin
  112.         bufpos := 0;
  113.         break;
  114.       end;

  115.       if bufpos >= buflen then break;

  116.       if (madebit + 6) >= 8 then
  117.       begin
  118.         _byte := byte(tmp or ((ch and $3F) shr (6 - bitpos)));
  119.         buf[bufpos] := char(_byte);
  120.         Inc(bufpos);
  121.         madebit := 0;
  122.         if bitpos < 6 then
  123.           Inc(bitpos, 2)
  124.         else
  125.         begin
  126.           bitpos := 2;
  127.           continue;
  128.         end;
  129.       end;

  130.       tmp := byte(byte(ch shl bitpos) and Masks[bitpos]); // #### ##--
  131.       Inc(madebit, 8 - bitpos);
  132.     end;
  133.     buf[bufpos] := #0;
  134.   except
  135.   end;
  136. end;

  137. function DecodeString(str: string; EnDecodeType: TEnDecodeType): string;
  138. begin
  139.   try
  140.     EnterCriticalSection(CSEncode);
  141.     Decode6BitBuf(str, EncBuf, BUFFERSIZE,EnDecodeType);
  142.     result := StrPas(EncBuf);           //error, 1, 2, 3,...
  143.   finally
  144.     LeaveCriticalSection(CSEncode);
  145.   end;
  146. end;

  147. procedure DecodeBuffer(src: string; buf: pChar; bufsize: integer; EnDecodeType: TEnDecodeType);
  148. begin
  149.   try
  150.     EnterCriticalSection(CSEncode);
  151.     Decode6BitBuf(src, EncBuf, BUFFERSIZE,EnDecodeType);
  152.     Move(EncBuf^, buf^, bufsize);
  153.   finally
  154.     LeaveCriticalSection(CSEncode);
  155.   end;
  156. end;

  157. function EncodeString(str: string; EnDecodeType: TEnDecodeType): string;
  158. begin
  159.   try
  160.     EnterCriticalSection(CSEncode);
  161.     Encode6BitBuf(pChar(str), EncBuf, length(str), BUFFERSIZE,EnDecodeType);
  162.     result := StrPas(EncBuf);
  163.   finally
  164.     LeaveCriticalSection(CSEncode);
  165.   end;
  166. end;

  167. function EncodeBuffer(buf: pChar; bufsize: integer; EnDecodeType: TEnDecodeType): string;
  168. begin
  169.   try
  170.     EnterCriticalSection(CSEncode);
  171.     if bufsize < BUFFERSIZE then
  172.     begin
  173.       Move(buf^, TempBuf^, bufsize);
  174.       Encode6BitBuf(TempBuf, EncBuf, bufsize, BUFFERSIZE,EnDecodeType);
  175.       result := StrPas(EncBuf);
  176.     end
  177.     else
  178.       result := '';
  179.   finally
  180.     LeaveCriticalSection(CSEncode);
  181.   end;
  182. end;

  183. function MirDecode(pIn: string; Size: Word; pOut: pChar): Word;
  184. //传奇世界封包解密
  185. var
  186.   b1, b2, b3        : byte;
  187.   c1, c2, c3, c4    : byte;
  188.   i, oPtr           : Word;
  189.   x, y              : Word;
  190. begin
  191.   //  i := 0;
  192.   oPtr := 0;
  193.   x := length(pIn) div 4;
  194.   if length(pIn) > 3 then
  195.     for i := 0 to x - 1 do
  196.     begin
  197.       c1 := ord(pIn[i * 4 + 1]) - $3B;
  198.       c2 := ord(pIn[i * 4 + 2]) - $3B;
  199.       c3 := ord(pIn[i * 4 + 3]) - $3B;
  200.       c4 := ord(pIn[i * 4 + 4]) - $3B;
  201.       b1 := (c1 and $FC) shl 2;         //11111100->11110000
  202.       b2 := (c1 and 3);                 //00000011
  203.       b3 := c4 and $C;                  //00001100
  204.       pOut[oPtr] := chr((b1 or b2 or b3) xor $EB);
  205.       Inc(oPtr);
  206.       b1 := (c2 and $FC) shl 2;         //11111100->11110000
  207.       b2 := (c2 and 3);                 //00000011
  208.       b3 := (c4 and 3) shl 2;           //00000011  ->00001100
  209.       pOut[oPtr] := chr((b1 or b2 or b3) xor $EB);
  210.       Inc(oPtr);
  211.       b1 := (c4 and $30) shl 2;         //00110000->11000000
  212.       pOut[oPtr] := chr((c3 or b1) xor $EB);
  213.       Inc(oPtr);
  214.     end;
  215.   y := length(pIn) mod 4;
  216.   if y = 2 then
  217.   begin
  218.     c1 := ord(pIn[x * 4 + 1]) - $3B;
  219.     c2 := ord(pIn[x * 4 + 2]) - $3B;

  220.     b1 := (c1 and $FC) shl 2;           //11111100->11110000
  221.     b2 := (c1 and 3);                   //00000011
  222.     b3 := (c2 and 3) shl 2;             //00000011->00001100
  223.     pOut[oPtr] := chr((b1 or b2 or b3) xor $EB);
  224.     Inc(oPtr);
  225.   end;
  226.   if y = 3 then
  227.   begin
  228.     c1 := ord(pIn[x * 4 + 1]) - $3B;
  229.     c2 := ord(pIn[x * 4 + 2]) - $3B;

  230.     c4 := ord(pIn[x * 4 + 3]) - $3B;

  231.     b1 := (c1 and $FC) shl 2;           //11111100->11110000
  232.     b2 := (c1 and 3);                   //00000011
  233.     b3 := c4 and $C;                    //00001100
  234.     pOut[oPtr] := chr((b1 or b2 or b3) xor $EB);
  235.     Inc(oPtr);

  236.     b1 := (c2 and $FC) shl 2;           //11111100->11110000
  237.     b2 := (c2 and 3);                   //00000011
  238.     b3 := (c4 and 3) shl 2;             //00000011  ->00001100
  239.     pOut[oPtr] := chr((b1 or b2 or b3) xor $EB);
  240.     Inc(oPtr);
  241.   end;
  242.   result := oPtr;
  243. end;

  244. function MirEncode(pIn: pChar; Size: Word; pOut: pChar): Word;
  245. //传奇世界封包加密
  246. var
  247.   b1, bcal          : byte;
  248.   bflag1, bflag2    : byte;
  249.   i, iPtr, oPtr     : Word;
  250. begin
  251.   //  b1 := 0;
  252.   //  bcal := 0;
  253.   //  bflag1 := 0;
  254.   bflag2 := 0;
  255.   i := 0;
  256.   iPtr := 0;
  257.   oPtr := 0;
  258.   while iPtr < Size do
  259.   begin
  260.     b1 := ord(pIn[iPtr]) xor $EB;
  261.     Inc(iPtr);
  262.     if i < 2 then
  263.     begin
  264.       bcal := b1;
  265.       bcal := bcal shr 2;
  266.       bflag1 := bcal;
  267.       bcal := bcal and $3C;
  268.       b1 := b1 and 3;
  269.       bcal := bcal or b1;
  270.       bcal := bcal + $3B;
  271.       pOut[oPtr] := chr(bcal);
  272.       Inc(oPtr);
  273.       bflag2 := (bflag1 and 3) or (bflag2 shl 2);
  274.     end
  275.     else
  276.     begin
  277.       bcal := b1;
  278.       bcal := bcal and $3F;
  279.       bcal := bcal + $3B;
  280.       pOut[oPtr] := chr(bcal);
  281.       Inc(oPtr);
  282.       b1 := b1 shr 2;
  283.       b1 := b1 and $30;
  284.       b1 := b1 or bflag2;
  285.       b1 := b1 + $3B;
  286.       pOut[oPtr] := chr(b1);
  287.       Inc(oPtr);
  288.       bflag2 := 0;
  289.     end;
  290.     Inc(i);
  291.     i := i mod 3;
  292.   end;
  293.   pOut[oPtr] := chr(0);
  294.   if i <> 0 then
  295.   begin
  296.     pOut[oPtr] := chr(bflag2 + $3B);
  297.     Inc(oPtr);
  298.     pOut[oPtr] := chr(0);
  299.   end;
  300.   result := oPtr;
  301. end;

  302. initialization
  303.   begin
  304.     GetMem(EncBuf, BUFFERSIZE + 100);   //BUFFERSIZE + 100);
  305.     GetMem(TempBuf, 10240);             //2048);
  306.     InitializeCriticalSection(CSEncode);
  307.   end;

  308. finalization
  309.   begin
  310.     FreeMem(EncBuf);
  311.     FreeMem(TempBuf);
  312.     DeleteCriticalSection(CSEncode);

  313.   end;

  314. end.</i></i></i></i>
复制代码

游客,如果您要查看本帖隐藏内容请回复





上一篇:新火鸟登录器源代码Delphi,lyy冷雨夜代码
下一篇:华立3.56登录器源码lyy冷雨夜登录器Delphi源码
回复

使用道具 举报

1

主题

20

回帖

289

积分

旋风流星刀

积分
289
发表于 2023-7-2 10:07:20 | 显示全部楼层
论坛有你而精彩
回复 支持 反对

使用道具 举报

0

主题

6

回帖

238

积分

旋风流星刀

积分
238
发表于 2023-11-1 21:39:47 | 显示全部楼层
顶顶顶顶顶顶顶顶顶多
回复 支持 反对

使用道具 举报

0

主题

19

回帖

647

积分

旋风流星刀

积分
647
发表于 2023-11-2 00:31:41 来自手机 | 显示全部楼层
学习学习
回复

使用道具 举报

0

主题

3

回帖

109

积分

旋风流星刀

积分
109
发表于 2024-3-12 17:09:34 | 显示全部楼层
笑嘻嘻笑嘻嘻笑嘻嘻系
回复 支持 反对

使用道具 举报

0

主题

4

回帖

202

积分

旋风流星刀

积分
202
发表于 2024-3-22 23:01:56 | 显示全部楼层
{:2_25:}{:2_25:}{:2_25:}
回复

使用道具 举报

0

主题

16

回帖

75

积分

旋风流星刀

积分
75
发表于 2024-4-13 12:03:18 | 显示全部楼层
看下新1.4Cdlq
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|美林GM论坛 ( 蜀ICP备2020030293号-2 )|网站地图

禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.如遇版权问题,请及时QQ联系

GMT+8, 2024-4-28 22:32 , Processed in 0.347057 second(s), 83 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表