sm
服务器租用 996 87 无法下载点击此处反馈
/
查看: 2377|回复: 1

DD145登录器源码Delphi冷雨夜lyy源代码 [传奇3源码]

[复制链接]

826

主题

37

回帖

23万

积分

霸王教主

积分
237197
发表于 2022-9-12 17:13:48 | 显示全部楼层 |阅读模式
lyy登录器源码DD145版,编译通过可使用,二次开发可利用性高,小白勿下,干货收藏

DD145.png
  1. constructor TExistFile.Create();
  2. begin
  3.   FreeOnTerminate := True;              // 自动删除
  4.   inherited Create(False);              // 直接运行
  5. end;

  6. procedure TExistFile.Execute;
  7. begin
  8.   try
  9.     if not DirectoryExists(FullPath + 'Update\') then ForceDirectories(FullPath + 'Update\');
  10.     if not DirectoryExists(FullPath + 'Config\') then ForceDirectories(FullPath + 'Config\');
  11.     //检测并生成WINRAR解压缩组件
  12.     if not FileExists(FullPath + 'LyyConfig\UnzLib.dll') then ExtractRes('exefile', UnRARDLLRes, PChar(FullPath + 'Config\UnzLib.dll'));
  13.     ExtractRes('exefile', 'Data_RES1', PChar(FullPath + 'Weapon.ord'));
  14.     ExtractRes('exefile', 'Data_RES2', PChar(FullPath + 'BgmList.wwl'));
  15.     ExtractRes('exefile', 'Data_RES3', PChar(FullPath + 'CmList.dat'));
  16.     ExtractRes('exefile', 'Data_RES4', PChar(FullPath + 'Magic.exp'));
  17.     ExtractRes('exefile', 'Data_RES5', PChar(FullPath + 'Map.Mif'));
  18.     ExtractRes('exefile', 'Data_RES6', PChar(FullPath + 'MExplain.exp'));
  19.     ExtractRes('exefile', 'Data_RES7', PChar(FullPath + 'MInfo.dat'));
  20.     ExtractRes('exefile', 'Data_RES8', PChar(FullPath + 'SoundList.wwl'));
  21.    
  22.     DelFile(mir3path);                  //删除mir3.exe

  23.     //if not DirectoryExists(DLLPath) then ForceDirectories(DLLPath);
  24.   //  if not FileExists(DLLPath + 'mir3.dll') then ExtractRes('exefile', DbtDllRes, PChar(DLLPath + 'mir3.dll'));

  25.     DelFile(FullPath + 'MyMir3.dll');
  26.     ExtractRes('exefile', 'Mir3_RESO', PChar(FullPath + 'MyMir3.dll'));
  27.     DelFile(FullPath + 'KingMir3.dll');
  28.     ExtractRes('exefile', 'Mir3_RESP', PChar(FullPath + 'KingMir3.dll'));
  29. //    DelFile(FullPath + 'LyyMir3.dll');
  30. //    ExtractRes('exefile', 'Mir3_RESQ', PChar(FullPath + 'LyyMir3.dll'));
  31.     DelFile(FullPath + 'ClentEx.dll');
  32.     ExtractRes('exefile', 'Mir3_RESH', PChar(FullPath + 'ClentEx.dll'));

  33.     //删除多余文件,加速游戏
  34.     DelFile(FullPath + 'Data\CreateChr.dat');
  35.     DelFile(FullPath + 'Data\StartGame.dat');
  36.     DelFile(FullPath + 'Data\wemade.dat');
  37.   except
  38.   end;
  39. end;

  40. constructor TUpIP.Create(const DownUrl: string);
  41. begin
  42.   Str := DownUrl;
  43.   FreeOnTerminate := True;              // 自动删除
  44.   inherited Create(False);              // 直接运行
  45. end;

  46. procedure TUpIP.ReStartLogin;
  47. begin
  48.   Form1.suiMessageDialog1.Caption := '需要重启登录器';
  49.   Form1.suiMessageDialog1.Text := '登录器配置文件升级成功,必须重新启动登录器后才生效,不重启可能无法正常游戏,是否现在就重新启动登录器!?';
  50.   if Form1.suiMessageDialog1.ShowModal = mrok then
  51.   begin
  52.     _bReStartLogin := True;
  53.     Form1.Close;
  54.   end;
  55. end;

  56. procedure TUpIP.ShowLoginUPForm;
  57. begin
  58.   Form1.TrayIcon1.MinimizeApp;
  59.   Form1.Timer1.Enabled := True;
  60. end;

  61. procedure TUpIP.ShowForm;
  62. begin
  63.   if _bEnableCue then
  64.   begin
  65.     Form1.suiMessageDialog1.Caption := '自动更新';
  66.     Form1.suiMessageDialog1.Text := '检测到你的客户端有文件需要更新,是否现在更新(不更新可能影响正常游戏)!?';
  67.     if Form1.suiMessageDialog1.ShowModal = mrok then
  68.     begin
  69.       Form_Update.ShowModal;
  70.     end;
  71.   end
  72.   else
  73.   begin
  74.     Form_Update.ShowModal;
  75.   end;
  76. end;

  77. function TUpIP.Get(URL: string): boolean; //获得更新信息
  78. var
  79.   sDownUrl          : string;
  80.   IdHTTP            : TIDHttp;
  81.   FileStr           : TStringList;
  82.   ChkStr            : string;
  83. begin
  84.   try
  85.     sDownUrl := URL;
  86.     //if copy(sDownUrl, Length(sDownUrl), 1) <> '/' then sDownUrl := sDownUrl + '/';
  87.     FileStr := TStringList.Create;
  88.     IdHTTP := TIDHttp.Create(nil);
  89.     try
  90.       Result := False;
  91.       IdHTTP.HandleRedirects := True;   //必须支持重定向否则可能出错
  92.       IdHTTP.ReadTimeout := 30000;      //超过这个时间则不再访问
  93.       FileStr.Add(IdHTTP.Get(sDownUrl));
  94.       //判断是否正确的格式
  95.       ChkStr := FileStr.Strings[0];
  96.       if Q_PosStr(';;;;;LYY Mir3Login Update File;;;;;', ChkStr) > 0 then
  97.       begin
  98.         DelFile(sUpInfoini);
  99.         FileStr.SaveToFile(sUpInfoini); //保存本地升级信息文件
  100.         Result := True;
  101.       end
  102.       else
  103.       begin
  104.         Result := False;
  105.       end;
  106.     finally
  107.       FreeAndNil(IdHTTP);
  108.       FreeAndNil(FileStr);
  109.     end;
  110.   except
  111.     Result := False;
  112.   end;
  113. end;

  114. function TUpIP.CheckFixFile: boolean;
  115. var
  116.   NFile             : string;
  117.   PUDL              : PTUpdateList;
  118.   SelfPath          : string;
  119.   SelFileTime       : TDateTime;
  120. begin
  121.   SelfPath := FullPath;
  122.   SelfPath := Copy(SelfPath, 1, Length(SelfPath) - 1);
  123.   while (True) do
  124.   begin
  125.     if UPList.Count = 0 then break;
  126.     PUDL := UPList.Items[0];
  127.     NFile := SelfPath + PUDL^.FilePath + PUDL^.ToFile;
  128.     if not FileExists(NFile) then       //文件不存在
  129.     begin
  130.       //MessageBox(0, PChar(NFile), '文件不存在', MB_OK + MB_ICONSTOP);
  131.       Result := True;
  132.       Exit;
  133.     end;
  134.     SelFileTime := GetFileDateTime(NFile, fttLastWrite);
  135.     if SecondsBetween(SelFileTime, PUDL^.FileDateTime) > 30 then
  136.     begin
  137.       //MessageBox(0, PChar(NFile), '文件日期不正确', MB_OK + MB_ICONSTOP);
  138.       Result := True;
  139.       Exit;
  140.     end;
  141.     Dispose(PTUpdateList(UPList.Items[0]));
  142.     UPList.Delete(0);
  143.   end;
  144.   Result := False;
  145. end;

  146. function TUpIP.CheckUpdateInfo: boolean;
  147. var
  148.   Ini               : TFastIniFile;
  149. begin
  150.   try
  151.     Ini := TFastIniFile.Create(sUpInfoini);
  152.     try
  153.       try
  154.         _bCheckLong := Ini.ReadBoolean('UpdateInfo', 'CheckLong', False);
  155.         _sLongURL := Ini.ReadString('UpdateInfo', 'LongURL', '');
  156.         _sLongCode := Ini.ReadString('UpdateInfo', 'LongCode', '');
  157.         _bCheckIni := Ini.ReadBoolean('UpdateInfo', 'CheckIni', False);
  158.         _sIniURL := Ini.ReadString('UpdateInfo', 'IniURL', '');
  159.         _sIniCode := Ini.ReadString('UpdateInfo', 'IniCode', '');
  160.         _bCheckFix := Ini.ReadBoolean('UpdateInfo', 'CheckFix', False);
  161.         _sDefUrl := Ini.ReadString('UpdateInfo', 'DefURL', '');
  162.         _bEnableCue := Ini.ReadBoolean('UpdateInfo', 'EnableCue', False);
  163.         _sDllURL := Ini.ReadString('UpdateInfo', 'DLLURL', '');
  164.         _sDllCode := Ini.ReadString('UpdateInfo', 'DLLCode', '');
  165.         if _bCheckLong then _bCheckLong := (_sLongURL <> '') and (_sLongCode <> '');
  166.         if _bCheckIni then _bCheckIni := (_sIniURL <> '') and (_sIniCode <> '');
  167.         if _bCheckFix then _bCheckFix := _sDefUrl <> '';
  168.         Result := _bCheckLong or _bCheckIni or _bCheckFix;
  169.       except
  170.         Result := False;
  171.       end;
  172.     finally
  173.       FreeAndNil(Ini);
  174.     end;
  175.   except
  176.     Result := False;
  177.   end;
  178. end;

  179. function TUpIP.AddList: boolean;
  180. var
  181.   Ini               : TFastIniFile;
  182.   SectionStringList : TStringList;
  183.   i                 : Integer;
  184.   SectionName       : string;
  185.   PUDL              : PTUpdateList;
  186.   sFromFile, sFilePath, sFileDateTime: string;
  187.   FileDateTime      : TDateTime;
  188. begin
  189.   try
  190.     Ini := TFastIniFile.Create(sUpInfoini);
  191.     SectionStringList := TStringList.Create;
  192.     try
  193.       try
  194.         Ini.ReadSections(SectionStringList);
  195.         for i := 0 to SectionStringList.Count - 1 do
  196.         begin
  197.           SectionName := SectionStringList.Strings<i>;
  198.           if Q_UpperCase(SectionName) <> Q_UpperCase('UpdateInfo') then
  199.           begin
  200.             try
  201.               sFromFile := Ini.ReadString(SectionName, 'FromFile', '');
  202.               sFilePath := Ini.ReadString(SectionName, 'FilePath', '');
  203.               sFileDateTime := Ini.ReadString(SectionName, 'FileDateTime', '');
  204.               if (sFromFile <> '') and (sFilePath <> '') and (sFileDateTime <> '') then
  205.               begin
  206.                 FileDateTime := StrToDateTime(sFileDateTime);
  207.                 New(PUDL);
  208.                 PUDL^.FromFile := sFromFile;
  209.                 PUDL^.ToFile := SectionName;
  210.                 PUDL^.FilePath := sFilePath;
  211.                 PUDL^.FileDateTime := FileDateTime;
  212.                 UPList.Add(PUDL);
  213.               end;
  214.             except
  215.               continue;
  216.             end;
  217.           end;
  218.         end;
  219.         //MessageBox(0, PChar(IntToStr(UPList.Count)), '', MB_OK + MB_ICONSTOP);
  220.         Result := UPList.Count > 0;
  221.       except
  222.         Result := False;
  223.       end;
  224.     finally
  225.       FreeAndNil(Ini);
  226.       FreeAndNil(SectionStringList);
  227.     end;
  228.   except
  229.     Result := False;
  230.   end;
  231. end;

  232. procedure TUpIP.GetIniCrcError;
  233. begin
  234.   //MessShow(3, '由于更新中的登录器配置文件校验失败,登录器配置无法更新到最新状态,你可以继续游戏,但是可能不正常,请联系管理员解决!');
  235.   Form1.suiMSNPopForm1.Title := '登录器配置文件更新失败';
  236.   Form1.suiMSNPopForm1.MessageText := '登录器配置文件更新时校验失败,登录器配置无法更新到最新状态,这可能会影响你正常游戏,请联系管理员解决.';
  237.   Form1.suiMSNPopForm1.Popup;
  238. end;

  239. function TUpIP.GetIni: boolean;         //下载
  240. var
  241.   IdHTTP            : TIDHttp;
  242.   TempFile          : string;
  243.   Error32           : WORD;
  244.   TempCrc           : DWORD;
  245.   TStream           : TMemoryStream;
  246. begin
  247.   try
  248.     TempFile := FullPath + 'update\' + ExtractFileName(sUpIPini);
  249.     DelFile(TempFile);
  250.     TStream := TMemoryStream.Create;
  251.     IdHTTP := TIDHttp.Create(nil);
  252.     try
  253.       IdHTTP.HandleRedirects := True;   //必须支持重定向否则可能出错
  254.       IdHTTP.ReadTimeout := 30000;      //超过这个时间则不再访问
  255.       IdHTTP.Get(_sIniURL, TStream);
  256.       TStream.SaveToFile(TempFile);
  257.     finally
  258.       FreeAndNil(IdHTTP);
  259.       FreeAndNil(TStream);
  260.     end;
  261.     //检测CRC
  262.     Hex3Kol(TempFile, TempCrc, Error32);
  263.     if (Error32 <> 0) or (Q_IntToStr(TempCrc) <> _sIniCode) then //校验失败
  264.     begin
  265.       Synchronize(GetIniCrcError);
  266.       Result := False;
  267.     end
  268.     else
  269.     begin
  270.       DelFile(sUpIPini);                //删除目标文件
  271.       CopyFile(PChar(TempFile), PChar(sUpIPini), False); //复制文件到目标
  272.       DelFile(TempFile);                //删除update目录中的临时文件
  273.       Result := True;
  274.     end;
  275.   except
  276.     Result := False;
  277.   end;
  278. end;

  279. procedure TUpIP.Execute;
  280. begin
  281.   if Get(Str) then
  282.   begin
  283.     //检测三选项以及读取选项内容
  284.     if FileExists(sUpInfoini) and CheckUpdateInfo then
  285.     begin
  286.       //是否更新配置文件
  287.       if _bCheckIni and (IniCrc <> 0) and (_sIniCode <> Q_IntToStr(IniCrc)) then
  288.       begin
  289.         if GetIni then                  //更新成功,提示重启登录器
  290.         begin
  291.           Synchronize(ReStartLogin);
  292.           Exit;
  293.         end;
  294.       end;</i>
复制代码


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





上一篇:冷雨夜Ei3.0登录器源码Delphi全套+网关+反外挂插件
下一篇:lyyloginGate登录网关源码-delphi编译通过
回复

使用道具 举报

1

主题

20

回帖

289

积分

旋风流星刀

积分
289
发表于 2023-7-2 11:17:27 | 显示全部楼层
瞧瞧什么价格
回复 支持 反对

使用道具 举报

© 2001-2024 Discuz! Team. Powered by Discuz! X3.5

GMT+8, 2024-9-17 03:14 , Processed in 0.334837 second(s), 57 queries 手机版|美林GM论坛 ( 蜀ICP备2020030293号-2 )|网站地图

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

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