@@ -401,4 +401,96 @@ public static void DoUBIKProcedure(MLO mlo) {
401401
402402 par . Dispose ( ) ;
403403 }
404+
405+ public static void DoYK3HActProcedure ( MLO mlo , string codename ) {
406+ var hactDir = new DirectoryInfo ( GamePath . DataPath ) . EnumerateDirectories ( ) . FirstOrDefault ( x => x . Name . StartsWith ( "hact_" ) ) ? . FullName ;
407+
408+ if ( string . IsNullOrEmpty ( hactDir ) )
409+ return ;
410+
411+ var haveTalk = mlo . Files . Any ( x => x . Name . Contains ( "/hact_" ) ) ;
412+
413+ if ( ! haveTalk )
414+ return ;
415+
416+ var rootHActDir = Path . Combine ( GamePath . ParlessDir , "hact_" + codename ) ;
417+
418+ Directory . CreateDirectory ( rootHActDir ) ;
419+
420+ // This is really bad but it will have to do:
421+ // Get the smallest hact in the hact dir
422+ // Use that as a dummy file.
423+ // Our created pars inf load the game for some reason.
424+ var smallestHAct = new DirectoryInfo ( hactDir )
425+ . EnumerateFiles ( "*.par" , SearchOption . TopDirectoryOnly )
426+ . OrderBy ( f => f . Length )
427+ . First ( ) ;
428+
429+ foreach ( var mod in mlo . Mods ) {
430+ var modPath = GamePath . GetModDirectory ( mod ) ;
431+ var hActDirPath = Directory . EnumerateDirectories ( modPath ) . FirstOrDefault ( x => x . Contains ( "hact_" ) ) ;
432+
433+ if ( string . IsNullOrEmpty ( hActDirPath ) )
434+ continue ;
435+
436+ var hActDir = new DirectoryInfo ( hActDirPath ) ;
437+
438+ foreach ( var dir in hActDir . EnumerateDirectories ( ) ) {
439+ var dummyParDir = new DirectoryInfo ( rootHActDir ) ;
440+
441+ if ( ! dummyParDir . Exists )
442+ dummyParDir . Create ( ) ;
443+
444+ var dummyParPath = new FileInfo ( Path . Combine ( dummyParDir . FullName , dir . Name + ".par" ) ) ;
445+ File . Copy ( smallestHAct . FullName , dummyParPath . FullName , true ) ;
446+ }
447+ }
448+ }
449+
450+ public static void DoTalkProcedureYK3 ( MLO mlo , string codename ) {
451+ var hactDir = new DirectoryInfo ( GamePath . DataPath ) . GetDirectories ( ) . FirstOrDefault ( x => x . Name . StartsWith ( "hact_" ) ) ? . FullName ;
452+
453+ if ( string . IsNullOrEmpty ( hactDir ) )
454+ return ;
455+
456+ var haveTalk = mlo . Files . Any ( x => x . Name . Contains ( "/talk_" ) ) ;
457+
458+ if ( ! haveTalk )
459+ return ;
460+
461+ var rootTalkDir = Path . Combine ( GamePath . ParlessDir , "talk_" + codename ) ;
462+
463+ if ( ! Directory . Exists ( rootTalkDir ) )
464+ Directory . CreateDirectory ( rootTalkDir ) ;
465+
466+ //This is really bad but it will have to do:
467+ //Get the smallest hact in the hact dir
468+ //Use that as a dummy file.
469+ //Our created pars inf load the game for some reason.
470+ var smallestHAct = new DirectoryInfo ( hactDir )
471+ . GetFiles ( "*.par" , SearchOption . TopDirectoryOnly )
472+ . OrderBy ( f => f . Length )
473+ . First ( ) ;
474+
475+ foreach ( var mod in mlo . Mods ) {
476+ var modPath = GamePath . GetModDirectory ( mod ) ;
477+ var talkDirs = Directory . EnumerateDirectories ( modPath ) . Where ( x => x . Contains ( "talk_" ) ) ;
478+
479+ foreach ( var modTalkDir in talkDirs ) {
480+ var talksDirs = new DirectoryInfo ( modTalkDir ) . EnumerateDirectories ( ) ;
481+
482+ foreach ( var talkCategory in talksDirs ) {
483+ foreach ( var talkDir in talkCategory . EnumerateDirectories ( ) ) {
484+ var dummyParDir = new DirectoryInfo ( Path . Combine ( rootTalkDir , talkCategory . Name ) ) ;
485+
486+ if ( ! dummyParDir . Exists )
487+ dummyParDir . Create ( ) ;
488+
489+ var dummyParPath = new FileInfo ( Path . Combine ( dummyParDir . FullName , talkDir . Name + ".par" ) ) ;
490+ File . Copy ( smallestHAct . FullName , dummyParPath . FullName , true ) ;
491+ }
492+ }
493+ }
494+ }
495+ }
404496}
0 commit comments