Advertisement
Guest User

Untitled

a guest
Jan 7th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.41 KB | None | 0 0
  1. ;/ Decompiled by Champollion V1.0.1
  2. Source : SHESON_DynDOLOD_Master.psc
  3. Modified : 2016-10-28 21:38:26
  4. Compiled : 2016-10-28 21:39:03
  5. User : Submit_
  6. Computer : Firstborn_
  7. /;
  8. scriptName SHESON_DynDOLOD_Master extends ObjectReference
  9.  
  10. ;-- Properties --------------------------------------
  11. Int property MyCurrentMinionList = 0 auto
  12. ObjectReference property MyCurrentFirstborn auto
  13. Int property MyCurrentFirstbornList = 0 auto
  14.  
  15. ;-- Variables ---------------------------------------
  16. Int Index = 0
  17. Bool MyCurrentAttach
  18. ObjectReference CurrentRef
  19. Int MyOldFirstbornList = 0
  20. Int MaxOld = 0
  21. Int ThrottleThreshold = 100
  22. String MyImportFileName = "None"
  23. Int ThrottleCount = 0
  24. Int MaxCurrent = 0
  25. String MyWorld = "None"
  26. ObjectReference MyOldFirstborn
  27. Int MyOldMinionList = 0
  28. Int MyCurrent = 0
  29.  
  30. ;-- Functions ---------------------------------------
  31.  
  32. ; Skipped compiler generated GotoState
  33.  
  34. ; Skipped compiler generated GetState
  35.  
  36. function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
  37.  
  38. self.GotoState("Updating")
  39. utility.Wait(3 as Float)
  40. MyWorld = stringutil.Substring(self.GetWorldspace() as String, 13, stringutil.Find(self.GetWorldspace() as String, "(", 0) - 14)
  41. MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld)
  42. if jsonutil.GetStringValue("DynDOLOD_Worlds", "bunchofnumbers", "x") != (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString()
  43. debug.Notification("DynDOLOD_Worlds.json" + " does not belong to this " + "DynDOLOD.esp")
  44. debug.Trace("DynDOLOD error: DynDOLOD_Worlds.json=" + jsonutil.GetStringValue("DynDOLOD_Worlds", "bunchofnumbers", "x") + " DynDOLOD.esp=" + (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString(), 0)
  45. storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "DynDOLOD_Worlds.json" + " does not belong to this " + "DynDOLOD.esp")
  46. self.GotoState("Missing")
  47. elseIf !jsonutil.Load(MyImportFileName)
  48. debug.Notification(MyImportFileName + " file not found")
  49. storageutil.SetStringValue(none, "DynDOLOD_Last_Message", MyImportFileName + " file not found")
  50. self.GotoState("Missing")
  51. else
  52. MaxCurrent = jsonutil.IntListCount(MyImportFileName, "f" + FirstbornList as String)
  53. if MaxCurrent == 0
  54. debug.Notification("DynDOLOD missing data for cell id " + FirstbornList as String)
  55. storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "Missing data for cell id " + FirstbornList as String)
  56. self.GotoState("EmptyState")
  57. utility.Wait(3 as Float)
  58. else
  59. MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld) + "_Objects"
  60. if jsonutil.GetStringValue(MyImportFileName, "bunchofnumbers", "x") != (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString()
  61. self.GotoState("Missing")
  62. if jsonutil.GetStringValue(MyImportFileName, "bunchofnumbers", "x") == "x"
  63. debug.Notification("DynDOLOD can not read data from " + MyImportFileName + ".json")
  64. storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "Can not read data from " + MyImportFileName + ".json")
  65. else
  66. debug.Notification(MyImportFileName + ".json does not belong to this " + "DynDOLOD.esp")
  67. debug.Trace("DynDOLOD error: " + MyImportFileName + ".json=" + jsonutil.GetStringValue(MyImportFileName, "bunchofnumbers", "x") + " DynDOLOD.esp=" + (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString(), 0)
  68. storageutil.SetStringValue(none, "DynDOLOD_Last_Message", MyImportFileName + ".json does not belong to this " + "DynDOLOD.esp")
  69. endIf
  70. else
  71. self.GotoState("Updating")
  72. Index = jsonutil.StringListCount(MyImportFileName, "reset")
  73. while Index
  74. Index -= 1
  75. CurrentRef = game.GetFormFromFile(stringutil.Substring(jsonutil.StringListGet(MyImportFileName, "reset", Index), stringutil.Find(jsonutil.StringListGet(MyImportFileName, "reset", Index), ";", 0) + 1, 0) as Int, stringutil.Substring(jsonutil.StringListGet(MyImportFileName, "reset", Index), 0, stringutil.Find(jsonutil.StringListGet(MyImportFileName, "reset", Index), ";", 0))) as ObjectReference
  76. if CurrentRef as Bool && !CurrentRef.IsDisabled()
  77. CurrentRef.reset(none)
  78. endIf
  79. endWhile
  80. CurrentRef = none
  81. MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld)
  82. self.GotoState("Running")
  83. storageutil.SetIntValue(none, "DynDOLOD_Active", 1)
  84. self.IBowToTheev2(MyFirstborn, FirstbornList, MinionList, MyAttach, MyActivateAll)
  85. if MyWorld == "Tamriel" && game.GetModByName("Merged Stuff 15.esp") != 255
  86. leveleditem Notes = game.GetFormFromFile(36705, "Merged Stuff 15.esp") as leveleditem
  87. if Notes
  88. form MyNote = game.GetFormFromFile(2316, "DynDOLOD.esp")
  89. if MyNote
  90. Notes.AddForm(MyNote, 1, 1)
  91. MyNote = none
  92. endIf
  93. Notes = none
  94. endIf
  95. endIf
  96. debug.Notification("DynDOLOD successfully initialized")
  97. storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "Successfully initialized")
  98. endIf
  99. endIf
  100. endIf
  101. endFunction
  102.  
  103. ;-- State -------------------------------------------
  104. state Running
  105.  
  106. function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
  107.  
  108. self.GotoState("Updating")
  109. MyCurrentFirstborn = MyFirstborn
  110. MyCurrentAttach = MyAttach
  111. MyCurrentFirstbornList = FirstbornList
  112. MyCurrentMinionList = MinionList
  113. if MyImportFileName == "None"
  114. MyWorld = stringutil.Substring(self.GetWorldspace() as String, 13, stringutil.Find(self.GetWorldspace() as String, "(", 0) - 14)
  115. MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld)
  116. endIf
  117. if MyCurrentAttach
  118. storageutil.SetFormValue(self as form, "DynDOLOD_MyActiveFirstborn", MyCurrentFirstborn as form)
  119. MyOldFirstborn = MyCurrentFirstborn
  120. if MyCurrentMinionList != MyOldMinionList || MyActivateAll
  121. if MyActivateAll
  122. self.Activate(self as ObjectReference, false)
  123. endIf
  124. MaxCurrent = jsonutil.IntListCount(MyImportFileName, "m" + MyCurrentMinionList as String)
  125. if MyOldMinionList as String != "None"
  126. MaxOld = jsonutil.IntListCount(MyImportFileName, "m" + MyOldMinionList as String)
  127. else
  128. MaxOld = 0
  129. endIf
  130. if MaxCurrent > MaxOld
  131. Index = MaxCurrent
  132. else
  133. Index = MaxOld
  134. endIf
  135. ThrottleCount = 0
  136. while Index
  137. Index -= 1
  138. if Index < MaxCurrent
  139. MyCurrent = jsonutil.IntListGet(MyImportFileName, "m" + MyCurrentMinionList as String, Index)
  140. CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
  141. if CurrentRef
  142. if MyActivateAll
  143. CurrentRef.Activate(self as ObjectReference, false)
  144. elseIf storageutil.GetIntValue(CurrentRef as form, "GridState", 0) == 0 && (!jsonutil.IntListHas(MyImportFileName, "m" + MyOldMinionList as String, MyCurrent) || MyOldMinionList == 0)
  145. storageutil.SetIntValue(CurrentRef as form, "GridState", 1)
  146. CurrentRef.Activate(self as ObjectReference, false)
  147. endIf
  148. endIf
  149. endIf
  150. if Index < MaxOld && !MyActivateAll
  151. MyCurrent = jsonutil.IntListGet(MyImportFileName, "m" + MyOldMinionList as String, Index)
  152. CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
  153. if CurrentRef
  154. if storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0 && (!jsonutil.IntListHas(MyImportFileName, "m" + MyCurrentMinionList as String, MyCurrent) || MyCurrentMinionList == 0)
  155. storageutil.UnsetIntValue(CurrentRef as form, "GridState")
  156. storageutil.UnsetIntValue(CurrentRef as form, "CellState")
  157. CurrentRef.Activate(self as ObjectReference, false)
  158. ThrottleCount += 1
  159. endIf
  160. endIf
  161. endIf
  162. if ThrottleCount > ThrottleThreshold
  163. utility.Wait(1 as Float)
  164. ThrottleCount = 0
  165. endIf
  166. endWhile
  167. CurrentRef = none
  168. MyOldMinionList = MyCurrentMinionList
  169. endIf
  170. if MyCurrentFirstbornList != MyOldFirstbornList || MyActivateAll
  171. MaxCurrent = jsonutil.IntListCount(MyImportFileName, "f" + MyCurrentFirstbornList as String)
  172. if MyOldFirstbornList != 0
  173. MaxOld = jsonutil.IntListCount(MyImportFileName, "f" + MyOldFirstbornList as String)
  174. else
  175. MaxOld = 0
  176. endIf
  177. if MaxCurrent > MaxOld
  178. Index = MaxCurrent
  179. else
  180. Index = MaxOld
  181. endIf
  182. ThrottleCount = 0
  183. while Index
  184. Index -= 1
  185. if Index < MaxCurrent
  186. MyCurrent = jsonutil.IntListGet(MyImportFileName, "f" + MyCurrentFirstbornList as String, Index)
  187. CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
  188. if MyActivateAll
  189. CurrentRef.Activate(self as ObjectReference, false)
  190. elseIf CurrentRef
  191. if storageutil.GetIntValue(CurrentRef as form, "GridState", 0) == 0 && (!jsonutil.IntListHas(MyImportFileName, "f" + MyOldFirstbornList as String, MyCurrent) || MyOldFirstbornList == 0)
  192. storageutil.SetIntValue(CurrentRef as form, "GridState", 1)
  193. CurrentRef.Activate(self as ObjectReference, false)
  194. endIf
  195. endIf
  196. endIf
  197. if Index < MaxOld && !MyActivateAll
  198. MyCurrent = jsonutil.IntListGet(MyImportFileName, "f" + MyOldFirstbornList as String, Index)
  199. CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
  200. if CurrentRef
  201. if storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0 && (!jsonutil.IntListHas(MyImportFileName, "f" + MyCurrentFirstbornList as String, MyCurrent) || MyCurrentFirstbornList == 0)
  202. storageutil.UnsetIntValue(CurrentRef as form, "GridState")
  203. storageutil.UnsetIntValue(CurrentRef as form, "CellState")
  204. CurrentRef.Activate(self as ObjectReference, false)
  205. ThrottleCount += 1
  206. endIf
  207. endIf
  208. endIf
  209. if ThrottleCount > ThrottleThreshold
  210. utility.Wait(1 as Float)
  211. ThrottleCount = 0
  212. endIf
  213. endWhile
  214. CurrentRef = none
  215. MyOldFirstbornList = MyCurrentFirstbornList
  216. endIf
  217. elseIf MyCurrentFirstborn == MyOldFirstborn
  218. storageutil.UnsetFormValue(self as form, "DynDOLOD_MyActiveFirstborn")
  219. Index = jsonutil.IntListCount(MyImportFileName, "m" + MyOldMinionList as String)
  220. ThrottleCount = 0
  221. while Index
  222. Index -= 1
  223. MyCurrent = jsonutil.IntListGet(MyImportFileName, "m" + MyOldMinionList as String, Index)
  224. CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
  225. if CurrentRef as Bool && storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0
  226. storageutil.UnsetIntValue(CurrentRef as form, "GridState")
  227. storageutil.UnsetIntValue(CurrentRef as form, "CellState")
  228. CurrentRef.Activate(self as ObjectReference, false)
  229. ThrottleCount += 1
  230. endIf
  231. if ThrottleCount > ThrottleThreshold
  232. utility.Wait(1 as Float)
  233. ThrottleCount = 0
  234. endIf
  235. endWhile
  236. Index = jsonutil.IntListCount(MyImportFileName, "f" + MyOldFirstbornList as String)
  237. ThrottleCount = 0
  238. while Index
  239. Index -= 1
  240. MyCurrent = jsonutil.IntListGet(MyImportFileName, "f" + MyOldFirstbornList as String, Index)
  241. CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
  242. if CurrentRef as Bool && storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0
  243. storageutil.UnsetIntValue(CurrentRef as form, "GridState")
  244. storageutil.UnsetIntValue(CurrentRef as form, "CellState")
  245. CurrentRef.Activate(self as ObjectReference, false)
  246. ThrottleCount += 1
  247. endIf
  248. if ThrottleCount > ThrottleThreshold
  249. utility.Wait(1 as Float)
  250. ThrottleCount = 0
  251. endIf
  252. endWhile
  253. MyOldFirstbornList = 0
  254. MyOldMinionList = 0
  255. MyOldFirstborn = none
  256. CurrentRef = none
  257. endIf
  258. self.GotoState("Running")
  259. endFunction
  260. endState
  261.  
  262. ;-- State -------------------------------------------
  263. state Missing
  264.  
  265. function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
  266.  
  267. ; Empty function
  268. endFunction
  269. endState
  270.  
  271. ;-- State -------------------------------------------
  272. state Updating
  273.  
  274. function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
  275.  
  276. if MyAttach
  277. storageutil.SetFormValue(self as form, "DynDOLOD_MyActiveFirstborn", MyFirstborn as form)
  278. else
  279. storageutil.UnsetFormValue(self as form, "DynDOLOD_MyActiveFirstborn")
  280. endIf
  281. endFunction
  282. endState
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement