IsleofEwe.asl 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. state("Isle of Ewe") {
  2. int checkpointloading : "UnityPlayer.dll", 0x014E2E68, 0x520, 0x268;
  3. }
  4. init {
  5. string logPath = Environment.GetEnvironmentVariable("appdata")+"\\..\\LocalLow\\No Ewe Productions\\Isle Of Ewe\\output_log.txt";
  6. try {
  7. FileStream fs = new FileStream(logPath, FileMode.Open, FileAccess.Write, FileShare.ReadWrite);
  8. fs.SetLength(0);
  9. fs.Close();
  10. } catch {
  11. print("Cant open log");
  12. }
  13. vars.line = "";
  14. vars.reader = new StreamReader(new FileStream(logPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
  15. vars.CurrentCheckpoint = "";
  16. vars.CurrentScene = "";
  17. vars.oldcheckpoint = "";
  18. vars.doneMaps = "";
  19. vars.sheepcounter = "";
  20. }
  21. update {
  22. if (vars.reader == null) return false;
  23. vars.line = vars.reader.ReadLine();
  24. if (vars.line !=null) {
  25. if (vars.line.StartsWith("Checkpoint")) {
  26. vars.CurrentCheckpoint = (vars.line.Split(' ')[1]);
  27. }
  28. }
  29. if (vars.line !=null) {
  30. if (vars.line.StartsWith("Scene")) {
  31. vars.CurrentScene = (vars.line.Split(' ')[1]);
  32. }
  33. }
  34. if (vars.line !=null) {
  35. if (vars.line.StartsWith("Sheep rescued")) {
  36. vars.sheepcounter = (vars.line.Split(' ')[2]);
  37. }
  38. }
  39. if (settings["sheep_count"]) {vars.SetTextComponent("Sheep Counter", (vars.sheepcounter).ToString()); }
  40. }
  41. startup {
  42. vars.SetTextComponent = (Action<string, string>)((id, text) =>
  43. {
  44. var textSettings = timer.Layout.Components.Where(x => x.GetType().Name == "TextComponent").Select(x => x.GetType().GetProperty("Settings").GetValue(x, null));
  45. var textSetting = textSettings.FirstOrDefault(x => (x.GetType().GetProperty("Text1").GetValue(x, null) as string) == id);
  46. if (textSetting == null)
  47. {
  48. var textComponentAssembly = Assembly.LoadFrom("Components\\LiveSplit.Text.dll");
  49. var textComponent = Activator.CreateInstance(textComponentAssembly.GetType("LiveSplit.UI.Components.TextComponent"), timer);
  50. timer.Layout.LayoutComponents.Add(new LiveSplit.UI.Components.LayoutComponent("LiveSplit.Text.dll", textComponent as LiveSplit.UI.Components.IComponent));
  51. textSetting = textComponent.GetType().GetProperty("Settings", BindingFlags.Instance | BindingFlags.Public).GetValue(textComponent, null);
  52. textSetting.GetType().GetProperty("Text1").SetValue(textSetting, id);
  53. }
  54. if (textSetting != null)
  55. textSetting.GetType().GetProperty("Text2").SetValue(textSetting, text);
  56. });
  57. settings.Add("sheep_count", true, "Sheep Count");
  58. // settings.Add("21212r", true, "Some of the Splits can't be disabled/ are not in the correct location, most notibly mushroom, section 2/3.");
  59. vars.missions = new Dictionary<string,string> {
  60. //{"6","Learned Double Jump"},
  61. //{"2","Lion King Refrenece"},
  62. // {"7","Golem Boss Fight"},
  63. //{"15","Return baaarbra/ Learn Sprint"},
  64. {"11","Section 2 Entrance"},
  65. //{"0002332","Bouncy House Mushroom Edition"},
  66. //{"4","indiana Jones Refrenece"},
  67. {"1","Scene 3 Entrance"},
  68. //{"3","Double Stream Lava"},
  69. //{"0001112","Lava Staircase"},
  70. };
  71. vars.missionList = new List<string>();
  72. foreach (var Tag in vars.missions) {
  73. settings.Add(Tag.Key, true, Tag.Value);
  74. vars.missionList.Add(Tag.Key); };
  75. vars.splits = new List<string>();
  76. }
  77. isLoading {
  78. return (current.checkpointloading != 0);
  79. }
  80. start {
  81. if (vars.line !=null) {
  82. if (vars.line.StartsWith("Save not found")) {
  83. return true;
  84. }
  85. }
  86. }
  87. reset {
  88. if(vars.line !=null) {
  89. if (vars.line.StartsWith("Loading Menu...")) {
  90. return true;
  91. }
  92. }
  93. }
  94. split
  95. {
  96. if (vars.oldcheckpoint != vars.CurrentCheckpoint)
  97. {
  98. if (settings[vars.CurrentCheckpoint])
  99. {
  100. vars.oldcheckpoint = vars.CurrentCheckpoint;
  101. return true;
  102. }
  103. }
  104. }
  105. exit {
  106. vars.reader = null;
  107. }
  108. //Thanks to The amazing Goose-thing Rythin, and DerKO