Advertisement
TKGP

Untitled

Jan 28th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.54 KB | None | 0 0
  1. private static void Onslaught()
  2.         {
  3.             var valids = new List<string>()
  4.             {
  5.                 "m30_00_00_00.msb.dcx",
  6.                 "m30_01_00_00.msb.dcx",
  7.                 "m31_00_00_00.msb.dcx",
  8.                 "m32_00_00_00.msb.dcx",
  9.                 "m33_00_00_00.msb.dcx",
  10.                 "m34_01_00_00.msb.dcx",
  11.                 "m35_00_00_00.msb.dcx",
  12.                 "m37_00_00_00.msb.dcx",
  13.                 "m38_00_00_00.msb.dcx",
  14.                 "m39_00_00_00.msb.dcx",
  15.                 "m40_00_00_00.msb.dcx",
  16.                 "m41_00_00_00.msb.dcx",
  17.                 "m45_00_00_00.msb.dcx",
  18.                 "m50_00_00_00.msb.dcx",
  19.                 "m51_00_00_00.msb.dcx",
  20.                 "m51_01_00_00.msb.dcx",
  21.             };
  22.  
  23.             string p = ds3 + @"\map\mapstudio";
  24.             string o = @"D:\Programs\Dark Souls\Dark Souls 3\Onslaught";
  25.  
  26.             foreach (string file in Directory.GetFiles(p, "*.msb.dcx"))
  27.             {
  28.                 if (!valids.Contains(Path.GetFileName(file)))
  29.                     continue;
  30.  
  31.                 if (!File.Exists(file + ".bak"))
  32.                     File.Copy(file, file + ".bak");
  33.  
  34.                 Directory.CreateDirectory($"{o}\\Vanilla\\map\\mapstudio");
  35.                 File.Copy(file + ".bak", $"{o}\\Vanilla\\map\\mapstudio\\{Path.GetFileName(file)}", true);
  36.             }
  37.  
  38.             for (int clones = 1; clones < 5; clones++)
  39.             {
  40.                 Parallel.ForEach(Directory.GetFiles(p, "*.msb.dcx"), (file) =>
  41.                 {
  42.                     if (!valids.Contains(Path.GetFileName(file)))
  43.                         return;
  44.  
  45.                     MSB3 msb = MSB3.Read(file + ".bak");
  46.  
  47.                     var guys = new List<MSB3.Part.Enemy>();
  48.                     foreach (var guy in msb.Parts.Enemies)
  49.                     {
  50.                         if (
  51.                             // Weird stuff
  52.                             guy.ModelName != "c0100"
  53.                             // Talkable dummy like bonfire
  54.                             && guy.ModelName != "c1000"
  55.                             // Pontiff's Shade
  56.                             //&& guy.NPCParamID != 514010
  57.                             // Lothric + Lorian
  58.                             && guy.NPCParamID != 525001
  59.                             // King of the Storm
  60.                             //&& guy.ModelName != "c5030"
  61.                             // Unused Demon Prince
  62.                             && guy.NPCParamID != 502000
  63.                             // Demon Prince attack
  64.                             && guy.ModelName != "c5021"
  65.                             // Also Demon Prince attack
  66.                             && guy.ModelName != "c5022"
  67.                             // Gael 2
  68.                             //&& guy.ModelName != "c6200"
  69.                             )
  70.                         {
  71.                             for (int i = 0; i < clones; i++)
  72.                             {
  73.                                 var newGuy = new MSB3.Part.Enemy(guy);
  74.                                 newGuy.Name += $"_x{i}";
  75.                                 newGuy.ID = msb.Parts.Enemies.Count + guys.Count;
  76.                                 newGuy.EventEntityID = -1;
  77.                                 newGuy.TalkID = 0;
  78.                                 guys.Add(newGuy);
  79.                             }
  80.                         }
  81.                     }
  82.                     msb.Parts.Enemies.AddRange(guys);
  83.  
  84.                     foreach (var col in msb.Parts.Collisions)
  85.                         col.DisableBonfireEntityID = -1;
  86.  
  87.                     string dir = $"{o}\\{clones + 1}x Enemies\\map\\mapstudio";
  88.                     Directory.CreateDirectory(dir);
  89.                     msb.Write($"{dir}\\{Path.GetFileName(file)}");
  90.                 });
  91.             }
  92.  
  93.             BND4 bnd = SFUtil.DecryptDS3Regulation(ds3Reg + ".bak");
  94.             foreach (BND4.File file in bnd.Files)
  95.             {
  96.                 if (Path.GetFileName(file.Name) == "NpcThinkParam.param")
  97.                 {
  98.                     PARAM64 param = PARAM64.Read(file.Bytes);
  99.                     PARAM64.Layout layout = PARAM64.Layout.ReadXMLFile("Layouts\\" + param.ID + ".xml");
  100.                     param.SetLayout(layout);
  101.  
  102.                     foreach (var row in param.Rows)
  103.                         row["teamAttackEffectivity"].Value = (byte)0;
  104.  
  105.                     file.Bytes = param.Write();
  106.                 }
  107.             }
  108.             SFUtil.EncryptDS3Regulation(o + "\\Impolite Enemies\\Data0.bdt", bnd);
  109.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement