cecell

Untitled

May 26th, 2021
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 133.73 KB | None | 0 0
  1. Scriptname cm_EtherealIncarnationMCM extends SKI_ConfigBase
  2.  
  3. Actor Property playerRef Auto
  4. Actor objActor
  5. ActorBase objActorBase
  6. ObjectReference playerObj
  7. Bool _toggleState011
  8. Bool _toggleState012
  9. Bool _toggleState013
  10. Bool _toggleState014
  11. Bool _toggleState015
  12. Bool _toggleState016
  13. Bool _toggleState017
  14. Bool _toggleState08
  15. Bool _toggleState09
  16. Bool _toggleState10
  17. Bool _toggleState11
  18. Bool _toggleState12
  19. Bool _toggleState13
  20. Bool _toggleState14
  21. Bool _toggleState15
  22. Bool _toggleState16
  23. Bool _toggleState018
  24. Bool booksFilePathExists
  25. Bool booksMasterInstalled
  26. Bool cUInstalled
  27. Bool depositWarning
  28. Bool dontTouchFilePathExists
  29. Bool isScriptRunning
  30. Bool loseSomeWeightInstalled
  31. Bool po3ExtenderInstalled
  32. Bool settingsfilepathExists
  33. Bool terminateVar = false
  34. Bool toolScriptPathExists
  35. Float progressBarProgress
  36. Form goldVar1
  37. Form objOwner
  38. Int __storedAlchemy
  39. Int __storedAlteration
  40. Int __storedBlock
  41. Int __storedBooksRead
  42. Int __storedCarryWeight
  43. Int __storedConjuration
  44. Int __storedContainerItems
  45. Int __storedDestruction
  46. Int __storedDragonSouls
  47. Int __storedEnchanting
  48. Int __storedHealth
  49. Int __storedHeavyArmor
  50. Int __storedIllusion
  51. Int __storedInventoryItems
  52. Int __storedLevel
  53. Int __storedLightArmor
  54. Int __storedLockpicking
  55. Int __storedMagicka
  56. Int __storedMarksman
  57. Int __storedOneHanded
  58. Int __storedPerkPoints
  59. Int __storedPickpocket
  60. Int __storedRestoration
  61. Int __storedShouts
  62. Int __storedSmithing
  63. Int __storedSneak
  64. Int __storedSpeechcraft
  65. Int __storedSpells
  66. Int __storedStamina
  67. Int __storedTwoHanded
  68. Int __storedWordsOfPower
  69. Int _addPerkPoint
  70. Int _cloudAmmo
  71. Int _cloudArmor
  72. Int _cloudBooks
  73. Int _cloudIngestibles
  74. Int _cloudIngredients
  75. Int _cloudMisc
  76. Int _cloudScrolls
  77. Int _cloudSoulGems
  78. Int _cloudWeapons
  79. Int _depArmor
  80. Int _depBooks
  81. Int _depCloud
  82. Int _depEverything
  83. Int _depIndiscriminatelyEverything
  84. Int _depIngestibles
  85. Int _depIngredients
  86. Int _depMisc
  87. Int _depSoulGems
  88. Int _depWeapons
  89. Int _displayCloudContainerItemQty
  90. Int _displayCurInventoryItemQty
  91. Int _displayCurrentAlchemy
  92. Int _displayCurrentAlteration
  93. Int _displayCurrentArchery
  94. Int _displayCurrentBlock
  95. Int _displayCurrentCarryWeight
  96. Int _displayCurrentConjuration
  97. Int _displayCurrentDestruction
  98. Int _displayCurrentEnchanting
  99. Int _displayCurrentHealth
  100. Int _displayCurrentHeavyArmor
  101. Int _displayCurrentIllusion
  102. Int _displayCurrentLevel
  103. Int _displayCurrentLightArmor
  104. Int _displayCurrentLockpicking
  105. Int _displayCurrentMagicka
  106. Int _displayCurrentNumBooksRead
  107. Int _displayCurrentNumDragonSouls
  108. Int _displayCurrentNumMapMarkers
  109. Int _displayCurrentNumPerkPoints
  110. Int _displayCurrentOneHanded
  111. Int _displayCurrentPickpocket
  112. Int _displayCurrentRestoration
  113. Int _displayCurrentShouts
  114. Int _displayCurrentSmithing
  115. Int _displayCurrentSneak
  116. Int _displayCurrentSpeech
  117. Int _displayCurrentSpells
  118. Int _displayCurrentStamina
  119. Int _displayCurrentTwoHanded
  120. Int _displayCurrentWordsOfPower
  121. Int _displayStoredAlchemy
  122. Int _displayStoredAlteration
  123. Int _displayStoredArchery
  124. Int _displayStoredBlock
  125. Int _displayStoredCarryWeight
  126. Int _displayStoredConjuration
  127. Int _displayStoredContainerItemQty
  128. Int _displayStoredDestruction
  129. Int _displayStoredEnchanting
  130. Int _displayStoredHealth
  131. Int _displayStoredHeavyArmor
  132. Int _displayStoredIllusion
  133. Int _displayStoredInventoryItemQty
  134. Int _displayStoredLevel
  135. Int _displayStoredLightArmor
  136. Int _displayStoredLockpicking
  137. Int _displayStoredMagicka
  138. Int _displayStoredNumBooksRead
  139. Int _displayStoredNumDragonSouls
  140. Int _displayStoredNumMapMarkers
  141. Int _displayStoredNumPerkPoints
  142. Int _displayStoredOneHanded
  143. Int _displayStoredPickpocket
  144. Int _displayStoredRestoration
  145. Int _displayStoredShouts
  146. Int _displayStoredSmithing
  147. Int _displayStoredSneak
  148. Int _displayStoredSpeech
  149. Int _displayStoredSpells
  150. Int _displayStoredStamina
  151. Int _displayStoredTwoHanded
  152. Int _displayStoredWordsOfPower
  153. Int _emptyContainer
  154. Int _isAQuestItem
  155. Int _isAQuestNPC
  156. Int _isTargetEssential = -1
  157. Int _isTargetProtected = -1
  158. Int _itemGoldValue
  159. Int _keymapOID_K
  160. Int _loadContainer
  161. Int _loadInventory
  162. Int _loadReadBooks
  163. Int _loadSkills
  164. Int _loadSpells
  165. Int _lswAmmo
  166. Int _lswBooks
  167. Int _lswIngestibles
  168. Int _lswIngredients
  169. Int _lswMisc
  170. Int _lswScrolls
  171. Int _lswSoulGems
  172. Int _noFileContainer
  173. Int _noFileInventory
  174. Int _noFileSkills
  175. Int _noFileSpells
  176. Int _notShowOnStealthMeter
  177. Int _noticeFavoriteEquipped
  178. Int _progressBar
  179. Int _progressBarTitle
  180. Int _removePerkPoint
  181. Int _restoreMapMarkers
  182. Int _saveContainer
  183. Int _saveInventory
  184. Int _saveMapMarkers
  185. Int _saveReadBooks
  186. Int _saveSkills
  187. Int _saveSpells
  188. Int _scrollDownToAssignCloudContainer
  189. Int _setCloud
  190. Int _testingOption1
  191. Int _testingOption2
  192. Int _testingOption3
  193. Int _testingOption4
  194. Int _testingOption5
  195. Int _testingOption6
  196. Int _toggleEssential
  197. Int _toggleProtected
  198. Int _wdArmor
  199. Int _wdBooks
  200. Int _wdIngestibles
  201. Int _wdIngredients
  202. Int _wdMisc
  203. Int _wdSoulGems
  204. Int _wdTest
  205. Int _wdWeapons
  206. Int adamantInstalled
  207. Int consoleUtilWarning = 0
  208. Int filesCheckedYet = -1
  209. Int isAContainer = -1
  210. Int isCCAssigned = -1
  211. Int isPlayerOwner = -1
  212. Int isThisTheCC = -1
  213. Int myKeyMapVar = -1
  214. Int numItemsCC = -1
  215. Int numPlayerItems = -1
  216. Int objIsActor = -1
  217. Int objIsOwned = -1
  218. Int objOwnedByPlayer = -1
  219. Int objType
  220. Int ordinatorInstalled
  221. Int perkModInstalled
  222. Int perkusMaximusInstalled
  223. Int playerAlchemy
  224. Int playerAlteration
  225. Int playerBlock
  226. Int playerCarryWeight
  227. Int playerConjuration
  228. Int playerDestruction
  229. Int playerEnchanting
  230. Int playerHealth
  231. Int playerHeavyArmor
  232. Int playerIllusion
  233. Int playerLevel
  234. Int playerLevelXP
  235. Int playerLightArmor
  236. Int playerLockpicking
  237. Int playerMagicka
  238. Int playerMarksman
  239. Int playerOneHanded
  240. Int playerPerkPoints
  241. Int playerPickpocket
  242. Int playerRestoration
  243. Int playerSmithing
  244. Int playerSneak
  245. Int playerSpeechcraft
  246. Int playerStamina
  247. Int playerTotalPerkPoints
  248. Int playerTwoHanded
  249. Int progressVarIndex
  250. Int smithingPerksOverhaulInstalled
  251. Int testVar
  252. Int vokriiInstalled
  253. Int[] ccDepositTypeCodes
  254. Int[] typeCodes
  255. ObjectReference objFoc
  256. String booksFilePath
  257. String dontTouchFilePath
  258. String filePath
  259. String progressVar
  260. String progressVar2
  261. String settingsfilepath
  262. String testStringVar
  263. String[] Pages
  264. String[] magicMods
  265. String[] magicMods0
  266. String[] modsToSkipItems
  267. String[] modsToSkipSpells
  268. String[] skillArray
  269. Int _containerPicker
  270. String[] containerList
  271. Int currentMenuOption = 0
  272. String[] multiContainerNameToIndex
  273. Int _multiContainerSelect
  274. Int _multiContainerAdd
  275. Int _multiContainerRename
  276. Int _multiContainerSave
  277. Int _multiContainerLoad
  278. ;Int _multiInventoryLoad
  279. Int _multiContainerDelete
  280. Int _multiContainerNumberOf
  281. Int _lswQuestItems
  282. Bool isLeveledActorBase = false
  283.  
  284. ;Menu layout
  285. event OnPageReset(String page)
  286.  
  287.   SetCursorFillMode(TOP_TO_BOTTOM)
  288.   if !po3ExtenderInstalled
  289.     AddTextOption("Powerofthree's Papyrus Extender", "", OPTION_FLAG_DISABLED)
  290.     AddTextOption("is required but isn't installed!", "", OPTION_FLAG_DISABLED)
  291.     AddEmptyOption()
  292.     AddTextOption("Download and install for functionality!", "", OPTION_FLAG_DISABLED)
  293.     AddTextOption("nexusmods.com/skyrimspecialedition/mods/22854", "", OPTION_FLAG_DISABLED)
  294.     return
  295.   endif
  296.  
  297.   if objIsActor == -1
  298.     EvaluateTarget()
  299.   endif
  300.  
  301.   if (page == "" || page == "Inventory")
  302.  
  303.   ; COLUMN 1 - DEPOSIT & ASSIGN
  304.     SetTitleText("Scroll down to see all options!")
  305.     AddHeaderOption("Deposit")
  306.       _depArmor = AddTextOption("Armor", "", OPTION_FLAG_NONE)
  307.       _depWeapons = AddTextOption("Weapons", "", OPTION_FLAG_NONE)
  308.       _depIngestibles = AddTextOption("Ingestibles: Food, Drink, Potions", "", OPTION_FLAG_NONE)
  309.       _depIngredients = AddTextOption("Alchemy Ingredients", "", OPTION_FLAG_NONE)
  310.       _depBooks = AddTextOption("Books", "", OPTION_FLAG_NONE)
  311.       _depSoulGems = AddTextOption("Soul Gem", "", OPTION_FLAG_NONE)
  312.       _depMisc = AddTextOption("Misc: Ore, Ingots, Junk", "", OPTION_FLAG_NONE)
  313.       _depEverything = AddTextOption("All Except Equipped and Favorited", "", OPTION_FLAG_NONE)
  314.       _depIndiscriminatelyEverything = AddTextOption("DUMP IT ALL NOW", "", OPTION_FLAG_NONE)
  315.       AddEmptyOption()
  316.      
  317.       if isCCAssigned > 0
  318.         ;_scrollDownToAssignCloudContainer = AddTextOption("", "Scroll down to assign", OPTION_FLAG_HIDDEN)
  319.         _depCloud = AddTextOption("Begin Cloud Deposit", "", OPTION_FLAG_NONE)
  320.         AddHeaderOption("")
  321.         _displayCloudContainerItemQty = AddTextOption("Items in Cloud Container:", numItemsCC, OPTION_FLAG_NONE)
  322.         ;SetTextOptionValue(_displayCloudContainerItemQty,numItemsCC)
  323.       else
  324.         ;_scrollDownToAssignCloudContainer = AddTextOption("", "", OPTION_FLAG_HIDDEN)
  325.         _depCloud = AddTextOption("Begin Cloud Deposit", "", OPTION_FLAG_DISABLED)
  326.         AddHeaderOption("")
  327.         _displayCloudContainerItemQty = AddTextOption("Items in Cloud Container:", "Unassigned", OPTION_FLAG_NONE)
  328.         ;SetTextOptionValue(_displayCloudContainerItemQty,"Unassigned")        
  329.       endif
  330.       _keymapOID_K = AddKeyMapOption("Cloud Deposit Hotkey", myKeyMapVar)
  331.       AddEmptyOption()
  332.       AddEmptyOption()
  333.       AddEmptyOption()
  334.     AddHeaderOption("Assign Cloud Container")
  335.       if isAContainer < 1
  336.         _setCloud = AddTextOption("<font color='#FF0000'>Not a valid container</font>", "", OPTION_FLAG_NONE)
  337.       elseif objOwnedByPlayer < 1
  338.         _setCloud = AddTextOption("<font color='#FF0000'>Container not owned by Player</font>", "", OPTION_FLAG_NONE)
  339.       elseif isCCAssigned < 1
  340.         _setCloud = AddTextOption("Cloud Container", "<font color='#00FF00'>Assign</font>", OPTION_FLAG_NONE)
  341.       elseif isThisTheCC > 0
  342.         _setCloud = AddTextOption("Cloud Container", "<font color='#FFFF00'>Unassign</font>", OPTION_FLAG_NONE)
  343.       elseif isCCAssigned > 0
  344.         _setCloud = AddTextOption("Cloud Container", "<font color='#FFFF00'>Reassign</font>", OPTION_FLAG_NONE)
  345.       else
  346.         _setCloud = AddTextOption("Cloud Container", "<font color='#BBBBBB'>N/A</font>", OPTION_FLAG_NONE)
  347.       endif
  348.      
  349.   ; COLUMN 2 - WITHDRAW & PROGRESS BAR
  350.     SetCursorPosition(1)
  351.    
  352.     AddHeaderOption("Withdraw")
  353.       _wdArmor = AddTextOption("Armor", "")
  354.       _wdWeapons = AddTextOption("Weapons", "")
  355.       _wdIngestibles = AddTextOption("Ingestibles: Food, Drink, Potions", "", OPTION_FLAG_NONE)
  356.       _wdIngredients = AddTextOption("Alchemy Ingredients", "", OPTION_FLAG_NONE)
  357.       _wdBooks = AddTextOption("Books", "", OPTION_FLAG_NONE)
  358.       _wdSoulGems = AddTextOption("Soul Gem", "", OPTION_FLAG_NONE)
  359.       _wdMisc = AddTextOption("Misc: Ore, Ingots, Junk", "", OPTION_FLAG_NONE)
  360.       AddEmptyOption()
  361.     AddHeaderOption("Progress-Exit all Menus to Cancel")
  362.       _progressBarTitle = AddTextOption("", "", OPTION_FLAG_NONE)
  363.       _progressBar = AddTextOption("", "", OPTION_FLAG_NONE)
  364.       AddEmptyOption()
  365.       AddEmptyOption()
  366.       AddEmptyOption()
  367.       AddEmptyOption()
  368.       AddEmptyOption()
  369.       AddEmptyOption()
  370.     AddHeaderOption("ACHTUNG BABY! - <font color='#FFFF00'>Destroy Contents!</font>")
  371.       if isAContainer > 0
  372.         _emptyContainer = AddTextOption("<font color='#FFFF00'>Container has:</font>", ObjFoc.GetNumItems() + " items", OPTION_FLAG_NONE)
  373.       else
  374.         _emptyContainer = AddTextOption("<font color='#FF0000'>Target a valid container!</font>", "", OPTION_FLAG_NONE)
  375.       endif
  376.      
  377.   elseif (page == "Transcription")
  378.     SetTitleText("Exit all Menus to Cancel (Data will be Incomplete!)")
  379.   ; COLUMN 1
  380.     AddHeaderOption("Player Skills, Stats and Perk Points")
  381.       _saveSkills = AddTextOption("Save", "", OPTION_FLAG_NONE)
  382.       _loadSkills = AddTextOption("   Restore", "", OPTION_FLAG_NONE)
  383.  
  384.     AddHeaderOption("Spells, Shouts, Words of Power, Dragon Souls")
  385.       _saveSpells = AddTextOption("Save", "", OPTION_FLAG_NONE)
  386.       _loadSpells = AddTextOption("   Restore", "", OPTION_FLAG_NONE)
  387.    
  388.     AddHeaderOption("Player Inventory")
  389.       _saveInventory = AddTextOption("Save", "", OPTION_FLAG_NONE)
  390.       _loadInventory = AddTextOption("   Restore", "", OPTION_FLAG_NONE)
  391.      
  392.     AddHeaderOption("Contents of Targeted Container")
  393.       _saveContainer = AddTextOption("Save", "", OPTION_FLAG_NONE)
  394.       _loadContainer = AddTextOption("   Restore", "", OPTION_FLAG_NONE)
  395.      
  396.   ; COLUMN 2
  397.     SetCursorPosition(1)
  398.  
  399.     AddHeaderOption("Map Markers")
  400.       _saveMapMarkers = AddTextOption("Save", "", OPTION_FLAG_NONE)
  401.       _restoreMapMarkers = AddTextOption("   Restore", "", OPTION_FLAG_NONE)
  402.  
  403.     AddHeaderOption("List of Books Read")
  404.       _saveReadBooks = AddTextOption("Save", "", OPTION_FLAG_NONE)
  405.       _loadReadBooks = AddTextOption("   Restore", "", OPTION_FLAG_NONE)
  406.       AddEmptyOption()
  407.       AddEmptyOption()
  408.       AddEmptyOption()
  409.     AddHeaderOption("Progress (Exit all Menus to Cancel)")
  410.       _progressBarTitle = AddTextOption("", "", OPTION_FLAG_NONE)
  411.       _progressBar = AddTextOption("", "", OPTION_FLAG_NONE)
  412.     AddEmptyOption()
  413.     AddEmptyOption()
  414.     AddEmptyOption()
  415.     AddEmptyOption()
  416.     AddEmptyOption()
  417.     AddHeaderOption("Tsk tsk tsk - Available Perk Points: " + playerPerkPoints)
  418.       _addPerkPoint = AddTextOption("Add one perk point", "", OPTION_FLAG_NONE)  ;   WILL NEED TO BE UPDATED
  419.       _removePerkPoint = AddTextOption("Remove one perk point", "", OPTION_FLAG_NONE)  ;   WILL NEED TO BE UPDATED
  420.  
  421. ; DISPLAY PLAYER DATA
  422.   elseif (page == "Stored Data")
  423.  
  424.     SetTitleText("Data on left is ready to restore")
  425.    
  426.   ; COLUMN 1 STORED INFO
  427.     AddHeaderOption("Stored Player Stats")
  428.       _displayStoredLevel = AddTextOption("Level:", __storedLevel, OPTION_FLAG_NONE)
  429.       _displayStoredHealth = AddTextOption("Health:", __storedHealth, OPTION_FLAG_NONE)
  430.       _displayStoredMagicka = AddTextOption("Magicka: ",__storedMagicka, OPTION_FLAG_NONE)
  431.       _displayStoredStamina = AddTextOption("Stamina:",__storedStamina, OPTION_FLAG_NONE)
  432.       _displayStoredSpells = AddTextOption("Spells:",__storedSpells, OPTION_FLAG_NONE)
  433.       _displayStoredNumPerkPoints = AddTextOption("Perk Points:",__storedPerkPoints, OPTION_FLAG_NONE)
  434.       _displayStoredShouts = AddTextOption("Shouts:",__storedShouts, OPTION_FLAG_NONE)
  435.       ;_displayStoredWordsOfPower = AddTextOption("Words of Power:",__storedMagicka, OPTION_FLAG_NONE)
  436.       ;_displayStoredNumDragonSouls = AddTextOption("Dragon Souls:",__storedMagicka, OPTION_FLAG_NONE)
  437.       _displayStoredOneHanded = AddTextOption("One Handed:",__storedOneHanded, OPTION_FLAG_NONE)
  438.       _displayStoredTwoHanded = AddTextOption("Two Handed:",__storedTwoHanded, OPTION_FLAG_NONE)
  439.       _displayStoredArchery = AddTextOption("Archery:",__storedMarksman, OPTION_FLAG_NONE)
  440.       _displayStoredBlock = AddTextOption("Block:",__storedBlock, OPTION_FLAG_NONE)
  441.       _displayStoredSmithing = AddTextOption("Smithing:",__storedSmithing, OPTION_FLAG_NONE)
  442.       _displayStoredHeavyArmor = AddTextOption("Heavy Armor:",__storedHeavyArmor, OPTION_FLAG_NONE)
  443.       _displayStoredLightArmor = AddTextOption("Light Armor:",__storedLightArmor, OPTION_FLAG_NONE)
  444.       _displayStoredPickpocket = AddTextOption("Pickpocket:",__storedPickpocket, OPTION_FLAG_NONE)
  445.       _displayStoredLockpicking = AddTextOption("Lockpicking:",__storedLockpicking, OPTION_FLAG_NONE)
  446.       _displayStoredSneak = AddTextOption("Sneak:",__storedSneak, OPTION_FLAG_NONE)
  447.       _displayStoredAlchemy = AddTextOption("Alchemy:",__storedAlchemy, OPTION_FLAG_NONE)
  448.       _displayStoredSpeech = AddTextOption("Speech:",__storedSpeechcraft, OPTION_FLAG_NONE)
  449.       _displayStoredAlteration = AddTextOption("Alteration:",__storedAlteration, OPTION_FLAG_NONE)
  450.       _displayStoredConjuration = AddTextOption("Conjuration:",__storedConjuration, OPTION_FLAG_NONE)
  451.       _displayStoredDestruction = AddTextOption("Destruction:",__storedDestruction, OPTION_FLAG_NONE)
  452.       _displayStoredIllusion = AddTextOption("Illusion:",__storedIllusion, OPTION_FLAG_NONE)
  453.       _displayStoredRestoration = AddTextOption("Restoration:",__storedRestoration, OPTION_FLAG_NONE)
  454.       _displayStoredEnchanting = AddTextOption("Enchanting:",__storedEnchanting, OPTION_FLAG_NONE)
  455.       _displayStoredCarryWeight = AddTextOption("Carry Weight:",__storedCarryWeight, OPTION_FLAG_NONE)
  456.       ;_displayStoredNumMapMarkers = AddTextOption("Map Markers:",__storedMagicka, OPTION_FLAG_NONE)
  457.     AddHeaderOption("Stored Misc Stats")
  458.       _displayStoredInventoryItemQty = AddTextOption("Inventory Items:",__storedInventoryItems, OPTION_FLAG_NONE)
  459.       _displayStoredNumBooksRead = AddTextOption("Books Read:",__storedBooksRead, OPTION_FLAG_NONE)
  460.  
  461.   ; COLUMN 2
  462.     SetCursorPosition(1)
  463.     AddHeaderOption("Currently Active Player Data (Base)")
  464.       _displayStoredLevel = AddTextOption("Level:",LessThanRedText(playerLevel, __storedLevel), OPTION_FLAG_NONE)
  465.       _displayCurrentHealth = AddTextOption("Health:",LessThanRedText(playerHealth,__storedHealth), OPTION_FLAG_NONE)
  466.       _displayCurrentMagicka = AddTextOption("Magicka: ",LessThanRedText(playerMagicka,__storedMagicka), OPTION_FLAG_NONE)
  467.       _displayCurrentStamina = AddTextOption("Stamina:",LessThanRedText(playerStamina,__storedStamina), OPTION_FLAG_NONE)
  468.       AddHeaderOption("")
  469.       AddHeaderOption("")
  470.       AddHeaderOption("")
  471.       _displayCurrentOneHanded = AddTextOption("One Handed:",LessThanRedText(playerOneHanded,__storedOneHanded), OPTION_FLAG_NONE)
  472.       _displayCurrentTwoHanded = AddTextOption("Two Handed:",LessThanRedText(playerTwoHanded,__storedTwoHanded), OPTION_FLAG_NONE)
  473.       _displayCurrentArchery = AddTextOption("Archery:",LessThanRedText(playerMarksman,__storedMarksman), OPTION_FLAG_NONE)
  474.       _displayCurrentBlock = AddTextOption("Block:",LessThanRedText(playerBlock,__storedBlock), OPTION_FLAG_NONE)
  475.       _displayCurrentSmithing = AddTextOption("Smithing:",LessThanRedText(playerSmithing,__storedSmithing), OPTION_FLAG_NONE)
  476.       _displayCurrentHeavyArmor = AddTextOption("Heavy Armor:",LessThanRedText(playerHeavyArmor,__storedHeavyArmor), OPTION_FLAG_NONE)
  477.       _displayCurrentLightArmor = AddTextOption("Light Armor:",LessThanRedText(playerLightArmor,__storedLightArmor), OPTION_FLAG_NONE)
  478.       _displayCurrentPickpocket = AddTextOption("Pickpocket:",LessThanRedText(playerPickpocket,__storedPickpocket), OPTION_FLAG_NONE)
  479.       _displayCurrentLockpicking = AddTextOption("Lockpicking:",LessThanRedText(playerLockpicking,__storedLockpicking), OPTION_FLAG_NONE)
  480.       _displayCurrentSneak = AddTextOption("Sneak:",LessThanRedText(playerSneak,__storedSneak), OPTION_FLAG_NONE)
  481.       _displayCurrentAlchemy = AddTextOption("Alchemy:",LessThanRedText(playerAlchemy,__storedAlchemy), OPTION_FLAG_NONE)
  482.       _displayCurrentSpeech = AddTextOption("Speech:",LessThanRedText(playerSpeechcraft,__storedSpeechcraft), OPTION_FLAG_NONE)
  483.       _displayCurrentAlteration = AddTextOption("Alteration:",LessThanRedText(playerAlteration,__storedAlteration), OPTION_FLAG_NONE)
  484.       _displayCurrentConjuration = AddTextOption("Conjuration:",LessThanRedText(playerConjuration,__storedConjuration), OPTION_FLAG_NONE)
  485.       _displayCurrentDestruction = AddTextOption("Destruction:",LessThanRedText(playerDestruction,__storedDestruction), OPTION_FLAG_NONE)
  486.       _displayCurrentIllusion = AddTextOption("Illusion:",LessThanRedText(playerIllusion,__storedIllusion), OPTION_FLAG_NONE)
  487.       _displayCurrentRestoration = AddTextOption("Restoration:",LessThanRedText(playerRestoration,__storedRestoration), OPTION_FLAG_NONE)
  488.       _displayCurrentEnchanting = AddTextOption("Enchanting:",LessThanRedText(playerEnchanting,__storedEnchanting), OPTION_FLAG_NONE)
  489.       _displayCurrentCarryWeight = AddTextOption("Carry Weight:",LessThanRedText(playerCarryWeight,__storedCarryWeight), OPTION_FLAG_NONE)
  490.       AddHeaderOption("")
  491.       _displayCurInventoryItemQty = AddTextOption("Inventory Items:",playerRef.GetNumItems(), OPTION_FLAG_NONE)
  492.      
  493.   elseif (page == "Addons-Settings")
  494.     SetTitleText("Additional Settings")
  495.   ; COLUMN 1 - SETTINGS FOR LOSE SOME WEIGHT PLUGIN
  496.     if loseSomeWeightInstalled
  497.       AddHeaderOption("Lose Some Weight-Toggle Types", OPTION_FLAG_NONE)
  498.       _lswScrolls = AddToggleOption("Scrolls", _toggleState011, OPTION_FLAG_NONE)
  499.       _lswBooks = AddToggleOption("Books and Notes", _toggleState012, OPTION_FLAG_NONE)
  500.       _lswIngredients = AddToggleOption("Alchemy Ingredients", _toggleState013, OPTION_FLAG_NONE)
  501.       _lswMisc = AddToggleOption("Misc: Ores, Ingots, Firewood", _toggleState014, OPTION_FLAG_NONE)
  502.       _lswAmmo = AddToggleOption("Arrows and Bolts", _toggleState015, OPTION_FLAG_NONE)
  503.       _lswIngestibles = AddToggleOption("Food and Potions", _toggleState016, OPTION_FLAG_NONE)
  504.       _lswSoulGems = AddToggleOption("Soul Gems ", _toggleState017, OPTION_FLAG_NONE)
  505.       _lswQuestItems = AddToggleOption("Quest Items", _toggleState018, OPTION_FLAG_NONE)
  506.     else
  507.       AddHeaderOption("Lose Some Weight Not Installed", OPTION_FLAG_DISABLED)
  508.     endif
  509.     AddEmptyOption()
  510.     AddEmptyOption()
  511.     AddEmptyOption()
  512.     AddEmptyOption()
  513.  
  514.   ; COLUMN 2 - CLOUD DEPOSIT OPTIONS
  515.     SetCursorPosition(1)
  516.     AddHeaderOption("Cloud Deposit-Toggle Types")
  517.       _cloudScrolls = AddToggleOption("Scrolls", _toggleState08, OPTION_FLAG_NONE)
  518.       _cloudBooks = AddToggleOption("Books", _toggleState09, OPTION_FLAG_NONE)
  519.       _cloudIngredients = AddToggleOption("Alchemy Ingredients", _toggleState10, OPTION_FLAG_NONE)
  520.       _cloudMisc = AddToggleOption("Misc: Ores, Ingots, Straw", _toggleState11, OPTION_FLAG_NONE)
  521.       _cloudAmmo = AddToggleOption("Arrows and Bolts", _toggleState12, OPTION_FLAG_NONE)
  522.       _cloudIngestibles = AddToggleOption("Food, Potions <- " + "<font color='#FF0000'>Caution!</font>", _toggleState13, OPTION_FLAG_NONE)
  523.       _cloudSoulGems = AddToggleOption("Soul Gems ", _toggleState14, OPTION_FLAG_NONE)
  524.       _cloudArmor = AddToggleOption("Armor", _toggleState15, OPTION_FLAG_NONE)
  525.       _cloudWeapons = AddToggleOption("Weapons", _toggleState16, OPTION_FLAG_NONE)
  526.       AddEmptyOption()
  527.       _noticeFavoriteEquipped = AddTextOption("Note: Favorited/Equipped <i>Not</i> Deposited", "", OPTION_FLAG_DISABLED)
  528.  
  529.   elseif page == "Dev Tools"
  530.     SetTitleText("Cell Form: " + cmlib.D2H(playerObj.GetParentCell().GetFormID()) + "    " + getCellXY())
  531.  
  532.   ; SET BOTH COLUMN HEADERS
  533.   ; COLUMN 1 - INFO ABOUT TARGETED OBJECT
  534.     if objIsActor < 1
  535.       SetCursorPosition(1)
  536.       AddHeaderOption("Target valid actor for info")
  537.       SetCursorPosition(0)
  538.       AddHeaderOption("Targeted Object Info")
  539.       String theObjName = ObjFoc.GetBaseObject().GetName()
  540.       if theObjName
  541.         AddTextOption("Name:",ObjFoc.GetBaseObject().GetName(),OPTION_FLAG_NONE)
  542.       else
  543.         AddTextOption("Name:","N/A",OPTION_FLAG_NONE)
  544.       endif
  545.       Int goldVal = ObjFoc.GetGoldValue()
  546.       if goldVal > 0
  547.         _itemGoldValue = AddTextOption("Gold Value:", goldVal, OPTION_FLAG_NONE)
  548.       else
  549.         _itemGoldValue = AddTextOption("Gold Value:", "N/A", OPTION_FLAG_NONE)
  550.       endif
  551.       _isAQuestItem = AddTextOption("Is a quest Item?:",PO3_SKSEFunctions.IsQuestItem(ObjFoc),OPTION_FLAG_NONE)
  552.       AddTextOption("Pos X:",ObjFoc.GetPositionX(),OPTION_FLAG_NONE)
  553.       AddTextOption("Pos Y:",ObjFoc.GetPositionY(),OPTION_FLAG_NONE)
  554.       AddTextOption("Pos Z:",ObjFoc.GetPositionZ(),OPTION_FLAG_NONE)
  555.       AddTextOption("Ang X:",ObjFoc.GetAngleX(),OPTION_FLAG_NONE)
  556.       AddTextOption("Ang Y:",ObjFoc.GetAngleY(),OPTION_FLAG_NONE)
  557.       AddTextOption("Ang Z:",ObjFoc.GetAngleZ(),OPTION_FLAG_NONE)
  558.       AddTextOption("Weight:",ObjFoc.GetMass(),OPTION_FLAG_NONE)
  559.       AddTextOption("Scale:",ObjFoc.GetScale(),OPTION_FLAG_NONE)
  560.       ActorBase actorOwner = objFoc.GetActorOwner()
  561.       String actorOwnerName = actorOwner.GetName()
  562.       if actorOwnerName
  563.         AddTextOption("Owner:",actorOwner.GetName(), OPTION_FLAG_NONE)
  564.       endif
  565.       Int actorOwnerFormID = actorOwner.GetFormID()
  566.       if actorOwnerFormID
  567.         AddTextOption("Owner Form:",cmlib.D2H(actorOwnerFormID), OPTION_FLAG_NONE)
  568.       endif
  569.       if objIsOwned
  570.         Faction inheritedOwner = cmlib.GetInheritedOwner(ObjFoc)
  571.         if inheritedOwner
  572.           AddTextOption("Owning Faction ID:",cmlib.D2H(inheritedOwner.GetFormID()), OPTION_FLAG_NONE)
  573.         endif
  574.         AddTextOption("Owning Faction Name: ", "", OPTION_FLAG_NONE)
  575.         String facName = inheritedOwner.GetName()
  576.         if !facName || facName == ""
  577.           AddTextOption("","Form only (no name)", OPTION_FLAG_NONE)
  578.         else
  579.           AddTextOption("",facName, OPTION_FLAG_NONE)
  580.         endif
  581.         if inheritedOwner
  582.           Bool isInThatFaction = playerRef.IsInFaction(cmlib.GetInheritedOwner(ObjFoc))
  583.           if isInThatFaction
  584.             AddTextOption("Is Player in Faction?","<font color='#00FF00'>" + isInThatFaction + "</font>", OPTION_FLAG_NONE)
  585.           else
  586.             AddTextOption("Is Player in Faction?","<font color='#FF0000'>" + isInThatFaction + "</font>", OPTION_FLAG_NONE)
  587.           endif
  588.         endif
  589.       endif
  590.       AddEmptyOption()
  591.     elseif objIsActor > 0
  592.       Int spellCount = (objFoc as Actor).GetSpellCount()
  593.       isLeveledActorBase = false
  594.       if !spellCount
  595.         spellCount = (objFoc as Actor).GetActorBase().GetSpellCount()
  596.         isLeveledActorBase = false
  597.       endif
  598.       if !spellCount
  599.         spellCount = (objFoc as Actor).GetLeveledActorBase().GetSpellCount()
  600.         isLeveledActorBase = true
  601.       endif
  602.       SetCursorPosition(0)
  603.       AddHeaderOption("Targeted Actor Info")
  604.       AddTextOption("Name:",objActorBase.GetName(), OPTION_FLAG_NONE)
  605.       _isTargetEssential = AddTextOption("Is Essential? Click-Toggle:",objActorBase.IsEssential(), OPTION_FLAG_NONE)
  606.       _isTargetProtected = AddTextOption("Is Protected? Click-Toggle:",objActorBase.IsProtected(), OPTION_FLAG_NONE)
  607.       _isAQuestNPC = AddTextOption("Is a quest NPC?: ",PO3_SKSEFunctions.IsVIP(ObjFoc) as String, OPTION_FLAG_NONE)
  608.       objActor = objFoc as Actor
  609.       AddTextOption("Relat Rank Me With Them:",playerRef.GetRelationshipRank(objActor), OPTION_FLAG_NONE)
  610.       AddTextOption("Relat Rank Them With Me:",objActor.GetRelationshipRank(playerRef), OPTION_FLAG_NONE)
  611.       AddTextOption("BodyWeight:",objActor.GetWeight(), OPTION_FLAG_NONE)
  612.       AddTextOption("TotalArmorWeight:",ObjFoc.GetTotalArmorWeight(), OPTION_FLAG_NONE)
  613.       AddTextOption("TotalItemWeight:",ObjFoc.GetTotalItemWeight(), OPTION_FLAG_NONE)
  614.       AddTextOption("PosX:",ObjFoc.GetPositionX(), OPTION_FLAG_NONE)
  615.       AddTextOption("PosY:",ObjFoc.GetPositionY(), OPTION_FLAG_NONE)
  616.       AddTextOption("PosZ:",ObjFoc.GetPositionZ(), OPTION_FLAG_NONE)
  617.       AddTextOption("AngX:",ObjFoc.GetAngleX(), OPTION_FLAG_NONE)
  618.       AddTextOption("AngY:",ObjFoc.GetAngleY(), OPTION_FLAG_NONE)
  619.       AddTextOption("AngZ:",ObjFoc.GetAngleZ(), OPTION_FLAG_NONE)
  620.       _notShowOnStealthMeter = AddTextOption("<i>Toggle Ignore on Stealth Meter</i>", "", OPTION_FLAG_NONE)
  621.     SetCursorPosition(1)
  622.     AddHeaderOption("Targeted NPC Stats")
  623.       AddTextOption("Level:",(objFoc as Actor).GetLevel(), OPTION_FLAG_NONE)
  624.       AddTextOption("Health:",(objFoc as Actor).GetActorValue("Health") as Int, OPTION_FLAG_NONE)
  625.       AddTextOption("Magicka: ",(objFoc as Actor).GetActorValue("Magicka") as Int, OPTION_FLAG_NONE)
  626.       AddTextOption("Stamina:",(objFoc as Actor).GetActorValue("Stamina") as Int, OPTION_FLAG_NONE)
  627.  
  628.       AddTextOption("Spells:",spellCount, OPTION_FLAG_NONE)
  629.       AddTextOption("One Handed:",(objFoc as Actor).GetActorValue("OneHanded") as Int, OPTION_FLAG_NONE)
  630.       AddTextOption("Two Handed:",(objFoc as Actor).GetActorValue("TwoHanded") as Int, OPTION_FLAG_NONE)
  631.       AddTextOption("Archery:",(objFoc as Actor).GetActorValue("Marksman") as Int, OPTION_FLAG_NONE)
  632.       AddTextOption("Block:",(objFoc as Actor).GetActorValue("Block") as Int, OPTION_FLAG_NONE)
  633.       AddTextOption("Smithing:",(objFoc as Actor).GetActorValue("Smithing") as Int, OPTION_FLAG_NONE)
  634.       AddTextOption("Heavy Armor:",(objFoc as Actor).GetActorValue("HeavyArmor") as Int, OPTION_FLAG_NONE)
  635.       AddTextOption("Light Armor:",(objFoc as Actor).GetActorValue("LightArmor") as Int, OPTION_FLAG_NONE)
  636.       AddTextOption("Pickpocket:",(objFoc as Actor).GetActorValue("Pickpocket") as Int, OPTION_FLAG_NONE)
  637.       AddTextOption("Lockpicking:",(objFoc as Actor).GetActorValue("Lockpicking") as Int, OPTION_FLAG_NONE)
  638.       AddTextOption("Sneak:",(objFoc as Actor).GetActorValue("Sneak") as Int, OPTION_FLAG_NONE)
  639.       AddTextOption("Alchemy:",(objFoc as Actor).GetActorValue("Alchemy") as Int, OPTION_FLAG_NONE)
  640.       AddTextOption("Speech:",(objFoc as Actor).GetActorValue("Speechcraft") as Int, OPTION_FLAG_NONE)
  641.       AddTextOption("Alteration:",(objFoc as Actor).GetActorValue("Alteration") as Int, OPTION_FLAG_NONE)
  642.       AddTextOption("Conjuration:",(objFoc as Actor).GetActorValue("Conjuration") as Int, OPTION_FLAG_NONE)
  643.       AddTextOption("Destruction:",(objFoc as Actor).GetActorValue("Destruction") as Int, OPTION_FLAG_NONE)
  644.       AddTextOption("Illusion:",(objFoc as Actor).GetActorValue("Illusion") as Int, OPTION_FLAG_NONE)
  645.       AddTextOption("Restoration:",(objFoc as Actor).GetActorValue("Restoration") as Int, OPTION_FLAG_NONE)
  646.       AddTextOption("Enchanting:",(objFoc as Actor).GetActorValue("Enchanting") as Int, OPTION_FLAG_NONE)
  647.       AddTextOption("Carry Weight:",(objFoc as Actor).GetActorValue("CarryWeight") as Int, OPTION_FLAG_NONE)
  648.       AddTextOption("Inventory Items:",objFoc.GetNumItems(), OPTION_FLAG_NONE)
  649.     else
  650.       SetCursorPosition(0)
  651.       AddHeaderOption("Target valid object for info")
  652.       SetCursorPosition(1)
  653.       AddHeaderOption("Target valid actor for info")
  654.     endif
  655.  
  656. ; WORKING1
  657.   elseif page == " Containers"
  658.     SetTitleText(" Infini-tainer ")
  659.     SetCursorPosition(0)
  660.     AddHeaderOption("Container Management")
  661.     _multiContainerSelect = AddMenuOption("Containers ", containerList[currentMenuOption])
  662.     _multiContainerNumberOf = AddTextOption("", containerList.length + " Containers Stored", OPTION_FLAG_DISABLED)
  663.     _multiContainerAdd = AddInputOption("Add Container", "")
  664.     _multiContainerRename = AddInputOption("Rename Container", "")
  665.     _multiContainerSave = AddTextOption("Save Targeted Container", ObjFoc.GetNumItems() + " items")
  666.     _multiContainerLoad = AddTextOption("Load to Target", JsonUtil.IntListCount(filePath,"containerformid" + IndexMatch(currentMenuOption)) + " items")
  667.     ;_multiInventoryLoad = AddTextOption("Load to Inventory", "")
  668.     AddEmptyOption()
  669.     AddEmptyOption()
  670.     AddEmptyOption()
  671.     AddEmptyOption()
  672.     _multiContainerDelete = AddTextOption("Delete Container", "")
  673.     SetCursorPosition(19)
  674.     AddHeaderOption("Progress-Exit all Menus to Cancel")
  675.       _progressBarTitle = AddTextOption("", "", OPTION_FLAG_NONE)
  676.       _progressBar = AddTextOption("", "", OPTION_FLAG_NONE)
  677.    
  678.   endif
  679.  
  680.   if !dontTouchFilePathExists
  681.     ShowMessage("Important file missing: \" ..\\Data\\SKSE\\Plugins\\StorageUtilData\\Ethereal Incarnation\\cm_DONOTTOUCHTHIS.json\\\"! Without this file certain mods and items will not be skipped in various functions for convenience sake! To restore the file simply reinstall the mod.",false)
  682.   endif
  683.    
  684. endEvent
  685.  
  686.  
  687. Bool function ContainerHandler(String whatToDo, String stringValue = "", Int intValue = 0, String stringValue2 = "")
  688. ;workingch
  689.   if whatToDo == "sort"
  690.     containerList = PO3_SKSEFunctions.SortArrayString(containerList)
  691.     StringArrayReplaceList(filePath, "multicontainername", containerList)
  692.     SetTextOptionValue(_multiContainerNumberOf, containerList.length + " containers stored")
  693.     if intValue == -1
  694.       JsonUtil.Save(filePath)
  695.     endif
  696.   elseif whatToDo == "add"
  697.     if JsonUtil.StringListHas(filePath,"multicontainernametoindex",stringValue)
  698.       ShowMessage("A container named " + stringValue + " already exists!")
  699.       return False
  700.     endif
  701.     Int firstBlank = JsonUtil.StringListFind(filePath, "multicontainernametoindex", "")
  702.     if firstBlank >= 0
  703.       JsonUtil.StringListSet(filePath, "multicontainernametoindex", firstBlank, stringValue)
  704.     else
  705.       JsonUtil.StringListAdd(filePath, "multicontainernametoindex", stringValue)
  706.     endif
  707.     containerList = PapyrusUtil.PushString(containerList, stringValue)
  708.     ContainerHandler("sort","",-1)
  709.     ShowMessage("Container " + stringValue + " has been added",False)
  710.    
  711.   elseif whatToDo == "delete"
  712.    
  713.     Int nameIndex = JsonUtil.StringListFind(filePath,"multicontainernametoindex",stringValue)
  714.     Int nameIndex2 = JsonUtil.StringListFind(filePath,"multicontainername",stringValue)
  715.     JsonUtil.StringListSet(filePath, "multicontainernametoindex", nameIndex, "")
  716.     containerList[nameIndex2] = ""
  717.     JsonUtil.StringListClear(filePath, "containerformid" + nameIndex)
  718.     JsonUtil.StringListClear(filePath, "containeritemquantity" + nameIndex)
  719.     JsonUtil.StringListClear(filePath, "containermodname" + nameIndex)
  720.     ContainerHandler("sort","",-1)
  721.     ShowMessage("Container " + stringValue + " has been deleted",False)
  722.   elseif whatToDo == "rename"
  723.     if JsonUtil.StringListHas(filePath,"multicontainernametoindex",stringValue2)
  724.       return False
  725.     endif
  726.     Int renameIndex1 = JsonUtil.StringListFind(filePath,"multicontainernametoindex",stringValue)
  727.     ;Int renameIndex2 = JsonUtil.StringListFind(filePath,"multicontainername",stringValue)
  728.     JsonUtil.StringListSet(filePath, "multicontainernametoindex", renameIndex1, stringValue2)
  729.     ;JsonUtil.StringListSet(filePath, "multicontainername", renameIndex2, stringValue2)
  730.     Int arrayPos = containerList.Find(stringValue)
  731.     containerList[arrayPos] = stringValue2
  732.     ContainerHandler("sort")
  733.     JsonUtil.Save(filePath)
  734.     ShowMessage("Container " + stringValue + " has been renamed to " + stringValue2,False)
  735.   endif
  736.   return TRUE
  737. endfunction
  738.  
  739. function IntArrayReplaceList(String fileNm, String listName, Int[] intArray)
  740.   Int i = 0
  741.   JsonUtil.IntListClear(fileNm,listName)
  742.   while i < intArray.length
  743.     JsonUtil.IntListAdd(fileNm,listName,intArray[i])
  744.     i += 1
  745.   endwhile
  746. endfunction
  747.  
  748. function StringArrayReplaceList(String fileNm, String listName, String[] stringArray)
  749.   Int i = 0
  750.   JsonUtil.StringListClear(fileNm,listName)
  751.   while i < stringArray.length
  752.     JsonUtil.StringListAdd(fileNm,listName,stringArray[i])
  753.     i += 1
  754.   endwhile
  755. endfunction
  756.  
  757. event OnOptionInputOpen(int option)
  758.  
  759.   if option == _multiContainerAdd
  760.     SetInputDialogStartText("New Container Name")
  761.   elseif option == _multiContainerRename
  762.     SetInputDialogStartText(containerList[currentMenuOption])
  763.   endif
  764. endevent
  765.  
  766. event OnOptionInputAccept(Int option, String optionInput)
  767.   ;add new container to list
  768.   ;select new container in list  ; working6
  769.   if option == _multiContainerAdd
  770.     ContainerHandler("add",optionInput)
  771.         SetMenuOptionValue(_multiContainerSelect, optionInput)
  772.   elseif option == _multiContainerRename
  773.     ContainerHandler("rename",containerList[currentMenuOption],0,optionInput)
  774.         SetMenuOptionValue(_multiContainerSelect, optionInput)
  775.   endif
  776.  
  777. endevent
  778.  
  779. event OnOptionMenuOpen(int option)
  780.  
  781.   if (option == _multiContainerSelect)
  782.         SetMenuDialogStartIndex(currentMenuOption)
  783.         SetMenuDialogDefaultIndex(0)
  784.         SetMenuDialogOptions(containerList)
  785.     endIf
  786.    
  787. endevent
  788.  
  789.  
  790. event OnOptionMenuAccept(int a_option, int a_index)
  791.     {Called when the user accepts a new menu entry}
  792.   ; WORKING3
  793.     if (a_option == _multiContainerSelect)
  794.         currentMenuOption = a_index
  795.         SetMenuOptionValue(a_option, containerList[currentMenuOption])
  796.     SetTextOptionValue(_multiContainerLoad, JsonUtil.IntListCount(filePath,"containerformid" + IndexMatch(currentMenuOption)) + " items")
  797.     endIf
  798. endEvent
  799.  
  800. Int function IndexMatch(Int i, String s = "")
  801.   if s
  802.     return JsonUtil.StringListFind(filePath,"multicontainernametoindex",s)
  803.   else
  804.     return JsonUtil.StringListFind(filePath,"multicontainernametoindex",JsonUtil.StringListGet(filePath,"multicontainername",i))
  805.   endif
  806. endfunction
  807.  
  808. String function LessThanRedText(Int var1, Int var2, String s = "")
  809.   String prefix = "<font color='#FF0000'>"
  810.   String suffix = "</font>"
  811.   if !s
  812.     s = var1 as String
  813.   endif
  814.   if var1 < var2
  815.     return prefix + s + suffix
  816.   endif
  817.   return s
  818. endfunction
  819.  
  820. function TerminateProcess()
  821.  
  822.   SetProgressBarTitle("Canceled by user!")
  823.   Debug.Notification("Canceled!")
  824.   terminateVar = false
  825.   EnableAllOptions()
  826.  
  827. endfunction
  828.  
  829. ;--------------------STAT STORAGE---------------------------------------------------
  830.  
  831. function loadStats()
  832.  
  833.   __storedLevel = JsonUtil.GetPathIntValue(filePath, ".skills.playerlevel")
  834.   __storedHealth = JsonUtil.GetPathFloatValue(filePath, ".skills.playerhealth") as Int
  835.   __storedMagicka = JsonUtil.GetPathFloatValue(filePath, ".skills.playermagicka") as Int
  836.   __storedStamina = JsonUtil.GetPathFloatValue(filePath, ".skills.playerstamina") as Int
  837.   __storedSpells = JsonUtil.IntListCount(filePath,"spellformid")
  838.   __storedShouts = JsonUtil.IntListCount(filePath,"shoutformid")
  839.   __storedWordsOfPower = JsonUtil.IntListCount(filePath,"wordofpowerformid")
  840.   __storedPerkPoints = JsonUtil.GetPathIntValue(filePath, ".skills.totalperkpoints")
  841.   __storedDragonSouls = JsonUtil.GetPathIntValue(filePath, ".shouts.dragonsouls")
  842.   __storedOneHanded = JsonUtil.GetPathFloatValue(filePath, ".skills.OneHanded.skilllevel") as Int
  843.   __storedTwoHanded = JsonUtil.GetPathFloatValue(filePath, ".skills.TwoHanded.skilllevel") as Int
  844.   __storedMarksman = JsonUtil.GetPathFloatValue(filePath, ".skills.Marksman.skilllevel") as Int
  845.   __storedBlock = JsonUtil.GetPathFloatValue(filePath, ".skills.Block.skilllevel") as Int
  846.   __storedSmithing = JsonUtil.GetPathFloatValue(filePath, ".skills.Smithing.skilllevel") as Int
  847.   __storedHeavyArmor = JsonUtil.GetPathFloatValue(filePath, ".skills.HeavyArmor.skilllevel") as Int
  848.   __storedLightArmor = JsonUtil.GetPathFloatValue(filePath, ".skills.LightArmor.skilllevel") as Int
  849.   __storedPickpocket = JsonUtil.GetPathFloatValue(filePath, ".skills.Pickpocket.skilllevel") as Int
  850.   __storedLockpicking = JsonUtil.GetPathFloatValue(filePath, ".skills.Lockpicking.skilllevel") as Int
  851.   __storedSneak = JsonUtil.GetPathFloatValue(filePath, ".skills.Sneak.skilllevel") as Int
  852.   __storedAlchemy = JsonUtil.GetPathFloatValue(filePath, ".skills.Alchemy.skilllevel") as Int
  853.   __storedSpeechcraft = JsonUtil.GetPathFloatValue(filePath, ".skills.Speechcraft.skilllevel") as Int
  854.   __storedAlteration = JsonUtil.GetPathFloatValue(filePath, ".skills.Alteration.skilllevel") as Int
  855.   __storedConjuration = JsonUtil.GetPathFloatValue(filePath, ".skills.Conjuration.skilllevel") as Int
  856.   __storedDestruction = JsonUtil.GetPathFloatValue(filePath, ".skills.Destruction.skilllevel") as Int
  857.   __storedIllusion = JsonUtil.GetPathFloatValue(filePath, ".skills.Illusion.skilllevel") as Int
  858.   __storedRestoration = JsonUtil.GetPathFloatValue(filePath, ".skills.Restoration.skilllevel") as Int
  859.   __storedEnchanting = JsonUtil.GetPathFloatValue(filePath, ".skills.Enchanting.skilllevel") as Int
  860.   __storedCarryWeight = JsonUtil.GetPathFloatValue(filePath, ".skills.playercarryweight") as Int
  861.   __storedBooksRead = JsonUtil.IntListCount(filePath, "bookformid")
  862.   __storedInventoryItems = JsonUtil.IntListCount(filePath, "inventoryformids")
  863.   __storedContainerItems = JsonUtil.IntListCount(filePath, "containerkeylist")
  864.  
  865. endfunction
  866.  
  867. function GetStats()
  868.  
  869.   playerLevel = playerRef.GetLevel()
  870.   playerHealth = playerRef.GetBaseActorValue("Health") as Int
  871.   playerMagicka = playerRef.GetBaseActorValue("Magicka") as Int
  872.   playerStamina = playerRef.GetBaseActorValue("Stamina") as Int
  873.   playerOneHanded = playerRef.GetBaseActorValue("OneHanded") as Int
  874.   playerTwoHanded = playerRef.GetBaseActorValue("TwoHanded") as Int
  875.   playerMarksman = playerRef.GetBaseActorValue("Marksman") as Int
  876.   playerBlock = playerRef.GetBaseActorValue("Block") as Int
  877.   playerSmithing = playerRef.GetBaseActorValue("Smithing") as Int
  878.   playerHeavyArmor = playerRef.GetBaseActorValue("HeavyArmor") as Int
  879.   playerLightArmor = playerRef.GetBaseActorValue("LightArmor") as Int
  880.   playerPickpocket = playerRef.GetBaseActorValue("Pickpocket") as Int
  881.   playerLockpicking = playerRef.GetBaseActorValue("Lockpicking") as Int
  882.   playerSneak = playerRef.GetBaseActorValue("Sneak") as Int
  883.   playerAlchemy = playerRef.GetBaseActorValue("Alchemy") as Int
  884.   playerSpeechcraft = playerRef.GetBaseActorValue("Speechcraft") as Int
  885.   playerAlteration = playerRef.GetBaseActorValue("Alteration") as Int
  886.   playerConjuration = playerRef.GetBaseActorValue("Conjuration") as Int
  887.   playerDestruction = playerRef.GetBaseActorValue("Destruction") as Int
  888.   playerIllusion = playerRef.GetBaseActorValue("Illusion") as Int
  889.   playerRestoration = playerRef.GetBaseActorValue("Restoration") as Int
  890.   playerEnchanting = playerRef.GetBaseActorValue("Enchanting") as Int
  891.   playerCarryWeight = playerRef.GetBaseActorValue("CarryWeight") as Int
  892.  
  893. endfunction
  894.  
  895. ;  --------------------PROGRESS BAR---------------------------------------------------
  896.  
  897. function AdvanceProgressBar(Int progressNum,Int totalNum, Bool reverse = false)
  898.   Int numDots = 60
  899.   if reverse
  900.     progressBarProgress = (((totalNum - progressNum) as Float)/(totalNum as Float))
  901.   else
  902.     progressBarProgress = ((progressNum as Float)/(totalNum as Float))
  903.   endif
  904.   Int totalDots = Math.Floor(progressBarProgress * numDots)
  905.   String loopString = progressVar
  906.   while progressVarIndex < totalDots
  907.     ;if (totalDots as Float)/10 == (numDots/10)
  908.       ;loopString = cmlib.SetNthChar(loopString,"|",progressVarIndex)
  909.       ;loopString = cmlib.SubStringInsert(loopString,"|","x")
  910.     ;else
  911.       loopString = cmlib.SetNthChar(loopString,".",progressVarIndex)
  912.       ;loopString = cmlib.SubStringInsert(loopString,".","x")
  913.     ;endif
  914.     progressVarIndex += 1
  915.   endwhile
  916.   progressVar = loopString
  917.   SetTextOptionValue(_progressBar, progressVar)
  918. endfunction
  919.  
  920. function SetProgressBarTitle(String sTitle)
  921.   SetTextOptionValue(_progressBarTitle, sTitle)
  922.   progressBarProgress = 0
  923.   ;progressVar = "x                                                                                                    x"
  924.   progressVar = "                                                               |"
  925.   progressVarIndex = 1
  926.   SetTextOptionValue(_progressBar, progressVar)
  927. endfunction
  928.  
  929. ;--------------------CLOUD CONTAINER------------------------------------------------
  930.  
  931. function SetCloudContainer(ObjectReference objFocus)
  932.  
  933.   if !cmlib.IsContainer(objFocus)
  934.     ShowMessage("Failure! The game doesn't recognize that as a container.",False)
  935.     return
  936.   elseif objFocus.GetActorOwner() != playerBase && !playerRef.IsInFaction(cmlib.GetInheritedOwner(ObjFocus))
  937.     ShowMessage("Only containers owned by the player may be assigned as the cloud container.",False)
  938.     return
  939.   elseif getIsCCAssigned(ObjFoc)
  940.     if ShowMessage("This container is already assigned as the cloud container. Do you want to unassign it?")
  941.       cm_CloudContainer09.Clear()
  942.       SetTextOptionValue(_displayCloudContainerItemQty, "<font color='#FFFF00'>Unassigned</font>")
  943.       SetTextOptionValue(_setCloud,"<font color='#00FF00'>Assign</font>")
  944.       SetOptionFlags(_depCloud, OPTION_FLAG_DISABLED)
  945.       isThisTheCC = 0
  946.       isCCAssigned = 0
  947.       ForcePageReset()
  948.       return
  949.     endif
  950.   elseif cmlib.IsContainer(cm_CloudContainer09.GetReference()) && !getIsCCAssigned(ObjFoc) && ShowMessage("Are you sure you want to reassign the cloud container?")
  951.     cm_CloudContainer09.ForceRefTo(objFocus)
  952.     isCCAssigned = 1
  953.     isThisTheCC = 1
  954.     SetTextOptionValue(_scrollDownToAssignCloudContainer, "")
  955.     SetOptionFlags(_scrollDownToAssignCloudContainer, OPTION_FLAG_HIDDEN)
  956.     SetOptionFlags(_depCloud, OPTION_FLAG_NONE)
  957.     SetTextOptionValue(_setCloud,"<font color='#FFFF00'>Unassign</font>")
  958.   else
  959.     cm_CloudContainer09.ForceRefTo(objFocus)
  960.     isCCAssigned = 1
  961.     isThisTheCC = 1
  962.     SetOptionFlags(_depCloud, OPTION_FLAG_NONE)
  963.     SetOptionFlags(_scrollDownToAssignCloudContainer, OPTION_FLAG_HIDDEN)
  964.     SetTextOptionValue(_setCloud,"<font color='#FFFF00'>Unassign</font>")
  965.     ;ForcePageReset()
  966.   endif
  967.  
  968.   ;JsonUtil.Save(filePath)
  969.   numItemsCC = cm_CloudContainer09.GetReference().GetNumItems()
  970.   SetTextOptionValue(_displayCloudContainerItemQty, numItemsCC)
  971. endfunction
  972.  
  973. Int function getIsCCAssigned(ObjectReference objFocus = None)
  974.   if objFocus
  975.     return (cm_CloudContainer09.GetReference() == objFocus) as Int
  976.   elseif cm_CloudContainer09.GetReference().GetBaseObject() as Container
  977.     return 1
  978.   else
  979.     return 0
  980.   endif
  981. endfunction
  982.  
  983. ;--------------------SKILLS---------------------------------------------------------
  984.  
  985. function SaveSkills(Actor playerAct, String pathNm)
  986.  
  987.   if perkModInstalled && !ShowMessage("A perk point mod such as Ordinator, Vokrii, Smithing Perks Overhaul, Adamant or PerMa has been detected. This may cause unpredictable results. You can however always add and remove perk points using the buttons in the menu.\nDo you want to proceed?", True, "$Yes","$No")
  988.     return
  989.   elseif !ShowMessage("This will replace the stored player stats. Do you want to proceed?")
  990.     return
  991.   endif
  992.  
  993.   DisableAllOptions()
  994.   SetProgressBarTitle("Saving stats...")
  995.  
  996.   Int iSkillIndex = 0
  997.   Float curSkillLvl
  998.   Int storedSkillVal
  999.   ActorValueInfo avi
  1000.   Int legendaryLevel
  1001.   playerPerkPoints = Game.GetPerkPoints()
  1002.   String responseString
  1003.   String responseSuffix
  1004.   playerTotalPerkPoints = cmlib.TotalPerkPoints(PlayerAct,skillArray)
  1005.   playerLevel = playerAct.GetLevel()
  1006.   playerLevelXP = Game.GetPlayerExperience() as Int
  1007.   playerHealth = playerAct.GetBaseActorValue("Health") as Int
  1008.   playerMagicka = playerAct.GetBaseActorValue("Magicka") as Int
  1009.   playerStamina = playerAct.GetBaseActorValue("Stamina") as Int
  1010.   playerCarryWeight = playerAct.GetBaseActorValue("CarryWeight") as Int
  1011.  
  1012. ; Clear existing to prepare
  1013.   JsonUtil.ClearPath(pathNm, ".skills")
  1014.  
  1015.   JsonUtil.SetPathIntValue(pathNm, ".skills.totalperkpoints", playerTotalPerkPoints)
  1016.  
  1017.   JsonUtil.SetPathIntValue(pathNm, ".skills.playerlevel", playerLevel)
  1018.   JsonUtil.SetPathFloatValue(pathNm, ".skills.playerxp", playerLevelXP)
  1019.   JsonUtil.SetPathFloatValue(pathNm, ".skills.playerhealth", playerHealth)
  1020.   JsonUtil.SetPathFloatValue(pathNm, ".skills.playermagicka", playerMagicka)
  1021.   JsonUtil.SetPathFloatValue(pathNm, ".skills.playerstamina", playerStamina)
  1022.   JsonUtil.SetPathFloatValue(pathNm, ".skills.playercarryweight", playerCarryWeight)
  1023.   iSkillIndex = 0
  1024.  
  1025.   while (iSkillIndex < 18)
  1026.     avi = ActorValueInfo.GetActorValueInfoByName(skillArray[iSkillIndex])
  1027.     curSkillLvl = playerAct.GetBaseActorValue(skillArray[iSkillIndex])
  1028.     legendaryLevel = avi.GetSkillLegendaryLevel()
  1029.     JsonUtil.SetPathFloatValue(pathNm, ".skills." + skillArray[iSkillIndex] + ".skilllevel", curSkillLvl)
  1030.     JsonUtil.SetPathIntValue(pathNm, ".skills." + skillArray[iSkillIndex] + ".legendarylevel", legendaryLevel)
  1031.     iSkillIndex += 1
  1032.   endwhile
  1033.  
  1034.   responseString = "Success, skills"
  1035.   responseSuffix = " were successfully recorded!"
  1036.  
  1037. ; Confirmation
  1038.   if JsonUtil.Save(filePath)
  1039.     if playerTotalPerkPoints
  1040.       ShowMessage(responseString + " and " + playerTotalPerkPoints + " perkPoints" + responseSuffix,False)
  1041.     else
  1042.       ShowMessage(responseString + responseSuffix,False)
  1043.     endif
  1044.   else
  1045.     ShowMessage("Failure, for an unknown reason the data couldn't be written to the hard drive!",False)
  1046.   endif
  1047.  
  1048.   LoadStats()
  1049.   GetStats()
  1050.  
  1051.   EnableAllOptions()
  1052.  
  1053. endFunction
  1054.  
  1055. function LoadSkills(Actor PlayerAct, String pathNm)
  1056.  
  1057.   if perkModInstalled && !ShowMessage("A perk point mod such as Ordinator, Vokrii, Smithing Perks Overhaul or PerMa has been detected which may cause unpredictable results. Would you like to continue? (You can manually correct any miscalculations using the add/subtract function in this mod)", true, "$Yes", "$No")
  1058.     return
  1059.   elseif !ShowMessage("Are you sure you want to restore the stored skill values?")
  1060.     return
  1061.   endif
  1062.  
  1063.   if !cuInstalled && !ShowMessage("Because ConsoleUtil SSE isn't installed, your level won't be set automatically and will have to be set manually. After this process completes type this into the console:\nplayer.setlevel " + __storedLevel + "\nDo you want to proceed?",True,"$Yes","$No")
  1064.     return
  1065.   endif
  1066.  
  1067.   DisableAllOptions()
  1068.  
  1069.   Float savedSkillLvl
  1070.   Float curSkillLevel
  1071.   Float curSkillXP
  1072.  
  1073.   Int savedLegendaryLevel
  1074.   Int curLegendaryLevel
  1075.   Int numSkillsChanged = 0
  1076.   Int diff
  1077.  
  1078.   Int savedPlayerLevel = JsonUtil.GetPathIntValue(pathNm, ".skills.playerlevel")
  1079.   Int curPlayerLevel = playerAct.GetLevel()
  1080.   Float savedPlayerLevelXP = JsonUtil.GetPathFloatValue(pathNm, ".skills.playerxp")
  1081.   Float curPlayerLevelXP = Game.GetPlayerExperience()
  1082.  
  1083.   Float savedHealth = JsonUtil.GetPathFloatValue(pathNm, ".skills.playerhealth")
  1084.   Float curHealth = playerAct.GetBaseActorValue("Health")
  1085.   Float savedMagicka = JsonUtil.GetPathFloatValue(pathNm, ".skills.playermagicka")
  1086.   Float curMagicka = playerAct.GetBaseActorValue("Magicka")
  1087.   Float savedStamina = JsonUtil.GetPathFloatValue(pathNm, ".skills.playerstamina")
  1088.   Float curStamina = playerAct.GetBaseActorValue("Stamina")
  1089.   Float savedCarryWeight = JsonUtil.GetPathFloatValue(pathNm, ".skills.playercarryweight")
  1090.   Float curCarryWeight = playerAct.GetBaseActorValue("CarryWeight")
  1091.  
  1092.   if savedPlayerLevelXP >= curPlayerLevelXP
  1093.     Game.SetPlayerExperience(savedPlayerLevelXP)
  1094.   endif
  1095.  
  1096. ; Player Stats
  1097.   if savedHealth >= curHealth
  1098.     playerAct.SetActorValue("Health", savedHealth)
  1099.   endif
  1100.  
  1101.   if savedMagicka >= curMagicka
  1102.     playerAct.SetActorValue("Magicka", savedMagicka)
  1103.   endif
  1104.  
  1105.   if savedStamina >= curStamina
  1106.     playerAct.SetActorValue("Stamina", savedStamina)
  1107.   endif
  1108.  
  1109.   if savedCarryWeight >= curCarryWeight
  1110.     playerAct.SetActorValue("CarryWeight", savedCarryWeight)
  1111.   endif
  1112.  
  1113.   ActorValueInfo avi
  1114.    
  1115. ; Skills
  1116.   Int iSkillIndex = 0
  1117.   while (iSkillIndex < 18)
  1118.     avi = ActorValueInfo.GetActorValueInfoByName(skillArray[iSkillIndex])
  1119.     savedSkillLvl = JsonUtil.GetPathFloatValue(pathNm, ".skills." + skillArray[iSkillIndex] + ".skilllevel")
  1120.     curSkillLevel = playerAct.GetBaseActorValue(skillArray[iSkillIndex]) as Int
  1121.     curSkillXP = avi.GetSkillExperience()
  1122.     savedLegendaryLevel = JsonUtil.GetPathIntValue(pathNm, ".skills." + skillArray[iSkillIndex] + ".legendarylevel")
  1123.     curLegendaryLevel = avi.GetSkillLegendaryLevel()
  1124.    
  1125.     if savedSkillLvl >= curSkillLevel
  1126.       playerAct.SetActorValue(skillArray[iSkillIndex], savedSkillLvl)
  1127.     endif
  1128.    
  1129.     if savedLegendaryLevel >= curLegendaryLevel
  1130.       avi.SetSkillLegendaryLevel(savedLegendaryLevel)
  1131.     endif
  1132.    
  1133.     iSkillIndex += 1
  1134.   endwhile
  1135.  
  1136. ; Perk Points
  1137.     Int curTtlPerkPoints = cmlib.TotalPerkPoints(PlayerAct,skillArray)
  1138.     Int savedPerkPoints = JsonUtil.GetPathIntValue(pathNm, ".skills.totalperkpoints")
  1139.     diff = savedPerkPoints - curTtlPerkPoints
  1140.     if diff > 0
  1141.       Game.ModPerkPoints(diff)
  1142.     elseif diff < 0 && ShowMessage("This character's current total perk points [" + curTtlPerkPoints + "] exceeds what is stored " + savedPerkPoints + "]! Do you want to reduce your current number of perk points to match the record?",TRUE,"$Yes","$No")
  1143.       Game.ModPerkPoints(diff)
  1144.     endif
  1145. ;  endif
  1146.  
  1147. ; Player Level
  1148.   ConsoleUtil.ExecuteCommand("player.setlevel " + savedPlayerLevel)
  1149.  
  1150. ; Update variables containing stats
  1151.   LoadStats()
  1152.   GetStats()
  1153.  
  1154. ; Confirmation
  1155.   ShowMessage("Success! Player stats have been restored.",false)
  1156.  
  1157.   EnableAllOptions()
  1158.  
  1159. endFunction
  1160.  
  1161. ;--------------------SPELLS---------------------------------------------------------
  1162.  
  1163. function SaveSpells(Actor playerAct, String pathNm)
  1164.  
  1165.   if !ShowMessage("This will replace the existing spell record. Do you want to proceed? (This function takes longer than the skills function!)",true,"$Yes","$No")
  1166.     return
  1167.   endif
  1168.  
  1169.   DisableAllOptions()
  1170.   Spell[] modSpells
  1171.  
  1172.   Spell curSpell
  1173.   Shout curShout
  1174.   String nameOfMod
  1175.   Int decForm
  1176.   Int subDecForm
  1177.   String spellFullName
  1178.   String shoutFullName
  1179.   String wopFullName
  1180.  
  1181.   Int numWordsOfPower = cm_WordsOfPower.GetSize()
  1182.   Int wWoPStored = 0
  1183.   Int spellsStored = 0
  1184.   Int shoutsStored = 0
  1185.   Int wopStored = 0
  1186.   Int iModIndex = 0
  1187.  
  1188.   Int iShoutIndex = 0
  1189.   Int iWoPIndex = 0
  1190.   WordOfPower curWoP
  1191.   Int wordUnlocked
  1192.   Int wordKnown
  1193.   Form curForm
  1194.   Int numSpells
  1195.   Int numShouts = cm_Shouts.GetSize()
  1196.   String responseString
  1197.   Int numDragonSouls = PlayerAct.GetActorValue("dragonsouls") as int
  1198.   Int totalIterations = 0
  1199.   Int numMods = magicMods.length
  1200.  
  1201.   JsonUtil.ClearPath(pathNm, ".spells")
  1202.   JsonUtil.ClearPath(pathNm, ".shouts")
  1203.   JsonUtil.IntListClear(pathNm, "spellformid")
  1204.   JsonUtil.StringListClear(pathNm, "spellmodname")
  1205.   JsonUtil.IntListClear(pathNm, "shoutformid")
  1206.   JsonUtil.StringListClear(pathNm, "shoutmodname")
  1207.   JsonUtil.IntListClear(pathNm, "wordofpowerformid")
  1208.   JsonUtil.StringListClear(pathNm, "wordofpowermodname")
  1209.  
  1210.   Int iSpellIndex = 0
  1211. ;/  
  1212. ; Vanilla Spells
  1213.   numSpells = cm_vanillaSpells.GetSize()
  1214.   SetProgressBarTitle("Iterating " + numSpells + " vanilla spells")
  1215.   while (iSpellIndex < numSpells)
  1216.     AdvanceProgressBar(iSpellIndex,numSpells)
  1217.     curForm = cm_vanillaSpells.GetAt(iSpellIndex)
  1218.     ;curForm = curSpell as Form
  1219.     if playerRef.HasSpell(curSpell)
  1220.       nameOfMod = cmlib.GetFormModName(curForm)
  1221.       spellFullName = curForm.GetName()
  1222.       JsonUtil.IntListAdd(pathNm,"spellformid",cmlib.GetTheSubForm("",curSpell.GetFormID()),TRUE)
  1223.       JsonUtil.StringListAdd(pathNm,"spellmodname",magicMods[iModIndex],TRUE)
  1224.       ;JsonUtil.SetPathStringValue(pathNm, ".spells." + cmlib._ModName(nameOfMod) + "." + subDecForm + ".fullname", spellFullName)
  1225.       spellsStored += 1
  1226.     endif
  1227.     iSpellIndex += 1
  1228.     if terminateVar
  1229.       TerminateProcess()
  1230.       return
  1231.     endif
  1232.   endwhile/;
  1233.  
  1234. ; Mod Spells
  1235.   while iModIndex < numMods
  1236.     iSpellIndex = 0
  1237.     if MiscUtil.FileExists("data/" + magicMods[iModIndex])
  1238.       modSpells = PO3_SKSEFunctions.GetAllSpellsInMod(magicMods[iModIndex],None,TRUE)
  1239.       numSpells = modSpells.length
  1240.       if numSpells > 0
  1241.         nameOfMod = magicMods[iModIndex]
  1242.         SetProgressBarTitle(numSpells + " spells: " + nameOfMod)
  1243.         while (iSpellIndex < numSpells)
  1244.           AdvanceProgressBar(iSpellIndex,numSpells)
  1245.           curSpell = modSpells[iSpellIndex]
  1246.           ;curForm = curSpell as Form
  1247.           if playerRef.HasSpell(curSpell)
  1248.             spellFullName = (curSpell as Form).GetName()
  1249.             JsonUtil.IntListAdd(pathNm,"spellformid",cmlib.GetTheSubForm("",curSpell.GetFormID()),TRUE)
  1250.             JsonUtil.StringListAdd(pathNm,"spellmodname",magicMods[iModIndex],TRUE)
  1251.             spellsStored += 1
  1252.           endif
  1253.           iSpellIndex += 1  
  1254.         endwhile
  1255.       endif
  1256.     endif
  1257.     if terminateVar
  1258.       TerminateProcess()
  1259.       return
  1260.     endif
  1261.     iModIndex += 1
  1262.   endwhile
  1263.  
  1264. ; Shouts
  1265.   SetProgressBarTitle("Checking " + numShouts + " shouts...")
  1266.   while (iShoutIndex < numShouts)
  1267.     AdvanceProgressBar(iShoutIndex,numShouts)
  1268.     curForm = cm_Shouts.GetAt(iShoutIndex)
  1269.     decForm = curForm.GetFormID()
  1270.     nameOfMod = cmlib.GetFormModName(curForm)
  1271.     if modsToSkipSpells.Find(nameOfMod) == -1
  1272.       curShout = curForm as Shout
  1273.       if PlayerAct.HasSpell(curShout)
  1274.         shoutFullName = curForm.GetName()
  1275.         subDecForm = cmlib.GetTheSubForm("",decForm)
  1276.         JsonUtil.IntListAdd(pathNm,"shoutformid",subDecForm,TRUE)
  1277.         JsonUtil.StringListAdd(pathNm,"shoutmodname",nameOfMod,TRUE)
  1278.         shoutsStored += 1
  1279.       endif
  1280.     endif
  1281.     iShoutIndex += 1
  1282.     if terminateVar
  1283.       TerminateProcess()
  1284.       return
  1285.     endif
  1286.   endwhile
  1287.  
  1288. ; Words of Power
  1289.   SetProgressBarTitle("Checking " + numWordsOfPower + " words of power...")
  1290.   while (iWoPIndex < numWordsOfPower)
  1291.     AdvanceProgressBar(iWoPIndex,numWordsOfPower)
  1292.     curForm = cm_WordsOfPower.GetAt(iWoPIndex)
  1293.     curWoP = curForm as WordOfPower
  1294.     decForm = curForm.GetFormID()
  1295.     wordUnlocked = Game.IsWordUnlocked(curWoP) as Int
  1296.     wordKnown = curWoP.PlayerKnows() as Int
  1297.     if wordUnlocked || wordKnown
  1298.       nameOfMod = cmlib.GetFormModName(curForm)
  1299.       subDecForm = cmlib.GetTheSubForm("",decForm)
  1300.       wopFullName = curForm.GetName()
  1301.       JsonUtil.IntListAdd(pathNm,"wordofpowerformid",subDecForm,TRUE)
  1302.       JsonUtil.StringListAdd(pathNm,"wordofpowermodname",nameOfMod,TRUE)
  1303.       JsonUtil.SetPathStringValue(pathNm, ".shouts.wordsofpower." + subDecForm + ".fullname", wopFullName)
  1304.       JsonUtil.SetPathIntValue(pathNm, ".shouts.wordsofpower." + subDecForm + ".unlocked", wordUnlocked)
  1305.       JsonUtil.SetPathIntValue(pathNm, ".shouts.wordsofpower." + subDecForm + ".known", wordKnown)
  1306.       wopStored += 1
  1307.     endif
  1308.     iWoPIndex += 1
  1309.     totalIterations += 1
  1310.  
  1311.     if terminateVar
  1312.       TerminateProcess()
  1313.       return
  1314.     endif
  1315.   endwhile
  1316.  
  1317. ; Dragon souls
  1318.   JsonUtil.SetPathIntValue(pathNm, ".shouts.dragonsouls", numDragonSouls)
  1319.  
  1320. ; Confirmation
  1321.   if JsonUtil.Save(filePath)
  1322.     responseString = "Success! Saved:"
  1323.     if spellsStored
  1324.       responseString = responseString + "\nSpell(s): " + spellsStored
  1325.     endif
  1326.     if shoutsStored
  1327.       responseString = responseString + "\nShout(s): " + shoutsStored
  1328.     endif
  1329.     if wopStored
  1330.       responseString = responseString + "\nWord(s) of Power: " + wopStored
  1331.     endif
  1332.     if numDragonSouls
  1333.       responseString = responseString + "\nDragon Soul(s): " + numDragonSouls
  1334.     endif
  1335.     ShowMessage(responseString,false)
  1336.   else
  1337.     ShowMessage("Failure, for an unknown reason data cannot be written to hard drive!",false)
  1338.   endif
  1339.  
  1340.   __storedSpells = spellsStored
  1341.   __storedDragonSouls = numDragonSouls
  1342.   __storedShouts = shoutsStored
  1343.   __storedWordsOfPower = wopStored
  1344.  
  1345.   EnableAllOptions()
  1346.  
  1347. endFunction
  1348.  
  1349. function LoadSpells(Actor playerAct, String pathNm)
  1350.  
  1351.   if !ShowMessage("This will add the stored spells to your character. Do you want to proceed?",TRUE,"$Yes","$No")
  1352.     return
  1353.   endif
  1354.  
  1355.   DisableAllOptions()
  1356.  
  1357.   Int subDecForm
  1358.   String nameOfMod
  1359.   Int spellsLearned = 0
  1360.   Int spellFailed = 0
  1361.   Int shoutsLearned = 0
  1362.   Int shoutsFailed = 0
  1363.   Int wWoPLearned = 0
  1364.   Int wWoPFailed = 0
  1365.   Int wWoPUnlocked = 0
  1366.   Int unKnown = 0
  1367.   Form curForm
  1368.   Spell curSpell
  1369.   Shout curShout
  1370.   WordOfPower curWoP
  1371.   Int iSpellsIndex = 0
  1372.   Int iShoutsIndex = 0
  1373.   Int iWoPIndex = 0
  1374.   Int totalIterations = 0
  1375.  
  1376.   Int totalSpells = JsonUtil.IntListCount(pathNm, "spellformid")
  1377.   Int totalShouts = JsonUtil.IntListCount(pathNm, "shoutformid")
  1378.   Int numWordsOfPower = JsonUtil.IntListCount(pathNm, "wordofpowerformid")
  1379.   Int numDragonSouls = JsonUtil.GetPathIntValue(pathNm, ".shouts.dragonsouls")
  1380.  
  1381. ; Spells
  1382.   SetProgressBarTitle("Restoring " + totalSpells + " spells...")
  1383.   while iSpellsIndex < totalSpells
  1384.     AdvanceProgressBar(iSpellsIndex,totalSpells)
  1385.     subDecForm = JsonUtil.IntListGet(pathNm,"spellformid",iSpellsIndex)
  1386.     nameOfMod = JsonUtil.StringListGet(pathNm,"spellmodname",iSpellsIndex)
  1387.     curForm = Game.GetFormFromFile(subDecForm,nameOfMod)
  1388.     curSpell = curForm as Spell
  1389.     if !playerAct.HasSpell(curForm)
  1390.       if playerAct.AddSpell(curSpell, false)
  1391.         spellsLearned += 1
  1392.       else
  1393.         spellFailed += 1
  1394.       endif
  1395.     endif
  1396.     iSpellsIndex += 1
  1397.     totalIterations += 1
  1398.     if terminateVar
  1399.       TerminateProcess()
  1400.       return
  1401.     endif
  1402.   endwhile
  1403.  
  1404. ; Shouts
  1405.   if totalShouts
  1406.     SetProgressBarTitle("Restoring " + totalShouts + " shouts...")
  1407.     while (iShoutsIndex < totalShouts)
  1408.       AdvanceProgressBar(iShoutsIndex,totalShouts)
  1409.       subDecForm = JsonUtil.IntListGet(pathNm, "shoutformid", iShoutsIndex)
  1410.       nameOfMod = JsonUtil.StringListGet(pathNm, "shoutmodname", iShoutsIndex)
  1411.       curForm = Game.GetFormFromFile(subDecForm,nameOfMod)
  1412.       curShout = curForm as Shout
  1413.       if !playerAct.HasSpell(curForm)
  1414.         if playerAct.AddShout(curShout)
  1415.           shoutsLearned += 1
  1416.         else
  1417.           shoutsFailed += 1
  1418.         endif
  1419.       endif
  1420.       iShoutsIndex += 1
  1421.       totalIterations += 1
  1422.       if terminateVar
  1423.         TerminateProcess()
  1424.         return
  1425.       endif
  1426.     endwhile
  1427.   endif
  1428.  
  1429.   if numWordsOfPower
  1430.     SetProgressBarTitle("Restoring " + numWordsOfPower + " words of power...")
  1431.     while (iWoPIndex < numWordsOfPower)
  1432.       AdvanceProgressBar(iWoPIndex,numWordsOfPower)
  1433.       subDecForm = JsonUtil.IntListGet(pathNm, "wordofpowerformid", iWoPIndex)
  1434.       nameOfMod = JsonUtil.StringListGet(pathNm, "wordofpowermodname", iWoPIndex)
  1435.       curForm = Game.GetFormFromFile(subDecForm,nameOfMod)
  1436.       curWoP = curForm as WordOfPower
  1437.       if JsonUtil.GetPathIntValue(pathNm,".shouts.wordsofpower." + subDecForm + ".unlocked")
  1438.         Game.UnlockWord(curWoP)
  1439.         wWoPUnlocked += 1
  1440.       endif
  1441.       if JsonUtil.GetPathIntValue(pathNm,".shouts.wordsofpower." + subDecForm + ".known")
  1442.         Game.TeachWord(curWoP)
  1443.         wWoPLearned += 1
  1444.       endif
  1445.       iWoPIndex += 1
  1446.       totalIterations += 1
  1447.       if terminateVar
  1448.         TerminateProcess()
  1449.         return
  1450.       endif
  1451.     endwhile
  1452.   endif
  1453.  
  1454. ; Dragon souls
  1455.   if numDragonSouls
  1456.    
  1457.   endif
  1458.   Int numCurDragonSouls = PlayerAct.GetActorValue("dragonsouls") as int
  1459.   Int diff = numDragonSouls - numCurDragonSouls
  1460.   if diff > 0
  1461.     PlayerAct.ModActorValue("dragonsouls", diff)
  1462.   elseif diff < 0 && ShowMessage("This character currently has " + numCurDragonSouls + " dragon souls which exceeds the number stored: " + numDragonSouls + "! Do you want to reduce the number of unspent dragon souls to match what is saved?",TRUE,"$Yes","$No")
  1463.     PlayerAct.ModActorValue("dragonsouls", diff)
  1464.   endif
  1465.  
  1466. ; Confirmation
  1467.   string responseString = "Success! Restored:"
  1468.   if !spellsLearned && !shoutsLearned && !wWoPUnlocked && !wWoPLearned
  1469.     ShowMessage("Player already knows all that is stored!",False)
  1470.   else
  1471.     if spellsLearned
  1472.       responseString = responseString + "\nSpells: " + spellsLearned
  1473.     endif
  1474.     if shoutsLearned
  1475.       responseString = responseString + "\nShouts: " + shoutsLearned
  1476.     endif
  1477.     if wWoPUnlocked
  1478.       responseString = responseString + "\nWords of Power: " + wWoPUnlocked + " (unlocked)"
  1479.     endif
  1480.     if wWoPLearned
  1481.       responseString = responseString + "\nWords of Power: " + wWoPLearned + " (known)"
  1482.     endif
  1483.     if numDragonSouls
  1484.       responseString = responseString + "\nDragon Souls: " + numDragonSouls
  1485.     endif
  1486.     ShowMessage(responseString,false)
  1487.   endif
  1488.  
  1489.   EnableAllOptions()
  1490.  
  1491. endFunction
  1492.  
  1493. ;--------------------INVENTORY-------------------------------------------------------
  1494.  
  1495. function SaveInventory(Actor playerAct, String pathNm)
  1496.  
  1497.   if !ShowMessage("Are you sure? This will replace the existing inventory record.")
  1498.     return
  1499.   endif
  1500.  
  1501.   DisableAllOptions()
  1502.   ObjectReference refSource = playerRefAlias.GetReference()
  1503.   Form curForm
  1504.   String nameOfMod
  1505.   String formFullName
  1506.   Int itemQty
  1507.   String fullName
  1508.   Int subDecForm
  1509.   Int totalPieceCount = 0
  1510.   Int iFormIndex = 0
  1511.   Int totalIterations = 0
  1512.   Int numQuestItems = 0
  1513.   Int itemsSkipped = 0
  1514.   String[] modsSkipped
  1515.  
  1516.   PO3_SKSEFunctions.AddAllItemsToList(refSource, cm_contentsPlayerInventory, false, false, true)
  1517.   Int totalForms = cm_contentsPlayerInventory.GetSize()
  1518.    
  1519.   JsonUtil.ClearPath(pathNm,".inventory")
  1520.   JsonUtil.IntListClear(pathNm,"inventoryformid")
  1521.   JsonUtil.IntListClear(pathNm,"inventoryitemquantity")
  1522.   JsonUtil.StringListClear(pathNm,"inventorymodname")
  1523.   JsonUtil.IntListClear(pathNm,"inventoryitemequipped")
  1524.  
  1525.   JsonUtil.IntListClear(pathNm, "inventoryquestitemformid")
  1526.   JsonUtil.IntListClear(pathNm,"inventoryquestitemquantity")
  1527.   JsonUtil.StringListClear(pathNm, "inventoryquestitemmodname")
  1528.   JsonUtil.StringListClear(pathNm, "inventoryquestitemname")
  1529.  
  1530.   SetProgressBarTitle("Saving " + totalForms + " items from inventory...")
  1531.   while (iFormIndex < totalForms)
  1532.     AdvanceProgressBar(iFormIndex,totalForms)
  1533.     curForm = cm_contentsPlayerInventory.GetAt(iFormIndex)
  1534.     nameOfMod = cmlib.GetFormModName(curForm)
  1535.     if modsToSkipItems.Find(nameOfMod) < 0
  1536.       itemQty = playerAct.GetItemCount(curForm)
  1537.       formFullName = curForm.GetName()
  1538.       subDecForm = cmlib.GetTheSubForm("",curForm.GetFormID())
  1539.       if PO3_SKSEFunctions.IsQuestItem(curForm as ObjectReference)
  1540.         JsonUtil.IntListAdd(pathNm,"inventoryquestitemformid",subDecForm,TRUE)
  1541.         JsonUtil.IntListAdd(pathNm,"inventoryquestitemquantity",itemQty,TRUE)
  1542.         JsonUtil.StringListAdd(pathNm, "inventoryquestitemmodname",nameOfMod,TRUE)
  1543.         JsonUtil.StringListAdd(pathNm, "inventoryquestitemname",formFullName,TRUE)
  1544.         numQuestItems += 1
  1545.       else
  1546.         JsonUtil.IntListAdd(pathNm,"inventoryformid",subDecForm,TRUE)
  1547.         JsonUtil.IntListAdd(pathNm,"inventoryitemquantity",itemQty,TRUE)
  1548.         JsonUtil.StringListAdd(pathNm,"inventorymodname",nameOfMod,TRUE)
  1549.         JsonUtil.IntListAdd(pathNm,"inventoryitemequipped",playerAct.IsEquipped(curForm) as Int,TRUE)
  1550.       endif
  1551.       if curForm != Gold001
  1552.         totalPieceCount = totalPieceCount + itemQty
  1553.       else
  1554.         totalPieceCount = totalPieceCount + 1
  1555.       endif
  1556.     else
  1557.       itemsSkipped += 1
  1558.       modsSkipped = PapyrusUtil.PushString(modsSkipped, nameOfMod)
  1559.     endif
  1560.     iFormIndex += 1
  1561.     totalIterations += 1
  1562.     if totalIterations > (totalForms + 100)
  1563.       ShowMessage("This process seems to be malfunctioning. Terminating!",false)
  1564.       EnableAllOptions()
  1565.       return
  1566.     endif
  1567.     if terminateVar
  1568.       TerminateProcess()
  1569.       return
  1570.     endif
  1571.   endwhile
  1572.  
  1573.   if JsonUtil.Save(filePath)
  1574.     if numQuestItems
  1575.       ShowMessage("Success, " + (totalForms as Int) + " different items saved and " + numQuestItems + " different quest items saved separately!",False)
  1576.     else
  1577.       ShowMessage("Success, " + (totalForms as Int) + " different items saved!",False)
  1578.     endif
  1579.   else
  1580.     ShowMessage("Failure! For an unknown reason data was unable to be written!",False)
  1581.   endif
  1582.   if itemsSkipped
  1583.     ShowMessage("Because of rules in the settings file " + itemsSkipped + " item(s) not recorded.  Item(s) from: " + modsSkipped as String,False)
  1584.   endif
  1585.   __storedInventoryItems = totalForms as Int
  1586.   EnableAllOptions()
  1587.  
  1588. endFunction
  1589.  
  1590. function LoadInventory(Actor playerAct, String pathNm)
  1591.  
  1592.   if !ShowMessage("Are you sure you want to restore the recorded inventory items?")
  1593.     return
  1594.   endif
  1595.  
  1596.   DisableAllOptions()
  1597.  
  1598.   Int itemQty
  1599.   Int subDecForm
  1600.   String nameOfMod
  1601.   String nameOfItem
  1602.   Int isThisEquipped
  1603.   Int equipItems = 0
  1604.   Form curForm
  1605.   Int iFormIndex = 0
  1606.   Int totalIterations = 0
  1607.   Int numKeys =  JsonUtil.IntListCount(pathNm, "inventoryformid")
  1608.   Int numQuestItems = JsonUtil.IntListCount(pathNm, "inventoryquestitemformid")
  1609.   Int itemsEquipped = 0
  1610.  
  1611.   if ShowMessage("Do you want to equip the same items that were equipped when the inventory list was saved?",TRUE,"$Yes","$No")
  1612.     equipItems = 1
  1613.   endif
  1614.  
  1615.   SetProgressBarTitle("Loading " + numKeys + " different items into inventory...")
  1616.   while (iFormIndex < numKeys)
  1617.     AdvanceProgressBar(iFormIndex,numKeys)
  1618.     subDecForm = JsonUtil.IntListGet(pathNm, "inventoryformid", iFormIndex)
  1619.     itemQty = JsonUtil.IntListGet(pathNm, "inventoryitemquantity", iFormIndex)
  1620.     nameOfMod = JsonUtil.StringListGet(pathNm, "inventorymodname", iFormIndex)
  1621.  
  1622.     curForm = Game.GetFormFromFile(subDecForm, nameOfMod)
  1623.     playerAct.AddItem(curForm, itemQty, TRUE)
  1624.    
  1625.     if equipItems && JsonUtil.IntListGet(pathNm, "inventoryitemequipped", iFormIndex)
  1626.       playerAct.EquipItem(curForm,False,TRUE)
  1627.       itemsEquipped += 1
  1628.     endif
  1629.    
  1630.     iFormIndex += 1
  1631.     totalIterations += 1
  1632.     if totalIterations > (numKeys + 200)
  1633.       ShowMessage("This process seems to be malfunctioning. Terminating!",false)
  1634.       EnableAllOptions()
  1635.       return
  1636.     endif
  1637.     if terminateVar
  1638.       TerminateProcess()
  1639.       return
  1640.     endif
  1641.   endwhile
  1642.  
  1643.   ShowMessage("Success, " + numKeys + " different items loaded.",false)
  1644.    
  1645. ; Quest Items
  1646.   iFormIndex = 0
  1647.   if numQuestItems < 1
  1648.     ShowMessage("No quest items are saved so there are none to review.",False)
  1649.   elseif numQuestItems > 0 && ShowMessage("Do you want to load quest items? There are " + numQuestItems + " quest items stored. If yes, the items will be shown one item at a time for review.",TRUE,"$Yes","$No")
  1650.     while iFormIndex < numQuestItems
  1651.       subDecForm = JsonUtil.IntListGet(pathNm, "inventoryquestitemformid", iFormIndex)
  1652.       itemQty = JsonUtil.IntListGet(pathNm, "inventoryquestitemquantity", iFormIndex)
  1653.       nameOfMod = JsonUtil.StringListGet(pathNm, "inventoryquestitemmodname", iFormIndex)
  1654.       nameOfItem = JsonUtil.StringListGet(pathNm, "inventoryquestitemname", iFormIndex)
  1655.       curForm = Game.GetFormFromFile(subDecForm, nameOfMod)
  1656.       if ShowMessage("Do you want to load\nName: " + nameOfItem + "\nFrom: " + nameOfMod + "\nQty: " + itemQty + "\nFormID: " + cmlib.D2H(curForm.GetFormID()) + "\nQuantity already in inventory: " + PlayerObj.GetItemCount(curForm),TRUE,"$Yes","$No")
  1657.         playerAct.AddItem(curForm, itemQty, False)
  1658.       endif
  1659.     endwhile
  1660.   endif
  1661.  
  1662.   ShowMessage("Inventory loading process complete!",False)
  1663.   EnableAllOptions()
  1664. endFunction
  1665.  
  1666. ;--------------------CONTAINER-------------------------------------------------------
  1667.  
  1668. String function SaveContainer(ObjectReference objFocus, String pathNm, Int whichOne = -2)
  1669.  
  1670.   if !cmlib.IsContainer(objFocus)
  1671.     return "Failed! This function is only for use on containers."
  1672.   elseif objFocus.GetNumItems() <= 0
  1673.     return "The targeted container has no contents to save!"
  1674.   elseif objFocus.GetItemCount(objFocus.GetNthForm(0)) == 0
  1675.     return "Open the container, close it and then try again."
  1676.   elseif !ShowMessage("This will replace the existing container record. Proceed?")
  1677.     return "Process terminated by user."
  1678.   elseif whichOne == -2 && (JsonUtil.StringListFind(filePath, "multicontainernametoindex", containerList[currentMenuOption]) < 0)
  1679.     return "This container record cannot be found."
  1680.   else
  1681.     PO3_SKSEFunctions.AddAllItemsToList(objFocus, cm_contentsChest)
  1682.   endif
  1683.   ; working5
  1684.  
  1685.   if whichOne == -2
  1686.     whichOne = IndexMatch(0,containerList[currentMenuOption])
  1687.   endif
  1688.  
  1689.   DisableAllOptions()
  1690.  
  1691.   Int itemQty
  1692.   Form curForm
  1693.   String nameOfMod
  1694.   String formFullName
  1695.   Int decForm
  1696.   Int subDecForm
  1697.   Int totalPieceCount = 0
  1698.   Int iFormIndex = 0
  1699.   Int totalForms = cm_contentsChest.GetSize()
  1700.   Int numOfItems = 0
  1701.   Int totalIterations = 0
  1702.   Int itemsSkipped = 0
  1703.   String[] modsSkipped
  1704.  
  1705.   JsonUtil.IntListClear(pathNm,"containerformid" + whichOne)
  1706.   JsonUtil.IntListClear(pathNm,"containeritemquantity" + whichOne)
  1707.   JsonUtil.StringListClear(pathNm,"containermodname" + whichOne)
  1708.   ShowMessage("cm_contentsChest: " + cm_contentsChest.GetSize() + "\nGetNumItems: " + objFocus.GetNumItems() + "\nTotalForms: " + totalForms)
  1709.   SetProgressBarTitle("Saving " + totalForms + " items...")
  1710.   while iFormIndex < totalForms
  1711.     AdvanceProgressBar(iFormIndex,totalForms)
  1712.     curForm = cm_contentsChest.GetAt(iFormIndex)
  1713.     decForm = curForm.GetFormID()
  1714.     nameOfMod = cmlib.GetFormModName(curForm)
  1715.     if modsToSkipItems.Find(nameOfMod) < 0
  1716.       itemQty = objFocus.GetItemCount(curForm)
  1717.       formFullName = curForm.GetName()
  1718.       subDecForm = cmlib.GetTheSubForm("",decForm)
  1719.       JsonUtil.IntListAdd(pathNm,"containerformid" + whichOne,subDecForm,TRUE)
  1720.       JsonUtil.IntListAdd(pathNm,"containeritemquantity" + whichOne,itemQty,TRUE)
  1721.       JsonUtil.StringListAdd(pathNm,"containermodname" + whichOne,nameOfMod,TRUE)
  1722.       if curForm != Gold001
  1723.         totalPieceCount = totalPieceCount + itemQty
  1724.       else
  1725.         totalPieceCount = totalPieceCount + 1
  1726.       endif
  1727.       numOfItems += 1
  1728.     else
  1729.       itemsSkipped += 1
  1730.       modsSkipped = PapyrusUtil.PushString(modsSkipped, nameOfMod)
  1731.     endif
  1732.     iFormIndex += 1
  1733.  
  1734.     totalIterations += 1
  1735.     if totalIterations > (totalForms + 200)
  1736.       EnableAllOptions()
  1737.       return "The process seems to be corrupted. Terminating!"
  1738.     endif
  1739.     if terminateVar
  1740.       TerminateProcess()
  1741.       return "Process terminated!"
  1742.     endif
  1743.   endwhile
  1744.  
  1745. ; Confirmation
  1746.  
  1747.   if JsonUtil.Save(filePath)
  1748.     ShowMessage("Success! " + totalPieceCount + " individual pieces of " + numOfItems + " different items have been recorded.",False)
  1749.   else
  1750.     ShowMessage("Failure!  For an unknown reason data could not be written to disk!",False)
  1751.   endif
  1752.   if itemsSkipped
  1753.     ShowMessage("Because of rules in the settings file " + itemsSkipped + " item(s) were not recorded.  The item(s) were from the mod(s): " + modsSkipped as String,False)
  1754.   endif
  1755.   EnableAllOptions()
  1756.  
  1757. endFunction
  1758.  
  1759. function LoadContainer(ObjectReference objFocus, String pathNm, Int whichOne = -2)
  1760.  
  1761.   if !cmlib.IsContainer(objFocus)
  1762.     ShowMessage("The targeted object is not recognized by the game as a container!",False)
  1763.     return
  1764.   elseif !ShowMessage("Are you sure you want to fill the targeted container with the recorded items?")
  1765.     return
  1766.   endif
  1767.  
  1768.   DisableAllOptions()
  1769.  
  1770.   if whichOne == -2
  1771.     whichOne = IndexMatch(0,containerList[currentMenuOption])
  1772.   endif
  1773.  
  1774.   Int itemQty
  1775.   Int subDecForm
  1776.   String nameOfMod
  1777.   String formFullName
  1778.   Form curForm
  1779.   Int totalForms = 0
  1780.   Int iFormIndex = 0
  1781.   Int numKeys =  JsonUtil.IntListCount(pathNm, "containerformid" + whichOne)
  1782.  
  1783.   SetProgressBarTitle("Loading " + numKeys + " different items into container...")
  1784.   while (iFormIndex < numKeys)
  1785.     AdvanceProgressBar(iFormIndex,numKeys)
  1786.     subDecForm = JsonUtil.IntListGet(pathNm, "containerformid" + whichOne, iFormIndex)
  1787.     itemQty = JsonUtil.IntListGet(pathNm, "containeritemquantity" + whichOne, iFormIndex)
  1788.     nameOfMod = JsonUtil.StringListGet(pathNm, "containermodname" + whichOne, iFormIndex)
  1789.     curForm = Game.GetFormFromFile(subDecForm, nameOfMod)
  1790.     objFocus.AddItem(curForm, itemQty, TRUE)
  1791.     iFormIndex += 1
  1792.    
  1793.     if terminateVar
  1794.       TerminateProcess()
  1795.       return
  1796.     endif
  1797.   endwhile
  1798.  
  1799.   ShowMessage("Success, " + numKeys + " different items loaded into the targeted container!",False)
  1800.  
  1801.   EnableAllOptions()
  1802.  
  1803. endfunction
  1804.  
  1805. function EmptyContainer(ObjectReference objFocus)
  1806.  
  1807.   Int totalForms = objFocus.GetNumItems()
  1808.  
  1809.   if !cmlib.IsContainer(objFocus)
  1810.     ShowMessage("That isn't a container!",False)
  1811.     return
  1812.   elseif totalForms <= 0
  1813.     ShowMessage("The targeted container has no contents to destroy!",False)
  1814.     return
  1815.   elseif !ShowMessage("CAUTION: Are you sure you want to permanently destroy the " + objFoc.GetNumItems() + " items in the targeted container?")
  1816.     return
  1817.   else
  1818.     if !ShowMessage("Are you really, REALLY sure?")
  1819.       return
  1820.     endif
  1821.   endif
  1822.  
  1823.   DisableAllOptions()
  1824.  
  1825.   Int itemQty
  1826.   Form curForm
  1827.  
  1828.   Int iFormIndex = 0
  1829.  
  1830.   objFocus.RemoveAllItems()
  1831.  
  1832.   if objFocus.GetNumItems() < 1
  1833.     ShowMessage("Success, " + totalForms + " different items were successfully destroyed.",False)
  1834.   else
  1835.     ShowMessage("Unexpected failure? The targeted container does not appear to be empty.",False)
  1836.   endif
  1837.  
  1838.   EnableAllOptions()
  1839.  
  1840. endfunction
  1841.  
  1842. ;--------------------DEPOSIT/WITHDRAW-------------------------------------------------------
  1843.  
  1844. String function DepStuff(ObjectReference refSource, ObjectReference refDestination, Int itemType = 0, Bool cloud = False)
  1845.  
  1846.   PO3_SKSEFunctions.AddAllItemsToList(refSource, cm_contentsPlayerInventory, true, true, true)
  1847.   Int totalForms = cm_contentsPlayerInventory.GetSize()
  1848.   if IsAContainer != 1 && !cloud
  1849.     return "Failure, target is not recognized by the game as a valid container."
  1850.   elseif totalForms < 1
  1851.     return "No items to deposit"
  1852.   elseif cloud && isCCAssigned != 1
  1853.     return "No cloud container assigned"
  1854.   endif
  1855.  
  1856.   if itemType == 99
  1857.     ShowMessage("This will dump all but quest items, proceed?")
  1858.     refSource.RemoveAllItems(refDestination,TRUE)
  1859.     return "All but quest items dumped into container indiscriminately!"
  1860.   endif
  1861.  
  1862.   DisableAllOptions()
  1863.  
  1864.   Int preTotalForms = totalForms
  1865.   Int totalPieceCount = 0
  1866.   Int itemQty
  1867.   Int itemsMoved = 0
  1868.   Int curFormType
  1869.   Form curForm
  1870.   String nameOfMod
  1871.  
  1872.   Int iFormIndex = 0
  1873.   SetProgressBarTitle("Sifting through " + totalForms + " items...")
  1874.   while (iFormIndex < totalForms)
  1875.     AdvanceProgressBar(iFormIndex,totalForms)
  1876.     curForm = cm_contentsPlayerInventory.GetAt(iFormIndex)
  1877.     curFormType = curForm.GetType()
  1878.     nameOfMod = cmlib.GetFormModName(curForm)
  1879.   ; Filters to skip items based on specific list and/or mod
  1880.     if !cm_itemsToSkip.HasForm(curForm) && modstoskipitems.Find(nameOfMod) < 0 && !PO3_SKSEFunctions.IsQuestItem(curForm as ObjectReference)
  1881.     ; Cloud deposit conditions first then regular
  1882.       if (cloud && ccDepositTypeCodes.Find(curFormType) != -1) || (!cloud && curFormType == itemType)
  1883.         itemQty = refSource.GetItemCount(curForm)
  1884.         refSource.RemoveItem(curForm,itemQty,TRUE,refDestination)
  1885.         itemsMoved += 1
  1886.         if curForm == Gold001
  1887.           totalPieceCount = totalPieceCount + 1
  1888.         else
  1889.           totalPieceCount = totalPieceCount + itemQty
  1890.         endif
  1891.       endif
  1892.     endif
  1893.     if terminateVar
  1894.       TerminateProcess()
  1895.       return "Canceled by user!"
  1896.     endif
  1897.     iFormIndex += 1
  1898.   endwhile
  1899.   EnableAllOptions()
  1900.   if cloud
  1901.     numItemsCC = cm_CloudContainer09.GetReference().GetNumItems()
  1902.   endif
  1903.   if !cloud && itemsMoved < 1
  1904.     return "There were no items in the player's inventory able to be moved."
  1905.   elseif !cloud && itemsMoved
  1906.     return "Success, " + itemsMoved + " different items deposited."
  1907.   elseif itemsMoved < 1
  1908.     return "No items able to be deposited."
  1909.   elseif itemsMoved > 0
  1910.     return itemsMoved + " item(s) successfully deposited"
  1911.   else
  1912.     return "idk wth happened"
  1913.   endif
  1914.  
  1915. endfunction
  1916.  
  1917. function WdStuff(ObjectReference refSource, ObjectReference refDestination, Int itemType)
  1918.  
  1919.   ;cm_contentsChest.revert()
  1920.   PO3_SKSEFunctions.AddAllItemsToList(refSource, cm_contentsChest)
  1921.   Int totalForms = cm_contentsChest.GetSize()
  1922.   if totalForms < 1
  1923.     ShowMessage("The container has no items to withdraw!",False)
  1924.     return
  1925.   endif
  1926.  
  1927.   DisableAllOptions()
  1928.  
  1929.   ;isPlayer = (refsource == )
  1930.  
  1931.   Int totalPieceCount = 0
  1932.   Int itemQty
  1933.   Int itemsMoved = 0
  1934.   Form curForm
  1935.   Int iFormIndex = 0
  1936.   Int totalIterations = 0
  1937.  
  1938.   SetProgressBarTitle("Withdrawing items...")
  1939.   while iFormIndex < totalForms
  1940.     AdvanceProgressBar(iFormIndex,totalForms)
  1941.     curForm = cm_contentsChest.GetAt(iFormIndex)
  1942.     if curForm.GetType() == itemType
  1943.       itemQty = refSource.GetItemCount(curForm)
  1944.       refSource.RemoveItem(curForm,itemQty,TRUE,refDestination)
  1945.       itemsMoved += 1
  1946.       if curForm != Gold001
  1947.         totalPieceCount = totalPieceCount + itemQty
  1948.       else
  1949.         totalPieceCount = totalPieceCount + 1
  1950.       endif
  1951.     endif
  1952.     iFormIndex += 1
  1953.  
  1954.     if terminateVar
  1955.       TerminateProcess()
  1956.       return
  1957.     endif
  1958.   endwhile
  1959.  
  1960.   if !itemsMoved
  1961.     ShowMessage("There were no items in the container that were able to be moved.",False)
  1962.   else
  1963.     ShowMessage("Success, " + itemsMoved + " different items have been withdrawn.",False)
  1964.   endif
  1965.  
  1966.   numItemsCC = cm_CloudContainer09.GetReference().GetNumItems()
  1967.   EnableAllOptions()
  1968.  
  1969. endfunction
  1970.  
  1971. ;--------------------MAP MARKERS----------------------------------------------------
  1972.  
  1973. function SaveMapMarkers(String pathNm)
  1974.  
  1975.   if !ShowMessage("This will overwrite saved map markers. Proceed?",TRUE,"$Yes","$No")
  1976.     return
  1977.   endif
  1978.  
  1979.   DisableAllOptions()
  1980.  
  1981.   Int totalForms = 403
  1982.   Int iFormIndex = 0
  1983.   ObjectReference curObjRef
  1984.   Int markerStatus
  1985.   Int visibleOnly = 0
  1986.   Int fastTravelVisible = 0
  1987.  
  1988.   JsonUtil.IntListClear(pathNm, "mapmarkerstatelistvanilla")
  1989.  
  1990.   SetProgressBarTitle("Checking status of " + totalForms + " map markers...")
  1991.   while iFormIndex < totalForms
  1992.     AdvanceProgressBar(iFormIndex,totalForms)
  1993.     curObjRef = cm_vanillaMapMarkers.GetAt(iFormIndex) as ObjectReference
  1994.     if curObjRef.IsMapMarkerVisible()
  1995.       if curObjRef.CanFastTravelToMarker()
  1996.         markerStatus = 2
  1997.         fastTravelVisible += 1
  1998.       else
  1999.         markerStatus = 1
  2000.         visibleOnly += 1
  2001.       endif
  2002.     else
  2003.       markerStatus = 0
  2004.     endif
  2005.     JsonUtil.IntListAdd(pathNm,"mapmarkerstatelistvanilla",markerStatus,TRUE)
  2006.     iFormIndex += 1
  2007.    
  2008.     if terminateVar
  2009.       TerminateProcess()
  2010.       return
  2011.     endif
  2012.   endwhile
  2013.  
  2014. ; Confirmation
  2015.   if JsonUtil.Save(pathNm)
  2016.     if visibleOnly && fastTravelVisible
  2017.       ShowMessage(visibleOnly + " view-only markers and " + fastTravelVisible + " fast travel markers have been recorded.",False)
  2018.     elseif !visibleOnly
  2019.       ShowMessage(fastTravelVisible + " markers with fast travel successfully recorded.",False)
  2020.     elseif !fastTravelVisible
  2021.       ShowMessage(visibleOnly + " view-only markers without fast travel have been recorded.",False)
  2022.     else
  2023.       ShowMessage("For an unknown reason the game does not recognize that any map markers are visible. This is an error!",False)
  2024.     endif
  2025.   else
  2026.     ShowMessage("Failure, For an unknown reason the data was unable to be written to the hard drive!",False)
  2027.   endif
  2028.   EnableAllOptions()
  2029.  
  2030. endfunction
  2031.  
  2032. function RestoreMapMarkers(String pathNm)
  2033.  
  2034.   DisableAllOptions()
  2035.  
  2036.   Int totalForms = 404
  2037.   Int iFormIndex = 0
  2038.   ObjectReference curObjRef
  2039.   Int markerStatus
  2040.   Int visibleOnly = 0
  2041.   Int fastTravelVisible = 0
  2042.   Int totalIterations = 0
  2043.  
  2044.   SetProgressBarTitle("Loading saved map markers...")
  2045.   while (iFormIndex < totalForms)
  2046.     AdvanceProgressBar(iFormIndex,totalForms)
  2047.     curObjRef = cm_vanillaMapMarkers.GetAt(iFormIndex) as ObjectReference
  2048.     markerStatus = JsonUtil.IntListGet(pathNm,"mapmarkerstatelistvanilla",iFormIndex)
  2049.     if markerStatus == 2 && !curObjRef.CanFastTravelToMarker()
  2050.       curObjRef.AddToMap(TRUE)
  2051.       fastTravelVisible += 1
  2052.     elseif markerStatus == 1 && !curObjRef.IsMapMarkerVisible()
  2053.       curObjRef.AddToMap(False)
  2054.       visibleOnly += 1
  2055.     endif
  2056.     iFormIndex += 1
  2057.    
  2058.     totalIterations += 1
  2059.     if totalIterations > (totalForms + 200)
  2060.       ShowMessage("This process seems to be malfunctioning. Terminating!",false)
  2061.       EnableAllOptions()
  2062.       return
  2063.     endif
  2064.     if terminateVar
  2065.       TerminateProcess()
  2066.       return
  2067.     endif
  2068.   endwhile
  2069.  
  2070. ; Confirmation
  2071.   if !visibleOnly && !fastTravelVisible
  2072.     ShowMessage("No markers added, all recorded marker data is already visible!",False)
  2073.   elseif !visibleOnly
  2074.     ShowMessage(fastTravelVisible + " markers have been successfully added for fast travel.",False)
  2075.   elseif !fastTravelVisible
  2076.     ShowMessage(visibleOnly + " markers have been made visible but not available for fast travel.",False)
  2077.   else
  2078.     ShowMessage(visibleOnly + " markers have been made visible and " + fastTravelVisible + " markers have been added for fast travel.",False)
  2079.   endif
  2080.   EnableAllOptions()
  2081.  
  2082. endfunction
  2083.  
  2084. ;--------------------BOOKS----------------------------------------------------
  2085.  
  2086. function SaveBooksRead(String pathNm)
  2087.  
  2088.   if !booksFilePathExists && !ShowMessage("Important file missing: \\\"..\\Data\\SKSE\\Plugins\\StorageUtilData\\Ethereal Incarnation\\cm_BookData.json\\\"! This will disable support for books from supported mods. Reinstalling the mod should restore the file. Proceed with Vanilla Skyrim books only?", True, "$Yes", "$No")
  2089.     return
  2090.   elseif booksFilePathExists && !ShowMessage("Approx 8,600 books from 72 different mods are supported. Depending on how many supported mods are loaded this could take a long time. Do you wish to proceed?")
  2091.     return
  2092.   endif
  2093.  
  2094.   DisableAllOptions()
  2095.  
  2096.   Int iModIndex = 0
  2097.   Int iFormIndex = 0
  2098.   Bool isInstalled
  2099.   Int numMods = JsonUtil.StringListCount(booksFilePath,"bookmodlist")
  2100.   Int numBooks
  2101.   Int numVanillaBooks = cm_vanillaBooks.GetSize()
  2102.   Int numBooksRead = 0
  2103.   Int decForm
  2104.   Int subDecForm
  2105.   Form curForm
  2106.   String nameOfMod
  2107.   Int numModsDetected = 0
  2108.   String nameOfBook
  2109.   Int totalIterations = 0
  2110.   Book curBook
  2111.   String pathModName
  2112.   Int modNameChecked
  2113.  
  2114.   JsonUtil.IntListClear(pathNm, "bookformid")
  2115.   JsonUtil.StringListClear(pathNm, "bookmodname")  
  2116.  
  2117. ; All vanilla books first
  2118.   SetProgressBarTitle("[" + numVanillaBooks + " books] vanilla ...")
  2119.   while iFormIndex < numVanillaBooks
  2120.     curForm = cm_vanillaBooks.GetAt(iFormIndex)
  2121.     curBook = curForm as Book
  2122.     nameOfBook = curForm.GetName()
  2123.     decForm = curForm.GetFormID()
  2124.     nameOfMod = cmlib.GetFormModName(curForm)
  2125.     subDecForm = cmlib.GetTheSubForm("",decForm)
  2126.     if curBook.IsRead()
  2127.       JsonUtil.IntListAdd(pathNm, "bookformid", subDecForm,TRUE)
  2128.       JsonUtil.StringListAdd(pathNm, "bookmodname", nameOfMod,TRUE)
  2129.       numBooksRead += 1
  2130.     endif
  2131.     AdvanceProgressBar(iFormIndex,numVanillaBooks)
  2132.     iFormIndex += 1
  2133.     totalIterations += 1
  2134.     if totalIterations > (numVanillaBooks + 200)
  2135.       ShowMessage("This process seems to be malfunctioning. Terminating!",false)
  2136.       EnableAllOptions()
  2137.       return
  2138.     endif
  2139.     if terminateVar
  2140.       TerminateProcess()
  2141.       return
  2142.     endif
  2143.   endwhile
  2144.  
  2145.   iFormIndex = 0
  2146.  
  2147. ; All books from supported mods
  2148.   if booksFilePathExists
  2149.     while iModIndex < numMods
  2150.       nameOfMod = JsonUtil.StringListGet(booksFilePath,"bookmodlist",iModIndex)
  2151.       if MiscUtil.FileExists("data/" + nameOfMod)
  2152.         numBooks = JsonUtil.IntListCount(booksFilePath,nameOfMod)
  2153.         SetProgressBarTitle(" [" + numBooks + " books] " + nameOfMod)
  2154.         while iFormIndex < numBooks
  2155.           AdvanceProgressBar(iFormIndex,numBooks)
  2156.           subDecForm = JsonUtil.IntListGet(booksFilePath,nameOfMod,iFormIndex)
  2157.           curForm = Game.GetFormFromFile(subDecForm,nameOfMod)
  2158.           curBook = curForm as Book
  2159.           nameOfBook = curForm.GetName()
  2160.  
  2161.           if curBook.IsRead()
  2162.             JsonUtil.IntListAdd(pathNm, "bookformid", subDecForm,TRUE)
  2163.             JsonUtil.StringListAdd(pathNm, "bookmodname", nameOfMod,TRUE)
  2164.             numBooksRead += 1
  2165.           endif
  2166.           iFormIndex += 1
  2167.          
  2168.           totalIterations += 1
  2169.           if totalIterations > 10000
  2170.             ShowMessage("This process seems to be malfunctioning. Terminating!",false)
  2171.             EnableAllOptions()
  2172.             return
  2173.           endif
  2174.         endwhile
  2175.         modNameChecked = 0
  2176.         numModsDetected += 1
  2177.       endif
  2178.       iModIndex += 1
  2179.     endwhile
  2180.     if terminateVar
  2181.       TerminateProcess()
  2182.       return
  2183.     endif
  2184.   endif
  2185.  
  2186. ; Confirmation
  2187.   if JsonUtil.Save(filePath)
  2188.     if numModsDetected < 1
  2189.       ShowMessage("Success! The read status of " + numBooksRead + " books has now been recorded.",false)
  2190.     elseif numBooksRead > 0
  2191.       ShowMessage("Success, " + numModsDetected + " supported mod(s) were detected and the read status of " + numBooksRead + " different books has been recorded.",false)
  2192.     else
  2193.       ShowMessage("No books were recorded as read.",false)
  2194.     endif
  2195.   else
  2196.     ShowMessage("For an unknown reason the data couldn't be written.",false)
  2197.   endif
  2198.  
  2199.   __storedBooksRead = numBooksRead
  2200.  
  2201.   EnableAllOptions()
  2202.  
  2203. endfunction
  2204.  
  2205. function LoadBooksRead(String pathNm, ObjectReference playerObject)
  2206.  
  2207.   if !ShowMessage("It is recommended that you be in an interior cell with very little activity before performing this function! Proceed?",true,"$Yes","$No")
  2208.     return
  2209.   endif
  2210.  
  2211.   DisableAllOptions()
  2212.  
  2213.   Int numBooks
  2214.   Int iFormIndex = 0
  2215.   Int iModIndex = 0
  2216.   Int subDecForm
  2217.   Int restoreBooks = 0
  2218.   String nameOfMod
  2219.   Int numBooksRead = 0
  2220.   Int numBooksUnableToRead = 0
  2221.   Form curForm
  2222.   ObjectReference bookPlacedAtMe
  2223.   Int totalIterations
  2224.   Book curBook
  2225.  
  2226.   if ShowMessage("Would you also like for one of each book to be placed in your inventory?",TRUE,"$Yes","$No")
  2227.     restoreBooks = 1
  2228.   endif
  2229.  
  2230.   numBooks = JsonUtil.IntListCount(pathNm, "bookformid")
  2231.   SetProgressBarTitle("Loading: " + numBooks + " books...")
  2232.   while iFormIndex < numBooks
  2233.     AdvanceProgressBar(iFormIndex,numBooks)
  2234.     subDecForm = JsonUtil.IntListGet(pathNm,"bookformid",iFormIndex)
  2235.     nameOfMod = JsonUtil.StringListGet(pathNm,"bookmodname",iFormIndex)
  2236.     curForm = Game.GetFormFromFile(subDecForm,nameOfMod)
  2237.     curBook = curForm as Book
  2238.     if !curBook.IsRead()
  2239. ;/      bookPlacedAtMe = playerObject.PlaceAtMe(curForm)
  2240.       if !PO3_SKSEFunctions.IsQuestItem(bookPlacedAtMe)
  2241.         bookPlacedAtMe.Activate(playerObject)
  2242.         if curBook.IsRead()
  2243.           numBooksRead += 1
  2244.         else
  2245.           numBooksUnableToRead += 1
  2246.         endif
  2247.         if playerRef.GetItemCount(curForm) < 1 && restoreBooks
  2248.           playerObject.AddItem(bookPlacedAtMe,1,TRUE)
  2249.         else
  2250.           bookPlacedAtMe.Disable()
  2251.           bookPlacedAtMe.Delete()
  2252.         endif
  2253.       else
  2254.         bookPlacedAtMe.Disable()
  2255.         bookPlacedAtMe.Delete()
  2256.       endif /;
  2257.       if !PO3_SKSEFunctions.IsQuestItem(curForm as ObjectReference)
  2258.         PO3_SKSEFunctions.SetReadFlag(curBook)
  2259.         if curBook.IsRead()
  2260.           numBooksRead += 1
  2261.         else
  2262.           numBooksUnableToRead += 1
  2263.         endif
  2264.         if restoreBooks
  2265.           playerObject.AddItem(curForm,1,TRUE)
  2266.         endif
  2267.       endif
  2268.     endif
  2269.     iFormIndex += 1
  2270.     totalIterations += 1
  2271.     if totalIterations > (10000)
  2272.       ShowMessage("This process seems to be malfunctioning. Terminating!",false)
  2273.       EnableAllOptions()
  2274.       return
  2275.     endif
  2276.     if terminateVar
  2277.       TerminateProcess()
  2278.       return
  2279.     endif
  2280.   endwhile
  2281.  
  2282. ; Confirmation
  2283.   String messageText
  2284.   if (numBooksRead + numBooksUnableToRead) > 0
  2285.     messageText = "Success!\nBooks Read: " + numBooksRead + "\nBooks Unread: " + numBooksUnableToRead
  2286.   else
  2287.     ShowMessage("It appears that all saved books are already marked as having been read.",false)
  2288.   endif
  2289.   if restoreBooks
  2290.     ShowMessage(messageText + "\nAll books are in your inventory.",false)
  2291.   else
  2292.     ShowMessage(messageText,false)
  2293.   endif
  2294.   EnableAllOptions()
  2295.  
  2296. endfunction
  2297.  
  2298. ;--------------------MISC FUNCTIONS----------------------------------------------------
  2299.  
  2300. ; function to quickly add stuff in json format
  2301. function StoreStuffManually()
  2302.  
  2303. endFunction
  2304.  
  2305. function SaveModListJson()
  2306.   JsonUtil.StringListClear(filePath, "loadedmodlist")
  2307.   String nameOfMod
  2308.   Int iModIndex = 0
  2309.   Int numMods = Game.GetModCount() ;The number of active mods.
  2310.   Int totalIterations
  2311.   while iModIndex < numMods
  2312.     nameOfMod = Game.GetModName(iModIndex) ;Gets Name of Mod eg. Skyrim.esm, Update.esm, Hearthfire.esm, etc.
  2313.     JsonUtil.StringListAdd(filePath, "loadedmodlist", nameOfMod,TRUE)
  2314.     iModIndex += 1
  2315.     if iModIndex > (numMods + 100)
  2316.       return
  2317.     endif
  2318.   endwhile
  2319.   JsonUtil.Save(filePath)
  2320. endfunction
  2321.  
  2322. String Function getCellXY()
  2323.   ; learned this code from the Player Cell Position mode by Ashen (open perms)
  2324.   ; https://www.nexusmods.com/skyrimspecialedition/mods/46173
  2325.   return (Math.Floor(playerRef.GetPositionX()/4096)) as Int+","+(Math.Floor(playerRef.GetPositionY()/4096)) as Int
  2326. endfunction
  2327.  
  2328. function EvaluateTarget()
  2329.  
  2330.   isCCAssigned = getIsCCAssigned()
  2331.   if isCCAssigned < 1
  2332.     isThisTheCC = 0
  2333.   else
  2334.     isThisTheCC = getIsCCAssigned(ObjFoc)
  2335.     numItemsCC = cm_CloudContainer09.GetReference().GetNumItems()
  2336.     isCCAssigned = 1
  2337.   endif
  2338.  
  2339.   if objFoc
  2340.     if objIsActor == -1 ; If this check has been performed all else is already done
  2341.       if (objFoc as Actor).GetLevel() < 1
  2342.         objIsActor = 0
  2343.         objActor = None
  2344.         objActorBase = None
  2345.         if isAContainer == -1
  2346.           isAContainer = cmlib.IsContainer(objFoc) as Int
  2347.         endif
  2348.         if objOwner == None || objIsOwned < 0
  2349.           objOwner = cmlib.GetOwner(objFoc)
  2350.           if objOwner
  2351.             objIsOwned = 1
  2352.             if objOwner == playerRef.GetActorBase() as Form
  2353.               objOwnedByPlayer = 1
  2354.             else
  2355.               objOwnedByPlayer = 0
  2356.             endif
  2357.           else
  2358.             objIsOwned = 0
  2359.             objOwnedByPlayer = 0
  2360.           endif
  2361.         endif
  2362.       else ; Is an actor
  2363.         objIsActor = 1
  2364.         objActorBase = objActor.GetActorBase()
  2365.       endif
  2366.     endif
  2367.   endif
  2368.  
  2369. endfunction
  2370.  
  2371. ;--------------------MENU FUNCTIONS----------------------------------------------------
  2372.  
  2373. function DisableSkills()
  2374.  
  2375.   SetOptionFlags(_saveSkills, OPTION_FLAG_DISABLED)
  2376.   SetOptionFlags(_loadSkills, OPTION_FLAG_DISABLED)
  2377.  
  2378. endfunction
  2379.  
  2380. function DisableSpellsAndInventory()
  2381.  
  2382.   SetOptionFlags(_saveSpells, OPTION_FLAG_DISABLED)
  2383.   SetOptionFlags(_loadSpells, OPTION_FLAG_DISABLED)
  2384.   SetOptionFlags(_saveInventory, OPTION_FLAG_DISABLED)
  2385.   SetOptionFlags(_loadInventory, OPTION_FLAG_DISABLED)
  2386.   SetOptionFlags(_saveContainer, OPTION_FLAG_DISABLED)
  2387.   SetOptionFlags(_loadContainer, OPTION_FLAG_DISABLED)
  2388.  
  2389. endfunction
  2390.  
  2391. function DisableAllOptions()
  2392.  
  2393.   isScriptRunning = TRUE
  2394.   SetOptionFlags(_saveSkills, OPTION_FLAG_DISABLED)
  2395.   SetOptionFlags(_loadSkills, OPTION_FLAG_DISABLED)
  2396.   SetOptionFlags(_saveSpells, OPTION_FLAG_DISABLED)
  2397.   SetOptionFlags(_loadSpells, OPTION_FLAG_DISABLED)
  2398.   SetOptionFlags(_saveInventory, OPTION_FLAG_DISABLED)
  2399.   SetOptionFlags(_loadInventory, OPTION_FLAG_DISABLED)
  2400.   SetOptionFlags(_saveContainer, OPTION_FLAG_DISABLED)
  2401.   SetOptionFlags(_loadContainer, OPTION_FLAG_DISABLED)
  2402.   SetOptionFlags(_emptyContainer, OPTION_FLAG_DISABLED)
  2403.   SetOptionFlags(_depArmor, OPTION_FLAG_DISABLED)
  2404.   SetOptionFlags(_depWeapons, OPTION_FLAG_DISABLED)
  2405.   SetOptionFlags(_depIngestibles, OPTION_FLAG_DISABLED)
  2406.   SetOptionFlags(_depIngredients, OPTION_FLAG_DISABLED)
  2407.   SetOptionFlags(_depBooks, OPTION_FLAG_DISABLED)
  2408.   SetOptionFlags(_depSoulGems, OPTION_FLAG_DISABLED)
  2409.   SetOptionFlags(_depMisc, OPTION_FLAG_DISABLED)
  2410.   SetOptionFlags(_depEverything, OPTION_FLAG_DISABLED)
  2411.   SetOptionFlags(_wdArmor, OPTION_FLAG_DISABLED)
  2412.   SetOptionFlags(_wdWeapons, OPTION_FLAG_DISABLED)
  2413.   SetOptionFlags(_wdIngestibles, OPTION_FLAG_DISABLED)
  2414.   SetOptionFlags(_wdIngredients, OPTION_FLAG_DISABLED)
  2415.   SetOptionFlags(_wdBooks, OPTION_FLAG_DISABLED)
  2416.   SetOptionFlags(_wdSoulGems, OPTION_FLAG_DISABLED)
  2417.   SetOptionFlags(_wdMisc, OPTION_FLAG_DISABLED)
  2418.   SetOptionFlags(_depCloud, OPTION_FLAG_DISABLED)
  2419.   SetOptionFlags(_setCloud, OPTION_FLAG_DISABLED)
  2420.   SetOptionFlags(_saveMapMarkers, OPTION_FLAG_DISABLED)
  2421.   SetOptionFlags(_restoreMapMarkers, OPTION_FLAG_DISABLED)
  2422.   SetOptionFlags(_saveReadBooks, OPTION_FLAG_DISABLED)
  2423.   SetOptionFlags(_loadReadBooks, OPTION_FLAG_DISABLED)
  2424.   SetOptionFlags(_addPerkPoint, OPTION_FLAG_DISABLED)
  2425.   SetOptionFlags(_removePerkPoint, OPTION_FLAG_DISABLED)
  2426.  
  2427. endfunction
  2428.  
  2429. function EnableAllOptions(Bool check = False)
  2430.  
  2431.   isScriptRunning = False
  2432.   SetOptionFlags(_saveSkills, OPTION_FLAG_NONE)
  2433.   SetOptionFlags(_loadSkills, OPTION_FLAG_NONE)
  2434.   SetOptionFlags(_saveInventory, OPTION_FLAG_NONE)
  2435.   SetOptionFlags(_loadInventory, OPTION_FLAG_NONE)
  2436.   SetOptionFlags(_saveContainer, OPTION_FLAG_NONE)
  2437.   SetOptionFlags(_loadContainer, OPTION_FLAG_NONE)
  2438.   SetOptionFlags(_emptyContainer, OPTION_FLAG_NONE)
  2439.   SetOptionFlags(_depArmor, OPTION_FLAG_NONE)
  2440.   SetOptionFlags(_depWeapons, OPTION_FLAG_NONE)
  2441.   SetOptionFlags(_depIngestibles, OPTION_FLAG_NONE)
  2442.   SetOptionFlags(_depIngredients, OPTION_FLAG_NONE)
  2443.   SetOptionFlags(_depBooks, OPTION_FLAG_NONE)
  2444.   SetOptionFlags(_depSoulGems, OPTION_FLAG_NONE)
  2445.   SetOptionFlags(_depMisc, OPTION_FLAG_NONE)
  2446.   SetOptionFlags(_depEverything, OPTION_FLAG_NONE)
  2447.   SetOptionFlags(_wdArmor, OPTION_FLAG_NONE)
  2448.   SetOptionFlags(_wdWeapons, OPTION_FLAG_NONE)
  2449.   SetOptionFlags(_wdIngestibles, OPTION_FLAG_NONE)
  2450.   SetOptionFlags(_wdIngredients, OPTION_FLAG_NONE)
  2451.   SetOptionFlags(_wdBooks, OPTION_FLAG_NONE)
  2452.   SetOptionFlags(_wdSoulGems, OPTION_FLAG_NONE)
  2453.   SetOptionFlags(_wdMisc, OPTION_FLAG_NONE)
  2454.   SetOptionFlags(_depCloud, OPTION_FLAG_NONE)
  2455.   SetOptionFlags(_setCloud, OPTION_FLAG_NONE)
  2456.   SetOptionFlags(_saveMapMarkers, OPTION_FLAG_NONE)
  2457.   SetOptionFlags(_restoreMapMarkers, OPTION_FLAG_NONE)
  2458.   SetOptionFlags(_saveReadBooks, OPTION_FLAG_NONE)
  2459.   SetOptionFlags(_loadReadBooks, OPTION_FLAG_NONE)
  2460.   SetOptionFlags(_addPerkPoint, OPTION_FLAG_NONE)
  2461.   SetOptionFlags(_removePerkPoint, OPTION_FLAG_NONE)
  2462.   SetInfoText("")
  2463.   SetTextOptionValue(_progressBar, "")
  2464.   SetTextOptionValue(_progressBarTitle, "")
  2465.   loadStats()
  2466.   cm_contentsChest.Revert()
  2467.   cm_contentsPlayerInventory.Revert()
  2468.   cm_contentsCloudContainer.Revert()
  2469.   cm_genericChest.Revert()
  2470.  
  2471. endfunction
  2472.  
  2473. ;--------------------STARTUP/EVENTS----------------------------------------------------
  2474.  
  2475. function OnGameReload()
  2476.   RegisterForCrosshairRef()
  2477.   filesCheckedYet = -1
  2478.   VarValInit()
  2479.   parent.OnGameReload()
  2480. endfunction
  2481.  
  2482. event OnInit()
  2483.   filesCheckedYet = -1
  2484.   VarValInit()
  2485.   parent.OnInit()
  2486. endevent
  2487.  
  2488. event OnConfigInit()
  2489.   VarValInit()
  2490. endEvent
  2491.  
  2492. event OnPlayerLoadGame()
  2493.   RegisterForCrosshairRef()
  2494.   filesCheckedYet = -1
  2495.   VarValInit()
  2496. endevent
  2497.  
  2498. event OnConfigClose()
  2499.   if isScriptRunning
  2500.     terminateVar = true
  2501.     TerminateProcess()
  2502.     debug.Messagebox("Ethereal Incarnation process terminated! Prior data is lost but partial progress may have been saved.")
  2503.   endif
  2504.   _isTargetEssential = -1
  2505.   _isTargetProtected = -1
  2506.   isAContainer = -1
  2507.   isCCAssigned = -1
  2508.   isPlayerOwner = -1
  2509.   isThisTheCC = -1
  2510.   numItemsCC = -1
  2511.   objIsActor = -1
  2512.   objIsOwned = -1
  2513.   objOwnedByPlayer = -1
  2514.   numPlayerItems = -1
  2515.   cm_contentsChest.Revert()
  2516.   cm_contentsPlayerInventory.Revert()
  2517.   cm_contentsCloudContainer.Revert()
  2518.   cm_genericChest.Revert()
  2519. endevent
  2520.  
  2521. event OnConfigOpen()
  2522.   if !isScriptRunning
  2523.     terminateVar = false
  2524.   else
  2525.     ShowMessage("A running process has been terminated!")
  2526.     terminateVar = true
  2527.   endif
  2528.   ;EvaluateTarget()
  2529.   VarValInit()
  2530.   LoadStats()
  2531.   GetStats()
  2532. endevent
  2533.  
  2534. ; functions to run when selecting an option
  2535. event OnOptionSelect(Int option)
  2536.   if option == _saveSkills
  2537.     SaveSkills(playerRef, filePath)
  2538.   elseif option == _loadSkills
  2539.     LoadSkills(playerRef, filePath)
  2540.   elseif option == _saveSpells
  2541.     SaveSpells(playerRef, filePath)
  2542.   elseif option == _loadSpells
  2543.     LoadSpells(playerRef, filePath)
  2544.   elseif option == _saveInventory
  2545.     SaveInventory(playerRef, filePath)
  2546.   elseif option == _loadInventory
  2547.     LoadInventory(playerRef, filePath)
  2548.   elseif option == _saveContainer
  2549.     SaveContainer(objFoc, filePath,999999)
  2550.   elseif option == _loadContainer
  2551.     LoadContainer(objFoc, filePath,999999)
  2552.   elseif option == _emptyContainer
  2553.     emptyContainer(objFoc)
  2554.   elseif option == _depArmor
  2555.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,26),False)
  2556.   elseif option == _depWeapons
  2557.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,41),False)
  2558.   elseif option == _depIngestibles
  2559.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,46),False)
  2560.   elseif option == _depIngredients
  2561.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,30),False)
  2562.   elseif option == _depBooks
  2563.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,27),False)
  2564.   elseif option == _depSoulGems
  2565.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,52),False)
  2566.   elseif option == _depMisc
  2567.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,32),False)
  2568.   elseif option == _depEverything
  2569.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc),False)
  2570.   elseif option == _wdArmor
  2571.     WdStuff(objFoc,playerRef,26)
  2572.   elseif option == _wdWeapons
  2573.     WdStuff(objFoc,playerRef,41)
  2574.   elseif option == _wdIngestibles
  2575.     WdStuff(objFoc,playerRef,46)
  2576.   elseif option == _wdIngredients
  2577.     WdStuff(objFoc,playerRef,30)
  2578.   elseif option == _wdBooks
  2579.     WdStuff(objFoc,playerRef,27)
  2580.   elseif option == _wdSoulGems
  2581.     WdStuff(objFoc,playerRef,52)
  2582.   elseif option == _wdMisc
  2583.     WdStuff(objFoc,playerRef,32)
  2584.   elseif option == _depCloud
  2585.     ShowMessage(DepStuff(playerObj,cm_CloudContainer09.GetReference(),0,TRUE))
  2586.   elseif option == _setCloud
  2587.     SetCloudContainer(objFoc)
  2588.   elseif option == _saveMapMarkers
  2589.     SaveMapMarkers(filePath)
  2590.   elseif option == _restoreMapMarkers
  2591.     restoreMapMarkers(filePath)
  2592.   elseif option == _saveReadBooks
  2593.     SaveBooksRead(filePath)
  2594.   elseif option == _loadReadBooks
  2595.     LoadBooksRead(filePath,playerObj)
  2596.   elseif option == _addPerkPoint
  2597.     if !cmlib.givePlayerPerkPoint()
  2598.       ShowMessage("Unable to add perk point for an unknown reason!",false)
  2599.     else
  2600.       playerPerkPoints += 1
  2601.       ForcePageReset()
  2602.     endif
  2603.   elseif option == _removePerkPoint
  2604.     if !cmlib.removePlayerPerkPoint()
  2605.       ShowMessage("You cannot have less than zero perk points!",false)
  2606.     else
  2607.       playerPerkPoints -= 1
  2608.       ForcePageReset()
  2609.     endif
  2610.   elseif option == _lswScrolls
  2611.     _toggleState011 = !_toggleState011
  2612.     SetToggleOptionValue(option, _toggleState011)
  2613.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.23",_toggleState011 as Int)
  2614.     JsonUtil.Save(settingsfilepath)
  2615.   elseif option == _lswBooks
  2616.     _toggleState012 = !_toggleState012
  2617.     SetToggleOptionValue(option, _toggleState012)
  2618.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.27",_toggleState012 as Int)
  2619.     JsonUtil.Save(settingsfilepath)
  2620.   elseif option == _lswIngredients
  2621.     _toggleState013 = !_toggleState013
  2622.     SetToggleOptionValue(option, _toggleState013)
  2623.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.30",_toggleState013 as Int)
  2624.     JsonUtil.Save(settingsfilepath)
  2625.   elseif option == _lswMisc
  2626.     _toggleState014 = !_toggleState014
  2627.     SetToggleOptionValue(option, _toggleState014)
  2628.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.32",_toggleState014 as Int)
  2629.     JsonUtil.Save(settingsfilepath)
  2630.   elseif option == _lswAmmo
  2631.     _toggleState015 = !_toggleState015
  2632.     SetToggleOptionValue(option, _toggleState015)
  2633.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.42",_toggleState015 as Int)
  2634.     JsonUtil.Save(settingsfilepath)
  2635.   elseif option == _lswIngestibles
  2636.     _toggleState016 = !_toggleState016
  2637.     SetToggleOptionValue(option, _toggleState016)
  2638.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.46",_toggleState016 as Int)
  2639.     JsonUtil.Save(settingsfilepath)
  2640.   elseif option == _lswSoulGems
  2641.     _toggleState017 = !_toggleState017
  2642.     SetToggleOptionValue(option, _toggleState017)
  2643.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.52",_toggleState017 as Int)
  2644.     JsonUtil.Save(settingsfilepath)
  2645.   elseif option == _lswQuestItems
  2646.     _toggleState018 = !_toggleState018
  2647.     SetToggleOptionValue(option, _toggleState018)
  2648.     JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.quest",_toggleState018 as Int)
  2649.     JsonUtil.Save(settingsfilepath)
  2650.   elseif option == _cloudScrolls
  2651.     _toggleState08 = !_toggleState08
  2652.     SetToggleOptionValue(option, _toggleState08)
  2653.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.23",(_toggleState08 as Int) * 23)
  2654.     GetCloudDepositOptions()
  2655.     JsonUtil.Save(settingsfilepath)
  2656.   elseif option == _cloudBooks
  2657.     _toggleState09 = !_toggleState09
  2658.     SetToggleOptionValue(option, _toggleState09)
  2659.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.27",(_toggleState09 as Int) * 27)
  2660.     GetCloudDepositOptions()
  2661.     JsonUtil.Save(settingsfilepath)
  2662.   elseif option == _cloudIngredients
  2663.   _toggleState10 = !_toggleState10
  2664.     SetToggleOptionValue(option, _toggleState10)
  2665.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.30",(_toggleState10 as Int) * 30)
  2666.     GetCloudDepositOptions()
  2667.     JsonUtil.Save(settingsfilepath)
  2668.   elseif option == _cloudMisc
  2669.     _toggleState11 = !_toggleState11
  2670.     SetToggleOptionValue(option, _toggleState11)
  2671.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.32",(_toggleState11 as Int) * 32)
  2672.     GetCloudDepositOptions()
  2673.     JsonUtil.Save(settingsfilepath)
  2674.   elseif option == _cloudAmmo
  2675.     _toggleState12 = !_toggleState12
  2676.     SetToggleOptionValue(option, _toggleState12)
  2677.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.42",(_toggleState12 as Int) * 42)
  2678.     GetCloudDepositOptions()
  2679.     JsonUtil.Save(settingsfilepath)
  2680.   elseif option == _cloudIngestibles
  2681.     _toggleState13 = !_toggleState13
  2682.     SetToggleOptionValue(option, _toggleState13)
  2683.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.46",(_toggleState13 as Int) * 46)
  2684.     GetCloudDepositOptions()
  2685.     JsonUtil.Save(settingsfilepath)
  2686.   elseif option == _cloudSoulGems
  2687.     _toggleState14 = !_toggleState14
  2688.     SetToggleOptionValue(option, _toggleState14)
  2689.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.52",(_toggleState14 as Int) * 52)
  2690.     GetCloudDepositOptions()
  2691.     JsonUtil.Save(settingsfilepath)
  2692.   elseif option == _cloudArmor
  2693.     _toggleState15 = !_toggleState15
  2694.     SetToggleOptionValue(option, _toggleState15)
  2695.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.26",(_toggleState15 as Int) * 26)
  2696.     GetCloudDepositOptions()
  2697.     JsonUtil.Save(settingsfilepath)
  2698.   elseif option == _cloudWeapons
  2699.     _toggleState16 = !_toggleState16
  2700.     SetToggleOptionValue(option, _toggleState16)
  2701.     JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.41",(_toggleState16 as Int) * 41)
  2702.     GetCloudDepositOptions()
  2703.     JsonUtil.Save(settingsfilepath)
  2704.   elseif option == _isTargetEssential
  2705.     ActorBase thatActorBase = (ObjFoc as Actor).GetActorBase()
  2706.     Actor thatActor = ObjFoc as Actor
  2707.     if ObjFoc as Actor
  2708.       thatActorBase.SetEssential(!thatActorBase.IsEssential())
  2709.       SetTextOptionValue(_isTargetEssential, "Is Essential?: " + thatActorBase.IsEssential() + " - Click2Toggle")
  2710.     endif
  2711.   elseif option == _isTargetProtected
  2712.     ActorBase thatActorBase = (ObjFoc as Actor).GetActorBase()
  2713.     Actor thatActor = ObjFoc as Actor
  2714.     if ObjFoc as Actor
  2715.       thatActorBase.SetProtected(!thatActorBase.IsProtected())
  2716.       SetTextOptionValue(_isTargetProtected, "Is Protected?: " + thatActorBase.IsProtected() + " - Click2Toggle")
  2717.     endif
  2718.   elseif option == _notShowOnStealthMeter
  2719.     (ObjFoc as Actor).SetNotShowOnStealthMeter(True)
  2720.   elseif option == _depIndiscriminatelyEverything
  2721.     ShowMessage(DepStuff(playerRef as ObjectReference,objFoc,99),False)
  2722.     SetTextOptionValue(_multiContainerLoad, JsonUtil.IntListCount(filePath,"containerformid" + IndexMatch(currentMenuOption)) + " items")
  2723.   elseif option == _multiContainerSave
  2724.     ShowMessage(SaveContainer(objFoc,filePath))
  2725.     SetTextOptionValue(_multiContainerLoad, JsonUtil.IntListCount(filePath,"containerformid" + IndexMatch(currentMenuOption)) + " items")
  2726.   elseif option == _multiContainerLoad
  2727.     LoadContainer(objFoc, filePath)
  2728.     SetTextOptionValue(_multiContainerSave, ObjFoc.GetNumItems() + " items")
  2729.   elseif option == _multiContainerDelete
  2730.   ;working4
  2731.     if ShowMessage("Are you sure you want to permanently delete this container record?",TRUE)
  2732.       ContainerHandler("delete",containerList[currentMenuOption])
  2733.       SetMenuOptionValue(_multiContainerSelect, containerList[0])
  2734.       SetTextOptionValue(_multiContainerLoad, JsonUtil.IntListCount(filePath,"containerformid" + IndexMatch(0,containerList[0])) + " items")
  2735.     endif
  2736.   endif
  2737.  
  2738. endEvent
  2739.  
  2740. event OnOptionKeyMapChange(int a_option, int a_keyCode, string a_conflictControl, string a_conflictName)
  2741. ; Called when a key has been remapped
  2742.   if (a_option == _keymapOID_K)
  2743.     bool continue = true
  2744.     if (a_conflictControl != "")
  2745.       string msg
  2746.       if (a_conflictName != "")
  2747.         msg = "This key is already mapped to:\n'" + a_conflictControl + "'\n(" + a_conflictName + ")\n\nAre you sure you want to continue?"
  2748.       else
  2749.         msg = "This key is already mapped to:\n'" + a_conflictControl + "'\n\nAre you sure you want to continue?"
  2750.       endIf
  2751.       continue = ShowMessage(msg, true, "$Yes", "$No")
  2752.     endIf
  2753.     if (continue)
  2754.       SetKeymapOptionValue(a_option, a_keyCode)
  2755.       myKeyMapVar = a_keyCode
  2756.       JsonUtil.SetPathIntValue(settingsfilepath,".settings.keymap.cloudcontainer",myKeyMapVar)
  2757.       JsonUtil.Save(settingsfilepath)
  2758.       WriteSettings()
  2759.     endIf
  2760.   endIf
  2761. endEvent
  2762.  
  2763. ; contents of the info box at the bottom of the MCM page
  2764. event OnOptionHighlight(Int option)
  2765.  
  2766.   if option == _saveSkills
  2767.     SetInfoText("Saves player health, magicka, stamina, carry weight, level, total perk points, current level xp, skill levels (including legendary levels).")
  2768.   elseif option == _loadSkills
  2769.     SetInfoText("Sets player health, magicka, stamina, carry weight, level, total perk points, current level xp, skill levels (including legendary levels) to the saved values.")
  2770.   elseif option == _saveSpells
  2771.     SetInfoText("Saves spells that are learned by books, shouts, words of power and dragon souls from supported mods. " + (magicMods.length + magicMods0.length) + " mods currently supported.")
  2772.   elseif option == _loadSpells
  2773.     SetInfoText("Adds all saved spells, shouts and words of power that are unknown to the player.")
  2774.   elseif option == _saveInventory
  2775.     SetInfoText("Saves all items in a player's inventory. DOES NOT SAVE PLAYER ENCHANTED ITEMS!")
  2776.   elseif option == _loadInventory
  2777.     SetInfoText("Loads saved items into the player's inventory.")
  2778.   elseif option == _saveContainer
  2779.     SetInfoText("Save contents of a valid targeted container. DOES NOT SAVE PLAYER ENCHANTED ITEMS!")
  2780.   elseif option == _loadContainer
  2781.     SetInfoText("Loads saved items into a valid targeted container.")
  2782.   elseif option == _emptyContainer
  2783.     SetInfoText("Destroys the contents of a valid targeted container (USE WITH CAUTION).")
  2784.   elseif option == _depArmor
  2785.     SetInfoText("Deposits unequipped and unfavorited armor, clothing and jewelry into a valid targeted container.")
  2786.   elseif option == _depWeapons
  2787.     SetInfoText("Deposits unequipped and unfavorited weapons into a valid targeted container.")
  2788.   elseif option == _depIngestibles
  2789.     SetInfoText("Deposits unfavorited ingestibles e.g. potions and food into a valid targeted container. CAUTION: This will deposit health and magicka potions as well!")
  2790.   elseif option == _depIngredients
  2791.     SetInfoText("Deposits all alchemy ingredients into a valid targeted container.")
  2792.   elseif option == _depBooks
  2793.     SetInfoText("Deposits all books and notes into a valid targeted container.")
  2794.   elseif option == _depSoulGems
  2795.     SetInfoText("Deposits all soul gems into a valid targeted container.")
  2796.   elseif option == _depMisc
  2797.     SetInfoText("Deposits all miscellaneous items e.g. ore, firewood and gems into a valid targeted container.")
  2798.   elseif option == _depEverything
  2799.     SetInfoText("Deposits all items except those equipped and favorited into a valid targeted container.")
  2800.   elseif option == _wdArmor
  2801.     SetInfoText("Withdraws all armor, clothing and jewelry contained in a valid targeted container.")
  2802.   elseif option == _wdWeapons
  2803.     SetInfoText("Withdraws all weapons contained in a valid targeted container.")
  2804.   elseif option == _wdIngestibles
  2805.     SetInfoText("Withdraws all e.g. potions and food contained in a valid targeted container.")
  2806.   elseif option == _wdIngredients
  2807.     SetInfoText("Withdraws all alchemy ingredients contained in a valid targeted container.")
  2808.   elseif option == _wdBooks
  2809.     SetInfoText("Withdraws all books and notes from the targeted container.")
  2810.   elseif option == _wdSoulGems
  2811.     SetInfoText("Withdraws all soul gems from the targeted container.")
  2812.   elseif option == _wdMisc
  2813.     SetInfoText("Withdraws all miscellaneous items such as ore, firewood and gems from the targeted container.")
  2814.   elseif option == _depCloud
  2815.     SetInfoText("Deposits all items of the types selected in options except for those favorited and equipped into the cloud container.")
  2816.   elseif option == _setCloud
  2817.     SetInfoText("Assigns, unassigns or reassigns the cloud container.")
  2818.   elseif option == _saveMapMarkers
  2819.     SetInfoText("Saves vanilla map markers including those that are visible only and those available for fast travel.")
  2820.   elseif option == _restoreMapMarkers
  2821.     SetInfoText("Adds saved map markers to the map along with their status e.g. visible only and available for fast travel.")
  2822.   elseif option == _saveReadBooks
  2823.     SetInfoText("Saves a list of all books from supported mods that the player has read.")
  2824.   elseif option == _loadReadBooks
  2825.     SetInfoText("Loads saved books, marks them as read (if possible) and then adds all of these books to the player's inventory that aren't already in player's inventory. NOTE: Books referenced by quests are neither marked as read nor added to the player's inventory.")
  2826.     elseif option == _addPerkPoint
  2827.     SetInfoText("Add one perk point to the player.")
  2828.   elseif option == _removePerkPoint
  2829.     SetInfoText("Remove one available perk point from the player.")
  2830.   elseif option == _lswScrolls
  2831.     SetInfoText("Lose Some Weight option to reduce the weight of scrolls to zero.")
  2832.   elseif option == _lswBooks
  2833.     SetInfoText("Lose Some Weight option to reduce the weight of books and notes to zero.")
  2834.   elseif option == _lswIngredients
  2835.     SetInfoText("Lose Some Weight option to reduce the weight of alchemy ingredients to zero.")
  2836.   elseif option == _lswMisc
  2837.     SetInfoText("Lose Some Weight option to reduce the weight of miscellaneous items such as ore, firewood and gems to zero.")
  2838.   elseif option == _lswAmmo
  2839.     SetInfoText("Lose Some Weight option to reduce the weight of bolts and arrows to zero.")
  2840.   elseif option == _lswIngestibles
  2841.     SetInfoText("Lose Some Weight option to reduce the weight of ingestibles e.g. potions and food to zero.")
  2842.   elseif option == _lswSoulGems
  2843.     SetInfoText("Lose Some Weight option to reduce the weight of soul gems to zero.")
  2844.   elseif option == _cloudScrolls
  2845.     SetInfoText("Include scrolls when using cloud deposit.")
  2846.   elseif option == _cloudBooks
  2847.     SetInfoText("Include books and notes when using cloud deposit.")
  2848.   elseif option == _cloudIngredients
  2849.     SetInfoText("Include alchemy ingredients when using cloud deposit.")
  2850.   elseif option == _cloudMisc
  2851.     SetInfoText("Include misc items e.g. ore, firewood and gems to zero when using cloud deposit.")
  2852.   elseif option == _cloudAmmo
  2853.     SetInfoText("Include bolts and arrows when using cloud deposit.")
  2854.   elseif option == _cloudIngestibles
  2855.     SetInfoText("Include ingestibles e.g. potions and food when using cloud deposit. CAUTION: This will deposit health and magicka potions as well!")
  2856.   elseif option == _cloudSoulGems
  2857.     SetInfoText("Include soul gems when using cloud deposit.")
  2858.   elseif option == _cloudArmor
  2859.     SetInfoText("Include armor, clothing and jewelry when using cloud deposit.")
  2860.   elseif option == _cloudWeapons
  2861.     SetInfoText("Include weapons when using cloud deposit.")
  2862.   elseif option == _isTargetEssential
  2863.     SetInfoText("Is this target marked as essential by the game? Click to toggle.")
  2864.   elseif option == _isTargetProtected
  2865.     SetInfoText("Is this target marked as protected by the game? Click to toggle.")
  2866.   elseif option == _notShowOnStealthMeter
  2867.     SetInfoText("Will this NPC affect your stealth meter? Click to toggle.")
  2868.   elseif option == _depIndiscriminatelyEverything
  2869.     SetInfoText("Immediately dump all of your inventory except for quest items into a valid targeted container.")
  2870.   elseif option == _isAQuestItem
  2871.     SetInfoText("If TRUE then this item is referenced by a Quest.")
  2872.   elseif option == _isAQuestNPC
  2873.     SetInfoText("If TRUE then this NPC is referenced by a Quest.")
  2874.   elseif option == _itemGoldValue
  2875.     SetInfoText("Full sale value before modifiers such as speech skill, perks, etc. This value should only apply to items than can be picked up by the player but from time to time the game shows values for items that cannot.")
  2876.   endif
  2877.  
  2878. endevent
  2879.  
  2880. event OnCrosshairRefChange(ObjectReference ref)
  2881.   objFoc = ref  ; remember what the player is targeting
  2882. endevent
  2883.  
  2884. Event OnKeyUp(Int KeyCode, Float HoldTime)
  2885.   If KeyCode == myKeyMapVar
  2886.     if isCCAssigned != 1
  2887.       isCCAssigned = getIsCCAssigned()
  2888.     endif
  2889.     if isScriptRunning
  2890.       Debug.Notification("Canceling deposit...")
  2891.       terminateVar = TRUE
  2892.     else
  2893.       Game.SetInChargen(TRUE, TRUE, TRUE)
  2894.       Debug.Notification("Beginning deposit")
  2895.       Debug.Notification(DepStuff(playerObj,cm_CloudContainer09.GetReference(),0,TRUE))
  2896.       Game.SetInChargen(False, False, False)
  2897.     endif
  2898.   EndIf
  2899. EndEvent
  2900.  
  2901. ;--------------------READ/WRITE SETTINGS----------------------------------------------------
  2902.  
  2903. function WriteSettings()
  2904.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.keymap.cloudcontainer",myKeyMapVar)
  2905.   if (myKeyMapVar == -1)
  2906.     UnregisterForAllKeys()
  2907.   else
  2908.     RegisterForKey(myKeyMapVar)
  2909.   Endif
  2910.  
  2911.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.23",_toggleState011 as Int)  ; scrolls
  2912.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.27",_toggleState012 as Int)  ; book
  2913.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.30",_toggleState013 as Int)  ; ing
  2914.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.32",_toggleState014 as Int)  ; ores, ingots
  2915.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.42",_toggleState015 as Int)  ; ammunition
  2916.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.46",_toggleState016 as Int)  ; ingestibles
  2917.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.52",_toggleState017 as Int)  ; soul gem
  2918.   JsonUtil.SetPathIntValue(settingsfilepath,".losesomeweight.quest",_toggleState018 as Int)  ; soul gem
  2919.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.23",(_toggleState08 as Int) * 23)  ; scrolls
  2920.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.27",(_toggleState09 as Int) * 27)  ; book
  2921.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.30",(_toggleState10 as Int) * 30)  ; ing
  2922.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.32",(_toggleState11 as Int) * 32)  ; ores, ingots
  2923.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.42",(_toggleState12 as Int) * 42)  ; ammunition
  2924.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.46",(_toggleState13 as Int) * 46)  ; ingestibles
  2925.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.52",(_toggleState14 as Int) * 52)  ; soul gem
  2926.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.26",(_toggleState15 as Int) * 26)  ; armor,cloth
  2927.   JsonUtil.SetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.41",(_toggleState16 as Int) * 41)  ; weapon
  2928.  
  2929.   JsonUtil.Save(settingsfilepath)
  2930.  
  2931. endfunction
  2932.  
  2933. function GetCloudDepositOptions()
  2934.  
  2935.   ccDepositTypeCodes[0] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.23")  ; scrolls
  2936.   ccDepositTypeCodes[1] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.27")  ; book
  2937.   ccDepositTypeCodes[2] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.30")  ; ing
  2938.   ccDepositTypeCodes[3] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.32")  ; ores, ingots
  2939.   ccDepositTypeCodes[4] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.42")  ; ammunition
  2940.   ccDepositTypeCodes[5] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.46")  ; ingestibles
  2941.   ccDepositTypeCodes[6] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.52")  ; soul gem
  2942.   ccDepositTypeCodes[7] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.26")  ; armor,cloth
  2943.   ccDepositTypeCodes[8] = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.41")  ; weapon
  2944.  
  2945. endfunction
  2946.  
  2947.  
  2948. function LoadSettings()
  2949.   myKeyMapVar = JsonUtil.GetPathIntValue(settingsfilepath,".settings.keymap.cloudcontainer")
  2950.   if (myKeyMapVar == -1)
  2951.     UnregisterForAllKeys()
  2952.   else
  2953.     RegisterForKey(myKeyMapVar)
  2954.   Endif
  2955.  
  2956.   _toggleState011 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.23") as Bool
  2957.   _toggleState012 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.27") as Bool
  2958.   _toggleState013 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.30") as Bool
  2959.   _toggleState014 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.32") as Bool
  2960.   _toggleState015 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.42") as Bool
  2961.   _toggleState016 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.46") as Bool
  2962.   _toggleState017 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.52") as Bool
  2963.   _toggleState018 = JsonUtil.GetPathIntValue(settingsfilepath,".losesomeweight.quest") as Bool
  2964.   _toggleState08 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.23") as Bool  ; scrolls
  2965.   _toggleState09 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.27") as Bool  ; book
  2966.   _toggleState10 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.30") as Bool  ; ing
  2967.   _toggleState11 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.32") as Bool  ; ores, ingots
  2968.   _toggleState12 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.42") as Bool  ; ammunition
  2969.   _toggleState13 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.46") as Bool  ; ingestibles
  2970.   _toggleState14 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.52") as Bool  ; soul gem
  2971.   _toggleState15 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.26") as Bool  ; armor,cloth
  2972.   _toggleState16 = JsonUtil.GetPathIntValue(settingsfilepath,".settings.cloudcontainer.deposit.41") as Bool  ; weapons
  2973.   GetCloudDepositOptions()
  2974.  
  2975. endfunction
  2976.  
  2977. function VarValInit()
  2978.  
  2979.   progressVar = "x                                                            x"
  2980.   progressVarIndex = 1
  2981.   ;Gold001 = Game.GetFormFromFile(15,"Skyrim.esm")
  2982.   if filesCheckedYet != 1
  2983.    
  2984.     playerObj = playerRef as ObjectReference
  2985.    
  2986.     containerList = JsonUtil.StringListToArray(filePath, "multicontainername")
  2987.     ContainerHandler("sort")
  2988.     JsonUtil.Save(filePath)
  2989.     if containerList.length <= 0
  2990.       ContainerHandler("add","New Container")
  2991.     endif
  2992.     typeCodes = new Int[8]
  2993.     skillArray = new String[18]
  2994.     magicMods = new String[107]
  2995.     ;magicMods0 = new String[128]
  2996.     ccDepositTypeCodes = new Int[9]
  2997.     if !playerRef.HasSpell(cm_Spell_HighlightCloudContainer)
  2998.       playerRef.AddSpell(cm_Spell_HighlightCloudContainer)
  2999.     endif
  3000.     booksFilePathExists = MiscUtil.FileExists("data/SKSE/plugins/StorageUtilData/Ethereal Incarnation/cm_BookData.json")
  3001.     loseSomeWeightInstalled = MiscUtil.FileExists("data/LoseSomeWeight-LSW.esp")
  3002.     po3ExtenderInstalled = MiscUtil.FileExists("data/SKSE/plugins/po3_PapyrusExtender.dll")
  3003.     dontTouchFilePath = "../StorageUtilData/Ethereal Incarnation/cm_DONOTTOUCHTHIS.json"
  3004.     settingsfilepath = "../StorageUtilData/Ethereal Incarnation/cm_Settings.json"
  3005.     booksFilePath = "../StorageUtilData/Ethereal Incarnation/cm_BookData.json"
  3006.     toolScriptPathExists = MiscUtil.FileExists("data/Scripts/bm_tools.pex")
  3007.     filePath = "../StorageUtilData/Ethereal Incarnation/cm_etherealIncarnationData.json"
  3008.     booksMasterInstalled = MiscUtil.FileExists("data/booksMaster.esp")
  3009.     cUInstalled = MiscUtil.FileExists("data/SKSE/plugins/ConsoleUtilSSE.dll")
  3010.     dontTouchFilePathExists = MiscUtil.FileExists("data/SKSE/plugins/StorageUtilData/Ethereal Incarnation/cm_DONOTTOUCHTHIS.json")
  3011.     settingsfilepathExists = MiscUtil.FileExists("data/SKSE/plugins/StorageUtilData/Ethereal Incarnation/cm_Settings.json")
  3012.     ordinatorInstalled = MiscUtil.FileExists("data/Ordinator - Perks of Skyrim.esp") as Int
  3013.     adamantInstalled = MiscUtil.FileExists("data/Adamant.esp") as Int
  3014.     smithingPerksOverhaulInstalled = MiscUtil.FileExists("data/Smithing Perks Overhaul SE.esp") as Int
  3015.     vokriiInstalled = MiscUtil.FileExists("data/Vokrii - Minimalistic Perks of Skyrim.esp") as Int
  3016.     if MiscUtil.FileExists("PerkusMaximus_Mage.esp") as Int || MiscUtil.FileExists("PerkusMaximus_Master.esp") as Int || MiscUtil.FileExists("PerkusMaximus_Thief.esp") as Int || MiscUtil.FileExists("PerkusMaximus_Warrior.esp") as Int
  3017.       perkusMaximusInstalled = 1
  3018.     endif
  3019.     perkModInstalled = ordinatorInstalled + smithingPerksOverhaulInstalled + vokriiInstalled + adamantInstalled + perkusMaximusInstalled
  3020.    
  3021.     magicMods[0] = "Skyrim.esm"
  3022.     magicMods[1] = "Dawnguard.esm"
  3023.     magicMods[2] = "Dragonborn.esm"
  3024.     magicMods[3] = "Mining For Mages Redux.esp"
  3025.     magicMods[4] = "Chronomancy Spell Pack.esp"
  3026.     magicMods[5] = "LoreOfRuin.esp"
  3027.     magicMods[6] = "DS3 Spell Pack.esp"
  3028.     magicMods[7] = "mihailfirewyrm.esp"
  3029.     magicMods[8] = "agni3.esp"
  3030.     magicMods[9] = "Cosmic Spells.esp"
  3031.     magicMods[10] = "Dukkhas Forbidden Death Magic.esp"
  3032.     magicMods[11] = "AnnaDruidConjuration.esp"
  3033.     magicMods[12] = "MysticismMagic.esp"
  3034.     magicMods[13] = "OverlordMagic.esp"
  3035.     magicMods[14] = "Odin - Skyrim Magic Overhaul.esp"
  3036.     magicMods[15] = "Daedric Entity Restoration Project.esp"
  3037.     magicMods[16] = "AwakenedMagicka.esp"
  3038.     magicMods[17] = "AetherialTomes.esp"
  3039.     magicMods[18] = "Tomebound.esp"
  3040.     magicMods[19] = "Arcanum.esp"
  3041.     magicMods[20] = "ReachMage.esp"
  3042.     magicMods[21] = "The Career Mage.esp"
  3043.     magicMods[22] = "khajitdave-necromanticsummons-v01.esp"
  3044.     magicMods[23] = "Phenderix Magic Evolved.esp"
  3045.     magicMods[24] = "Use the Force Skyrim.esp"
  3046.     magicMods[25] = "Triumvirate - Mage Archetypes.esp"
  3047.     magicMods[26] = "DragonMonarch's Master Spells.esp"
  3048.     magicMods[27] = "New Skyrim Master Spells.esp"
  3049.     magicMods[28] = "TheDarkPathSpells.esp"
  3050.     magicMods[29] = "DustAdept.esp"
  3051.     magicMods[30] = "Dwemertech - Magic of the Dwarves.esp"
  3052.     magicMods[31] = "MJHSynthesisRedux.esp"
  3053.     magicMods[32] = "Air Spells.esp"
  3054.     magicMods[33] = "ColdharbourDaedra.esp"
  3055.     magicMods[34] = "PathOfTheAntiMage.esp"
  3056.     magicMods[35] = "Darkspell01.esp"
  3057.     magicMods[36] = "ForgottenMagic_Redone.esp"
  3058.     magicMods[37] = "GlamorilLite.esp"
  3059.     magicMods[38] = "The Dark Arts.esp"
  3060.     magicMods[39] = "Apocalypse - Magic of Skyrim.esp"
  3061.     magicMods[40] = "CorpseToCoinage.esp"
  3062.     magicMods[41] = "Apocalypse - Waterstride Spell Addon.esp"
  3063.     magicMods[42] = "Elemental Destruction Magic Redux.esp"
  3064.     magicMods[43] = "Apocalypse - More Apocalypse.esp"
  3065.     magicMods[44] = "Undriel_SummonIceHorse.esp"
  3066.     magicMods[45] = "Calling of the Conjurer.esp"
  3067.     magicMods[46] = "ShadowSpellPackage.esp"
  3068.     magicMods[47] = "ShadefireSpellsV.1.1.esp"
  3069.     magicMods[48] = "SummonSkaafins.esp" ; Summon Mihail's Skaafins
  3070.    magicMods[49] = "rt_teleportation.esp" ; RustyTrader's Teleportation SSE
  3071.     magicMods[50] = "Cure Disease Spell of Stendarr - SE.esl"
  3072.     magicMods[51] = "Unrelenting Flame Spells and Enchanted Sword.esp"
  3073.     magicMods[52] = "fta_TES5BoundEquipLootTable.esp"
  3074.     magicMods[53] = "RedLightningSpells.esp"
  3075.     magicMods[54] = "Arcane Miscellanea.esp"
  3076.     magicMods[55] = "Summon Gallus SE.esp"
  3077.     magicMods[56] = "UndeathFixes.esp"
  3078.     magicMods[57] = "DHSpell.esp"
  3079.     magicMods[58] = "survival_spells.esp"
  3080.     magicMods[59] = "EnchantedArsenal.esp"
  3081.     magicMods[60] = "Crimson Storm.esp"
  3082.     magicMods[61] = "DaxafaganSpells.esp"
  3083.     magicMods[62] = "MidasSkyrim.esp"
  3084.     magicMods[63] = "FestusKrexSpell.esp"
  3085.     magicMods[64] = "FestusKrexSpell.esl"
  3086.     magicMods[65] = "SuckLife.esp"
  3087.     magicMods[66] = "NecromancySpellsPack.esp"
  3088.     magicMods[67] = "ZCSkyrimTeleportationCollection.esp"
  3089.     magicMods[68] = "Atom Bomb.esp"
  3090.     magicMods[69] = "Levin.esp"
  3091.     magicMods[70] = "Dishonored Blink.esp"
  3092.     magicMods[71] = "PotentBasicSpells.esp"
  3093.     magicMods[72] = "Archmage Eye Of Magnus and Spells.esp"
  3094.     magicMods[73] = "SummonSkeleton.esp"
  3095.     magicMods[74] = "LiamsConjurationSpells.esp"
  3096.     magicMods[75] = "Skyrim Immersive Creatures Special Edition.esp"
  3097.     magicMods[76] = "JJSC.esp"
  3098.     magicMods[77] = "Z Mage light.esp"
  3099.     magicMods[78] = "Destruction Mage's Compendium.esp"
  3100.     magicMods[79] = "Yeetus Magic Destruction Spells.esp"
  3101.     magicMods[80] = "Z Cyclone -Spell type-.esp"
  3102.     magicMods[81] = "SpellCollection.esp"
  3103.     magicMods[82] = "CrowdControlExtended.esp"
  3104.     magicMods[83] = "CurePoisonSpellV1.1.esp"
  3105.     magicMods[84] = "CurePoisonSpell (truly deadly poisons).esp"
  3106.     magicMods[85] = "DragonGuard.esp"
  3107.     magicMods[86] = "Interactive Summons And Illusions.esp"
  3108.     magicMods[87] = "Z Acceleration.esp"
  3109.     magicMods[88] = "SkeletonResisReanimateNoMore.esp"
  3110.     magicMods[89] = "MJResto.esp"
  3111.     magicMods[90] = "Conjurer's Compendium.esp"
  3112.     magicMods[91] = "UndeadWerewolfSE.esp"
  3113.     magicMods[92] = "Dwemerend.esp"
  3114.     magicMods[93] = "Summon Astrid SE.esp"
  3115.     magicMods[94] = "shehaiblu.esp"
  3116.     magicMods[95] = "shehai.esp"
  3117.     magicMods[96] = "Z Flame Atronach.esp"
  3118.     magicMods[97] = "DLC1Uni.esp"
  3119.     magicMods[98] = "hovering torch.esp"
  3120.     magicMods[99] = "ConjurationThrallsExpanded.esp"
  3121.     magicMods[100] = "Blastbones.esp"
  3122.     magicMods[101] = "MarkRecallNPC.esp"
  3123.     magicMods[102] = "Wasserwandeln SE.esp"
  3124.     magicMods[103] = "Waterwalking.esp"
  3125.     magicMods[104] = "SOTI.esp" ; Spells of the Initiate
  3126.     magicMods[105] = "Alteration Muffle and Invisibility.esp"
  3127.     magicMods[106] = "Glenmoril.esm"
  3128.     magicMods[107] = "IHarvest.esl"
  3129.     magicMods[108] = "ProgressiveNoviceSpells.esl"
  3130.     magicMods[109] = "Astral.esp"
  3131. ;/  magicMods[110] = ""
  3132.     magicMods[111] = ""
  3133.     magicMods[112] = ""
  3134.     magicMods[113] = ""
  3135.     magicMods[114] = ""
  3136.     magicMods[115] = ""
  3137.     magicMods[116] = ""
  3138.     magicMods[117] = ""
  3139.     magicMods[118] = ""
  3140.     magicMods[119] = ""
  3141.     magicMods[120] = ""
  3142.     magicMods[121] = ""
  3143.     magicMods[122] = ""
  3144.     magicMods[123] = ""
  3145.     magicMods[124] = ""
  3146.     magicMods[125] = ""
  3147.     magicMods[126] = ""
  3148.     magicMods[127] = "" /;
  3149.    
  3150. ;/    magicMods0[0] = ""
  3151.     magicMods0[1] = ""
  3152.     magicMods0[2] = ""
  3153.     magicMods0[3] = ""
  3154.     magicMods0[4] = ""
  3155.     magicMods0[5] = ""
  3156.     magicMods0[6] = ""
  3157.     magicMods0[7] = ""
  3158.     magicMods0[8] = ""
  3159.     magicMods0[9] = ""
  3160.     magicMods0[10] = ""
  3161.     magicMods0[11] = ""
  3162.     magicMods0[12] = ""
  3163.     magicMods0[13] = ""
  3164.     magicMods0[14] = ""
  3165.     magicMods0[15] = ""
  3166.     magicMods0[16] = ""
  3167.     magicMods0[17] = ""
  3168.     magicMods0[18] = ""
  3169.     magicMods0[19] = ""
  3170.     magicMods0[20] = ""
  3171.     magicMods0[21] = ""
  3172.     magicMods0[22] = ""
  3173.     magicMods0[23] = ""
  3174.     magicMods0[24] = ""
  3175.     magicMods0[25] = ""
  3176.     magicMods0[26] = ""
  3177.     magicMods0[27] = ""
  3178.     magicMods0[28] = ""
  3179.     magicMods0[29] = ""
  3180.     magicMods0[30] = ""
  3181.     magicMods0[31] = ""
  3182.     magicMods0[32] = ""
  3183.     magicMods0[33] = ""
  3184.     magicMods0[34] = ""
  3185.     magicMods0[35] = ""
  3186.     magicMods0[36] = ""
  3187.     magicMods0[37] = ""
  3188.     magicMods0[38] = ""
  3189.     magicMods0[39] = ""
  3190.     magicMods0[40] = ""
  3191.     magicMods0[41] = ""
  3192.     magicMods0[42] = ""
  3193.     magicMods0[43] = ""
  3194.     magicMods0[44] = ""
  3195.     magicMods0[45] = ""
  3196.     magicMods0[46] = ""
  3197.     magicMods0[47] = ""
  3198.     magicMods0[48] = ""
  3199.     magicMods0[49] = ""
  3200.     magicMods0[50] = ""
  3201.     magicMods0[51] = ""
  3202.     magicMods0[52] = ""
  3203.     magicMods0[53] = ""
  3204.     magicMods0[54] = ""
  3205.     magicMods0[55] = ""
  3206.     magicMods0[56] = ""
  3207.     magicMods0[57] = ""
  3208.     magicMods0[58] = ""
  3209.     magicMods0[59] = ""
  3210.     magicMods0[60] = ""
  3211.     magicMods0[61] = ""
  3212.     magicMods0[62] = ""
  3213.     magicMods0[63] = ""
  3214.     magicMods0[64] = ""
  3215.     magicMods0[65] = ""
  3216.     magicMods0[66] = ""
  3217.     magicMods0[67] = ""
  3218.     magicMods0[68] = ""
  3219.     magicMods0[69] = ""
  3220.     magicMods0[70] = ""
  3221.     magicMods0[71] = ""
  3222.     magicMods0[72] = ""
  3223.     magicMods0[73] = ""
  3224.     magicMods0[74] = ""
  3225.     magicMods0[75] = ""
  3226.     magicMods0[76] = ""
  3227.     magicMods0[77] = ""
  3228.     magicMods0[78] = ""
  3229.     magicMods0[79] = ""
  3230.     magicMods0[80] = ""
  3231.     magicMods0[81] = ""
  3232.     magicMods0[82] = ""
  3233.     magicMods0[83] = ""
  3234.     magicMods0[84] = ""
  3235.     magicMods0[85] = ""
  3236.     magicMods0[86] = ""
  3237.     magicMods0[87] = ""
  3238.     magicMods0[88] = ""
  3239.     magicMods0[89] = ""
  3240.     magicMods0[90] = ""
  3241.     magicMods0[91] = ""
  3242.     magicMods0[92] = ""
  3243.     magicMods0[93] = ""
  3244.     magicMods0[94] = ""
  3245.     magicMods0[95] = ""
  3246.     magicMods0[96] = ""
  3247.     magicMods0[97] = ""
  3248.     magicMods0[98] = ""
  3249.     magicMods0[99] = ""
  3250.     magicMods0[100] = ""
  3251.     magicMods0[101] = ""
  3252.     magicMods0[102] = ""
  3253.     magicMods0[103] = ""
  3254.     magicMods0[104] = ""
  3255.     magicMods0[105] = ""
  3256.     magicMods0[106] = "" /;
  3257.    
  3258.     typeCodes[0] = 30
  3259.     typeCodes[1] = 42
  3260.     typeCodes[2] = 26
  3261.     typeCodes[3] = 27
  3262.     typeCodes[4] = 46
  3263.     typeCodes[5] = 32
  3264.     typeCodes[6] = 52
  3265.     typeCodes[7] = 41
  3266.    
  3267.     skillArray[0] = "OneHanded"
  3268.     skillArray[1] = "TwoHanded"
  3269.     skillArray[2] = "Marksman"
  3270.     skillArray[3] = "Block"
  3271.     skillArray[4] = "Smithing"
  3272.     skillArray[5] = "HeavyArmor"
  3273.     skillArray[6] = "LightArmor"
  3274.     skillArray[7] = "Pickpocket"
  3275.     skillArray[8] = "Lockpicking"
  3276.     skillArray[9] = "Sneak"
  3277.     skillArray[10] = "Alchemy"
  3278.     skillArray[11] = "Speechcraft"
  3279.     skillArray[12] = "Alteration"
  3280.     skillArray[13] = "Conjuration"
  3281.     skillArray[14] = "Destruction"
  3282.     skillArray[15] = "Illusion"
  3283.     skillArray[16] = "Restoration"
  3284.     skillArray[17] = "Enchanting"
  3285.    
  3286.     Pages = new String[6]
  3287.     Pages[0] = "Inventory"
  3288.     Pages[1] = "Transcription"
  3289.     Pages[2] = "Stored Data"
  3290.     Pages[3] = "Addons-Settings"
  3291.     Pages[4] = " Containers"
  3292.     Pages[5] = "Dev Tools"
  3293.    
  3294.     JsonUtil.Load(dontTouchFilePath)
  3295.     JsonUtil.Load(settingsfilepath)
  3296.     JsonUtil.Load(booksFilePath)
  3297.     JsonUtil.Load(filePath)
  3298.     modsToSkipSpells = JsonUtil.StringListToArray(dontTouchFilePath, "modstoskipspells")
  3299.     modsToSkipItems = JsonUtil.StringListToArray(dontTouchFilePath, "modstoskipitems")
  3300.  
  3301.     SaveModListJson()
  3302.  
  3303.     filesCheckedYet = 1
  3304.    
  3305.   endif
  3306.  
  3307.  
  3308.   LoadSettings()
  3309.   GetCloudDepositOptions()
  3310.   LoadStats()
  3311.   GetStats()
  3312.  
  3313. endfunction
  3314.  
  3315. ;--------------------SKYUI VERSION CONTROL----------------------------------------------------
  3316.  
  3317. event OnVersionUpdate(Int a_version)
  3318.   Int newVersion = 9821
  3319.   if (a_version >= newVersion && CurrentVersion < newVersion)
  3320.     Debug.Notification("Ethereal Incarnation updating to version " + a_version)
  3321.     OnConfigInit()
  3322.   endif
  3323. endEvent
  3324.  
  3325. Int function GetVersion()
  3326.  
  3327.   return 9821 ;0.9821
  3328.  
  3329. endFunction
  3330.  
  3331. FormList Property cm_itemsToSkip  Auto  
  3332.  
  3333. ReferenceAlias Property cm_CloudContainer09  Auto  
  3334.  
  3335. FormList Property cm_vanillaMapMarkers  Auto  
  3336.  
  3337. SPELL Property cm_Spell_HighlightCloudContainer Auto  
  3338.  
  3339. FormList Property cm_vanillaBooks  Auto  
  3340.  
  3341. FormList Property cm_Shouts  Auto  
  3342.  
  3343. FormList Property cm_WordsOfPower  Auto  
  3344.  
  3345. FormList Property cm_vanillaSpells  Auto  
  3346.  
  3347. ActorBase Property playerBase  Auto  
  3348.  
  3349. FormList Property cm_contentsPlayerInventory  Auto  
  3350.  
  3351. FormList Property cm_contentsCloudContainer  Auto  
  3352.  
  3353. FormList Property cm_contentsChest  Auto  
  3354.  
  3355. FormList Property cm_genericChest  Auto  
  3356. ReferenceAlias Property playerRefAlias  Auto  
  3357.  
  3358. MiscObject Property Gold001  Auto  
Add Comment
Please, Sign In to add comment