Baoulettes

Lineage II Old skool launcher (just a backup unrelease)

Oct 15th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance force
  2. #Include %A_ScriptDir%\HttpQueryInfo.ahk
  3.  
  4. ; Application type and code started :
  5. ; 15th October 2014 by Baoulettes aka Joffrey Panisset
  6. ; Unauthorized use is forbidden.
  7. ; Lib used that isn't writen by remain to author and Authorization pending.
  8.  
  9. ; Gamemode Game <-> Dev console will be writen in Option.ini. No need to provide it in "L2OSCheckFileList.ini"
  10. ; Options modifier Is there to produce same effect than In game just with few little tweak:
  11. ; Change Fullscreen mode, Play on server or Dev console to discover Items, Map.
  12.  
  13. ; I suggest to Manualy update "L2OSConfig.ini"
  14. ; And put it in the Launcher file check ini.
  15. ; And so it will be better to see both version and that easier to manage.
  16. ; Also "L2OSServer.ini" and "L2OSConfig.ini" is the same files only name change.
  17.  
  18. ; In case of Launcher update it can happen, check Global variables to change Version.
  19. ; AppAuthor is there only as copyright things and it never seen on the application itself.
  20.  
  21. ; The source of code is provided to show I do but it can be used for learning process.
  22. ; A pure copy paste of the code isn't a learning process that is why I comment all part I could to explain how this work and help you later.
  23. ; Running this software as it will be useless for you but it can be modified to work on ANY game system or update system without requiring FTP access.
  24. ; So in case of hack/flaw in the code all your credencial are safe as it require NONE! :)
  25. ; Security first.
  26.  
  27. ; Global variable set :
  28. Appname = Lineage ][ OS Launcher
  29. Appversion = 0.0.0b
  30. AppAuthor = Baoulettes
  31. CurrentStatut = Client Ready to play
  32. ServerRoot = http://baoulettesgalerie.site11.com
  33. ServerFileCheckVersion = http://baoulettesgalerie.site11.com/L2OSServer.ini
  34. Changelogsfiles = http://baoulettesgalerie.site11.com/L2OSlastlogs.ini
  35. Checkfilelist = http://baoulettesgalerie.site11.com/L2OSCheckFileList.ini
  36.  
  37. ; Function to force player to select Lineage II Directory if that a first launch or if install conrupted.
  38. IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  39. If L2OSDIR = ERROR
  40. {
  41.         FileSelectFolder, L2OSDIR,, 3, Select Lineage II Folder
  42.         IniWrite, %L2OSDIR%, L2OSConfig.ini, GameDirectory, Loc
  43.         IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  44.         GuiControl,, L2OSdirtext, %L2OSDIR%.
  45.         Loop {
  46.             If L2OSDIR =
  47.             {  
  48.                 FileSelectFolder, L2OSDIR,, 3, Select Lineage II Folder
  49.                 IniWrite, %L2OSDIR%, L2OSConfig.ini, GameDirectory, Loc
  50.                 IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  51.                 GuiControl,, L2OSdirtext, %L2OSDIR%.
  52.             } else {
  53.                 IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  54.                 break
  55.             }
  56.         }
  57. } else {
  58.        IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  59. }
  60. If L2OSDIR =
  61. {
  62.         FileSelectFolder, L2OSDIR,, 3, Select Lineage II Folder
  63.         IniWrite, %L2OSDIR%, L2OSConfig.ini, GameDirectory, Loc
  64.         IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  65.         GuiControl,, L2OSdirtext, %L2OSDIR%.
  66.         Loop {
  67.             If L2OSDIR =
  68.             {  
  69.                 FileSelectFolder, L2OSDIR,, 3, Select Lineage II Folder
  70.                 IniWrite, %L2OSDIR%, L2OSConfig.ini, GameDirectory, Loc
  71.                 IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  72.                 GuiControl,, L2OSdirtext, %L2OSDIR%.
  73.             } else {
  74.                 IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  75.                 break
  76.             }
  77.         }
  78. } else {
  79.        IniRead, L2OSDIR, L2OSConfig.ini, GameDirectory, Loc
  80. }
  81. ; Download require files :
  82. UrlDownloadToFile, %ServerFileCheckVersion%, %L2OSDIR%\L2OSServer.ini
  83. UrlDownloadToFile, %Changelogsfiles%, %L2OSDIR%\L2OSlastlogs.ini
  84.  
  85. ; Initial read to provide importante information.
  86. IniRead, Serverversion, %L2OSDIR%\L2OSServer.ini, GameVersion, Version
  87.  
  88. ; If initial read failed due to network error or Server error throw an Error message to informe the user.
  89. If Serverversion = ERROR
  90. {
  91.     ; We set a variable that will be used by the Gui to show the user about the error.
  92.     Serverversion = /!\ No Network connection /!\
  93.     MsgBox We cannot check the server required game version.`nBe sure to be connected to internet.`nAlso be sure to run this application in Admin rights and check Firewall/Anti-virus exception.
  94. }
  95. else
  96. {
  97.     ; If all goes fine show the download server required game version.
  98.     Serverversion = %Serverversion%
  99.    
  100.     ; Delete the files used to know server requirement.
  101.     FileDelete, %L2OSDIR%\L2OSServer.ini
  102. }
  103.  
  104. ; Read local game version from files.
  105. IniRead, Gameversion, %L2OSDIR%\L2OSConfig.ini, GameVersion, Version
  106.  
  107. ; If the game show no version throw an error and assume it to be in "1.0.0" and force the player to update.
  108. If Gameversion = ERROR
  109. {
  110.     ; Force game to be in version 1.0.0 and create file version for it.
  111.     IniWrite, 1.0.0, %L2OSDIR%\L2OSConfig.ini, GameVersion, Version
  112.    
  113.     ; Re-read the file to refresh variable.
  114.     IniRead, Gameversion, %L2OSDIR%\L2OSConfig.ini, GameVersion, Version
  115.    
  116.     ; Put variable to show in gui later to the user that he/she have to update!
  117.     CurrentStatut = Client NOT Ready to play, Please check files !
  118.    
  119.     ; Force diable button play (it will be unable if the user update the game.)
  120.     GuiControl, disable, btnPlay
  121. }
  122. else
  123. {
  124.     ; If all goes fine then show in gui the current game version.
  125.     Gameversion = %Gameversion%
  126. }
  127.  
  128. ;File read to get the change logs !
  129. FileRead, L2OSChangelogs, %L2OSDIR%\L2OSlastlogs.ini
  130.  
  131. ; If change log file happen to be missing on server throw an error to informe the user.
  132. If L2OSChangelogs = ERROR
  133. {
  134.     L2OSChangelogs = /!\ No Network connection /!\
  135.     MsgBox We cannot check the server required Change logs.`nBe sure to be connected to internet.`nAlso be sure to run this application in Admin rights and check Firewall/Anti-virus exception.
  136. }
  137. else
  138. {
  139.     ; If all goes fines delete the changelog temporary files and place the text in the placeholder
  140.     L2OSChangelogs = %L2OSChangelogs%
  141.     FileDelete, %L2OSDIR%\L2OSlastlogs.ini
  142. }
  143.  
  144.  
  145.  
  146. ; Gui Creation.
  147. ; Logo placeholder creation
  148. Gui, Add, Picture, x11 y7 w460 h90 , C:\Users\Baoulettes\Desktop\todo.png
  149.  
  150. ; Game & Server game required version text place holder
  151. Gui, Add, Text, x11 y107 w140 h20 , Game version : %Gameversion%
  152. Gui, Add, Text, x161 y107 w320 h20 , Server Game version : %Serverversion%
  153.  
  154. ; Progress & Launcher status
  155. Gui, Add, Text, vDllFiles x11 y257 w350 h20 , %CurrentStatut%
  156.  
  157. ; Progress Bars creation.
  158. Gui, Add, Progress, x11 y287 w350 h20 , 25
  159. Gui, Add, Progress, x11 y317 w350 h20 , 25
  160.  
  161. ; Buttons Creation
  162. Gui, Add, Button, vbtnPlay x371 y327 w100 h30 , Play
  163. Gui, Add, Button, vbtnUpdate gcheckfiles x371 y287 w100 h30 , Check Files
  164. Gui, Add, Button, vbtnOptions gbtnoption x371 y247 w100 h30 , Options
  165.  
  166. ; Change Log place holder
  167. Gui, Add, Text, x11 y127 w460 h120 , %L2OSChangelogs%
  168.  
  169. ; Copyright in the button of the launcher %Appname% is a variable see the header.
  170. Gui, Add, Text, x11 y347 w350 h20 , %Appname% - %Appversion%
  171.  
  172. ; Show the current created Gui.
  173. Gui, Show, x203 y214 h379 w485, %Appname% - %Appversion%
  174. Return
  175.  
  176. ; Global action used for the button "checkfiles"
  177. checkfiles:
  178.  
  179. ; Disabling Button play, Option, Check Files
  180. GuiControl, disable, btnPlay
  181. GuiControl, disable, btnOptions
  182. GuiControl, disable, btnUpdate
  183.  
  184. ; Download list of the files to check (see header for url.)
  185. UrlDownloadToFile, %Checkfilelist%, %L2OSDIR%\L2OSCheckFileList.ini
  186.  
  187. ; Loop read the files per line !
  188. Loop, read, %L2OSDIR%\L2OSCheckFileList.ini
  189. {
  190. ; Simple Variable to form the url used later.
  191. url = %ServerRoot%/%A_LoopReadLine%
  192.  
  193. ; Call Function "HttpQueryInfo" with variable url and param 5 (file size)
  194. Version1 :=HttpQueryInfo(url, 5)
  195.  
  196. ; Check local files size.
  197. FileGetSize, Version2, %A_LoopReadLine%
  198.  
  199. ; If local files size is Zero Or negative for it to be 0
  200. If Version2 =
  201. {
  202.  
  203. ; Here is where it for it to be "Zero"
  204. Version2 = 0
  205. }
  206.  
  207. ; check if both files size is the same
  208. If (%Version2%=%Version1%)
  209. {
  210.  
  211. ; If is is the same then download nothing just update the gui to show "Skipping - FILENAME.EXT"
  212. GuiControl,,DllFiles,Skipping - %A_LoopReadLine%
  213. }
  214. Else
  215. {
  216.  
  217. ; Used to form the url used later
  218. url3 = %ServerRoot%/%A_LoopReadLine%
  219.  
  220. ; Download files in "url3" variable and put it in the same folder as the launcher.
  221. UrlDownloadToFile, %url3%, %L2OSDIR%\%A_LoopReadLine%
  222.  
  223. ; Update gui to show "Downloading - FILENAME.EXT"
  224. GuiControl,,DllFiles,Downloading - %A_LoopReadLine%
  225. }
  226. }
  227.  
  228. ; Delete the file download in the begining to check the list of files to be checked.
  229. FileDelete, %L2OSDIR%\L2OSCheckFileList.ini
  230.  
  231. ; Update gui to show "Client Ready to play" (Variable set in header!)
  232. GuiControl,,DllFiles,%CurrentStatut%
  233.  
  234. ; Re-enable buttons !
  235. GuiControl, Enable, btnPlay
  236. GuiControl, Enable, btnOptions
  237. GuiControl, Enable, btnUpdate
  238. Return
  239.  
  240. ; Function used to create gui the same way as we did for main gui but on 2 process (internal process not multiple ".exe")
  241. btnoption:
  242. ; Reading LineageII Options.ini properties in the order it show on the window !
  243.  
  244. ; Get info Tab "Video"
  245. IniRead, StartupFullScreen, %L2OSDIR%\System\Option.ini, Video, StartupFullScreen
  246. IniRead, RefreshRate, %L2OSDIR%\System\Option.ini, Video, RefreshRate
  247. IniRead, ColorBits, %L2OSDIR%\System\Option.ini, Video, ColorBits
  248. IniRead, TextureDetail, %L2OSDIR%\System\Option.ini, Video, TextureDetail
  249. IniRead, ModelDetail, %L2OSDIR%\System\Option.ini, Video, ModelDetail
  250. IniRead, SkipAnim, %L2OSDIR%\System\Option.ini, Video, SkipAnim
  251.  
  252. IniRead, PawnShadow, %L2OSDIR%\System\Option.ini, Video, PawnShadow
  253. IniRead, RenderDeco, %L2OSDIR%\System\Option.ini, Video, RenderDeco
  254.  
  255. IniRead, Terrain, %L2OSDIR%\System\Option.ini, ClippingRange, Terrain
  256. IniRead, Actor, %L2OSDIR%\System\Option.ini, Video, Actor
  257. IniRead, RenderActorLimited, %L2OSDIR%\System\Option.ini, Video, RenderActorLimited
  258. IniRead, IsUseEffect, %L2OSDIR%\System\Option.ini, L2WaterEffect, IsUseEffect
  259. IniRead, AntiAliasing, %L2OSDIR%\System\Option.ini, Video, AntiAliasing
  260.  
  261. IniRead, Glow, %L2OSDIR%\System\Option.ini, Video, Glow
  262. IniRead, UseTrilinear, %L2OSDIR%\System\Option.ini, Video, UseTrilinear
  263. IniRead, UseColorCursor, %L2OSDIR%\System\Option.ini, Video, UseColorCursor
  264.  
  265. ; Get info Tab "Audio"
  266. IniRead, SoundVolume, %L2OSDIR%\System\Option.ini, Audio, SoundVolume
  267. IniRead, MusicVolume, %L2OSDIR%\System\Option.ini, Audio, MusicVolume
  268. IniRead, WavVoiceVolume, %L2OSDIR%\System\Option.ini, Audio, WavVoiceVolume
  269. IniRead, OggVoiceVolume, %L2OSDIR%\System\Option.ini, Audio, OggVoiceVolume
  270.  
  271. ; Get info Tab "Game"
  272. IniRead, TransparencyMode, %L2OSDIR%\System\Option.ini, Game, TransparencyMode
  273.  
  274. IniRead, GameMode, %L2OSDIR%\System\Option.ini, Game, GameMode
  275.  
  276. IniRead, MyName, %L2OSDIR%\System\Option.ini, Game, MyName
  277. IniRead, NPCName, %L2OSDIR%\System\Option.ini, Game, NPCName
  278. IniRead, GroupName, %L2OSDIR%\System\Option.ini, Game, GroupName
  279. IniRead, PledgeMemberName, %L2OSDIR%\System\Option.ini, Game, PledgeMemberName
  280. IniRead, PartyMemberName, %L2OSDIR%\System\Option.ini, Game, PartyMemberName
  281. IniRead, OtherPCName, %L2OSDIR%\System\Option.ini, Game, OtherPCName
  282.  
  283. IniRead, EnterChatting, %L2OSDIR%\System\Option.ini, Game, EnterChatting
  284. IniRead, AutoTrackingPawn, %L2OSDIR%\System\Option.ini, Game, AutoTrackingPawn
  285. IniRead, OldChatting, %L2OSDIR%\System\Option.ini, Game, OldChatting
  286. IniRead, IsNative, %L2OSDIR%\System\Option.ini, Game, IsNative
  287. IniRead, ArrowMode, %L2OSDIR%\System\Option.ini, Game, ArrowMode
  288. IniRead, UseJoystick, %L2OSDIR%\System\Option.ini, Game, UseJoystick
  289.  
  290. IniRead, ScreenShotQuality, %L2OSDIR%\System\Option.ini, Game, ScreenShotQuality
  291.  
  292. IniRead, PartyLooting, %L2OSDIR%\System\Option.ini, Game, PartyLooting
  293.  
  294. ; Next read -> Variables -> Variables -> UI System
  295. ; Need Variable Load so no more working since there!
  296.  
  297. Gui, 2:Add, Button, x11 y477 w70 h20 , Default
  298. Gui, 2:Add, Button, x91 y477 w70 h20 , Cancel
  299. Gui, 2:Add, Button, x171 y477 w70 h20 , Apply
  300. Gui, 2:Add, Tab, x0 y0 w2410 h770 , Video|Audio|Game
  301.  
  302. Gui, 2:Tab, 1
  303. Gui, 2:Add, GroupBox, x5 y15 w250 h205 ,
  304. Gui, 2:Add, GroupBox, x5 y210 w250 h45 ,
  305. Gui, 2:Add, GroupBox, x5 y245 w250 h165 ,
  306. Gui, 2:Add, GroupBox, x5 y400 w250 h70 ,
  307. Gui, 2:Add, DropDownList, x131 y37 w110 h20 , DropDownList
  308. Gui, 2:Add, DropDownList, x131 y67 w110 h24 , DropDownList
  309. Gui, 2:Add, DropDownList, x131 y97 w110 h24 , DropDownList
  310. Gui, 2:Add, DropDownList, x131 y127 w110 h24 , DropDownList
  311. Gui, 2:Add, DropDownList, x131 y157 w110 h24 , DropDownList
  312. Gui, 2:Add, DropDownList, x131 y187 w110 h24 , DropDownList
  313. Gui, 2:Add, CheckBox, x21 y227 w100 h20 , Shadows
  314. Gui, 2:Add, CheckBox, x131 y227 w110 h20 , Ground Detail
  315. Gui, 2:Add, DropDownList, x131 y257 w110 h24 , DropDownList
  316. Gui, 2:Add, DropDownList, x131 y287 w110 h24 , DropDownList
  317. Gui, 2:Add, DropDownList, x131 y317 w110 h24 , DropDownList
  318. Gui, 2:Add, DropDownList, x131 y347 w110 h24 , DropDownList
  319. Gui, 2:Add, DropDownList, x131 y377 w110 h24 , DropDownList
  320. Gui, 2:Add, Text, x11 y37 w100 h30 , FullScreen
  321. Gui, 2:Add, Text, x11 y67 w100 h30 , Refresh Rate
  322. Gui, 2:Add, Text, x11 y97 w100 h30 , Gamma
  323. Gui, 2:Add, Text, x11 y127 w100 h30 , Textures
  324. Gui, 2:Add, Text, x11 y157 w100 h30 , Modeling Detail
  325. Gui, 2:Add, Text, x11 y187 w100 h30 , Motion Detail
  326. Gui, 2:Add, Text, x11 y257 w100 h30 , Terrain Range
  327. Gui, 2:Add, Text, x11 y287 w100 h30 , PC/NPC Range
  328. Gui, 2:Add, Text, x11 y317 w100 h30 , PC/NPC Limit
  329. Gui, 2:Add, Text, x11 y347 w100 h30 , Reflection
  330. Gui, 2:Add, Text, x11 y377 w100 h30 , Anti-Aliasing
  331. Gui, 2:Add, CheckBox, x21 y417 w100 h20 , Glow Effect
  332. Gui, 2:Add, CheckBox, x131 y417 w100 h20 , Texture Filter
  333. Gui, 2:Add, CheckBox, x131 y447 w100 h20 , Low detail
  334. Gui, 2:Add, CheckBox, x21 y447 w100 h20 , Game Cursor
  335.  
  336. Gui, 2:Tab, 2
  337. Gui, 2:Add, GroupBox, x5 y37 w250 h150 ,
  338. Gui, 2:Add, DropDownList, x131 y57 w100 h20 , DropDownList
  339. Gui, 2:Add, DropDownList, x131 y87 w100 h24 , DropDownList
  340. Gui, 2:Add, DropDownList, x131 y117 w100 h24 , DropDownList
  341. Gui, 2:Add, DropDownList, x131 y147 w100 h24 , DropDownList
  342. Gui, 2:Add, Text, x21 y57 w100 h30 , SFX Vol.
  343. Gui, 2:Add, Text, x21 y87 w100 h30 , Music Vol.
  344. Gui, 2:Add, Text, x21 y117 w100 h30 , System Voice
  345. Gui, 2:Add, Text, x21 y147 w100 h30 , Tutorial Voice
  346.  
  347. Gui, 2:Tab, 3
  348. Gui, 2:Add, GroupBox, x5 y35 w250 h40 ,
  349. Gui, 2:Add, GroupBox, x5 y75 w250 h40 ,
  350. Gui, 2:Add, GroupBox, x5 y115 w250 h130 ,
  351. Gui, 2:Add, GroupBox, x5 y245 w250 h110 ,
  352. Gui, 2:Add, GroupBox, x5 y355 w250 h50 ,
  353. Gui, 2:Add, Text, x11 y47 w80 h20 , Interface
  354. Gui, 2:Add, Button, x91 y47 w60 h20 , Initialize
  355. Gui, 2:Add, CheckBox, x155 y47 w95 h20 , Transparent
  356. Gui, 2:Add, Text, x11 y87 w80 h20 , Gamemode
  357. Gui, 2:Add, DropDownList, x91 y87 w160 h20 , DropDownList
  358. Gui, 2:Add, Text, x11 y117 w80 h30 , Display
  359. Gui, 2:Add, CheckBox, x91 y117 w90 h20 , Players
  360. Gui, 2:Add, CheckBox, x91 y137 w90 h20 , Monsters
  361. Gui, 2:Add, CheckBox, x91 y157 w90 h20 , Other PCs
  362. Gui, 2:Add, CheckBox, x101 y177 w90 h20 , Clan
  363. Gui, 2:Add, CheckBox, x101 y197 w90 h20 , Party
  364. Gui, 2:Add, CheckBox, x101 y217 w90 h20 , General
  365. Gui, 2:Add, CheckBox, x11 y257 w120 h20 , Enter Chat
  366. Gui, 2:Add, CheckBox, x11 y277 w120 h20 , Auto Code
  367. Gui, 2:Add, CheckBox, x11 y297 w120 h20 , 3D Arrow
  368. Gui, 2:Add, CheckBox, x141 y257 w110 h20 , Tracking
  369. Gui, 2:Add, CheckBox, x141 y277 w110 h20 , Key Security
  370. Gui, 2:Add, CheckBox, x141 y297 w110 h20 , Game Pad
  371. Gui, 2:Add, Text, x11 y327 w80 h20 , Screenshot
  372. Gui, 2:Add, DropDownList, x91 y327 w160 h20 , DropDownList
  373. Gui, 2:Add, Text, x11 y367 w80 h20 , Party Loot
  374. Gui, 2:Add, DropDownList, x91 y367 w160 h24 , DropDownList
  375. Gui, 2:Show, x591 y216 h508 w263, Options
  376. Return
  377.  
  378.  
  379. ; If the app is closed totaly close the process! & delete unused files. (prevent to be a mess!)
  380. GuiClose:
  381. FileDelete, %L2OSDIR%\L2OSlastlogs.ini
  382. FileDelete, %L2OSDIR%\L2OSCheckFileList.ini
  383. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment