michaelrw

simplified inventory init.lua

Nov 7th, 2022
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 125.81 KB | Gaming | 0 0
  1. modVersion = "1.30.03"
  2.  
  3. -----------------------------------------------------------------------
  4. -----   START OF USER CONFIGURABLE OPTIONS   --------------------------
  5. ----- These are saved in Settings/settings.ini ------------------------
  6. -----------------------------------------------------------------------
  7. ini = {}
  8. ini.consumable = {}
  9.  
  10. ini.autoHealthInhaler ={}
  11. ini.Main = {}
  12. ini.Junk = {}
  13. ini.SimplifyGrenades = {}
  14. ini.SimplifyClothesMod = {}
  15. ini.SimplifyWeaponMod = {}
  16. ini.SimplifyWeapon = {}
  17. ini.SimplifyFeet = {}
  18. ini.SimplifyHeadArmor = {}
  19. ini.SimplifyChestArmor = {}
  20. ini.SimplifyInnerChestArmor = {}
  21. ini.SimplifyFaceArmor = {}
  22. ini.SimplifyLegArmor = {}
  23. ini.SimplifyHealthItems = {}
  24. ini.SimplifyShards = {}
  25.  
  26. -----------------------------------------------------------------------
  27. -----     END OF USER CONFIGURABLE OPTIONS   --------------------------
  28. -----------------------------------------------------------------------
  29.  
  30. ini.Main.UseMod = true
  31. ini.Main.followCETOverlay = true
  32. ini.SimplifyShards.SimplifyShards = false
  33.  
  34. i = 0
  35. timeAllowedToUseAny = os.time() + 5
  36.  
  37. nextAvailableTime = timeAllowedToUseAny
  38. prevItemQuantity = 0
  39. nextConsumeTime_FoodBeverages = timeAllowedToUseAny
  40. nextConsumeTime_Booster = timeAllowedToUseAny
  41. nextInhalerTime = timeAllowedToUseAny
  42. pauseDetected = false
  43. pauseDetectionCheck2 = false
  44.  
  45. lastActionDescription = {}
  46. lastActionValue = {}
  47. lastActionTime = {}
  48. maxMessages = 15
  49.  
  50. for i = 0, maxMessages do
  51.     lastActionDescription[i] = ""
  52.     lastActionValue[i] = ""
  53.     lastActionTime[i] = ""
  54. end
  55.  
  56. currentActionPass = 0
  57. lastTime = os.time() + 5
  58.  
  59. initNotDone = true
  60. timeAccumulation = 0
  61. scriptInverval = 0
  62. slowDown = 0
  63. startupDelayTime = os.time() + 5 --globalDelayinSeconds
  64. hasSystemsBeenRetrieved = false
  65. globalDelayinSeconds = 3
  66.  
  67. currentLevel = 0
  68. playerhealthpercent = 0
  69. previousPlayerHealth = 0
  70.  
  71. --systems
  72. ts = nil
  73. ssc = nil
  74. timeSystem = nil
  75. equipmentSystem = nil
  76. statsPoolSystem = nil
  77. player = nil
  78. ss = nil
  79. imgr = nil
  80. espd = nil
  81.  
  82. equippedArrayItemID = {}
  83. equippedArrayILevel = {}
  84. equippedArraySlot = {}
  85. equippedArrayType = {}
  86.  
  87. for i=0,20 do
  88.     equippedArrayItemID[i] = 0
  89.     equippedArrayILevel[i] = -1
  90.     equippedArraySlot[i] = ""
  91.     equippedArrayType[i] = ""
  92. end
  93.    
  94. currentRetrievalPass = 0
  95.  
  96. highestEffectiveDPSWeapon = 0
  97.  
  98. onlyDoOnceAfterIni = true
  99. itemTypeArray = {}
  100. manualModeTriggered = false
  101. itemSelected = false
  102.  
  103. --session stats
  104. session_Food = 0
  105. session_Drinks = 0
  106. session_Alcohol = 0
  107. session_ItemsSold = 0
  108. session_ItemsDisassembled = 0
  109. session_MoneyGained = 0
  110.  
  111. highestArmorLevel = {}
  112. equippedArmorLevel = {}
  113. highestArmorLevelOverall = {}
  114. foundArmorThatsBetter = false
  115.  
  116. ------------------------------------------------------------------------
  117. MyMod = { description = "Simplified Inventory" }
  118.  
  119. function MyMod:new()
  120.     o = {}
  121.     setmetatable(o, self)
  122.     self.__index = self
  123.     self.description = "Simplified Inventory"
  124.    
  125.     --print(modDirectory2("init.lua"))
  126.     --consumableListModule = require(modDirectory2("init.lua") .. "consumableList")
  127.    
  128.     return o
  129. end
  130. ---------------------------------------------------------------------------
  131.  
  132. local boosterItems = {
  133.     "Items.StaminaBooster",
  134.     "Items.HealthBooster",
  135.     "Items.MemoryBooster",
  136.     "Items.CarryCapacityBooster"
  137. }
  138.  
  139. --sorted by best to worst
  140. local inhalerItems = {
  141.     "Items.FirstAidWhiffV2",
  142.     "Items.FirstAidWhiffV1",
  143.     "Items.FirstAidWhiffV2",
  144.     "Items.FirstAidWhiffV1",
  145.     "Items.FirstAidWhiffV0",
  146.     "Items.BonesMcCoy70V2",
  147.     "Items.BonesMcCoy70V1",
  148.     "Items.BonesMcCoy70V0"
  149. }
  150.  
  151. local alcoholItems = {
  152.     "Items.GoodQualityAlcohol1",
  153.     "Items.GoodQualityAlcohol2",
  154.     "Items.GoodQualityAlcohol3",
  155.     "Items.GoodQualityAlcohol4",
  156.     "Items.GoodQualityAlcohol5",
  157.     "Items.GoodQualityAlcohol6",
  158.     "Items.LowQualityAlcohol1",
  159.     "Items.LowQualityAlcohol2",
  160.     "Items.LowQualityAlcohol3",
  161.     "Items.LowQualityAlcohol4",
  162.     "Items.LowQualityAlcohol5",
  163.     "Items.LowQualityAlcohol6",
  164.     "Items.LowQualityAlcohol7",
  165.     "Items.LowQualityAlcohol8",
  166.     "Items.LowQualityAlcohol9",
  167.     "Items.MediumQualityAlcohol1",
  168.     "Items.MediumQualityAlcohol2",
  169.     "Items.MediumQualityAlcohol3",
  170.     "Items.MediumQualityAlcohol4",
  171.     "Items.MediumQualityAlcohol5",
  172.     "Items.MediumQualityAlcohol6",
  173.     "Items.MediumQualityAlcohol7",
  174.     "Items.NomadsAlcohol1",
  175.     "Items.NomadsAlcohol2",
  176.     "Items.TopQualityAlcohol1",
  177.     "Items.TopQualityAlcohol2",
  178.     "Items.TopQualityAlcohol3",
  179.     "Items.TopQualityAlcohol4",
  180.     "Items.TopQualityAlcohol5",
  181.     "Items.TopQualityAlcohol6",
  182.     "Items.TopQualityAlcohol7"
  183. }
  184.  
  185. local drinkItems = {
  186.     "Items.GoodQualityDrink1",
  187.     "Items.GoodQualityDrink11",
  188.     "Items.GoodQualityDrink2",
  189.     "Items.GoodQualityDrink3",
  190.     "Items.GoodQualityDrink4",
  191.     "Items.GoodQualityDrink5",
  192.     "Items.GoodQualityDrink6",
  193.     "Items.GoodQualityDrink7",
  194.     "Items.GoodQualityDrink8",
  195.     "Items.GoodQualityDrink9",
  196.     "Items.GoodQualityDrink10",
  197.     "Items.LowQualityDrink1",
  198.     "Items.LowQualityDrink10",
  199.     "Items.LowQualityDrink11",
  200.     "Items.LowQualityDrink12",
  201.     "Items.LowQualityDrink13",
  202.     "Items.LowQualityDrink2",
  203.     "Items.LowQualityDrink3",
  204.     "Items.LowQualityDrink4",
  205.     "Items.LowQualityDrink5",
  206.     "Items.LowQualityDrink6",
  207.     "Items.LowQualityDrink7",
  208.     "Items.LowQualityDrink8",
  209.     "Items.LowQualityDrink9",
  210.     "Items.MediumQualityDrink1",
  211.     "Items.MediumQualityDrink10",
  212.     "Items.MediumQualityDrink11",
  213.     "Items.MediumQualityDrink12",
  214.     "Items.MediumQualityDrink13",
  215.     "Items.MediumQualityDrink14",
  216.     "Items.MediumQualityDrink2",
  217.     "Items.MediumQualityDrink3",
  218.     "Items.MediumQualityDrink4",
  219.     "Items.MediumQualityDrink5",
  220.     "Items.MediumQualityDrink6",
  221.     "Items.MediumQualityDrink7",
  222.     "Items.MediumQualityDrink8",
  223.     "Items.MediumQualityDrink9",
  224.     "Items.NomadsDrink1",
  225.     "Items.NomadsDrink2"
  226. }
  227.  
  228. local foodItems = {
  229.     "Items.GoodQualityFood1",
  230.     "Items.GoodQualityFood10",
  231.     "Items.GoodQualityFood11",
  232.     "Items.GoodQualityFood12",
  233.     "Items.GoodQualityFood13",
  234.     "Items.GoodQualityFood2",
  235.     "Items.GoodQualityFood3",
  236.     "Items.GoodQualityFood4",
  237.     "Items.GoodQualityFood5",
  238.     "Items.GoodQualityFood6",
  239.     "Items.GoodQualityFood7",
  240.     "Items.GoodQualityFood8",
  241.     "Items.GoodQualityFood9",
  242.     "Items.LowQualityFood1",
  243.     "Items.LowQualityFood10",
  244.     "Items.LowQualityFood11",
  245.     "Items.LowQualityFood12",
  246.     "Items.LowQualityFood13",
  247.     "Items.LowQualityFood14",
  248.     "Items.LowQualityFood15",
  249.     "Items.LowQualityFood16",
  250.     "Items.LowQualityFood17",
  251.     "Items.LowQualityFood18",
  252.     "Items.LowQualityFood19",
  253.     "Items.LowQualityFood20",
  254.     "Items.LowQualityFood21",
  255.     "Items.LowQualityFood22",
  256.     "Items.LowQualityFood23",
  257.     "Items.LowQualityFood24",
  258.     "Items.LowQualityFood25",
  259.     "Items.LowQualityFood26",
  260.     "Items.LowQualityFood27",
  261.     "Items.LowQualityFood28",
  262.     "Items.LowQualityFood3",
  263.     "Items.LowQualityFood5",
  264.     "Items.LowQualityFood6",
  265.     "Items.LowQualityFood7",
  266.     "Items.LowQualityFood8",
  267.     "Items.LowQualityFood9",
  268.     "Items.MediumQualityFood1",
  269.     "Items.MediumQualityFood10",
  270.     "Items.MediumQualityFood11",
  271.     "Items.MediumQualityFood12",
  272.     "Items.MediumQualityFood13",
  273.     "Items.MediumQualityFood14",
  274.     "Items.MediumQualityFood15",
  275.     "Items.MediumQualityFood16",
  276.     "Items.MediumQualityFood17",
  277.     "Items.MediumQualityFood18",
  278.     "Items.MediumQualityFood19",
  279.     "Items.MediumQualityFood2",
  280.     "Items.MediumQualityFood20",
  281.     "Items.MediumQualityFood3",
  282.     "Items.MediumQualityFood4",
  283.     "Items.MediumQualityFood5",
  284.     "Items.MediumQualityFood6",
  285.     "Items.MediumQualityFood7",
  286.     "Items.MediumQualityFood8",
  287.     "Items.MediumQualityFood9",
  288.     "Items.NomadsFood1",
  289.     "Items.NomadsFood2"
  290. }
  291.  
  292. local slots = {
  293.     "FeetClothing",
  294.     "HeadArmor",
  295.     "ChestArmor",
  296.     "InnerChest",
  297.     "InnerChestArmor",
  298.     "FaceArmor",
  299.     "LegArmor",
  300.     "Weapon"
  301. }
  302.  
  303. local slotsFriendlyName = {
  304.     "Feet",
  305.     "Head",
  306.     "Outer",
  307.     "InnerChest---",
  308.     "Inner",
  309.     "Face",
  310.     "Leg",
  311.     "Weapon"
  312. }
  313.  
  314. local equipAreaList = {
  315.     "Head",
  316.     "Face",
  317.     "OuterChest",
  318.     "InnerChest",
  319.     "Feet",
  320.     "Legs",
  321.     "Outfit",
  322.     "Weapon"
  323. }
  324.  
  325. local weaponTagList = {
  326.     "Rifle Assault",
  327.     "Knuckles",
  328.     "Two Hand Hammer",
  329.     "Handgun",
  330.     "HeavyWeapon",
  331.     "Katana",
  332.     "Knife",
  333.     "LMG",
  334.     "One Hand Blade",
  335.     "One Hand Club",
  336.     "Rifle Precision",
  337.     "Revolver",
  338.     "Shotgun",
  339.     "Shotgun Dual",
  340.     "Rifle Sniper",
  341.     "SMG",
  342.     "Two Hand Club",
  343.     "Unique"
  344. }
  345.  
  346. registerForEvent("onInit", function()
  347.     print("plugins\\cyber_engine_tweaks\\mods\\food\\init.lua loaded")
  348.     print("Simplified Inventory | Ver: ", modVersion)
  349.    
  350.     startupDelayTime = os.time() + globalDelayinSeconds
  351.     initNotDone = false
  352.    
  353.     MyMod:INI_Check_Nills()
  354. end)
  355.  
  356. registerForEvent("onShutdown", function()
  357.     --save settings to ini file
  358.     MyMod:INI_File_Save()
  359. end)
  360.  
  361. registerForEvent("onOverlayOpen", function()
  362.     if(ini.Main.followCETOverlay) then
  363.         onOpenDebug = true
  364.     end
  365. end)
  366.  
  367. registerForEvent("onOverlayClose", function()
  368.     if(ini.Main.followCETOverlay) then
  369.         onOpenDebug = false
  370.     end
  371. end)
  372.  
  373. ------------------------------------------------------------------------------------------------------------
  374. registerHotkey("tryEatConsumable", "Keybind to consume both Food and Beverage", function()
  375.     MyMod:tryEatConsumable()
  376. end)
  377.  
  378. registerHotkey("tryUseBooster", "Keybind to use any available Booster", function()
  379.     MyMod:tryUseBooster()
  380. end)
  381.  
  382. registerHotkey("tryDebugMenu", "Keybind to Show Menu", function()
  383.     onOpenDebug = not onOpenDebug
  384. end)
  385.  
  386. registerHotkey("tryFlipModUsage", "Keybind to Toggle Mod ON/OFF", function()
  387.     ini.Main.UseMod = not ini.Main.UseMod
  388. end)
  389.  
  390. registerHotkey("tryProcessMainFunctionOnce", "Keybind for Manual Mode", function()
  391.     MyMod:TryToProcessOnce()
  392. end)
  393.  
  394. registerHotkey("toggleEquipmentWindow", "Keybind for Equipment Notification window", function()
  395.     MyMod:ToggleEquipmentWindow()
  396. end)
  397.  
  398. ------------------------------------------------------------------------------------------------------------
  399.  
  400. TimeLoading = 0
  401.  
  402. function MyMod:TryToProcessOnce()
  403.     if(initNotDone) then
  404.         do return end
  405.     end
  406.    
  407.     if(onlyDoOnceAfterIni) then
  408.         do return end
  409.     end
  410.    
  411.     MyMod:LogAction("Manual mode triggered")
  412.    
  413.     manualModeTriggered = true
  414. end
  415.  
  416. function MyMod:ToggleEquipmentWindow()
  417.     ini.Main.UseEquipmentNotification = not ini.Main.UseEquipmentNotification
  418. end
  419.  
  420. registerForEvent("onUpdate", function(deltaTime)
  421.     if(initNotDone) then
  422.         do return end
  423.     end
  424.    
  425.     --wait 5s after being loaded
  426.     if(startupDelayTime > os.time()) then
  427.         do return end
  428.     end
  429.    
  430.     if(onlyDoOnceAfterIni) then
  431.         startupDelayTime = os.time() + 1
  432.         MyMod:INI_File_Load()
  433.         MyMod:INI_File_Save()
  434.         onlyDoOnceAfterIni = false
  435.         print("loaded ini")
  436.        
  437.     end
  438.    
  439.     if(ini.Main.UseMod == false) then
  440.         do return end
  441.     end
  442.    
  443.     if(MyMod:CheckSystems() == false) then
  444.         startupDelayTime = os.time() + 3
  445.         do return end
  446.     end
  447.    
  448.    
  449.    
  450.     ------------------------------------------------------------------------
  451.     --Check if we're paused
  452.     timeAccumulation = timeAccumulation + deltaTime
  453.    
  454.     pauseDetected = false
  455.    
  456.     if(timeAccumulation > 10) then
  457.         timeAccumulation = 10
  458.     end
  459.    
  460.     --------------------------------------------------------------------
  461.     --we come in this script every 0.2s
  462.     scriptInverval = scriptInverval + deltaTime
  463.     if(scriptInverval < 0.5) then
  464.         do return end
  465.     else
  466.         scriptInverval = 0
  467.     end
  468.    
  469.     if(MyMod:IsMainMenu() == true and (ini.Main.IgnorePauseDetection == false or ini.Main.UseManualMode == false)) then
  470.         pauseDetected = true
  471.         pauseDetectionCheck2 = true
  472.         do return end
  473.     end
  474.    
  475.     if(IsPlayerInAnyMenu() and (ini.Main.IgnorePauseDetection == false or ini.Main.UseManualMode == false)) then
  476.         pauseDetected = true
  477.         pauseDetectionCheck2 = true
  478.         do return end
  479.     end
  480.    
  481.     --it has come to this
  482.     MyMod:GetSystems()
  483.     if(espd == nil) then
  484.         do return end ;
  485.     end
  486.    
  487.     if(imgr == nil) then
  488.         return;
  489.     end
  490.    
  491.     tempLevel = ss:GetStatValue(player:GetEntityID(), 'PowerLevel')
  492.     currentLevel = tempLevel
  493.    
  494.     --Script is finally going to do stuff, let's make sure there are no nils hanging around
  495.     playerHealthPercent = statsPoolSystem:GetStatPoolValue(player:GetEntityID(), 'Health', true)
  496.    
  497.     if(playerHealthPercent > 0 and previousPlayerHealth == 0 and ini.Main.UseManualMode == false) then
  498.         --clear the debug menu
  499.         MyMod:ClearDebugMenu()
  500.     end
  501.    
  502.     if(playerHealthPercent == 0 or currentLevel <= 1.0 ) then
  503.         pauseDetected = true
  504.         pauseDetectionCheck2 = true
  505.         do return end
  506.     end
  507.    
  508.     previousPlayerHealth = playerHealthPercent
  509.    
  510.     currentItemQuantity = ts:GetTotalItemQuantity(player)
  511.    
  512.     if(currentItemQuantity == 389) then
  513.         pauseDetectionCheck2 = true
  514.         pauseDetected = true
  515.         do return end
  516.     end
  517.    
  518.    
  519.     ----------------------------------
  520.     pauseDetected = false
  521.     pauseDetectionCheck2 = false
  522.    
  523.     if(ini.Main.UseManualMode == false or manualModeTriggered == true) then
  524.         manualModeTriggered = false
  525.         MyMod:ProcessMainFunctionOnce()
  526.     end
  527.    
  528. end)
  529.  
  530. -- called on each frame when it is time to draw (after onUpdate), draw things here!
  531. registerForEvent("onDraw", function()
  532.    
  533.     if(onOpenDebug) then
  534.  
  535.         ImGui.SetNextWindowPos(80, 170, ImGuiCond.FirstUseEver)
  536.         ImGui.SetNextWindowSize(400, 225, ImGuiCond.FirstUseEver)
  537.        
  538.         if (ImGui.Begin("Simplified Inventory")) then
  539.             --ImGui.PushStyleColor(ImGuiCol.WindowBg, 0.9, 0.9, 0.9, 0.9);
  540.            
  541.             if (ImGui.BeginTabBar("TABS")) then
  542.                
  543.                 -----DEBUG VIEW TAB
  544.                 if (ImGui.BeginTabItem("Debug View")) then
  545.                     ImGui.Spacing()
  546.                     if (ImGui.Button("Manual Mode: Process Once")) then
  547.                         MyMod:TryToProcessOnce()
  548.                     end
  549.                     ImGui.Spacing()
  550.                    
  551.                     ImGui.Spacing();
  552.                     ImGui.Separator()
  553.                    
  554.                     if(ini.Main.IgnorePauseDetection == false and ini.Main.UseManualMode == false) then
  555.                    
  556.                         if(currentLevel <= 1.0) then
  557.                             ImGui.Text("**DISABLED due to low level: " .. tostring(currentLevel))
  558.                         else
  559.                             ImGui.Text("pauseDetected: " .. tostring(pauseDetectionCheck2))
  560.                         end
  561.                     else
  562.                         if(ini.Main.UseManualMode == true) then
  563.                             ImGui.Text("MANUAL MODE ACTIVATED")
  564.                         else
  565.                             ImGui.Text("pauseDetected: IGNORED")
  566.                         end
  567.                     end
  568.                    
  569.                     if ImGui.CollapsingHeader("Player Info: ") then
  570.                    
  571.                         ImGui.Text("playerHealthPercent: " .. tostring(playerHealthPercent))
  572.                         ImGui.Text("currentItemQuantity: " .. tostring(currentItemQuantity))
  573.                        
  574.                         --Debug show stats
  575.                         ImGui.Text("highestEffectiveDPSWeapon: " .. tostring(highestEffectiveDPSWeapon))
  576.                        
  577.                         for jj=0, 9 do
  578.                             if(equippedArrayILevel[jj] > 0) then
  579.                                 ImGui.Text(tostring(equippedArraySlot[jj]) .. ": " .. tostring(equippedArrayILevel[jj]))
  580.                             end
  581.                         end
  582.                    
  583.                     end
  584.                    
  585.                     ImGui.Spacing()
  586.                     ImGui.Separator()
  587.                    
  588.                     if ImGui.CollapsingHeader("Messages: ") then
  589.                         local arrowString = ""
  590.                        
  591.                         for j=0, maxMessages do
  592.                             arrowString = ""
  593.                             if(j == currentActionPass) then
  594.                                 arrowString = "   -> "
  595.                             end
  596.                            
  597.                             ImGui.Text(tostring(arrowString) .. tostring(lastActionDescription[j]) .. tostring(lastActionValue[j])) --.. " @: " .. tostring(lastActionTime[j]))
  598.                         end
  599.                     end
  600.                    
  601.                     ImGui.Spacing()
  602.                     ImGui.Separator()
  603.                    
  604.                     if ImGui.CollapsingHeader("Session Stats: ") then
  605.                         ImGui.Text("Food converted: " .. session_Food)
  606.                         ImGui.Text("Drinks converted: " .. session_Drinks)
  607.                         ImGui.Text("Alcohol converted: " .. session_Alcohol)
  608.                         ImGui.Spacing()
  609.                         ImGui.Text("Items Sold: " .. session_ItemsSold)
  610.                         ImGui.Text("Items Disassembled: " .. session_ItemsDisassembled)
  611.                         ImGui.Spacing()
  612.                         ImGui.Text("Money gained: " .. session_MoneyGained)
  613.                     end
  614.                    
  615.                     ImGui.EndTabItem();
  616.                 end
  617.                
  618.                 -----SETTINGS TAB
  619.                 if (ImGui.BeginTabItem("Settings")) then
  620.                     if (ImGui.Button("Force Save to settings.ini")) then
  621.                         MyMod:INI_File_Save()
  622.                     end
  623.                    
  624.                     if (ImGui.Button("Process Once")) then
  625.                         MyMod:TryToProcessOnce()
  626.                     end
  627.                    
  628.                     ini.Main.UseMod = ImGui.Checkbox("Use Mod", ini.Main.UseMod)
  629.                     ini.Main.followCETOverlay = ImGui.Checkbox("Close and Open with CET Overlay", ini.Main.followCETOverlay)
  630.                    
  631.                     ini.Main.UseManualMode = ImGui.Checkbox("Use Manual Mode (Does not process items automatically)", ini.Main.UseManualMode)
  632.                     ini.Main.IgnorePauseDetection = ImGui.Checkbox("Ignore Pause Detection", ini.Main.IgnorePauseDetection)
  633.                     ini.Main.UseEquipmentNotification = ImGui.Checkbox("Use Equipment Notification", ini.Main.UseEquipmentNotification)
  634.                    
  635.                     ImGui.Spacing()
  636.                     ImGui.Separator()
  637.                    
  638.                     ImGui.PushItemWidth(250);
  639.                    
  640.                     ini.Main.simplifiedInterval = ImGui.SliderInt("Timer Interval", ini.Main.simplifiedInterval, 0, 10, "%d");
  641.                    
  642.                     ini.Main.processItemsOfLesserItemLevel_Only = ImGui.Checkbox("Process items Of lesser item levels ONLY", ini.Main.processItemsOfLesserItemLevel_Only)
  643.                     ini.Main.ignoreIconicItems = ImGui.Checkbox("Do NOT process Iconic Items", ini.Main.ignoreIconicItems)
  644.                    
  645.                     ImGui.Spacing()
  646.                     ImGui.Spacing()
  647.                    
  648.                     optionTextforSlider = {}
  649.                     optionTextforSlider[0] = "Nothing"
  650.                     optionTextforSlider[1] = "AutoSell"
  651.                     optionTextforSlider[2] = "AutoDismantle"
  652.                     tempText = ""
  653.                     tempValue = ""
  654.                    
  655.                     if ImGui.CollapsingHeader("Consumables:") then
  656.                         ImGui.PushItemWidth(250);
  657.                        
  658.                         ini.consumable.ProcessAlcohol = ImGui.Checkbox("Process Alcohol", ini.consumable.ProcessAlcohol)
  659.                         ini.consumable.ProcessFoods = ImGui.Checkbox("Process Foods", ini.consumable.ProcessFoods)
  660.                         ini.consumable.ProcessDrinks = ImGui.Checkbox("Process Drinks", ini.consumable.ProcessDrinks)
  661.                        
  662.                         ImGui.Spacing()
  663.                         ImGui.Separator()
  664.                        
  665.                         ini.consumable.foodToKeep, inputConfirmed = ImGui.InputText("foodToKeep", tostring(ini.consumable.foodToKeep), 100, ImGuiInputTextFlags.EnterReturnsTrue)
  666.                        
  667.                         ini.consumable.beverageToKeep, inputConfirmed = ImGui.InputText("beverageToKeep", tostring(ini.consumable.beverageToKeep), 100, ImGuiInputTextFlags.EnterReturnsTrue)
  668.                         ini.consumable.useAlcoholCraft = ImGui.Checkbox("Auto Convert Alcohol to Moonshine (or whatever you chose below)", ini.consumable.useAlcoholCraft)
  669.                         ini.consumable.alcoholToKeep, inputConfirmed = ImGui.InputText("alcoholToKeep", tostring(ini.consumable.alcoholToKeep), 100, ImGuiInputTextFlags.EnterReturnsTrue)
  670.                         ini.consumable.useHotkey_FoodBeverages = ImGui.Checkbox("useHotkey_FoodBeverages", ini.consumable.useHotkey_FoodBeverages)
  671.                         ini.consumable.useHotkey_Booster = ImGui.Checkbox("Use Hotkey for Booster", ini.consumable.useHotkey_Booster)
  672.                     end
  673.                    
  674.                     if ImGui.CollapsingHeader("Health Items:") then
  675.                         ImGui.PushItemWidth(250);
  676.                        
  677.                         tempValue = optionTextforSlider[ini.SimplifyHealthItems.MaxDoc_MK1]
  678.                         ini.SimplifyHealthItems.MaxDoc_MK1 = ImGui.SliderInt("MaxDoc_MK1", ini.SimplifyHealthItems.MaxDoc_MK1, 0, 2, tempValue);
  679.                        
  680.                         tempValue = optionTextforSlider[ini.SimplifyHealthItems.MaxDoc_MK2]
  681.                         ini.SimplifyHealthItems.MaxDoc_MK2 = ImGui.SliderInt("MaxDoc_MK2", ini.SimplifyHealthItems.MaxDoc_MK2, 0, 2, tempValue);
  682.                        
  683.                         tempValue = optionTextforSlider[ini.SimplifyHealthItems.MaxDoc_MK3]
  684.                         ini.SimplifyHealthItems.MaxDoc_MK3 = ImGui.SliderInt("MaxDoc_MK3", ini.SimplifyHealthItems.MaxDoc_MK3, 0, 2, tempValue);
  685.                        
  686.                         tempValue = optionTextforSlider[ini.SimplifyHealthItems.Bounce_Back_MK1]
  687.                         ini.SimplifyHealthItems.Bounce_Back_MK1 = ImGui.SliderInt("Bounce_Back_MK1", ini.SimplifyHealthItems.Bounce_Back_MK1, 0, 2, tempValue);
  688.                        
  689.                         tempValue = optionTextforSlider[ini.SimplifyHealthItems.Bounce_Back_MK2]
  690.                         ini.SimplifyHealthItems.Bounce_Back_MK2 = ImGui.SliderInt("Bounce_Back_MK2", ini.SimplifyHealthItems.Bounce_Back_MK2, 0, 2, tempValue);
  691.                        
  692.                         tempValue = optionTextforSlider[ini.SimplifyHealthItems.Bounce_Back_MK3]
  693.                         ini.SimplifyHealthItems.Bounce_Back_MK3 = ImGui.SliderInt("Bounce_Back_MK3", ini.SimplifyHealthItems.Bounce_Back_MK3, 0, 2, tempValue);
  694.                        
  695.                     end
  696.                    
  697.                     if ImGui.CollapsingHeader("Auto Health:") then
  698.                         ImGui.PushItemWidth(250);
  699.                         ini.autoHealthInhaler.autoHealthInhaler = ImGui.Checkbox("Auto Use Health Inhaler", ini.autoHealthInhaler.autoHealthInhaler)
  700.                        
  701.                         ini.autoHealthInhaler.autoHealthInhalerThreshold = ImGui.SliderInt("autoHealthInhalerThreshold", ini.autoHealthInhaler.autoHealthInhalerThreshold, 0, 99, "%d");
  702.                         ini.autoHealthInhaler.autoHealthInhalerCoolDown = ImGui.SliderInt("autoHealthInhalerCoolDown (seconds)", ini.autoHealthInhaler.autoHealthInhalerCoolDown, 0, 60, "%d");
  703.                     end
  704.                    
  705.                     if ImGui.CollapsingHeader("Junk Items:") then
  706.                         ImGui.PushItemWidth(250);
  707.                         ini.Junk.autoCleanJunk = ImGui.Checkbox("Auto Clean Junk", ini.Junk.autoCleanJunk)
  708.                         ImGui.Spacing()
  709.                         ImGui.Separator()
  710.                         ini.Junk.sellAllJunk = ImGui.Checkbox("Sell All Junk", ini.Junk.sellAllJunk)
  711.                         ini.Junk.sellExpensiveJunk = ImGui.Checkbox("Sell Expensive Junk", ini.Junk.sellExpensiveJunk)
  712.                         ini.Junk.disassembleAllJunk = ImGui.Checkbox("Disassemble All Junk", ini.Junk.disassembleAllJunk)
  713.                         ini.Junk.disassembleCheapJunk = ImGui.Checkbox("Disassemble Cheap Junk", ini.Junk.disassembleCheapJunk)
  714.                     end
  715.                    
  716.                     if ImGui.CollapsingHeader("Grenades:") then
  717.                         ImGui.Text("Select the Grenade types to process:")
  718.                         ImGui.Spacing()
  719.                        
  720.                         ini.SimplifyGrenades.Biohazard = ImGui.Checkbox("Biohazard ", ini.SimplifyGrenades.Biohazard);ImGui.SameLine();
  721.                         ini.SimplifyGrenades.Cutting = ImGui.Checkbox("Cutting   ", ini.SimplifyGrenades.Cutting);ImGui.SameLine();
  722.                         ini.SimplifyGrenades.Emp = ImGui.Checkbox("Emp   ", ini.SimplifyGrenades.Emp);ImGui.SameLine();
  723.                         ini.SimplifyGrenades.Flash = ImGui.Checkbox("Flash", ini.SimplifyGrenades.Flash)
  724.                         ini.SimplifyGrenades.Frag = ImGui.Checkbox("Frag      ", ini.SimplifyGrenades.Frag);ImGui.SameLine();
  725.                         ini.SimplifyGrenades.Incendiary = ImGui.Checkbox("Incendiary", ini.SimplifyGrenades.Incendiary);ImGui.SameLine();
  726.                         ini.SimplifyGrenades.Recon = ImGui.Checkbox("Recon", ini.SimplifyGrenades.Recon)
  727.                        
  728.                         ImGui.Spacing();ImGui.Spacing()
  729.                         tempText = "Common - Grenades"
  730.                         tempValue = optionTextforSlider[ini.SimplifyGrenades.SimplifyGrenades_Common]
  731.                         ini.SimplifyGrenades.SimplifyGrenades_Common = ImGui.SliderInt(tempText, ini.SimplifyGrenades.SimplifyGrenades_Common, 0, 2, tempValue);
  732.                        
  733.                         tempText = "Uncommon - Grenades"
  734.                         tempValue = optionTextforSlider[ini.SimplifyGrenades.SimplifyGrenades_Uncommon]
  735.                         ini.SimplifyGrenades.SimplifyGrenades_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyGrenades.SimplifyGrenades_Uncommon, 0, 2, tempValue);
  736.                        
  737.                         tempText = "Rare - Grenades"
  738.                         tempValue = optionTextforSlider[ini.SimplifyGrenades.SimplifyGrenades_Rare]
  739.                         ini.SimplifyGrenades.SimplifyGrenades_Rare = ImGui.SliderInt(tempText, ini.SimplifyGrenades.SimplifyGrenades_Rare, 0, 2, tempValue);
  740.                        
  741.                         tempText = "Epic - Grenades"
  742.                         tempValue = optionTextforSlider[ini.SimplifyGrenades.SimplifyGrenades_Epic]
  743.                         ini.SimplifyGrenades.SimplifyGrenades_Epic = ImGui.SliderInt(tempText, ini.SimplifyGrenades.SimplifyGrenades_Epic, 0, 2, tempValue);
  744.                        
  745.                         tempText = "Legendary - Grenades"
  746.                         tempValue = optionTextforSlider[ini.SimplifyGrenades.SimplifyGrenades_Legendary]
  747.                         ini.SimplifyGrenades.SimplifyGrenades_Legendary = ImGui.SliderInt(tempText, ini.SimplifyGrenades.SimplifyGrenades_Legendary, 0, 2, tempValue);
  748.                     end
  749.                    
  750.                     ImGui.Spacing()
  751.                     ImGui.Separator()
  752.                     ImGui.Text("MODS")
  753.                    
  754.                     if ImGui.CollapsingHeader("Clothing Mods:") then
  755.                         ImGui.PushItemWidth(250);
  756.                         tempText = "Common - Clothing Mods"
  757.                         tempValue = optionTextforSlider[ini.SimplifyClothesMod.SimplifyClothesMod_Common]
  758.                         ini.SimplifyClothesMod.SimplifyClothesMod_Common = ImGui.SliderInt(tempText, ini.SimplifyClothesMod.SimplifyClothesMod_Common, 0, 2, tempValue);
  759.                        
  760.                         tempText = "Uncommon - Clothing Mods"
  761.                         tempValue = optionTextforSlider[ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon]
  762.                         ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon, 0, 2, tempValue);
  763.                        
  764.                         tempText = "Rare - Clothing Mods"
  765.                         tempValue = optionTextforSlider[ini.SimplifyClothesMod.SimplifyClothesMod_Rare]
  766.                         ini.SimplifyClothesMod.SimplifyClothesMod_Rare = ImGui.SliderInt(tempText, ini.SimplifyClothesMod.SimplifyClothesMod_Rare, 0, 2, tempValue);
  767.                        
  768.                         tempText = "Epic - Clothing Mods"
  769.                         tempValue = optionTextforSlider[ini.SimplifyClothesMod.SimplifyClothesMod_Epic]
  770.                         ini.SimplifyClothesMod.SimplifyClothesMod_Epic = ImGui.SliderInt(tempText, ini.SimplifyClothesMod.SimplifyClothesMod_Epic, 0, 2, tempValue);
  771.                        
  772.                         tempText = "Legendary - Clothing Mods"
  773.                         tempValue = optionTextforSlider[ini.SimplifyClothesMod.SimplifyClothesMod_Legendary]
  774.                         ini.SimplifyClothesMod.SimplifyClothesMod_Legendary = ImGui.SliderInt(tempText, ini.SimplifyClothesMod.SimplifyClothesMod_Legendary, 0, 2, tempValue);
  775.                     end
  776.                    
  777.                     if ImGui.CollapsingHeader("Weapon Mods:") then
  778.                         ImGui.PushItemWidth(250);
  779.                         tempText = "Common - Weapon Mod"
  780.                         tempValue = optionTextforSlider[ini.SimplifyWeaponMod.SimplifyWeaponMod_Common]
  781.                         ini.SimplifyWeaponMod.SimplifyWeaponMod_Common = ImGui.SliderInt(tempText, ini.SimplifyWeaponMod.SimplifyWeaponMod_Common, 0, 2, tempValue);
  782.                        
  783.                         tempText = "Uncommon - Weapon Mod"
  784.                         tempValue = optionTextforSlider[ini.SimplifyWeaponMod.SimplifyWeaponMod_Uncommon]
  785.                         ini.SimplifyWeaponMod.SimplifyWeaponMod_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyWeaponMod.SimplifyWeaponMod_Uncommon, 0, 2, tempValue);
  786.                        
  787.                         tempText = "Rare - Weapon Mod"
  788.                         tempValue = optionTextforSlider[ini.SimplifyWeaponMod.SimplifyWeaponMod_Rare]
  789.                         ini.SimplifyWeaponMod.SimplifyWeaponMod_Rare = ImGui.SliderInt(tempText, ini.SimplifyWeaponMod.SimplifyWeaponMod_Rare, 0, 2, tempValue);
  790.                        
  791.                         tempText = "Epic - Weapon Mod"
  792.                         tempValue = optionTextforSlider[ini.SimplifyWeaponMod.SimplifyWeaponMod_Epic]
  793.                         ini.SimplifyWeaponMod.SimplifyWeaponMod_Epic = ImGui.SliderInt(tempText, ini.SimplifyWeaponMod.SimplifyWeaponMod_Epic, 0, 2, tempValue);
  794.                        
  795.                         tempText = "Legendary - Weapon Mod"
  796.                         tempValue = optionTextforSlider[ini.SimplifyWeaponMod.SimplifyWeaponMod_Legendary]
  797.                         ini.SimplifyWeaponMod.SimplifyWeaponMod_Legendary = ImGui.SliderInt(tempText, ini.SimplifyWeaponMod.SimplifyWeaponMod_Legendary, 0, 2, tempValue);
  798.                     end
  799.                    
  800.                     if ImGui.CollapsingHeader("Quickhack Mods:") then
  801.                         ImGui.Spacing()
  802.                         ImGui.PushItemWidth(250);
  803.                        
  804.                         ini.SimplifyShards.SimplifyShards = ImGui.Checkbox("Autosell Duplicate Quickhack Mods", ini.SimplifyShards.SimplifyShards)
  805.                        
  806.                     end
  807.                    
  808.                     ----------------------------------------------------------------------------------------------------------------------------------------
  809.                     ImGui.Spacing()
  810.                     ImGui.Separator()
  811.                     ImGui.Text("EQUIPMENT")
  812.                    
  813.                     if ImGui.CollapsingHeader("Weapons:") then
  814.                         ImGui.PushItemWidth(250);
  815.                        
  816.                         ini.SimplifyWeapon.KeepOneOfEachType = ImGui.Checkbox("Keep one of each weapon type", ini.SimplifyWeapon.KeepOneOfEachType)
  817.                        
  818.                         if(ini.SimplifyWeapon.KeepOneOfEachType) then
  819.                             ImGui.Indent();
  820.                             ImGui.TextWrapped("Select the weapon types you want to keep one of:");ImGui.Spacing()
  821.                            
  822.                            
  823.                             if ImGui.BeginListBox("", 350.0, 150.0) then
  824.                                 ImGui.Spacing()
  825.                                
  826.                                 ImGui.Selectable("Rifle Assault", ini.SimplifyWeapon.RifleAssault)
  827.                                 if(ImGui.IsItemClicked()) then
  828.                                     ini.SimplifyWeapon.RifleAssault = not ini.SimplifyWeapon.RifleAssault
  829.                                 end
  830.                                
  831.                                 ImGui.Selectable("Knuckles", ini.SimplifyWeapon.Knuckles)
  832.                                 if(ImGui.IsItemClicked()) then
  833.                                     ini.SimplifyWeapon.Knuckles = not ini.SimplifyWeapon.Knuckles
  834.                                 end
  835.                                
  836.                                 ImGui.Selectable("Two Hand Hammer", ini.SimplifyWeapon.TwoHandHammer)
  837.                                 if(ImGui.IsItemClicked()) then
  838.                                     ini.SimplifyWeapon.TwoHandHammer = not ini.SimplifyWeapon.TwoHandHammer
  839.                                 end
  840.                                
  841.                                 ImGui.Selectable("Handgun", ini.SimplifyWeapon.Handgun)
  842.                                 if(ImGui.IsItemClicked()) then
  843.                                     ini.SimplifyWeapon.Handgun = not ini.SimplifyWeapon.Handgun
  844.                                 end
  845.                                
  846.                                 ImGui.Selectable("Heavy Weapon", ini.SimplifyWeapon.HeavyWeapon)
  847.                                 if(ImGui.IsItemClicked()) then
  848.                                     ini.SimplifyWeapon.HeavyWeapon = not ini.SimplifyWeapon.HeavyWeapon
  849.                                 end
  850.                                
  851.                                 ImGui.Selectable("Katana", ini.SimplifyWeapon.Katana)
  852.                                 if(ImGui.IsItemClicked()) then
  853.                                     ini.SimplifyWeapon.Katana = not ini.SimplifyWeapon.Katana
  854.                                 end
  855.                                
  856.                                 ImGui.Selectable("Knife", ini.SimplifyWeapon.Knife)
  857.                                 if(ImGui.IsItemClicked()) then
  858.                                     ini.SimplifyWeapon.Knife = not ini.SimplifyWeapon.Knife
  859.                                 end
  860.                                
  861.                                 ImGui.Selectable("Light Machine Gun (LMG)", ini.SimplifyWeapon.LMG)
  862.                                 if(ImGui.IsItemClicked()) then
  863.                                     ini.SimplifyWeapon.LMG = not ini.SimplifyWeapon.LMG
  864.                                 end
  865.                                
  866.                                 ImGui.Selectable("One Hand Blade", ini.SimplifyWeapon.OneHandBlade)
  867.                                 if(ImGui.IsItemClicked()) then
  868.                                     ini.SimplifyWeapon.OneHandBlade = not ini.SimplifyWeapon.OneHandBlade
  869.                                 end
  870.                                
  871.                                 ImGui.Selectable("One Hand Club", ini.SimplifyWeapon.OneHandClub)
  872.                                 if(ImGui.IsItemClicked()) then
  873.                                     ini.SimplifyWeapon.OneHandClub = not ini.SimplifyWeapon.OneHandClub
  874.                                 end
  875.                                
  876.                                 ImGui.Selectable("Rifle Precision", ini.SimplifyWeapon.RiflePrecision)
  877.                                 if(ImGui.IsItemClicked()) then
  878.                                     ini.SimplifyWeapon.RiflePrecision = not ini.SimplifyWeapon.RiflePrecision
  879.                                 end
  880.                                
  881.                                 ImGui.Selectable("Revolver", ini.SimplifyWeapon.Revolver)
  882.                                 if(ImGui.IsItemClicked()) then
  883.                                     ini.SimplifyWeapon.Revolver = not ini.SimplifyWeapon.Revolver
  884.                                 end
  885.                                
  886.                                 ImGui.Selectable("Shotgun", ini.SimplifyWeapon.Shotgun)
  887.                                 if(ImGui.IsItemClicked()) then
  888.                                     ini.SimplifyWeapon.Shotgun = not ini.SimplifyWeapon.Shotgun
  889.                                 end
  890.                                
  891.                                 ImGui.Selectable("Shotgun Dual (Double-Barrel Shotgun)", ini.SimplifyWeapon.ShotgunDual)
  892.                                 if(ImGui.IsItemClicked()) then
  893.                                     ini.SimplifyWeapon.ShotgunDual = not ini.SimplifyWeapon.ShotgunDual
  894.                                 end
  895.                                
  896.                                 ImGui.Selectable("Rifle Sniper", ini.SimplifyWeapon.RifleSniper)
  897.                                 if(ImGui.IsItemClicked()) then
  898.                                     ini.SimplifyWeapon.RifleSniper = not ini.SimplifyWeapon.RifleSniper
  899.                                 end
  900.                                
  901.                                 ImGui.Selectable("Sub Machine Gun (SMG)", ini.SimplifyWeapon.SMG)
  902.                                 if(ImGui.IsItemClicked()) then
  903.                                     ini.SimplifyWeapon.SMG = not ini.SimplifyWeapon.SMG
  904.                                 end
  905.                                
  906.                                 ImGui.Selectable("Two Hand Club", ini.SimplifyWeapon.TwoHandClub)
  907.                                 if(ImGui.IsItemClicked()) then
  908.                                     ini.SimplifyWeapon.TwoHandClub = not ini.SimplifyWeapon.TwoHandClub
  909.                                 end
  910.                                
  911.                                 ImGui.Selectable("Unique", ini.SimplifyWeapon.Unique)
  912.                                 if(ImGui.IsItemClicked()) then
  913.                                     ini.SimplifyWeapon.Unique = not ini.SimplifyWeapon.Unique
  914.                                 end
  915.                                
  916.                                 ImGui.EndListBox();
  917.                             end
  918.                             ImGui.Unindent();
  919.                            
  920.                             ImGui.Spacing()
  921.                             ImGui.Separator()
  922.                         end
  923.                         ----------------------------------
  924.                        
  925.                         tempText = "Common - Weapons"
  926.                         tempValue = optionTextforSlider[ini.SimplifyWeapon.SimplifyWeapon_Common]
  927.                         ini.SimplifyWeapon.SimplifyWeapon_Common = ImGui.SliderInt(tempText, ini.SimplifyWeapon.SimplifyWeapon_Common, 0, 2, tempValue);
  928.                        
  929.                         tempText = "Uncommon - Weapons"
  930.                         tempValue = optionTextforSlider[ini.SimplifyWeapon.SimplifyWeapon_Uncommon]
  931.                         ini.SimplifyWeapon.SimplifyWeapon_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyWeapon.SimplifyWeapon_Uncommon, 0, 2, tempValue);
  932.                        
  933.                         tempText = "Rare - Weapons"
  934.                         tempValue = optionTextforSlider[ini.SimplifyWeapon.SimplifyWeapon_Rare]
  935.                         ini.SimplifyWeapon.SimplifyWeapon_Rare = ImGui.SliderInt(tempText, ini.SimplifyWeapon.SimplifyWeapon_Rare, 0, 2, tempValue);
  936.                        
  937.                         tempText = "Epic - Weapons"
  938.                         tempValue = optionTextforSlider[ini.SimplifyWeapon.SimplifyWeapon_Epic]
  939.                         ini.SimplifyWeapon.SimplifyWeapon_Epic = ImGui.SliderInt(tempText, ini.SimplifyWeapon.SimplifyWeapon_Epic, 0, 2, tempValue);
  940.                        
  941.                         tempText = "Legendary - Weapons"
  942.                         tempValue = optionTextforSlider[ini.SimplifyWeapon.SimplifyWeapon_Legendary]
  943.                         ini.SimplifyWeapon.SimplifyWeapon_Legendary = ImGui.SliderInt(tempText, ini.SimplifyWeapon.SimplifyWeapon_Legendary, 0, 2, tempValue);
  944.                     end
  945.                    
  946.                     if ImGui.CollapsingHeader("Feet Armor:") then
  947.                         ImGui.PushItemWidth(250);
  948.                         tempText = "Common - Feet"
  949.                         tempValue = optionTextforSlider[ini.SimplifyFeet.SimplifyFeet_Common]
  950.                         ini.SimplifyFeet.SimplifyFeet_Common = ImGui.SliderInt(tempText, ini.SimplifyFeet.SimplifyFeet_Common, 0, 2, tempValue);
  951.                        
  952.                         tempText = "Uncommon - Feet"
  953.                         tempValue = optionTextforSlider[ini.SimplifyFeet.SimplifyFeet_Uncommon]
  954.                         ini.SimplifyFeet.SimplifyFeet_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyFeet.SimplifyFeet_Uncommon, 0, 2, tempValue);
  955.                        
  956.                         tempText = "Rare - Feet"
  957.                         tempValue = optionTextforSlider[ini.SimplifyFeet.SimplifyFeet_Rare]
  958.                         ini.SimplifyFeet.SimplifyFeet_Rare = ImGui.SliderInt(tempText, ini.SimplifyFeet.SimplifyFeet_Rare, 0, 2, tempValue);
  959.                        
  960.                         tempText = "Epic - Feet"
  961.                         tempValue = optionTextforSlider[ini.SimplifyFeet.SimplifyFeet_Epic]
  962.                         ini.SimplifyFeet.SimplifyFeet_Epic = ImGui.SliderInt(tempText, ini.SimplifyFeet.SimplifyFeet_Epic, 0, 2, tempValue);
  963.                        
  964.                         tempText = "Legendary - Feet"
  965.                         tempValue = optionTextforSlider[ini.SimplifyFeet.SimplifyFeet_Legendary]
  966.                         ini.SimplifyFeet.SimplifyFeet_Legendary = ImGui.SliderInt(tempText, ini.SimplifyFeet.SimplifyFeet_Legendary, 0, 2, tempValue);
  967.                     end
  968.                    
  969.                     if ImGui.CollapsingHeader("Head Armor:") then
  970.                         ImGui.PushItemWidth(250);
  971.                         tempText = "Common - Head Armor"
  972.                         tempValue = optionTextforSlider[ini.SimplifyHeadArmor.SimplifyHeadArmor_Common]
  973.                         ini.SimplifyHeadArmor.SimplifyHeadArmor_Common = ImGui.SliderInt(tempText, ini.SimplifyHeadArmor.SimplifyHeadArmor_Common, 0, 2, tempValue);
  974.                        
  975.                         tempText = "Uncommon - Head Armor"
  976.                         tempValue = optionTextforSlider[ini.SimplifyHeadArmor.SimplifyHeadArmor_Uncommon]
  977.                         ini.SimplifyHeadArmor.SimplifyHeadArmor_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyHeadArmor.SimplifyHeadArmor_Uncommon, 0, 2, tempValue);
  978.                        
  979.                         tempText = "Rare - Head Armor"
  980.                         tempValue = optionTextforSlider[ini.SimplifyHeadArmor.SimplifyHeadArmor_Rare]
  981.                         ini.SimplifyHeadArmor.SimplifyHeadArmor_Rare = ImGui.SliderInt(tempText, ini.SimplifyHeadArmor.SimplifyHeadArmor_Rare, 0, 2, tempValue);
  982.                        
  983.                         tempText = "Epic - Head Armor"
  984.                         tempValue = optionTextforSlider[ini.SimplifyHeadArmor.SimplifyHeadArmor_Epic]
  985.                         ini.SimplifyHeadArmor.SimplifyHeadArmor_Epic = ImGui.SliderInt(tempText, ini.SimplifyHeadArmor.SimplifyHeadArmor_Epic, 0, 2, tempValue);
  986.                        
  987.                         tempText = "Legendary - Head Armor"
  988.                         tempValue = optionTextforSlider[ini.SimplifyHeadArmor.SimplifyHeadArmor_Legendary]
  989.                         ini.SimplifyHeadArmor.SimplifyHeadArmor_Legendary = ImGui.SliderInt(tempText, ini.SimplifyHeadArmor.SimplifyHeadArmor_Legendary, 0, 2, tempValue);
  990.                     end
  991.                    
  992.                     if ImGui.CollapsingHeader("Outer Chest Armor:") then
  993.                         ImGui.PushItemWidth(250);
  994.                         tempText = "Common - Outer Chest Armor"
  995.                         tempValue = optionTextforSlider[ini.SimplifyChestArmor.SimplifyChestArmor_Common]
  996.                         ini.SimplifyChestArmor.SimplifyChestArmor_Common = ImGui.SliderInt(tempText, ini.SimplifyChestArmor.SimplifyChestArmor_Common, 0, 2, tempValue);
  997.                        
  998.                         tempText = "Uncommon - Outer Chest Armor"
  999.                         tempValue = optionTextforSlider[ini.SimplifyChestArmor.SimplifyChestArmor_Uncommon]
  1000.                         ini.SimplifyChestArmor.SimplifyChestArmor_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyChestArmor.SimplifyChestArmor_Uncommon, 0, 2, tempValue);
  1001.                        
  1002.                         tempText = "Rare - Outer Chest Armor"
  1003.                         tempValue = optionTextforSlider[ini.SimplifyChestArmor.SimplifyChestArmor_Rare]
  1004.                         ini.SimplifyChestArmor.SimplifyChestArmor_Rare = ImGui.SliderInt(tempText, ini.SimplifyChestArmor.SimplifyChestArmor_Rare, 0, 2, tempValue);
  1005.                        
  1006.                         tempText = "Epic - Outer Chest Armor"
  1007.                         tempValue = optionTextforSlider[ini.SimplifyChestArmor.SimplifyChestArmor_Epic]
  1008.                         ini.SimplifyChestArmor.SimplifyChestArmor_Epic = ImGui.SliderInt(tempText, ini.SimplifyChestArmor.SimplifyChestArmor_Epic, 0, 2, tempValue);
  1009.                        
  1010.                         tempText = "Legendary - Outer Chest Armor"
  1011.                         tempValue = optionTextforSlider[ini.SimplifyChestArmor.SimplifyChestArmor_Legendary]
  1012.                         ini.SimplifyChestArmor.SimplifyChestArmor_Legendary = ImGui.SliderInt(tempText, ini.SimplifyChestArmor.SimplifyChestArmor_Legendary, 0, 2, tempValue);
  1013.                     end
  1014.                    
  1015.                     if ImGui.CollapsingHeader("Inner Chest Armor:") then
  1016.                         ImGui.PushItemWidth(250);
  1017.                         tempText = "Common - Inner Chest Armor"
  1018.                         tempValue = optionTextforSlider[ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Common]
  1019.                         ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Common = ImGui.SliderInt(tempText, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Common, 0, 2, tempValue);
  1020.                        
  1021.                         tempText = "Uncommon - Inner Chest Armor"
  1022.                         tempValue = optionTextforSlider[ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Uncommon]
  1023.                         ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Uncommon, 0, 2, tempValue);
  1024.                        
  1025.                         tempText = "Rare - Inner Chest Armor"
  1026.                         tempValue = optionTextforSlider[ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Rare]
  1027.                         ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Rare = ImGui.SliderInt(tempText, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Rare, 0, 2, tempValue);
  1028.                        
  1029.                         tempText = "Epic - Inner Chest Armor"
  1030.                         tempValue = optionTextforSlider[ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Epic]
  1031.                         ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Epic = ImGui.SliderInt(tempText, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Epic, 0, 2, tempValue);
  1032.                        
  1033.                         tempText = "Legendary - Inner Chest Armor"
  1034.                         tempValue = optionTextforSlider[ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Legendary]
  1035.                         ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Legendary = ImGui.SliderInt(tempText, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Legendary, 0, 2, tempValue);
  1036.                     end
  1037.                    
  1038.                     if ImGui.CollapsingHeader("Face Armor:") then
  1039.                         ImGui.PushItemWidth(250);
  1040.                         tempText = "Common - Face Armor"
  1041.                         tempValue = optionTextforSlider[ini.SimplifyFaceArmor.SimplifyFaceArmor_Common]
  1042.                         ini.SimplifyFaceArmor.SimplifyFaceArmor_Common = ImGui.SliderInt(tempText, ini.SimplifyFaceArmor.SimplifyFaceArmor_Common, 0, 2, tempValue);
  1043.                        
  1044.                         tempText = "Uncommon - Face Armor"
  1045.                         tempValue = optionTextforSlider[ini.SimplifyFaceArmor.SimplifyFaceArmor_Uncommon]
  1046.                         ini.SimplifyFaceArmor.SimplifyFaceArmor_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyFaceArmor.SimplifyFaceArmor_Uncommon, 0, 2, tempValue);
  1047.                        
  1048.                         tempText = "Rare - Face Armor"
  1049.                         tempValue = optionTextforSlider[ini.SimplifyFaceArmor.SimplifyFaceArmor_Rare]
  1050.                         ini.SimplifyFaceArmor.SimplifyFaceArmor_Rare = ImGui.SliderInt(tempText, ini.SimplifyFaceArmor.SimplifyFaceArmor_Rare, 0, 2, tempValue);
  1051.                        
  1052.                         tempText = "Epic - Face Armor"
  1053.                         tempValue = optionTextforSlider[ini.SimplifyFaceArmor.SimplifyFaceArmor_Epic]
  1054.                         ini.SimplifyFaceArmor.SimplifyFaceArmor_Epic = ImGui.SliderInt(tempText, ini.SimplifyFaceArmor.SimplifyFaceArmor_Epic, 0, 2, tempValue);
  1055.                        
  1056.                         tempText = "Legendary - Face Armor"
  1057.                         tempValue = optionTextforSlider[ini.SimplifyFaceArmor.SimplifyFaceArmor_Legendary]
  1058.                         ini.SimplifyFaceArmor.SimplifyFaceArmor_Legendary = ImGui.SliderInt(tempText, ini.SimplifyFaceArmor.SimplifyFaceArmor_Legendary, 0, 2, tempValue);
  1059.                     end
  1060.                    
  1061.                     if ImGui.CollapsingHeader("Leg Armor:") then
  1062.                         ImGui.PushItemWidth(250);
  1063.                         tempText = "Common - Leg Armor"
  1064.                         tempValue = optionTextforSlider[ini.SimplifyLegArmor.SimplifyLegArmor_Common]
  1065.                         ini.SimplifyLegArmor.SimplifyLegArmor_Common = ImGui.SliderInt(tempText, ini.SimplifyLegArmor.SimplifyLegArmor_Common, 0, 2, tempValue);
  1066.                        
  1067.                         tempText = "Uncommon - Leg Armor"
  1068.                         tempValue = optionTextforSlider[ini.SimplifyLegArmor.SimplifyLegArmor_Uncommon]
  1069.                         ini.SimplifyLegArmor.SimplifyLegArmor_Uncommon = ImGui.SliderInt(tempText, ini.SimplifyLegArmor.SimplifyLegArmor_Uncommon, 0, 2, tempValue);
  1070.                        
  1071.                         tempText = "Rare - Leg Armor"
  1072.                         tempValue = optionTextforSlider[ini.SimplifyLegArmor.SimplifyLegArmor_Rare]
  1073.                         ini.SimplifyLegArmor.SimplifyLegArmor_Rare = ImGui.SliderInt(tempText, ini.SimplifyLegArmor.SimplifyLegArmor_Rare, 0, 2, tempValue);
  1074.                        
  1075.                         tempText = "Epic - Leg Armor"
  1076.                         tempValue = optionTextforSlider[ini.SimplifyLegArmor.SimplifyLegArmor_Epic]
  1077.                         ini.SimplifyLegArmor.SimplifyLegArmor_Epic = ImGui.SliderInt(tempText, ini.SimplifyLegArmor.SimplifyLegArmor_Epic, 0, 2, tempValue);
  1078.                        
  1079.                         tempText = "Legendary - Leg Armor"
  1080.                         tempValue = optionTextforSlider[ini.SimplifyLegArmor.SimplifyLegArmor_Legendary]
  1081.                         ini.SimplifyLegArmor.SimplifyLegArmor_Legendary = ImGui.SliderInt(tempText, ini.SimplifyLegArmor.SimplifyLegArmor_Legendary, 0, 2, tempValue);
  1082.                     end
  1083.                    
  1084.                    
  1085.                    
  1086.  
  1087.                     ImGui.PopItemWidth()
  1088.                     ImGui.EndTabItem();
  1089.                 end
  1090.                
  1091.                
  1092.                 ImGui.EndTabBar();
  1093.             end
  1094.            
  1095.    
  1096.         end
  1097.        
  1098.        
  1099.         ImGui.End()
  1100.  
  1101.     end
  1102.    
  1103.     ImGui.SetNextWindowPos(80, 170, ImGuiCond.FirstUseEver)
  1104.     ImGui.SetNextWindowSize(400, 225, ImGuiCond.FirstUseEver)
  1105.    
  1106.     if (ini.Main.UseEquipmentNotification and foundArmorThatsBetter) then
  1107.         --set this window's transparency
  1108.         ImGui.PushStyleColor(ImGuiCol.WindowBg, 0.1, 0.1, 0.1, 0.5);
  1109.        
  1110.         if (ImGui.Begin("Equipment: ")) then
  1111.             ImGui.PopStyleColor(1);
  1112.            
  1113.             for i,v in ipairs(slots) do
  1114.                 --we dont want weapons
  1115.                 if(v ~= "Weapon") then
  1116.                     if (highestArmorLevel[v] > 0) then
  1117.                         itemLevelDiff = highestArmorLevel[v] - equippedArmorLevel[v]
  1118.                         --check to see if higher level than equipped
  1119.                         if (itemLevelDiff > 0) then
  1120.                            
  1121.                             ImGui.Text(slotsFriendlyName[i]..":"); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Text, 0, 1, 0, 1);ImGui.Text("+"..itemLevelDiff)
  1122.                             ImGui.PopStyleColor(1);
  1123.                         end
  1124.                         --slotsFriendlyName
  1125.                     end
  1126.                 end
  1127.                
  1128.             end
  1129.            
  1130.         end
  1131.        
  1132.     end
  1133.     ImGui.End()
  1134.    
  1135. end)
  1136.  
  1137. function MyMod:ProcessMainFunctionOnce()
  1138.     if(ini.Main.UseMod == false) then
  1139.         do return end
  1140.     end
  1141.    
  1142.     --player = Game.GetPlayerSystem():GetLocalPlayerMainGameObject()
  1143.    
  1144.     --convert food and beverages
  1145.     if(nextAvailableTime < os.time() or ini.Main.UseManualMode == true) then
  1146.        
  1147.         nextAvailableTime = os.time() + ini.Main.simplifiedInterval
  1148.        
  1149.         if(player ~= nil) then
  1150.            
  1151.             --Quantites have changed
  1152.             if(prevItemQuantity ~= currentItemQuantity ) then
  1153.                 MyMod:ProcessConsumable()
  1154.             end
  1155.            
  1156.             --Auto sell junk
  1157.             if(ini.Junk.autoCleanJunk == true) then
  1158.                 if(ts:GetItemQuantityByTag(player, "Junk") > 0) then
  1159.                     MyMod:sellJunk()
  1160.                 end
  1161.                
  1162.             end
  1163.            
  1164.             --IMGUI Menu screen
  1165.             --do return end
  1166.             MyMod:getItemLevels()
  1167.            
  1168.             --Auto sell grenades
  1169.             if(ts:GetItemQuantityByTag(player, "Grenade") > 0) then
  1170.                 MyMod:ProcessMiscItems("Grenade", false, ini.SimplifyGrenades.SimplifyGrenades_Common, ini.SimplifyGrenades.SimplifyGrenades_Uncommon, ini.SimplifyGrenades.SimplifyGrenades_Rare, ini.SimplifyGrenades.SimplifyGrenades_Epic, ini.SimplifyGrenades.SimplifyGrenades_Legendary)
  1171.             end
  1172.            
  1173.             if(ts:GetItemQuantityByTag(player, "SimpleEnhancer") > 0) then
  1174.                 MyMod:ProcessMiscItems("SimpleEnhancer", false, ini.SimplifyClothesMod.SimplifyClothesMod_Common, ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon, ini.SimplifyClothesMod.SimplifyClothesMod_Rare, ini.SimplifyClothesMod.SimplifyClothesMod_Epic, ini.SimplifyClothesMod.SimplifyClothesMod_Legendary)
  1175.             end
  1176.            
  1177.             if(ts:GetItemQuantityByTag(player, "FabricEnhancer") > 0) then
  1178.                 MyMod:ProcessMiscItems("FabricEnhancer", false, ini.SimplifyClothesMod.SimplifyClothesMod_Common, ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon, ini.SimplifyClothesMod.SimplifyClothesMod_Rare, ini.SimplifyClothesMod.SimplifyClothesMod_Epic, ini.SimplifyClothesMod.SimplifyClothesMod_Legendary)
  1179.             end
  1180.            
  1181.            
  1182.             if(ts:GetItemQuantityByTag(player, "WeaponMod") > 0) then
  1183.                 MyMod:ProcessMiscItems("WeaponMod", false, ini.SimplifyWeaponMod.SimplifyWeaponMod_Common, ini.SimplifyWeaponMod.SimplifyWeaponMod_Uncommon, ini.SimplifyWeaponMod.SimplifyWeaponMod_Rare, ini.SimplifyWeaponMod.SimplifyWeaponMod_Epic, ini.SimplifyWeaponMod.SimplifyWeaponMod_Legendary)
  1184.             end
  1185.            
  1186.             if(ini.SimplifyWeapon.KeepOneOfEachType) then
  1187.                 for iteration,v in ipairs(weaponTagList) do
  1188.                     if(ts:GetItemQuantityByTag(player, weaponTagList[iteration]) > 0) then
  1189.                         processWeaponType = false
  1190.                        
  1191.                         --check to see if it's something a weapon type that the user wants
  1192.                         if(weaponTagList[iteration] == "Rifle Assault") then
  1193.                             if ini.SimplifyWeapon.RifleAssault then
  1194.                                 processWeaponType = true
  1195.                             end
  1196.                         end
  1197.                        
  1198.                         if(weaponTagList[iteration] == "Rifle Assault") then
  1199.                             if ini.SimplifyWeapon.RifleAssault then
  1200.                                 processWeaponType = true
  1201.                             end
  1202.                         end
  1203.                        
  1204.                         if(weaponTagList[iteration] == "Knuckles") then
  1205.                             if ini.SimplifyWeapon.Knuckles then
  1206.                                 processWeaponType = true
  1207.                             end
  1208.                         end
  1209.                        
  1210.                         if(weaponTagList[iteration] == "Two Hand Hammer") then
  1211.                             if ini.SimplifyWeapon.TwoHandHammer then
  1212.                                 processWeaponType = true
  1213.                             end
  1214.                         end
  1215.                        
  1216.                         if(weaponTagList[iteration] == "Handgun") then
  1217.                             if ini.SimplifyWeapon.Handgun then
  1218.                                 processWeaponType = true
  1219.                             end
  1220.                         end
  1221.                        
  1222.                         if(weaponTagList[iteration] == "HeavyWeapon") then
  1223.                             if ini.SimplifyWeapon.HeavyWeapon then
  1224.                                 processWeaponType = true
  1225.                             end
  1226.                         end
  1227.                        
  1228.                         if(weaponTagList[iteration] == "Katana") then
  1229.                             if ini.SimplifyWeapon.Katana then
  1230.                                 processWeaponType = true
  1231.                             end
  1232.                         end
  1233.                        
  1234.                         if(weaponTagList[iteration] == "Knife") then
  1235.                             if ini.SimplifyWeapon.Knife then
  1236.                                 processWeaponType = true
  1237.                             end
  1238.                         end
  1239.                        
  1240.                         if(weaponTagList[iteration] == "LMG") then
  1241.                             if ini.SimplifyWeapon.LMG then
  1242.                                 processWeaponType = true
  1243.                             end
  1244.                         end
  1245.                        
  1246.                         if(weaponTagList[iteration] == "One Hand Blade") then
  1247.                             if ini.SimplifyWeapon.OneHandBlade then
  1248.                                 processWeaponType = true
  1249.                             end
  1250.                         end
  1251.                        
  1252.                         if(weaponTagList[iteration] == "One Hand Club") then
  1253.                             if ini.SimplifyWeapon.OneHandClub then
  1254.                                 processWeaponType = true
  1255.                             end
  1256.                         end
  1257.                        
  1258.                         if(weaponTagList[iteration] == "Rifle Precision") then
  1259.                             if ini.SimplifyWeapon.RiflePrecision then
  1260.                                 processWeaponType = true
  1261.                             end
  1262.                         end
  1263.                        
  1264.                         if(weaponTagList[iteration] == "Revolver") then
  1265.                             if ini.SimplifyWeapon.Revolver then
  1266.                                 processWeaponType = true
  1267.                             end
  1268.                         end
  1269.                        
  1270.                         if(weaponTagList[iteration] == "Shotgun") then
  1271.                             if ini.SimplifyWeapon.Shotgun then
  1272.                                 processWeaponType = true
  1273.                             end
  1274.                         end
  1275.                        
  1276.                         if(weaponTagList[iteration] == "Shotgun Dual") then
  1277.                             if ini.SimplifyWeapon.ShotgunDual then
  1278.                                 processWeaponType = true
  1279.                             end
  1280.                         end
  1281.                        
  1282.                         if(weaponTagList[iteration] == "Rifle Sniper") then
  1283.                             if ini.SimplifyWeapon.RifleSniper then
  1284.                                 processWeaponType = true
  1285.                             end
  1286.                         end
  1287.                        
  1288.                         if(weaponTagList[iteration] == "SMG") then
  1289.                             if ini.SimplifyWeapon.SMG then
  1290.                                 processWeaponType = true
  1291.                             end
  1292.                         end
  1293.                        
  1294.                         if(weaponTagList[iteration] == "Two Hand Club") then
  1295.                             if ini.SimplifyWeapon.TwoHandClub then
  1296.                                 processWeaponType = true
  1297.                             end
  1298.                         end
  1299.                        
  1300.                         if(weaponTagList[iteration] == "Unique") then
  1301.                             if ini.SimplifyWeapon.Unique then
  1302.                                 processWeaponType = true
  1303.                             end
  1304.                         end
  1305.                        
  1306.                         if(processWeaponType) then
  1307.                             --if(ts:GetItemQuantityByTag(player, weaponTagList[iteration]) > 1) then
  1308.                                 MyMod:GetHighestEffectiveDPSWeapon(weaponTagList[iteration], false)
  1309.                             --end
  1310.                         else
  1311.                             MyMod:GetHighestEffectiveDPSWeapon("Weapon", true)
  1312.                         end
  1313.                        
  1314.                         MyMod:ProcessMiscItems(weaponTagList[iteration], true, ini.SimplifyWeapon.SimplifyWeapon_Common, ini.SimplifyWeapon.SimplifyWeapon_Uncommon, ini.SimplifyWeapon.SimplifyWeapon_Rare, ini.SimplifyWeapon.SimplifyWeapon_Epic, ini.SimplifyWeapon.SimplifyWeapon_Legendary)
  1315.                        
  1316.                     end
  1317.                 end
  1318.             else
  1319.                 MyMod:GetHighestEffectiveDPSWeapon("Weapon", true)
  1320.                 if(ts:GetItemQuantityByTag(player, "Weapon") > 0) then
  1321.                     MyMod:ProcessMiscItems("Weapon", false, ini.SimplifyWeapon.SimplifyWeapon_Common, ini.SimplifyWeapon.SimplifyWeapon_Uncommon, ini.SimplifyWeapon.SimplifyWeapon_Rare, ini.SimplifyWeapon.SimplifyWeapon_Epic, ini.SimplifyWeapon.SimplifyWeapon_Legendary)
  1322.                 end
  1323.             end
  1324.            
  1325.             if(ts:GetItemQuantityByTag(player, "FeetClothing") > 0) then
  1326.                 MyMod:ProcessMiscItems("FeetClothing", false, ini.SimplifyFeet.SimplifyFeet_Common, ini.SimplifyFeet.SimplifyFeet_Uncommon, ini.SimplifyFeet.SimplifyFeet_Rare, ini.SimplifyFeet.SimplifyFeet_Epic, ini.SimplifyFeet.SimplifyFeet_Legendary)
  1327.             end
  1328.            
  1329.             if(ts:GetItemQuantityByTag(player, "HeadArmor") > 0) then
  1330.                 MyMod:ProcessMiscItems("HeadArmor", false, ini.SimplifyHeadArmor.SimplifyHeadArmor_Common, ini.SimplifyHeadArmor.SimplifyHeadArmor_Uncommon, ini.SimplifyHeadArmor.SimplifyHeadArmor_Rare, ini.SimplifyHeadArmor.SimplifyHeadArmor_Epic, ini.SimplifyHeadArmor.SimplifyHeadArmor_Legendary)
  1331.             end
  1332.            
  1333.             if(ts:GetItemQuantityByTag(player, "ChestArmor") > 0) then
  1334.                 MyMod:ProcessMiscItems("ChestArmor", false, ini.SimplifyChestArmor.SimplifyChestArmor_Common, ini.SimplifyChestArmor.SimplifyChestArmor_Uncommon, ini.SimplifyChestArmor.SimplifyChestArmor_Rare, ini.SimplifyChestArmor.SimplifyChestArmor_Epic, ini.SimplifyChestArmor.SimplifyChestArmor_Legendary)
  1335.             end
  1336.            
  1337.             if(ts:GetItemQuantityByTag(player, "InnerChestArmor") > 0) then
  1338.                 MyMod:ProcessMiscItems("InnerChestArmor", false, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Common, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Uncommon, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Rare, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Epic, ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Legendary)
  1339.             end
  1340.            
  1341.             if(ts:GetItemQuantityByTag(player, "FaceArmor") > 0) then
  1342.                 MyMod:ProcessMiscItems("FaceArmor", false, ini.SimplifyFaceArmor.SimplifyFaceArmor_Common, ini.SimplifyFaceArmor.SimplifyFaceArmor_Uncommon, ini.SimplifyFaceArmor.SimplifyFaceArmor_Rare, ini.SimplifyFaceArmor.SimplifyFaceArmor_Epic, ini.SimplifyFaceArmor.SimplifyFaceArmor_Legendary)
  1343.             end
  1344.            
  1345.             if(ts:GetItemQuantityByTag(player, "LegArmor") > 0) then
  1346.                 MyMod:ProcessMiscItems("LegArmor", false, ini.SimplifyLegArmor.SimplifyLegArmor_Common, ini.SimplifyLegArmor.SimplifyLegArmor_Uncommon, ini.SimplifyLegArmor.SimplifyLegArmor_Rare, ini.SimplifyLegArmor.SimplifyLegArmor_Epic, ini.SimplifyLegArmor.SimplifyLegArmor_Legendary)
  1347.             end
  1348.            
  1349.             if(ts:GetItemQuantityByTag(player, "Drug") > 0) then
  1350.                 MyMod:processByTag("Drug")
  1351.             end
  1352.            
  1353.             --shards
  1354.             if(ini.SimplifyShards.SimplifyShards) then
  1355.                 MyMod:ProcessShards();
  1356.             end
  1357.            
  1358.             --check to see if there is any better equipment
  1359.             totalSlotsFoundBetter = 0
  1360.            
  1361.             for i,v in pairs(slots) do
  1362.                 if(v ~= "Weapon") then
  1363.                     totalSlotsFoundBetter = totalSlotsFoundBetter + MyMod:GetHighestArmorByTag(v)
  1364.                 end
  1365.             end
  1366.            
  1367.             --this determines if the Equipment Notification window pops up
  1368.             if(totalSlotsFoundBetter == 0) then
  1369.                 foundArmorThatsBetter = false
  1370.             else
  1371.                 foundArmorThatsBetter = true
  1372.             end
  1373.         end
  1374.        
  1375.     end
  1376.    
  1377.     --use autoHealthInhaler
  1378.     if(ini.autoHealthInhaler.autoHealthInhaler) then
  1379.         if (nextInhalerTime < os.time()) then
  1380.             nextInhalerTime = os.time() + ini.autoHealthInhaler.autoHealthInhalerCoolDown
  1381.            
  1382.             if(playerHealthPercent < ini.autoHealthInhaler.autoHealthInhalerThreshold and playerHealthPercent > 1 ) then
  1383.                 MyMod:ProccessInhaler()
  1384.             end
  1385.         end
  1386.        
  1387.     end
  1388. end
  1389.  
  1390. function MyMod:suicidePlayer()
  1391.     ---DEBUG SUICIDE
  1392.       Game.ApplyEffectOnPlayer("WorkspotStatus.Death")
  1393. end
  1394.  
  1395. function MyMod:tryEatConsumable()
  1396.     --use consumables
  1397.     if(ini.consumable.useHotkey_FoodBeverages) then
  1398.         if(pauseDetected == false) then
  1399.             --10 second interval between eatings to prevent overeating :D
  1400.             if(nextConsumeTime_FoodBeverages < os.time()) then
  1401.                 nextConsumeTime_FoodBeverages = os.time() + globalDelayinSeconds
  1402.                 MyMod:EatConsumable()
  1403.             end
  1404.         end
  1405.     end
  1406.    
  1407. end
  1408.  
  1409. function MyMod:tryUseBooster()
  1410.     --Use booster
  1411.     if(ini.consumable.useHotkey_Booster) then
  1412.         if(pauseDetected == false) then
  1413.             --10 second interval between eatings to prevent overeating :D
  1414.             if(nextConsumeTime_Booster < os.time()) then
  1415.            
  1416.                 nextConsumeTime_Booster = os.time() + globalDelayinSeconds
  1417.                 MyMod:UseBooster()
  1418.             end
  1419.         end
  1420.     end
  1421. end
  1422.  
  1423.  
  1424.  
  1425. function MyMod:ProcessConsumable()
  1426.    
  1427.     ------------------------------------------------------------------------------------------------------
  1428.     --
  1429.     --Count how many drinks the player has not counting GoodQualityDrink1
  1430.     --GoodQualityDrink10 = Water
  1431.     --Count how much food the player has not counting MediumQualityFood16 (those are Tacos, choombas like Tacos)
  1432.     --MediumQualityFood16 = Taco
  1433.    
  1434.     totalDrinks = 0
  1435.     totalTacos = 0
  1436.     totalAlcohol = 0
  1437.    
  1438.     if(ini.consumable.ProcessAlcohol) then
  1439.         for i,v in ipairs(alcoholItems) do
  1440.             tid = TweakDBID.new(v)
  1441.             itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  1442.             currentDrinkCount = ts:GetItemQuantity(player, itemid)
  1443.            
  1444.             if currentDrinkCount > 0 then
  1445.                 if ini.consumable.useAlcoholCraft then
  1446.                     if v ~= ini.consumable.alcoholToKeep then
  1447.                         ts:RemoveItem(player, itemid, currentDrinkCount)
  1448.                        
  1449.                         totalAlcohol = totalAlcohol + currentDrinkCount
  1450.                     end
  1451.                    
  1452.                 else
  1453.                     --alcohol price = $30
  1454.                     moneyToAdd = MyMod:GetItemSellPrice(itemid) * currentDrinkCount
  1455.                    
  1456.                     --for debugging
  1457.                     MyMod:LogAction("Gained Eurodollars: ", moneyToAdd)
  1458.                    
  1459.                    
  1460.                     Game.AddToInventory("Items.money",moneyToAdd)
  1461.                     ts:RemoveItem(player, itemid, currentDrinkCount)
  1462.                    
  1463.                     session_MoneyGained = session_MoneyGained + moneyToAdd
  1464.                 end
  1465.             end
  1466.         end
  1467.     end
  1468.    
  1469.     if(ini.consumable.ProcessDrinks) then
  1470.         for i,v in ipairs(drinkItems) do
  1471.             tid = TweakDBID.new(v)
  1472.             itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  1473.             currentDrinkCount = ts:GetItemQuantity(player, itemid)
  1474.            
  1475.             if currentDrinkCount > 0 and v ~= ini.consumable.beverageToKeep then
  1476.                
  1477.                 ts:RemoveItem(player, itemid, currentDrinkCount)
  1478.                 totalDrinks = totalDrinks + currentDrinkCount
  1479.             end
  1480.         end
  1481.     end
  1482.    
  1483.    
  1484.     if(ini.consumable.ProcessFoods) then
  1485.         for i,v in ipairs(foodItems) do
  1486.             tid = TweakDBID.new(v)
  1487.             itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  1488.             currentFoodCount = ts:GetItemQuantity(player, itemid)
  1489.            
  1490.             if currentFoodCount > 0 then
  1491.                
  1492.                 if(v ~= ini.consumable.foodToKeep) then
  1493.                     ts:RemoveItem(player, itemid, currentFoodCount)
  1494.                     totalTacos = totalTacos + currentFoodCount
  1495.                 end
  1496.                
  1497.             end
  1498.         end
  1499.     end
  1500.    
  1501.     if(totalDrinks > 0) then
  1502.         MyMod:LogAction("Water Added: ", totalDrinks)
  1503.         Game.AddToInventory(ini.consumable.beverageToKeep, totalDrinks)
  1504.     end
  1505.    
  1506.     if(totalTacos > 0) then
  1507.         MyMod:LogAction("Food Added: ", totalTacos)
  1508.         Game.AddToInventory(ini.consumable.foodToKeep, totalTacos)
  1509.     end
  1510.    
  1511.     if(totalAlcohol > 0) then
  1512.         MyMod:LogAction("Alcohol Added: ", totalAlcohol)
  1513.         Game.AddToInventory(ini.consumable.alcoholToKeep, totalAlcohol)
  1514.     end
  1515.    
  1516.     --update previuos total quantity value
  1517.     prevItemQuantity = ts:GetTotalItemQuantity(player)
  1518.     session_Food  = session_Food + totalTacos
  1519.     session_Drinks = session_Drinks + totalDrinks
  1520.     session_Alcohol = session_Alcohol + totalAlcohol
  1521.    
  1522. end
  1523.  
  1524. function MyMod:EatConsumable()
  1525.    
  1526.     for i,v in ipairs(drinkItems) do
  1527.         tid = TweakDBID.new(v)
  1528.         itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  1529.         currentDrinkCount = ts:GetItemQuantity(player, itemid)
  1530.        
  1531.         if currentDrinkCount > 0 and v == ini.consumable.beverageToKeep then
  1532.             --for debugging
  1533.             MyMod:LogAction("Drank: ", v)
  1534.            
  1535.             Game['ItemActionsHelper::DrinkItem;GameObjectItemIDBool'](player, itemid, true)
  1536.            
  1537.         end
  1538.     end
  1539.    
  1540.    
  1541.     for i,v in ipairs(foodItems) do
  1542.         tid = TweakDBID.new(v)
  1543.         itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  1544.         currentFoodCount = ts:GetItemQuantity(player, itemid)
  1545.        
  1546.         if currentFoodCount > 0 and v == ini.consumable.foodToKeep then
  1547.             --for debugging
  1548.             MyMod:LogAction("Ate: ", v)
  1549.            
  1550.             Game['ItemActionsHelper::EatItem;GameObjectItemIDBool'](player, itemid, true)
  1551.            
  1552.         end
  1553.        
  1554.     end
  1555.  
  1556. end
  1557.  
  1558. function MyMod:ProccessInhaler()
  1559.    
  1560.     for i,v in ipairs(inhalerItems) do
  1561.         tid = TweakDBID.new(v)
  1562.         itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  1563.         currentInhalerCount = ts:GetItemQuantity(player, itemid)
  1564.        
  1565.         if currentInhalerCount > 0 then
  1566.             --for debugging
  1567.             MyMod:LogAction("Used inhaler: ", v)
  1568.            
  1569.             Game['ItemActionsHelper::ConsumeItem;GameObjectItemIDBool'](player, itemid, true)
  1570.             break
  1571.         end
  1572.     end
  1573.  
  1574. end
  1575.  
  1576. function MyMod:UseBooster()
  1577.    
  1578.     for i,v in ipairs(boosterItems) do
  1579.         tid = TweakDBID.new(v)
  1580.         itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  1581.         currentBoosterCount = ts:GetItemQuantity(player, itemid)
  1582.        
  1583.         if currentBoosterCount > 0 then
  1584.             --for debugging
  1585.             MyMod:LogAction("Used booster: ", v)
  1586.            
  1587.             Game['ItemActionsHelper::ConsumeItem;GameObjectItemIDBool'](player, itemid, true)
  1588.         end
  1589.     end
  1590.  
  1591. end
  1592.  
  1593. function MyMod:LogAction(actionDescription, actionValue)
  1594.     currentActionPass = currentActionPass + 1
  1595.    
  1596.     if(currentActionPass > maxMessages) then
  1597.         currentActionPass = 0
  1598.     end
  1599.    
  1600.     if(actionDescription == nil) then
  1601.         actionDescription = " "
  1602.     end
  1603.    
  1604.     if(actionValue == nil) then
  1605.         actionValue = " "
  1606.     end
  1607.    
  1608.     lastActionDescription[currentActionPass] = actionDescription
  1609.     lastActionValue[currentActionPass] = actionValue
  1610.     lastActionTime[currentActionPass] = os.time()
  1611. end
  1612.  
  1613. function MyMod:GetItemSellPrice(itemid)
  1614.     imgr = espd:GetInventoryManager()
  1615.    
  1616.     return imgr:GetSellPrice(player, itemid)
  1617. end
  1618.  
  1619.  
  1620. function MyMod:sellJunk()
  1621.     imgr = espd:GetInventoryManager()
  1622.    
  1623.     local ok, itemList = ts:GetItemListByTag(player, "Junk")
  1624.    
  1625.     itemCount = 0
  1626.     moneyToAdd = 0
  1627.     amountDisassembled = 0
  1628.     earlyExit = false
  1629.     diffTime = 0
  1630.     enteredTime = os.clock()
  1631.     local vItemID
  1632.     local v
  1633.    
  1634.     for _,v in ipairs(itemList) do
  1635.         diffTime = os.clock() - enteredTime
  1636.         if(diffTime > 0.03) then
  1637.             MyMod:LogAction("Exited Processing of : Junk | Amount of Items Processed: " .. _)
  1638.             earlyExit = true
  1639.             break
  1640.         end
  1641.        
  1642.         vItemID = v:GetID()
  1643.        
  1644.         itemCount = itemCount + 1
  1645.         sellPrice = imgr:GetSellPrice(player, vItemID)
  1646.        
  1647.         itemQuantity = ts:GetItemQuantity(player, vItemID)
  1648.         canBeDisassembled = Game["gameRPGManager::CanItemBeDisassembled;GameInstanceItemID"](vItemID)
  1649.        
  1650.         --sell junk
  1651.         if((sellPrice > 3 and ini.Junk.sellExpensiveJunk) or ini.Junk.sellAllJunk) then
  1652.            
  1653.             --make sure to only sell if user is not disassembling ALL junk
  1654.             if(ini.Junk.disassembleAllJunk == false) then
  1655.                
  1656.                 moneyToAdd = moneyToAdd + (sellPrice * itemQuantity)
  1657.                 ts:RemoveItem(player, vItemID, itemQuantity)
  1658.             end
  1659.         end
  1660.        
  1661.         --disassemble junk
  1662.         if((canBeDisassembled and ini.Junk.disassembleCheapJunk and sellPrice <= 3 and sellPrice > 0) or (canBeDisassembled and ini.Junk.disassembleAllJunk and sellPrice > 0)) then
  1663.             --Some quest items are marked as Junk but their sellPrice = 0
  1664.             --if sellPrice = 0 we're just going to asssume that it shouldnt be sold
  1665.            
  1666.             --make sure to only disassmble if user is not selling ALL junk
  1667.             if(ini.Junk.sellAllJunk == false) then
  1668.                 Game['ItemActionsHelper::DisassembleItem;GameObjectItemIDInt32'](player, vItemID, itemQuantity)
  1669.                 amountDisassembled = amountDisassembled + itemQuantity
  1670.             end
  1671.         end
  1672.  
  1673.     end
  1674.     --print("itemCount: " , itemCount)
  1675.    
  1676.     if(moneyToAdd > 0) then
  1677.         MyMod:LogAction("Junk items sold: ", itemCount)
  1678.         MyMod:LogAction("Money Gained: ", moneyToAdd)
  1679.        
  1680.         Game.AddToInventory("Items.money",moneyToAdd)
  1681.         session_ItemsSold = session_ItemsSold + itemCount
  1682.         session_MoneyGained = session_MoneyGained + moneyToAdd
  1683.     end
  1684.    
  1685.     if(amountDisassembled > 0) then
  1686.         MyMod:LogAction("Disassembled Junk Items: ", amountDisassembled)
  1687.         session_ItemsDisassembled = session_ItemsDisassembled + amountDisassembled
  1688.     end
  1689.    
  1690. end
  1691.  
  1692. function MyMod:GetLocalizedName(itemID)
  1693.     -- Get the TweakDBID of the item
  1694.     local itemTweakDBID = itemID.id;
  1695.  
  1696.     -- Get the TweakDBID of the "displayName" property of the TweakDB record
  1697.     local displayNameTweakDBID = TweakDBID.new(itemTweakDBID, '.displayName');
  1698.  
  1699.     -- Get the localization key (LocKey) of the "displayName" property
  1700.     local displayNameLocKey = Game['TDB::GetLocKey;TweakDBID'](displayNameTweakDBID);
  1701.  
  1702.     -- Get localized text by LocKey
  1703.     if(Game.GetLocalizedTextByKey(displayNameLocKey) == nil) then
  1704.         return "nothing";
  1705.     else
  1706.         return Game.GetLocalizedTextByKey(displayNameLocKey);
  1707.     end
  1708. end
  1709.  
  1710. function MyMod:GetLocalizedQuality(itemID)
  1711.     -- Get the TweakDBID of the item
  1712.     local itemTweakDBID = itemID.id;
  1713.  
  1714.     -- Get the TweakDBID of the "displayName" property of the TweakDB record
  1715.     local displayNameTweakDBID = TweakDBID.new(itemTweakDBID, '.quality');
  1716.     print (displayNameTweakDBID)
  1717.     print (displayNameTweakDBID.quality)
  1718.     -- Get the localization key (LocKey) of the "displayName" property
  1719.     local displayNameLocKey = Game['TDB::GetLocKey;TweakDBID'](displayNameTweakDBID);
  1720.  
  1721.     -- Get localized text by LocKey
  1722.     if(Game.GetLocalizedTextByKey(displayNameLocKey) == nil) then
  1723.         return "nothing";
  1724.     else
  1725.         return Game.GetLocalizedTextByKey(displayNameLocKey);
  1726.     end
  1727. end
  1728.  
  1729. function MyMod:ProcessShards()
  1730.     local ok, itemList = ts:GetItemListByTag(player, "SoftwareShard")
  1731.     local vItemID
  1732.     local v
  1733.     local sellPrice
  1734.     local itemQuantity
  1735.     local canBeDisassembled
  1736.     local itemCount = 0
  1737.     local moneyToAdd = 0
  1738.     local amountDisassembled = 0
  1739.     local itemIdentifier
  1740.     local moneyToAdd = 0
  1741.     local itemRecord
  1742.     local itemIconPath
  1743.     local currentQuality
  1744.     local statObj
  1745.    
  1746.     local shardAmount = {}
  1747.     local shardInfo = {}
  1748.     local shardvItemID = {}
  1749.     local shardQuality = {}
  1750.     local combinedShardText
  1751.     local totalShardCount = 0
  1752.     local i
  1753.     local isShardEquipped
  1754.     local canDeleteShard = {}
  1755.     local isShardTypeEquipped = {}
  1756.     local forceShardSell = {}
  1757.     local has_Tier1Shard
  1758.     local has_Tier2Shard
  1759.     local has_Tier3Shard
  1760.     local has_Tier4Shard
  1761.     local bestShardTierSoFar = {}
  1762.     local shardIdentifier = {}
  1763.     local shardRawQuality = {}
  1764.     local shardAmountLeft = {}
  1765.     local shardIdentifierCombined = {}
  1766.    
  1767.     ---------------------
  1768.     local cyberdeckId;
  1769.     local equippedHackItemID = {};
  1770.     local equippedHackLocalizedName = {};
  1771.     local equippedHackQuality = {};
  1772.    
  1773.     ts = Game.GetTransactionSystem();
  1774.     ssc = Game.GetScriptableSystemsContainer();
  1775.     ss = Game.GetStatsSystem();
  1776.     equipmentSystem = ssc:Get("EquipmentSystem");
  1777.     player = Game.GetPlayerSystem():GetLocalPlayerMainGameObject();
  1778.     espd = equipmentSystem:GetPlayerData(player);
  1779.     imgr = espd:GetInventoryManager();
  1780.    
  1781.     cyberdeckId = imgr:GetEquippedItemIdInArea(35, 0); -- gamedataEquipmentArea.SystemReplacementCW
  1782.     deckData2 = ts:GetItemData(player, cyberdeckId);
  1783.  
  1784.    
  1785.     --partData2 = deckData2:GetItemParts(partData2);
  1786.     ------------ FIX from Nexus comments section ------------------------
  1787.     -- SOURCE: https://forums.nexusmods.com/index.php?/topic/9466953-decluttered-beverages-and-food/page-28#entry97888278
  1788.     partData2 = deckData2:GetItemParts();
  1789.     ---------------------------------------------------------------------
  1790.     if(partData2[2] ~= nil) then
  1791.         equippedHackItemID[0] = partData2[2]:GetItemID(partData2[2]); -- these are the quickhacks
  1792.         equippedHackLocalizedName[0] = MyMod:GetLocalizedName(equippedHackItemID[0]);
  1793.         equippedHackQuality[0] = partData2[2]:GetStatValueByType(partData2[2], 664); --gamedataStatType.Quality = 664
  1794.     else
  1795.         equippedHackItemID[0] = 0;
  1796.         equippedHackLocalizedName[0] = "";
  1797.         equippedHackQuality[0] = -1;
  1798.     end
  1799.    
  1800.     if(partData2[3] ~= nil) then
  1801.         equippedHackItemID[1] = partData2[3]:GetItemID(partData2[3]); -- these are the quickhacks
  1802.         equippedHackLocalizedName[1] = MyMod:GetLocalizedName(equippedHackItemID[1]);
  1803.         equippedHackQuality[1] = partData2[3]:GetStatValueByType(partData2[3], 664); --gamedataStatType.Quality = 664
  1804.     else
  1805.         equippedHackItemID[1] = 0;
  1806.         equippedHackLocalizedName[1] = "";
  1807.         equippedHackQuality[1] = -1;
  1808.     end
  1809.    
  1810.     if(partData2[4] ~= nil) then
  1811.         equippedHackItemID[2] = partData2[4]:GetItemID(partData2[4]); -- these are the quickhacks
  1812.         equippedHackLocalizedName[2] = MyMod:GetLocalizedName(equippedHackItemID[2]);
  1813.         equippedHackQuality[2] = partData2[4]:GetStatValueByType(partData2[4], 664); --gamedataStatType.Quality = 664
  1814.     else
  1815.         equippedHackItemID[2] = 0;
  1816.         equippedHackLocalizedName[2] = "";
  1817.         equippedHackQuality[2] = -1;
  1818.     end
  1819.    
  1820.     ----------------------------------------
  1821.     for _,v in ipairs(itemList) do
  1822.         vItemID = v:GetID()
  1823.        
  1824.         if(ts:HasTag(player, "Tier1Shard", vItemID)) then
  1825.             has_Tier1Shard = 1
  1826.         else
  1827.             has_Tier1Shard = 0
  1828.         end
  1829.        
  1830.         if(ts:HasTag(player, "Tier2Shard", vItemID)) then
  1831.             has_Tier2Shard = 1
  1832.         else
  1833.             has_Tier2Shard = 0
  1834.         end
  1835.        
  1836.         if(ts:HasTag(player, "Tier3Shard", vItemID)) then
  1837.             has_Tier3Shard = 1
  1838.         else
  1839.             has_Tier3Shard = 0
  1840.         end
  1841.        
  1842.         if(ts:HasTag(player, "Tier4Shard", vItemID)) then
  1843.             has_Tier4Shard = 1
  1844.         else
  1845.             has_Tier4Shard = 0
  1846.         end
  1847.        
  1848.        
  1849.         if(has_Tier1Shard or has_Tier2Shard or has_Tier3Shard or has_Tier4Shard) then
  1850.            
  1851.             itemRecord = Game['gameRPGManager::GetItemRecord;ItemID'](vItemID)
  1852.             itemIdentifier = itemRecord:IconPath() --grenade_recon_normal
  1853.             statObj = v:GetStatsObjectID()
  1854.             currentQuality = ss:GetStatValue(statObj, 'Quality')
  1855.             combinedShardText = currentQuality .. ":" .. itemIdentifier
  1856.            
  1857.            
  1858.             if(shardAmount[itemIdentifier] == nil) then
  1859.                 shardAmount[itemIdentifier] = 0
  1860.                 bestShardTierSoFar[itemIdentifier] = 0
  1861.             end
  1862.            
  1863.             if(isShardTypeEquipped[itemIdentifier] == nil) then
  1864.                 isShardTypeEquipped[itemIdentifier] = 0
  1865.             end
  1866.            
  1867.             if(forceShardSell[itemIdentifier] == nil) then
  1868.                 forceShardSell[itemIdentifier] = 0
  1869.             end
  1870.            
  1871.             totalShardCount = totalShardCount + 1
  1872.            
  1873.             isShardEquipped = false
  1874.            
  1875.             tempLocalizedName = MyMod:GetLocalizedName(vItemID)
  1876.            
  1877.             equippedQuality = -1;
  1878.             if(tempLocalizedName == equippedHackLocalizedName[0]) then
  1879.                 equippedQuality = equippedHackQuality[0];
  1880.             end
  1881.             if(tempLocalizedName == equippedHackLocalizedName[1]) then
  1882.                 equippedQuality = equippedHackQuality[1];
  1883.             end
  1884.             if(tempLocalizedName == equippedHackLocalizedName[2]) then
  1885.                 equippedQuality = equippedHackQuality[2];
  1886.             end
  1887.            
  1888.            
  1889.  
  1890.             if(isShardEquipped) then
  1891.                 canDeleteShard[totalShardCount] = 0
  1892.                 isShardTypeEquipped[itemIdentifier] = 1
  1893.                 --print("this is equipped: " .. itemIdentifier)
  1894.             else
  1895.                 --print("this is NOT equipped: " .. itemIdentifier)
  1896.                 canDeleteShard[totalShardCount] = 1
  1897.                
  1898.             end
  1899.            
  1900.             if(currentQuality == 0.0) then
  1901.                 shardQuality[totalShardCount] = "Common"
  1902.             end
  1903.             if(currentQuality == 1.0) then
  1904.                 shardQuality[totalShardCount] = "Uncommon"
  1905.             end
  1906.             if(currentQuality == 2.0) then
  1907.                 shardQuality[totalShardCount] = "Rare"
  1908.             end
  1909.             if(currentQuality == 3.0) then
  1910.                 shardQuality[totalShardCount] = "Epic"
  1911.             end
  1912.             if(currentQuality == 4.0) then
  1913.                 shardQuality[totalShardCount] = "Legendary"
  1914.             end
  1915.  
  1916.             if (bestShardTierSoFar[itemIdentifier] == nil) then
  1917.                 bestShardTierSoFar[itemIdentifier] = currentQuality
  1918.             end
  1919.            
  1920.             if(bestShardTierSoFar[itemIdentifier] < currentQuality) then
  1921.                 bestShardTierSoFar[itemIdentifier] = currentQuality
  1922.             end
  1923.            
  1924.             if(shardAmountLeft[combinedShardText] == nil) then
  1925.                 shardAmountLeft[combinedShardText] = 0;
  1926.             end
  1927.            
  1928.             --equipped shards
  1929.             if(equippedQuality > -1) then
  1930.                 if(equippedQuality > currentQuality) then
  1931.                     forceShardSell[itemIdentifier] = 1
  1932.                     shardAmount[itemIdentifier] = shardAmount[itemIdentifier] + 1
  1933.                 end
  1934.                
  1935.                 shardAmountLeft[combinedShardText] = shardAmountLeft[combinedShardText] + 1
  1936.             end
  1937.            
  1938.             shardRawQuality[totalShardCount] = currentQuality
  1939.             shardAmount[itemIdentifier] = shardAmount[itemIdentifier] + 1
  1940.             shardAmountLeft[combinedShardText] = shardAmountLeft[combinedShardText] + 1
  1941.             shardInfo[totalShardCount] = itemIdentifier
  1942.             shardIdentifier[totalShardCount] = itemIdentifier
  1943.             shardIdentifierCombined[totalShardCount] = combinedShardText
  1944.            
  1945.             shardvItemID[totalShardCount] = vItemID
  1946.            
  1947.            
  1948.         end
  1949.     end
  1950.    
  1951.     if(totalShardCount < 1) then
  1952.         return;
  1953.     end
  1954.    
  1955.    
  1956.     --Remove duplicate shards
  1957.     for i = 1, totalShardCount do
  1958.         --print("")
  1959.         --print("Start of loop")
  1960.         --print("i=" .. i)
  1961.         --print("shardInfo = " .. shardInfo[i])
  1962.         --print("shardAmount = "..shardAmount[shardInfo[i]])
  1963.         --print("shardIdentifierCombined = " .. shardIdentifierCombined[i])
  1964.         --print("shardAmountLeft = " .. shardAmountLeft[shardIdentifierCombined[i]])
  1965.         --print("shardRawQuality = " .. shardRawQuality[i])
  1966.         --print("End of loop")
  1967.        
  1968.         vItemID = shardvItemID[i]
  1969.        
  1970.         --delete lesser shard tiers (only keep highest tier)
  1971.         markForDeletion = false
  1972.         if(shardRawQuality[i] <  bestShardTierSoFar[shardIdentifier[i]]) then
  1973.             --print("shardRawQuality[i]=" .. shardRawQuality[i] .. " < " .. "bestShardTierSoFar[shardIdentifier[i]=" .. bestShardTierSoFar[shardIdentifier[i]])
  1974.             --dont mark for deletion if it's equipped
  1975.             if(isShardTypeEquipped[shardInfo[i]] == 0) then
  1976.                 --print("Marking for deletion: " .. shardRawQuality[i].. " " .. shardInfo[i])
  1977.                 markForDeletion = true
  1978.             end
  1979.         else
  1980.             --delete duplicates of same quality as long as there is more than 1
  1981.             if(shardRawQuality[i] ==  bestShardTierSoFar[shardIdentifier[i]] and shardAmountLeft[shardIdentifierCombined[i]] > 1) then
  1982.                 markForDeletion = true
  1983.                 --print("Deleting duplicate of: " .. shardRawQuality[i].. " " .. shardInfo[i] .. "Qty Remaining: " .. shardAmountLeft[shardIdentifierCombined[i]]);
  1984.             else
  1985.                 canDeleteShard[i] = 0
  1986.             end
  1987.         end
  1988.        
  1989.         if((shardAmount[shardInfo[i]] > 1 and canDeleteShard[i] == 1) or markForDeletion == true) then
  1990.            
  1991.             sellPrice = imgr:GetSellPrice(player, vItemID)
  1992.            
  1993.  
  1994.             -- Get the TweakDBID of the item
  1995.             local vItemIDTweakDBID = vItemID.id
  1996.             local displayNameTweakDBID = TweakDBID.new(vItemIDTweakDBID, '.displayName')
  1997.             local displayNameLocKey = Game['TDB::GetLocKey;TweakDBID'](displayNameTweakDBID)
  1998.             itemIdentifier = Game.GetLocalizedTextByKey(displayNameLocKey)
  1999.            
  2000.             if(ts:HasTag(player, "Tier1Shard", vItemID) or ts:HasTag(player, "Tier2Shard", vItemID) or ts:HasTag(player, "Tier3Shard", vItemID) or ts:HasTag(player, "Tier4Shard", vItemID)) then
  2001.                
  2002.                 --Sell
  2003.                 if(ini.SimplifyShards.SimplifyShards) then
  2004.                     MyMod:LogAction("Sold: " .. tostring(shardQuality[i]) .. " " .. tostring(itemIdentifier) .. " Qty: " .. 1 .. " @ " .. sellPrice .. "ea.")
  2005.                    
  2006.                     moneyToAdd = moneyToAdd + (sellPrice)
  2007.                     ts:RemoveItem(player, vItemID, 1)
  2008.                    
  2009.                     session_ItemsSold = session_ItemsSold + 1
  2010.                    
  2011.                     shardAmountLeft[shardIdentifierCombined[i]] = shardAmountLeft[shardIdentifierCombined[i]] - 1
  2012.                 end
  2013.                
  2014.             end
  2015.         end
  2016.        
  2017.     end
  2018.    
  2019.     if(moneyToAdd > 0) then
  2020.         MyMod:LogAction("Total Money Gained: ", moneyToAdd)
  2021.        
  2022.         Game.AddToInventory("Items.money",moneyToAdd)
  2023.         session_MoneyGained = session_MoneyGained + moneyToAdd
  2024.     end
  2025.    
  2026. end
  2027.  
  2028. function MyMod:ProcessMiscItems(currentTag, isWeapon, item_Common, item_Uncommon, item_Rare, item_Epic, item_Legendary)
  2029.     espd = equipmentSystem:GetPlayerData(player)
  2030.     if(espd == nil) then
  2031.         return;
  2032.     end
  2033.    
  2034.     imgr = espd:GetInventoryManager()
  2035.     if(imgr == nil) then
  2036.         return;
  2037.     end
  2038.    
  2039.     local ok, itemList = ts:GetItemListByTag(player, currentTag)
  2040.    
  2041.     --no need to be here, user has it disabled
  2042.     if(item_Common == 0 and item_Uncommon == 0 and item_Rare == 0 and item_Epic == 0 and item_Legendary == 0) then
  2043.         do return end
  2044.     end
  2045.    
  2046.     local isItemEqupped_OG
  2047.     local sellPrice
  2048.     local itemQuantity
  2049.     local canBeDisassembled
  2050.     local itemRecord
  2051.     local v
  2052.     local vItemID
  2053.     local statObj
  2054.     local currentQuality
  2055.     local isQuestItem
  2056.     local shouldWeSellItem
  2057.     local equippedIsBetter
  2058.     local forbidSell
  2059.     local bestWeaponDPS_SoFar
  2060.     local itemCount = 0
  2061.     local moneyToAdd = 0
  2062.     local amountDisassembled = 0
  2063.     local ignoreisItemInHotkey = true
  2064.     local isArmor = false
  2065.     local tempHighest
  2066.     local diffTime
  2067.    
  2068.     if(isWeapon == true or currentTag == "FeetClothing" or currentTag == "HeadArmor" or currentTag == "ChestArmor" or currentTag == "InnerChestArmor" or currentTag == "FaceArmor" or currentTag == "LegArmor") then
  2069.         MyMod:getItemEquippedWithTag(currentTag, itemList)
  2070.     end
  2071.    
  2072.     if(currentTag == "Grenade" or  currentTag == "Drug") then
  2073.         ignoreisItemInHotkey = false
  2074.     end
  2075.    
  2076.     enteredTime = os.clock()
  2077.     diffTime = 0
  2078.     earlyExit = false
  2079.    
  2080.     for _,v in ipairs(itemList) do
  2081.         diffTime = os.clock() - enteredTime
  2082.         if(diffTime > 0.05) then
  2083.             MyMod:LogAction("Exited Processing of : " .. tostring(currentTag) .. " Amount of Items Processed: " .. _)
  2084.             earlyExit = true
  2085.             break
  2086.         end
  2087.        
  2088.         vItemID = v:GetID()
  2089.         isItemEqupped_OG = false
  2090.         isItemEqupped_OG = espd:IsEquipped(vItemID)
  2091.        
  2092.         sellPrice = imgr:GetSellPrice(player, vItemID)
  2093.         itemQuantity = ts:GetItemQuantity(player, vItemID)
  2094.        
  2095.         canBeDisassembled = Game["gameRPGManager::CanItemBeDisassembled;GameInstanceItemID"](vItemID)
  2096.        
  2097.         --Don't break down starter gear
  2098.         itemRecord = Game['gameRPGManager::GetItemRecord;ItemID'](vItemID)
  2099.         itemAppearanceName = itemRecord:AppearanceName().value
  2100.         itemIconPath = itemRecord:IconPath() --grenade_recon_normal
  2101.         itemIdentifier = v:GetNameAsString()
  2102.        
  2103.         if(itemIdentifier == nil or itemIdentifier == "None") then
  2104.             itemIdentifier = itemIconPath
  2105.         end
  2106.         --print("itemAppearanceName: ", itemAppearanceName)
  2107.         --print("v:GetNameAsString(): ", v:GetNameAsString()) --recon
  2108.         --print("itemIconPath: ", itemIconPath) --recon
  2109.         --print("itemRecord: ", itemRecord)
  2110.        
  2111.         --print("1: ", itemRecord:EquipArea())
  2112.         --print("2: ", itemRecord:EquipArea():Type())
  2113.         --print("3: ", itemRecord:EquipArea():Type().value)
  2114.        
  2115.         if(itemRecord:EquipArea() ~= nil) then
  2116.             equippedArea = itemRecord:EquipArea():Type().value
  2117.         end
  2118.        
  2119.        
  2120.         if string.find(itemAppearanceName, "_q000_") then
  2121.           isStarterItem = true
  2122.         else
  2123.           isStarterItem = false
  2124.         end
  2125.        
  2126.         --ignore Quest items, equipped items, starter gear items
  2127.        
  2128.         --do return end
  2129.        
  2130.        
  2131.         isHotkey = false
  2132.         if(ignoreisItemInHotkey == false) then
  2133.             isHotkey = equipmentSystem:IsItemInHotkey(player, vItemID)
  2134.            
  2135.             --dont process hotkeyed items
  2136.             if(isHotkey) then
  2137.                 isItemEqupped_OG = true
  2138.             end
  2139.         end
  2140.        
  2141.        
  2142.         isQuestItem = ts:HasTag(player, "Quest", vItemID)
  2143.        
  2144.         statObj = v:GetStatsObjectID()
  2145.         currentQuality = ss:GetStatValue(statObj, 'Quality')
  2146.         --print("currentQuality: ", currentQuality) --recon
  2147.         currentItemLevel_PMI = ss:GetStatValue(statObj, 'ItemLevel')
  2148.        
  2149.         itemdata = ts:GetItemData(player, vItemID)
  2150.        
  2151.         IsItemIconic = itemdata:GetStatValueByType('IsItemIconic')
  2152.        
  2153.         -----------------------------------------------
  2154.        
  2155.         shouldWeSellItem = true --we'll always default to selling an item
  2156.         equippedIsBetter = false
  2157.         forbidSell = false
  2158.         bestWeaponDPS_SoFar = 0
  2159.        
  2160.         --comparison check is only for weapons and armor
  2161.         doComparisonCheck = false
  2162.        
  2163.         --we'll compare the slotted equipped item level versus the current Item level
  2164.         if(isWeapon == true) then
  2165.             statObj = v:GetStatsObjectID()
  2166.             currentItemLevel_PMI = ss:GetStatValue(statObj, 'EffectiveDPS')
  2167.             currentQuality = ss:GetStatValue(statObj, 'Quality')
  2168.            
  2169.             --bestWeaponDPS_SoFar = tonumber(string.format("%.2f", highestEffectiveDPSWeapon))
  2170.             currentItemLevel_PMI = tonumber(string.format("%.2f", currentItemLevel_PMI))
  2171.             doComparisonCheck = true
  2172.             shouldWeSellItem = false --dont sell just yet, requires further checks
  2173.            
  2174.             --checking to see if it's something that can actually be sold
  2175.             if(isItemInEquippedArea(equippedArea, 1) == false) then
  2176.                 forbidSell = true
  2177.             end
  2178.            
  2179.         end
  2180.        
  2181.         if(currentTag == "FeetClothing" or currentTag == "HeadArmor" or currentTag == "ChestArmor" or currentTag == "InnerChestArmor" or currentTag == "FaceArmor" or currentTag == "LegArmor") then
  2182.             isArmor = true
  2183.             --retrieve highestArmorLevel
  2184.             MyMod:GetHighestArmorByTag(currentTag)
  2185.            
  2186.             statObj = v:GetStatsObjectID()
  2187.             currentQuality = ss:GetStatValue(statObj, 'Quality')
  2188.            
  2189.             currentItemLevel_PMI = ss:GetStatValue(statObj, 'Armor')
  2190.             currentItemLevel_PMI = tonumber(string.format("%.3f", currentItemLevel_PMI))
  2191.            
  2192.             doComparisonCheck = true
  2193.            
  2194.             --checking to see if it's something that can actually be sold
  2195.             if(isItemInEquippedArea(equippedArea, 1) == false) then
  2196.                 forbidSell = true
  2197.             end
  2198.            
  2199.             shouldWeSellItem = false --dont sell just yet, requires further checks
  2200.         end
  2201.        
  2202.         --we'll compare the slotted equipped item level versus the current Item level
  2203.         if(isArmor and currentTag == "ChestArmor") then
  2204.         --  tempHighest = highestArmorLevel[currentTag]
  2205.         --  print("currentTag: ", currentTag)
  2206.         --  print("_:",_)
  2207.         --  print("itemAppearanceName: ", itemAppearanceName)
  2208.         --  print("tempHighest:", tempHighest)
  2209.         --  print("currentItemLevel:", currentItemLevel_PMI)
  2210.         --  print("isItemEqupped_OG :", isItemEqupped_OG)
  2211.         --  print("canBeDisassembled :",canBeDisassembled )
  2212.         --  print("isQuestItem :", isQuestItem)
  2213.         --  print("isStarterItem :", isStarterItem)
  2214.         --  print("equippedIsBetter :", equippedIsBetter)
  2215.         --  print("shouldWeSellItem :", shouldWeSellItem)
  2216.         --  print("equippedILevel :", equippedILevel)
  2217.         --  print("forbidSell :", forbidSell)
  2218.         --  print("currentQuality: ", currentQuality)
  2219.         -- 
  2220.         --  print("Original equipped function: ", isItemEqupped)
  2221.         --  print("isItemEqupped_OG: ", isItemEqupped_OG)
  2222.         -- 
  2223.         --  if(isItemEqupped_OG == false and canBeDisassembled and isQuestItem == false and isStarterItem == false and equippedIsBetter == false and shouldWeSellItem and forbidSell == false) then
  2224.         --      print("umm this crap should definetely be sold!!!")
  2225.         --  end
  2226.         -- 
  2227.         --  print(" ")
  2228.         end
  2229.                    
  2230.         if(equippedILevel ~= currentItemLevel_PMI and isItemEqupped_OG == false and doComparisonCheck == true) then
  2231.            
  2232.             if(ini.Main.processItemsOfLesserItemLevel_Only) then
  2233.                 tempHighest = highestEffectiveDPSWeapon
  2234.                
  2235.                 if(isArmor) then
  2236.                     tempHighest = highestArmorLevel[currentTag]
  2237.                 end
  2238.                
  2239.                
  2240.                 if(tempHighest > currentItemLevel_PMI) then
  2241.                     --only sell worse items than what's equipped
  2242.                     --print("We should sell this item")
  2243.                    
  2244.                     equippedIsBetter = false
  2245.                     shouldWeSellItem = true
  2246.                    
  2247.                 else
  2248.                     equippedIsBetter = true
  2249.                     shouldWeSellItem = false
  2250.                 end
  2251.             else
  2252.                 --we can sell any item regardless if it's better or worse
  2253.                 --print("We should sell this item")
  2254.                 equippedIsBetter = false
  2255.                 shouldWeSellItem = true
  2256.             end
  2257.            
  2258.         end
  2259.        
  2260.         --Iconic check
  2261.         if(IsItemIconic > 0 and ini.Main.ignoreIconicItems == true) then
  2262.             forbidSell = true
  2263.         end
  2264.        
  2265.         --Grenade type check
  2266.         if(currentTag == "Grenade") then
  2267.             itemFriendlyName = itemRecord:FriendlyName()
  2268.             shouldWeSellItem = false
  2269.            
  2270.             if(itemFriendlyName == "biohazard") then
  2271.                 if(ini.SimplifyGrenades.Biohazard) then
  2272.                     shouldWeSellItem = true
  2273.                 end
  2274.             end
  2275.            
  2276.             if(itemFriendlyName == "cutting") then
  2277.                 if(ini.SimplifyGrenades.Cutting) then
  2278.                     shouldWeSellItem = true
  2279.                 end
  2280.             end
  2281.            
  2282.             if(itemFriendlyName == "emp") then
  2283.                 if(ini.SimplifyGrenades.Emp) then
  2284.                     shouldWeSellItem = true
  2285.                 end
  2286.             end
  2287.            
  2288.             if(itemFriendlyName == "flash") then
  2289.                 if(ini.SimplifyGrenades.Flash) then
  2290.                     shouldWeSellItem = true
  2291.                 end
  2292.             end
  2293.            
  2294.             if(itemFriendlyName == "frag") then
  2295.                 if(ini.SimplifyGrenades.Frag) then
  2296.                     shouldWeSellItem = true
  2297.                 end
  2298.             end
  2299.            
  2300.             if(itemFriendlyName == "incendiary_grenade") then
  2301.                 if(ini.SimplifyGrenades.Incendiary) then
  2302.                     shouldWeSellItem = true
  2303.                 end
  2304.             end
  2305.            
  2306.             if(itemFriendlyName == "recon") then
  2307.                 if(ini.SimplifyGrenades.Recon) then
  2308.                     shouldWeSellItem = true
  2309.                 end
  2310.             end
  2311.         end
  2312.        
  2313.         --Sell or Dismantle Item
  2314.         if(isItemEqupped_OG == false and canBeDisassembled and isQuestItem == false and isStarterItem == false and equippedIsBetter == false and shouldWeSellItem and forbidSell == false) then
  2315.             --print("something should sell!")
  2316.             --print("item_Common: ", item_Common)
  2317.             --print("currentQuality: ", currentQuality)
  2318.             itemCount = itemCount + 1          
  2319.            
  2320.            
  2321.             --SELL ITEMS------------------------------------------------------------
  2322.             sellitemsThisPass = 0
  2323.            
  2324.             if(item_Common == 1 and currentQuality == 0.0) then
  2325.                 sellitemsThisPass = 1
  2326.             end
  2327.            
  2328.             if(item_Uncommon == 1 and currentQuality == 1.0) then
  2329.                 sellitemsThisPass = 1
  2330.             end
  2331.            
  2332.             if(item_Rare == 1 and currentQuality == 2.0) then
  2333.                 sellitemsThisPass = 1
  2334.             end
  2335.            
  2336.             if(item_Epic == 1 and currentQuality == 3.0) then
  2337.                 sellitemsThisPass = 1
  2338.             end
  2339.            
  2340.             if(item_Legendary == 1 and currentQuality == 4.0) then
  2341.                 sellitemsThisPass = 1
  2342.             end
  2343.            
  2344.             if(sellitemsThisPass == 1) then
  2345.                 MyMod:LogAction("Sold: " .. tostring(currentTag) .. " (" .. itemIdentifier .. ")" .. " Qty: " .. itemQuantity .. " @ " .. sellPrice .. "ea.")
  2346.                
  2347.                 moneyToAdd = moneyToAdd + (sellPrice * itemQuantity)
  2348.                 vItemID = v:GetID()
  2349.                 ts:RemoveItem(player, vItemID, itemQuantity)
  2350.                
  2351.                 session_ItemsSold = session_ItemsSold + itemQuantity
  2352.             end
  2353.            
  2354.             --DISMANTLE ITEMS------------------------------------------------------------
  2355.             dismantleItemsThisPass = 0
  2356.            
  2357.             if(item_Common == 2 and currentQuality == 0.0) then
  2358.                 dismantleItemsThisPass = 1
  2359.             end
  2360.            
  2361.             if(item_Uncommon == 2 and currentQuality == 1.0) then
  2362.                 dismantleItemsThisPass = 1
  2363.             end
  2364.            
  2365.             if(item_Rare == 2 and currentQuality == 2.0) then
  2366.                 dismantleItemsThisPass = 1
  2367.             end
  2368.            
  2369.             if(item_Epic == 2 and currentQuality == 3.0) then
  2370.                 dismantleItemsThisPass = 1
  2371.             end
  2372.            
  2373.             if(item_Legendary == 2 and currentQuality == 4.0) then
  2374.                 dismantleItemsThisPass = 1
  2375.             end
  2376.            
  2377.             if(dismantleItemsThisPass == 1) then
  2378.                
  2379.                 MyMod:LogAction("Disassembled: " .. tostring(currentTag) .. " (" .. itemIdentifier .. ")" .. " Qty: " .. itemQuantity)
  2380.                 vItemID = v:GetID()
  2381.                 Game['ItemActionsHelper::DisassembleItem;GameObjectItemIDInt32'](player, vItemID, itemQuantity)
  2382.                 amountDisassembled = amountDisassembled + itemQuantity
  2383.             end
  2384.            
  2385.         end
  2386.     end
  2387.    
  2388.     if(moneyToAdd > 0) then
  2389.         MyMod:LogAction("Total Money Gained: ", moneyToAdd)
  2390.        
  2391.         Game.AddToInventory("Items.money",moneyToAdd)
  2392.         session_MoneyGained = session_MoneyGained + moneyToAdd
  2393.     end
  2394.    
  2395.     if(amountDisassembled > 0) then
  2396.         MyMod:LogAction("Total " .. currentTag .. " Dissassembled: " .. tostring(amountDisassembled))
  2397.         session_ItemsDisassembled = session_ItemsDisassembled + amountDisassembled
  2398.     end
  2399.  
  2400.     if(earlyExit == true) then
  2401.         MyMod:LogAction("You still have more items to be processed! Try again!! ", currentTag)
  2402.     end
  2403.    
  2404.    
  2405.    
  2406.    
  2407.    
  2408. end
  2409.  
  2410. function MyMod:processByTag(currentTag)
  2411.    
  2412.     local ok, itemList = ts:GetItemListByTag(player, currentTag)
  2413.    
  2414.     itemCount = 0
  2415.     moneyToAdd = 0
  2416.     amountDisassembled = 0
  2417.    
  2418.     for _,v in ipairs(itemList) do
  2419.        
  2420.         vItemID = v:GetID()
  2421.        
  2422.         sellPrice = imgr:GetSellPrice(player, vItemID)
  2423.        
  2424.         itemQuantity = ts:GetItemQuantity(player, vItemID)
  2425.         canBeDisassembled = Game["gameRPGManager::CanItemBeDisassembled;GameInstanceItemID"](vItemID)
  2426.        
  2427.         itemRecord = Game['gameRPGManager::GetItemRecord;ItemID'](vItemID)
  2428.         displayName = itemRecord:DisplayName()
  2429.         itemdata = ts:GetItemData(player, vItemID)
  2430.        
  2431.         displayName = itemRecord:DisplayName()
  2432.         locDisplayName = Game['LocKeyToString'](displayName)
  2433.         isHotkey = equipmentSystem:IsItemInHotkey(player, vItemID)
  2434.        
  2435.        
  2436.        
  2437.         processAction = 0
  2438.         localizedName = ""
  2439.         --;0=Nothing, 1=AutoSell, 2=AutoDismantle
  2440.        
  2441.         --FirstAidWhiffV0
  2442.         if(locDisplayName == "LocKey#35384") then
  2443.             processAction = ini.SimplifyHealthItems.MaxDoc_MK1
  2444.             localizedName = "MaxDoc MK1"
  2445.         end
  2446.        
  2447.         --FirstAidWhiffV1
  2448.         if(locDisplayName == "LocKey#2679") then
  2449.             processAction = ini.SimplifyHealthItems.MaxDoc_MK2
  2450.             localizedName = "MaxDoc MK2"
  2451.         end
  2452.        
  2453.         --FirstAidWhiffV2
  2454.         if(locDisplayName == "LocKey#35387") then
  2455.             processAction = ini.SimplifyHealthItems.MaxDoc_MK3
  2456.             localizedName = "MaxDoc MK3"
  2457.         end
  2458.        
  2459.         --BonesMcCoy70V0
  2460.         if(locDisplayName == "LocKey#35418") then
  2461.             processAction = ini.SimplifyHealthItems.Bounce_Back_MK1
  2462.             localizedName = "Bounce Back MK1"
  2463.         end
  2464.        
  2465.         --BonesMcCoy70V1
  2466.         if(locDisplayName == "LocKey#34157") then
  2467.             processAction = ini.SimplifyHealthItems.Bounce_Back_MK2
  2468.             localizedName = "Bounce Back MK2"
  2469.         end
  2470.        
  2471.         --BonesMcCoy70V2
  2472.         if(locDisplayName == "LocKey35420") then
  2473.             processAction = ini.SimplifyHealthItems.Bounce_Back_MK3
  2474.             localizedName = "Bounce Back MK3"
  2475.         end
  2476.        
  2477.        
  2478.         --sell item
  2479.         if(processAction == 1 and isHotkey == false) then      
  2480.             MyMod:LogAction("Sold: " .. tostring(localizedName) .. " Qty: " .. itemQuantity .. " @ " .. sellPrice .. "ea.")
  2481.            
  2482.             moneyToAdd = moneyToAdd + (sellPrice * itemQuantity)
  2483.             ts:RemoveItem(player, vItemID, itemQuantity)
  2484.            
  2485.             itemCount = itemCount + itemQuantity
  2486.         end
  2487.        
  2488.         --disassemble item
  2489.         if(processAction == 2 and isHotkey == false) then
  2490.             MyMod:LogAction("Disassembled " .. tostring(localizedName) .. " Qty: " .. amountDisassembled)
  2491.            
  2492.             Game['ItemActionsHelper::DisassembleItem;GameObjectItemIDInt32'](player, vItemID, itemQuantity)
  2493.             amountDisassembled = amountDisassembled + itemQuantity
  2494.         end
  2495.  
  2496.     end
  2497.    
  2498.    
  2499.     if(moneyToAdd > 0) then
  2500.         MyMod:LogAction("Total " .. tostring(currentTag) .."s sold: ", itemCount)
  2501.         MyMod:LogAction("Money Gained: ", moneyToAdd)
  2502.        
  2503.         Game.AddToInventory("Items.money",moneyToAdd)
  2504.         session_ItemsSold = session_ItemsSold + itemCount
  2505.         session_MoneyGained = session_MoneyGained + moneyToAdd
  2506.     end
  2507.    
  2508.     if(amountDisassembled > 0) then
  2509.         MyMod:LogAction("Total Disassembled " .. tostring(currentTag) .."s: ", amountDisassembled)
  2510.         session_ItemsDisassembled = session_ItemsDisassembled + amountDisassembled
  2511.     end
  2512.    
  2513. end
  2514.  
  2515. function MyMod:IsMainMenu() --Use "q000_started" to check if in mainmenu
  2516.    
  2517.     if (Game.GetQuestsSystem():GetFactStr("q000_started") == 0) then
  2518.     --  print("q000_started")
  2519.         hasSystemsBeenRetrieved = false
  2520.         startupDelayTime = os.time() + globalDelayinSeconds
  2521.        
  2522.         MyMod:ClearDebugMenu()
  2523.        
  2524.         return true
  2525.     end
  2526.    
  2527.     return false
  2528. end
  2529.  
  2530. function MyMod:getItemEquippedWithTag(currentTag, itemList)
  2531.     equippedItemID = 0
  2532.     equippedILevel = 0
  2533.    
  2534.     --print(currentTag)
  2535.     --print(itemList)
  2536.    
  2537.    
  2538.     for _,v in ipairs(itemList) do
  2539.        
  2540.         vItemID = v:GetID()
  2541.        
  2542.         --this is what we're looking for
  2543.         isItemEqupped = espd:IsEquipped(vItemID)
  2544.        
  2545.         statObj = v:GetStatsObjectID()
  2546.        
  2547.         --we'll compare the slotted equipped item level versus the current Item level
  2548.         if(currentTag == "Weapon") then
  2549.             currentItemLevel = highestEffectiveDPSWeapon --ss:GetStatValue(statObj, 'EffectiveDPS')
  2550.         else
  2551.             currentItemLevel = ss:GetStatValue(statObj, 'Armor')
  2552.         end
  2553.        
  2554.         if(isItemEqupped) then
  2555.             --print("found equipped item")
  2556.             equippedItemID = v
  2557.            
  2558.             equippedILevel = currentItemLevel
  2559.             equippedILevel = tonumber(string.format("%.3f", equippedILevel))
  2560.            
  2561.         end
  2562.     end
  2563.    
  2564.     --print("Retrieved: ", equippedItemID)
  2565.     --print("Retrieved: ", equippedILevel)
  2566.     --print("EXIT MyMod:getItemEquippedWithTag")
  2567. end
  2568.  
  2569. function MyMod:ClearDebugMenu()
  2570.     --clear the debug menu
  2571.     lastActionDescription = {}
  2572.     lastActionValue = {}
  2573.     lastActionTime = {}
  2574.     currentActionPass = 0
  2575.    
  2576.     equippedILevel = -1
  2577.     for ii = 0, maxMessages do
  2578.         lastActionDescription[ii] = ""
  2579.         lastActionValue[ii] = ""
  2580.         lastActionTime[ii] = ""
  2581.     end
  2582. end
  2583.  
  2584. function MyMod:GetSystems()
  2585.     statsPoolSystem = Game.GetStatPoolsSystem()
  2586.     ts = Game.GetTransactionSystem()
  2587.     ssc = Game.GetScriptableSystemsContainer()
  2588.     ss = Game.GetStatsSystem()
  2589.     equipmentSystem = ssc:Get("EquipmentSystem")
  2590.     player = Game.GetPlayerSystem():GetLocalPlayerMainGameObject()
  2591.     espd = equipmentSystem:GetPlayerData(player)
  2592.    
  2593.     if(espd == nil) then
  2594.         return;
  2595.     end
  2596.    
  2597.     imgr = espd:GetInventoryManager()
  2598. end
  2599.  
  2600. function MyMod:getItemLevels()
  2601.     --this is just for debug purposes
  2602.     ssc = Game.GetScriptableSystemsContainer()
  2603.     equipmentSystem = ssc:Get("EquipmentSystem")
  2604.     ps = Game.GetPlayerSystem()
  2605.     player = ps:GetLocalPlayerMainGameObject()
  2606.     espd = equipmentSystem:GetPlayerData(player)
  2607.     ss = Game.GetStatsSystem()
  2608.     ts = Game.GetTransactionSystem()
  2609.     imgr = espd:GetInventoryManager()
  2610.     currentSlot = 0
  2611.    
  2612.     --local ok, itemList = ts:GetItemListByTags(player, slots, itemList)
  2613.     ------------ FIX from Nexus comments section ------------------------
  2614.     ----https://forums.nexusmods.com/index.php?/topic/9466953-decluttered-beverages-and-food/page-28#entry95947388
  2615.     local ok, itemList = ts:GetItemListByTags(player, slots)
  2616.     ---------------------------------------------------------------------
  2617.    
  2618.     for i=0,20 do
  2619.         equippedArrayItemID[i] = ""
  2620.         equippedArrayILevel[i] = -1
  2621.         equippedArraySlot[i] = ""
  2622.         equippedArrayType[i] = ""
  2623.     end
  2624.    
  2625.     for i,v in ipairs(itemList) do
  2626.         vItemID = v:GetID()
  2627.        
  2628.         isItemEqupped = espd:IsEquipped(vItemID)
  2629.        
  2630.        
  2631.         if(isItemEqupped == true) then
  2632.             itemRecord = Game['gameRPGManager::GetItemRecord;ItemID'](vItemID)
  2633.             equippedArea = itemRecord:EquipArea():Type().value
  2634.             equippedArraySlot[currentSlot] = equippedArea
  2635.             equippedArrayItemID[currentSlot] = v:GetID()
  2636.            
  2637.            
  2638.             --print("equippedArea: ", equippedArea)
  2639.             --print("v:GetNameAsString(): ", v:GetNameAsString())
  2640.            
  2641.             --we're only looking for items that the player can slot.
  2642.             --we dont want weird equipedAreas like BaseFists or VDefaultHandgun
  2643.             if(isItemInEquippedArea(equippedArea, 1)) then
  2644.                 statObj = v:GetStatsObjectID()
  2645.                
  2646.                 if(isItemInEquippedArea(equippedArea, 0)) then
  2647.                     currentItemLevel = ss:GetStatValue(statObj, 'Armor')
  2648.                     --print("Armor Rating: ", currentItemLevel)
  2649.                 end
  2650.                
  2651.                 if(ts:HasTag(player, "Weapon", vItemID)) then
  2652.                     currentItemLevel = ss:GetStatValue(statObj, 'EffectiveDPS')
  2653.                     --print("Weapon EffectiveDPS: ",currentItemLevel)
  2654.                     equippedArrayType[currentSlot] = itemRecord:ItemType():Type().value
  2655.                    
  2656.                 end
  2657.                
  2658.                 equippedArrayILevel[currentSlot] = tonumber(string.format("%.2f", currentItemLevel))
  2659.             end
  2660.            
  2661.             currentSlot = currentSlot + 1
  2662.         end
  2663.     end
  2664. end
  2665.  
  2666. function isItemInEquippedArea(lookEquippedArea, includeWeapon)
  2667.  
  2668.     for i,v in ipairs(equipAreaList) do
  2669.         if(v == lookEquippedArea) then
  2670.             return true
  2671.         end
  2672.        
  2673.         if(includeWeapon == 0 and i == 7) then
  2674.             return false
  2675.         end    
  2676.     end
  2677.    
  2678.     return false
  2679. end
  2680.  
  2681. function MyMod:CheckSystems()
  2682.     --returns true if systems are ok
  2683.    
  2684.     if(ini.Main.IgnorePauseDetection == false and ini.Main.UseManualMode == false) then
  2685.         inkMenuScenario = GetSingleton('inkMenuScenario'):GetSystemRequestsHandler()
  2686.         if(inkMenuScenario:IsGamePaused() or inkMenuScenario:IsPreGame()) then
  2687.             pauseDetected = true
  2688.             pauseDetectionCheck2 = true
  2689.            
  2690.             return false
  2691.         end
  2692.     end
  2693.    
  2694.     if(Game.GetPlayerSystem() == nil) then
  2695.         return false
  2696.     end
  2697.    
  2698.     if(Game.GetPlayerSystem():GetLocalPlayerMainGameObject() == nil) then
  2699.         return false
  2700.     end
  2701.    
  2702.     if(Game.GetPlayer() == nil) then
  2703.         return false
  2704.     end
  2705.    
  2706.     return true
  2707. end
  2708.  
  2709. function MyMod:GetHighestEffectiveDPSWeapon(lookedUpTag, checkEquipped)
  2710.     highestEffectiveDPSWeapon = 0
  2711.    
  2712.     local ok, itemList = ts:GetItemListByTag(player, lookedUpTag)
  2713.    
  2714.     for i,v in ipairs(itemList) do
  2715.         vItemID = v:GetID()
  2716.        
  2717.         if(checkEquipped == true) then
  2718.             isItemEqupped = espd:IsEquipped(vItemID)
  2719.            
  2720.             if(isItemEqupped == true) then
  2721.                 itemRecord = Game['gameRPGManager::GetItemRecord;ItemID'](vItemID)
  2722.                 equippedArea = itemRecord:EquipArea():Type().value
  2723.                
  2724.                 if(isItemInEquippedArea(equippedArea, 1)) then
  2725.                     statObj = v:GetStatsObjectID()
  2726.                    
  2727.                     currentItemLevel = ss:GetStatValue(statObj, 'EffectiveDPS')
  2728.                    
  2729.                     currentItemLevel = tonumber(string.format("%.2f", currentItemLevel))
  2730.                     if(currentItemLevel > highestEffectiveDPSWeapon) then
  2731.                         highestEffectiveDPSWeapon = currentItemLevel
  2732.                     end
  2733.                 end
  2734.             end
  2735.         else
  2736.             statObj = v:GetStatsObjectID()
  2737.             currentItemLevel = ss:GetStatValue(statObj, 'EffectiveDPS')
  2738.             currentItemLevel = tonumber(string.format("%.2f", currentItemLevel))
  2739.            
  2740.             if(currentItemLevel > highestEffectiveDPSWeapon) then
  2741.                 highestEffectiveDPSWeapon = currentItemLevel
  2742.             end
  2743.         end
  2744.     end
  2745.    
  2746.     --print("Highest weapon itemlevel tempItemLevel[0]= ", highestEffectiveDPSWeapon)
  2747. end
  2748.  
  2749. function MyMod:GetHighestArmorByTag(lookedUpTag)
  2750.     equipmentSystem = ssc:Get("EquipmentSystem")
  2751.     espd = equipmentSystem:GetPlayerData(player)
  2752.    
  2753.     highestArmorLevel[lookedUpTag] = 0 --highest armor level by tag that player has
  2754.     equippedArmorLevel[lookedUpTag] = 0
  2755.    
  2756.     local ok, itemList = ts:GetItemListByTag(player, lookedUpTag)
  2757.     local v
  2758.     local vItemID
  2759.     local isItemEqupped
  2760.     local currentItemLevel
  2761.     local itemLevelDiff
  2762.    
  2763.     for i,v in ipairs(itemList) do
  2764.         vItemID = v:GetID()
  2765.        
  2766.         statObj = v:GetStatsObjectID()
  2767.         currentItemLevel = ss:GetStatValue(statObj, 'Armor')
  2768.        
  2769.         currentItemLevel = tonumber(string.format("%.3f", currentItemLevel))
  2770.        
  2771.         isItemEqupped = espd:IsEquipped(vItemID)
  2772.        
  2773.         if(isItemEqupped == true) then
  2774.             equippedArmorLevel[lookedUpTag] = currentItemLevel
  2775.         end
  2776.        
  2777.         if(currentItemLevel > highestArmorLevel[lookedUpTag]) then
  2778.             highestArmorLevel[lookedUpTag] = currentItemLevel
  2779.         end
  2780.        
  2781.         --print("currentItemLevel for:".. lookedUpTag .. " is:".. currentItemLevel)  --
  2782.        
  2783.     end
  2784.    
  2785.     --print("highestArmorLevel ".. lookedUpTag .. " :" .. highestArmorLevel[lookedUpTag])
  2786.    
  2787.     itemLevelDiff = highestArmorLevel[lookedUpTag] - equippedArmorLevel[lookedUpTag]
  2788.     if(itemLevelDiff > 0) then
  2789.         return 1
  2790.     else
  2791.         return 0
  2792.     end
  2793.    
  2794.    
  2795.     --print("highestArmorLevel ".. lookedUpTag .. " :" .. highestArmorLevel[lookedUpTag])
  2796. end
  2797.  
  2798. function MyMod:IsItemInIgnoreList(itemIDToCheck)
  2799.     --working on this (01/23/2021)
  2800.    
  2801.     --public class UIItemsHelper {
  2802.     --public string GetItemName(InventoryItemData itemData) {
  2803.     --GetItemName(ToHandle(itemRecord), itemData);
  2804.    
  2805.     --itemdata = ts:GetItemData(player, itemIDToCheck)
  2806.     --IsItemIconic = itemdata:GetStatValueByType('IsItemIconic')
  2807.    
  2808.     --Game['UIItemsHelper::GetItemName;itemData'](itemdata)
  2809.    
  2810.    
  2811.     --for i,v in ipairs(ignoreTheseItems) do
  2812.     --  tid = TweakDBID.new(v)
  2813.     --  itemid = GetSingleton("gameItemID"):FromTDBID(tid)
  2814.    
  2815.     --  currentBoosterCount = ts:GetItemQuantity(player, itemid)
  2816.     -- 
  2817.     --  if currentBoosterCount > 0 then
  2818.     --      --for debugging
  2819.     --      MyMod:LogAction("Used booster: ", v)
  2820.     --     
  2821.     --      Game['ItemActionsHelper::ConsumeItem;GameObjectItemIDBool'](player, itemid, true)
  2822.     --  end
  2823.     --end
  2824.  
  2825. end
  2826.  
  2827. function MyMod:INI_File_Load()
  2828.     ini = MyMod:LIP_Load('settings.ini')
  2829.     MyMod:INI_Check_Nills()
  2830. end
  2831.  
  2832. function MyMod:INI_Check_Nills()
  2833.     if(ini.Main == nil) then ini.Main = {} end
  2834.     if(ini.Main.UseMod == nil) then ini.Main.UseMod = true end
  2835.     if(ini.Main.followCETOverlay == nil) then ini.Main.followCETOverlay = true end
  2836.    
  2837.     if(ini.Main.UseManualMode == nil) then ini.Main.UseManualMode = false end
  2838.     if(ini.Main.IgnorePauseDetection == nil) then ini.Main.IgnorePauseDetection = false end
  2839.     if(ini.Main.UseEquipmentNotification == nil) then ini.Main.UseEquipmentNotification = false end
  2840.    
  2841.     if(ini.Main.simplifiedInterval == nil) then ini.Main.simplifiedInterval = 1 end
  2842.     if(ini.Main.processItemsOfLesserItemLevel_Only == nil) then ini.Main.processItemsOfLesserItemLevel_Only = true end
  2843.     if(ini.Main.ignoreIconicItems == nil) then ini.Main.ignoreIconicItems = true end
  2844.    
  2845.     if(ini.consumable == nil) then ini.consumable = {} end
  2846.    
  2847.     if(ini.consumable.ProcessAlcohol == nil) then ini.consumable.ProcessAlcohol = true end
  2848.     if(ini.consumable.ProcessFoods == nil) then ini.consumable.ProcessFoods = true end
  2849.     if(ini.consumable.ProcessDrinks == nil) then ini.consumable.ProcessDrinks = true end
  2850.    
  2851.     if(ini.consumable.foodToKeep == nil) then ini.consumable.foodToKeep = "Items.LowQualityFood11" end
  2852.     if(ini.consumable.beverageToKeep == nil) then ini.consumable.beverageToKeep = "Items.GoodQualityDrink10" end
  2853.     if(ini.consumable.useAlcoholCraft == nil) then ini.consumable.useAlcoholCraft = false end
  2854.     if(ini.consumable.alcoholToKeep == nil) then ini.consumable.alcoholToKeep = "Items.NomadsAlcohol1" end
  2855.     if(ini.consumable.useHotkey_FoodBeverages == nil) then ini.consumable.useHotkey_FoodBeverages = true end
  2856.     if(ini.consumable.useHotkey_Booster == nil) then ini.consumable.useHotkey_Booster = true end
  2857.    
  2858.     if(ini.autoHealthInhaler == nil) then ini.autoHealthInhaler = {} end
  2859.     if(ini.autoHealthInhaler.autoHealthInhaler == nil) then ini.autoHealthInhaler.autoHealthInhaler = false end
  2860.     if(ini.autoHealthInhaler.autoHealthInhalerThreshold == nil) then ini.autoHealthInhaler.autoHealthInhalerThreshold = 50 end
  2861.     if(ini.autoHealthInhaler.autoHealthInhalerCoolDown == nil) then ini.autoHealthInhaler.autoHealthInhalerCoolDown = 5 end
  2862.    
  2863.     if(ini.Junk == nil) then ini.Junk = {} end
  2864.     if(ini.Junk.autoCleanJunk == nil) then ini.Junk.autoCleanJunk = false end
  2865.     if(ini.Junk.sellAllJunk == nil) then ini.Junk.sellAllJunk = false end
  2866.     if(ini.Junk.sellExpensiveJunk  == nil) then ini.Junk.sellExpensiveJunk = true end
  2867.     if(ini.Junk.disassembleAllJunk == nil) then ini.Junk.disassembleAllJunk = false end
  2868.     if(ini.Junk.disassembleCheapJunk == nil) then ini.Junk.disassembleCheapJunk = true end
  2869.    
  2870.     if(ini.SimplifyGrenades == nil) then ini.SimplifyGrenades = {} end
  2871.    
  2872.     if(ini.SimplifyGrenades.Biohazard == nil) then ini.SimplifyGrenades.Biohazard=false end
  2873.     if(ini.SimplifyGrenades.Cutting == nil) then ini.SimplifyGrenades.Cutting=false end
  2874.     if(ini.SimplifyGrenades.Emp == nil) then ini.SimplifyGrenades.Emp=false end
  2875.     if(ini.SimplifyGrenades.Flash == nil) then ini.SimplifyGrenades.Flash=false end
  2876.     if(ini.SimplifyGrenades.Frag == nil) then ini.SimplifyGrenades.Frag=false end
  2877.     if(ini.SimplifyGrenades.Incendiary == nil) then ini.SimplifyGrenades.Incendiary=false end
  2878.     if(ini.SimplifyGrenades.Recon == nil) then ini.SimplifyGrenades.Recon=false end
  2879.    
  2880.     if(ini.SimplifyGrenades.SimplifyGrenades_Common == nil) then ini.SimplifyGrenades.SimplifyGrenades_Common=0 end
  2881.     if(ini.SimplifyGrenades.SimplifyGrenades_Uncommon == nil) then ini.SimplifyGrenades.SimplifyGrenades_Uncommon=0 end
  2882.     if(ini.SimplifyGrenades.SimplifyGrenades_Rare == nil) then ini.SimplifyGrenades.SimplifyGrenades_Rare=0 end
  2883.     if(ini.SimplifyGrenades.SimplifyGrenades_Epic == nil) then ini.SimplifyGrenades.SimplifyGrenades_Epic=0 end
  2884.     if(ini.SimplifyGrenades.SimplifyGrenades_Legendary == nil) then ini.SimplifyGrenades.SimplifyGrenades_Legendary=0 end
  2885.    
  2886.     if(ini.SimplifyClothesMod == nil) then ini.SimplifyClothesMod = {} end
  2887.     if(ini.SimplifyClothesMod.SimplifyClothesMod_Common == nil) then ini.SimplifyClothesMod.SimplifyClothesMod_Common=0 end
  2888.     if(ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon == nil) then ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon=0 end
  2889.     if(ini.SimplifyClothesMod.SimplifyClothesMod_Rare == nil) then ini.SimplifyClothesMod.SimplifyClothesMod_Rare=0 end
  2890.     if(ini.SimplifyClothesMod.SimplifyClothesMod_Epic == nil) then ini.SimplifyClothesMod.SimplifyClothesMod_Epic=0 end
  2891.     if(ini.SimplifyClothesMod.SimplifyClothesMod_Legendary == nil) then ini.SimplifyClothesMod.SimplifyClothesMod_Legendary=0 end
  2892.    
  2893.     if(ini.SimplifyWeaponMod == nil) then ini.SimplifyWeaponMod = {} end
  2894.     if(ini.SimplifyWeaponMod.SimplifyWeaponMod_Common == nil) then ini.SimplifyWeaponMod.SimplifyWeaponMod_Common=0 end
  2895.     if(ini.SimplifyWeaponMod.SimplifyWeaponMod_Uncommon == nil) then ini.SimplifyWeaponMod.SimplifyWeaponMod_Uncommon=0 end
  2896.     if(ini.SimplifyWeaponMod.SimplifyWeaponMod_Rare == nil) then ini.SimplifyWeaponMod.SimplifyWeaponMod_Rare=0 end
  2897.     if(ini.SimplifyWeaponMod.SimplifyWeaponMod_Epic == nil) then ini.SimplifyWeaponMod.SimplifyWeaponMod_Epic=0 end
  2898.     if(ini.SimplifyWeaponMod.SimplifyWeaponMod_Legendary == nil) then ini.SimplifyWeaponMod.SimplifyWeaponMod_Legendary=0 end
  2899.    
  2900.     if(ini.SimplifyWeapon == nil) then ini.SimplifyWeapon = {} end
  2901.     if(ini.SimplifyWeapon.KeepOneOfEachType == nil) then ini.SimplifyWeapon.KeepOneOfEachType=false end
  2902.     --
  2903.     if(ini.SimplifyWeapon.RifleAssault == nil) then ini.SimplifyWeapon.RifleAssault=true end
  2904.     if(ini.SimplifyWeapon.Knuckles == nil) then ini.SimplifyWeapon.Knuckles=true end
  2905.     if(ini.SimplifyWeapon.TwoHandHammer == nil) then ini.SimplifyWeapon.TwoHandHammer=true end
  2906.     if(ini.SimplifyWeapon.Handgun == nil) then ini.SimplifyWeapon.Handgun=true end
  2907.     if(ini.SimplifyWeapon.HeavyWeapon == nil) then ini.SimplifyWeapon.HeavyWeapon=true end
  2908.     if(ini.SimplifyWeapon.Katana == nil) then ini.SimplifyWeapon.Katana=true end
  2909.     if(ini.SimplifyWeapon.Knife == nil) then ini.SimplifyWeapon.Knife=true end
  2910.     if(ini.SimplifyWeapon.LMG == nil) then ini.SimplifyWeapon.LMG=true end
  2911.     if(ini.SimplifyWeapon.OneHandBlade == nil) then ini.SimplifyWeapon.OneHandBlade=true end
  2912.     if(ini.SimplifyWeapon.OneHandClub == nil) then ini.SimplifyWeapon.OneHandClub=true end
  2913.     if(ini.SimplifyWeapon.RiflePrecision == nil) then ini.SimplifyWeapon.RiflePrecision=true end
  2914.     if(ini.SimplifyWeapon.Revolver == nil) then ini.SimplifyWeapon.Revolver=true end
  2915.     if(ini.SimplifyWeapon.Shotgun == nil) then ini.SimplifyWeapon.Shotgun=true end
  2916.     if(ini.SimplifyWeapon.ShotgunDual == nil) then ini.SimplifyWeapon.ShotgunDual=true end
  2917.     if(ini.SimplifyWeapon.RifleSniper == nil) then ini.SimplifyWeapon.RifleSniper=true end
  2918.     if(ini.SimplifyWeapon.SMG == nil) then ini.SimplifyWeapon.SMG=true end
  2919.     if(ini.SimplifyWeapon.TwoHandClub == nil) then ini.SimplifyWeapon.TwoHandClub=true end
  2920.     if(ini.SimplifyWeapon.Unique == nil) then ini.SimplifyWeapon.Unique=true end
  2921.     --
  2922.     if(ini.SimplifyWeapon.SimplifyWeapon_Common == nil) then ini.SimplifyWeapon.SimplifyWeapon_Common=0 end
  2923.     if(ini.SimplifyWeapon.SimplifyWeapon_Uncommon == nil) then ini.SimplifyWeapon.SimplifyWeapon_Uncommon=0 end
  2924.     if(ini.SimplifyWeapon.SimplifyWeapon_Rare == nil) then ini.SimplifyWeapon.SimplifyWeapon_Rare=0 end
  2925.     if(ini.SimplifyWeapon.SimplifyWeapon_Epic == nil) then ini.SimplifyWeapon.SimplifyWeapon_Epic=0 end
  2926.     if(ini.SimplifyWeapon.SimplifyWeapon_Legendary == nil) then ini.SimplifyWeapon.SimplifyWeapon_Legendary=0 end
  2927.    
  2928.     if(ini.SimplifyFeet == nil) then ini.SimplifyFeet = {} end
  2929.     if(ini.SimplifyFeet.SimplifyFeet_Common == nil) then ini.SimplifyFeet.SimplifyFeet_Common=0 end
  2930.     if(ini.SimplifyFeet.SimplifyFeet_Uncommon == nil) then ini.SimplifyFeet.SimplifyFeet_Uncommon=0 end
  2931.     if(ini.SimplifyFeet.SimplifyFeet_Rare == nil) then ini.SimplifyFeet.SimplifyFeet_Rare=0 end
  2932.     if(ini.SimplifyFeet.SimplifyFeet_Epic == nil) then ini.SimplifyFeet.SimplifyFeet_Epic=0 end
  2933.     if(ini.SimplifyFeet.SimplifyFeet_Legendary == nil) then ini.SimplifyFeet.SimplifyFeet_Legendary=0 end
  2934.    
  2935.     if(ini.SimplifyHeadArmor == nil) then ini.SimplifyHeadArmor = {} end
  2936.     if(ini.SimplifyHeadArmor.SimplifyHeadArmor_Common == nil) then ini.SimplifyHeadArmor.SimplifyHeadArmor_Common=0 end
  2937.     if(ini.SimplifyHeadArmor.SimplifyHeadArmor_Uncommon == nil) then ini.SimplifyHeadArmor.SimplifyHeadArmor_Uncommon=0 end
  2938.     if(ini.SimplifyHeadArmor.SimplifyHeadArmor_Rare == nil) then ini.SimplifyHeadArmor.SimplifyHeadArmor_Rare=0 end
  2939.     if(ini.SimplifyHeadArmor.SimplifyHeadArmor_Epic == nil) then ini.SimplifyHeadArmor.SimplifyHeadArmor_Epic=0 end
  2940.     if(ini.SimplifyHeadArmor.SimplifyHeadArmor_Legendary == nil) then ini.SimplifyHeadArmor.SimplifyHeadArmor_Legendary=0 end
  2941.    
  2942.     if(ini.SimplifyChestArmor == nil) then ini.SimplifyChestArmor = {} end
  2943.     if(ini.SimplifyChestArmor.SimplifyChestArmor_Common == nil) then ini.SimplifyChestArmor.SimplifyChestArmor_Common=0 end
  2944.     if(ini.SimplifyChestArmor.SimplifyChestArmor_Uncommon == nil) then ini.SimplifyChestArmor.SimplifyChestArmor_Uncommon=0 end
  2945.     if(ini.SimplifyChestArmor.SimplifyChestArmor_Rare == nil) then ini.SimplifyChestArmor.SimplifyChestArmor_Rare=0 end
  2946.     if(ini.SimplifyChestArmor.SimplifyChestArmor_Epic == nil) then ini.SimplifyChestArmor.SimplifyChestArmor_Epic=0 end
  2947.     if(ini.SimplifyChestArmor.SimplifyChestArmor_Legendary == nil) then ini.SimplifyChestArmor.SimplifyChestArmor_Legendary=0 end
  2948.    
  2949.     if(ini.SimplifyInnerChestArmor == nil) then ini.SimplifyInnerChestArmor = {} end
  2950.     if(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Common == nil) then ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Common=0 end
  2951.     if(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Uncommon == nil) then ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Uncommon=0 end
  2952.     if(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Rare == nil) then ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Rare=0 end
  2953.     if(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Epic == nil) then ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Epic=0 end
  2954.     if(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Legendary == nil) then ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Legendary=0 end
  2955.    
  2956.     if(ini.SimplifyFaceArmor == nil) then ini.SimplifyFaceArmor = {} end
  2957.     if(ini.SimplifyFaceArmor.SimplifyFaceArmor_Common == nil) then ini.SimplifyFaceArmor.SimplifyFaceArmor_Common=0 end
  2958.     if(ini.SimplifyFaceArmor.SimplifyFaceArmor_Uncommon == nil) then ini.SimplifyFaceArmor.SimplifyFaceArmor_Uncommon=0 end
  2959.     if(ini.SimplifyFaceArmor.SimplifyFaceArmor_Rare == nil) then ini.SimplifyFaceArmor.SimplifyFaceArmor_Rare=0 end
  2960.     if(ini.SimplifyFaceArmor.SimplifyFaceArmor_Epic == nil) then ini.SimplifyFaceArmor.SimplifyFaceArmor_Epic=0 end
  2961.     if(ini.SimplifyFaceArmor.SimplifyFaceArmor_Legendary == nil) then ini.SimplifyFaceArmor.SimplifyFaceArmor_Legendary=0 end
  2962.    
  2963.     if(ini.SimplifyLegArmor == nil) then ini.SimplifyLegArmor = {} end
  2964.     if(ini.SimplifyLegArmor.SimplifyLegArmor_Common == nil) then ini.SimplifyLegArmor.SimplifyLegArmor_Common=0 end
  2965.     if(ini.SimplifyLegArmor.SimplifyLegArmor_Uncommon == nil) then ini.SimplifyLegArmor.SimplifyLegArmor_Uncommon=0 end
  2966.     if(ini.SimplifyLegArmor.SimplifyLegArmor_Rare == nil) then ini.SimplifyLegArmor.SimplifyLegArmor_Rare=0 end
  2967.     if(ini.SimplifyLegArmor.SimplifyLegArmor_Epic == nil) then ini.SimplifyLegArmor.SimplifyLegArmor_Epic=0 end
  2968.     if(ini.SimplifyLegArmor.SimplifyLegArmor_Legendary == nil) then ini.SimplifyLegArmor.SimplifyLegArmor_Legendary=0 end
  2969.    
  2970.     if(ini.SimplifyHealthItems == nil) then ini.SimplifyHealthItems = {} end
  2971.     if(ini.SimplifyHealthItems.MaxDoc_MK1 == nil) then ini.SimplifyHealthItems.MaxDoc_MK1=0 end
  2972.     if(ini.SimplifyHealthItems.MaxDoc_MK2 == nil) then ini.SimplifyHealthItems.MaxDoc_MK2=0 end
  2973.     if(ini.SimplifyHealthItems.MaxDoc_MK3 == nil) then ini.SimplifyHealthItems.MaxDoc_MK3=0 end
  2974.     if(ini.SimplifyHealthItems.Bounce_Back_MK1 == nil) then ini.SimplifyHealthItems.Bounce_Back_MK1=0 end
  2975.     if(ini.SimplifyHealthItems.Bounce_Back_MK2 == nil) then ini.SimplifyHealthItems.Bounce_Back_MK2=0 end
  2976.     if(ini.SimplifyHealthItems.Bounce_Back_MK3 == nil) then ini.SimplifyHealthItems.Bounce_Back_MK3=0 end
  2977.    
  2978.     if(ini.SimplifyShards == nil) then ini.SimplifyShards = {} end
  2979.     if(ini.SimplifyShards.SimplifyShards == nil) then ini.SimplifyShards.SimplifyShards=false end
  2980.     if(ini.SimplifyShards.SimplifyShards == 0) then
  2981.         ini.SimplifyShards.SimplifyShards = false
  2982.     end
  2983.    
  2984.    
  2985. end
  2986.  
  2987. function MyMod:INI_File_Save()
  2988.     if(initNotDone) then
  2989.         print("MyMod:INI_File_Save: Message 0 TRIED ENTERING WHILE onInit IS NOT DONE!")
  2990.         do return end
  2991.     end
  2992.    
  2993.     --Don't save nills!
  2994.     MyMod:INI_Check_Nills()
  2995.    
  2996.     --we want to save in a certain order, damned Lua
  2997.     --having tables in a random order. god dammit
  2998.     --contents = contents .. ('%s\n'):format("DESCRIPTION_HERE");
  2999.    
  3000.     filename = getCWD('settings.ini')
  3001.    
  3002.     assert(type(filename) == 'string', 'Parameter "filename" must be a string.');
  3003.     local file = assert(io.open(filename, 'w+b'), 'Error loading file :' .. filename);
  3004.     local contents = '';
  3005.    
  3006.     contents = contents .. ('[%s]\n'):format("Main");
  3007.    
  3008.     contents = contents .. ('%s=%s\n'):format("UseMod", tostring(ini.Main.UseMod));
  3009.     contents = contents .. ('%s=%s\n'):format("followCETOverlay", tostring(ini.Main.followCETOverlay));
  3010.     contents = contents .. ('%s\n'):format(";trigger the mod manually");
  3011.     contents = contents .. ('%s=%s\n'):format("UseManualMode", tostring(ini.Main.UseManualMode));
  3012.     contents = contents .. ('%s=%s\n'):format("IgnorePauseDetection", tostring(ini.Main.IgnorePauseDetection));
  3013.     contents = contents .. ('%s=%s\n'):format("UseEquipmentNotification", tostring(ini.Main.UseEquipmentNotification));
  3014.    
  3015.     contents = contents .. ('%s\n'):format(";time interval allowed to auto simplify food and beverages");
  3016.     contents = contents .. ('%s=%s\n'):format("simplifiedInterval", tostring(ini.Main.simplifiedInterval));
  3017.     contents = contents .. ('%s=%s\n'):format("processItemsOfLesserItemLevel_Only", tostring(ini.Main.processItemsOfLesserItemLevel_Only));
  3018.     contents = contents .. ('%s=%s\n'):format("ignoreIconicItems", tostring(ini.Main.ignoreIconicItems));
  3019.     contents = contents .. ('\n')
  3020.    
  3021.     contents = contents .. ('[%s]\n'):format("consumable");
  3022.    
  3023.     contents = contents .. ('%s=%s\n'):format("ProcessAlcohol", tostring(ini.consumable.ProcessAlcohol));
  3024.     contents = contents .. ('%s=%s\n'):format("ProcessFoods", tostring(ini.consumable.ProcessFoods));
  3025.     contents = contents .. ('%s=%s\n'):format("ProcessDrinks", tostring(ini.consumable.ProcessDrinks));
  3026.    
  3027.     contents = contents .. ('%s=%s\n'):format("foodToKeep", tostring(ini.consumable.foodToKeep));
  3028.     contents = contents .. ('%s=%s\n'):format("beverageToKeep", tostring(ini.consumable.beverageToKeep));
  3029.     contents = contents .. ('%s=%s\n'):format("useAlcoholCraft", tostring(ini.consumable.useAlcoholCraft));
  3030.     contents = contents .. ('%s=%s\n'):format("alcoholToKeep", tostring(ini.consumable.alcoholToKeep));
  3031.     contents = contents .. ('%s=%s\n'):format("useHotkey_FoodBeverages", tostring(ini.consumable.useHotkey_FoodBeverages));
  3032.     contents = contents .. ('%s=%s\n'):format("useHotkey_Booster", tostring(ini.consumable.useHotkey_Booster));
  3033.     contents = contents .. ('\n')
  3034.    
  3035.     contents = contents .. ('[%s]\n'):format("autoHealthInhaler");
  3036.     contents = contents .. ('%s\n'):format(";auto use health inhaler on low health.");
  3037.     contents = contents .. ('%s=%s\n'):format("autoHealthInhaler", tostring(ini.autoHealthInhaler.autoHealthInhaler));
  3038.     contents = contents .. ('%s\n'):format(";autoHealthInhalerThreshold = is the percent of the player's health when it activates");
  3039.     contents = contents .. ('%s=%s\n'):format("autoHealthInhalerThreshold", tostring(ini.autoHealthInhaler.autoHealthInhalerThreshold));
  3040.     contents = contents .. ('%s=%s\n'):format("autoHealthInhalerCoolDown", tostring(ini.autoHealthInhaler.autoHealthInhalerCoolDown));
  3041.     contents = contents .. ('\n')
  3042.  
  3043.     contents = contents .. ('[%s]\n'):format("Junk");
  3044.     contents = contents .. ('%s\n'):format(";Determines if the script will process junk items");
  3045.     contents = contents .. ('%s=%s\n'):format("autoCleanJunk", tostring(ini.Junk.autoCleanJunk));
  3046.     contents = contents .. ('%s=%s\n'):format("sellAllJunk", tostring(ini.Junk.sellAllJunk));
  3047.     contents = contents .. ('%s=%s\n'):format("sellExpensiveJunk", tostring(ini.Junk.sellExpensiveJunk));
  3048.     contents = contents .. ('%s=%s\n'):format("disassembleAllJunk", tostring(ini.Junk.disassembleAllJunk));
  3049.     contents = contents .. ('%s=%s\n'):format("disassembleCheapJunk", tostring(ini.Junk.disassembleCheapJunk));
  3050.     contents = contents .. ('\n')
  3051.    
  3052.     contents = contents .. ('[%s]\n'):format("SimplifyGrenades");
  3053.     contents = contents .. ('%s\n'):format(";If true will process grenade type");
  3054.     contents = contents .. ('%s=%s\n'):format("Biohazard", tostring(ini.SimplifyGrenades.Biohazard));
  3055.     contents = contents .. ('%s=%s\n'):format("Cutting", tostring(ini.SimplifyGrenades.Cutting));
  3056.     contents = contents .. ('%s=%s\n'):format("Emp", tostring(ini.SimplifyGrenades.Emp));
  3057.     contents = contents .. ('%s=%s\n'):format("Flash", tostring(ini.SimplifyGrenades.Flash));
  3058.     contents = contents .. ('%s=%s\n'):format("Frag", tostring(ini.SimplifyGrenades.Frag));
  3059.     contents = contents .. ('%s=%s\n'):format("Incendiary", tostring(ini.SimplifyGrenades.Incendiary));
  3060.     contents = contents .. ('%s=%s\n'):format("Recon", tostring(ini.SimplifyGrenades.Recon));
  3061.    
  3062.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3063.     contents = contents .. ('%s=%s\n'):format("SimplifyGrenades_Common", tostring(ini.SimplifyGrenades.SimplifyGrenades_Common));
  3064.     contents = contents .. ('%s=%s\n'):format("SimplifyGrenades_Uncommon", tostring(ini.SimplifyGrenades.SimplifyGrenades_Uncommon));
  3065.     contents = contents .. ('%s=%s\n'):format("SimplifyGrenades_Rare", tostring(ini.SimplifyGrenades.SimplifyGrenades_Rare));
  3066.     contents = contents .. ('%s=%s\n'):format("SimplifyGrenades_Epic", tostring(ini.SimplifyGrenades.SimplifyGrenades_Epic));
  3067.     contents = contents .. ('%s=%s\n'):format("SimplifyGrenades_Legendary", tostring(ini.SimplifyGrenades.SimplifyGrenades_Legendary));
  3068.     contents = contents .. ('\n')
  3069.    
  3070.     contents = contents .. ('[%s]\n'):format("SimplifyClothesMod");
  3071.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3072.     contents = contents .. ('%s=%s\n'):format("SimplifyClothesMod_Common", tostring(ini.SimplifyClothesMod.SimplifyClothesMod_Common));
  3073.     contents = contents .. ('%s=%s\n'):format("SimplifyClothesMod_Uncommon", tostring(ini.SimplifyClothesMod.SimplifyClothesMod_Uncommon));
  3074.     contents = contents .. ('%s=%s\n'):format("SimplifyClothesMod_Rare", tostring(ini.SimplifyClothesMod.SimplifyClothesMod_Rare));
  3075.     contents = contents .. ('%s=%s\n'):format("SimplifyClothesMod_Epic", tostring(ini.SimplifyClothesMod.SimplifyClothesMod_Epic));
  3076.     contents = contents .. ('%s=%s\n'):format("SimplifyClothesMod_Legendary", tostring(ini.SimplifyClothesMod.SimplifyClothesMod_Legendary));
  3077.     contents = contents .. ('\n')
  3078.    
  3079.     contents = contents .. ('[%s]\n'):format("SimplifyWeaponMod");
  3080.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3081.     contents = contents .. ('%s=%s\n'):format("SimplifyWeaponMod_Common", tostring(ini.SimplifyWeaponMod.SimplifyWeaponMod_Common));
  3082.     contents = contents .. ('%s=%s\n'):format("SimplifyWeaponMod_Uncommon", tostring(ini.SimplifyWeaponMod.SimplifyWeaponMod_Uncommon));
  3083.     contents = contents .. ('%s=%s\n'):format("SimplifyWeaponMod_Rare", tostring(ini.SimplifyWeaponMod.SimplifyWeaponMod_Rare));
  3084.     contents = contents .. ('%s=%s\n'):format("SimplifyWeaponMod_Epic", tostring(ini.SimplifyWeaponMod.SimplifyWeaponMod_Epic));
  3085.     contents = contents .. ('%s=%s\n'):format("SimplifyWeaponMod_Legendary", tostring(ini.SimplifyWeaponMod.SimplifyWeaponMod_Legendary));
  3086.     contents = contents .. ('\n')
  3087.    
  3088.     contents = contents .. ('[%s]\n'):format("SimplifyWeapon");
  3089.     contents = contents .. ('%s\n'):format(";Prevents the system from selling a weapon if it is the only one of that type in your inventory");
  3090.     contents = contents .. ('%s=%s\n'):format("KeepOneOfEachType", tostring(ini.SimplifyWeapon.KeepOneOfEachType));
  3091.     contents = contents .. ('%s\n'):format(";Part of KeepOneOfEachType, which weapon type to keep");
  3092.     contents = contents .. ('%s=%s\n'):format("RifleAssault", tostring(ini.SimplifyWeapon.RifleAssault));
  3093.     contents = contents .. ('%s=%s\n'):format("Knuckles", tostring(ini.SimplifyWeapon.Knuckles));
  3094.     contents = contents .. ('%s=%s\n'):format("TwoHandHammer", tostring(ini.SimplifyWeapon.TwoHandHammer));
  3095.     contents = contents .. ('%s=%s\n'):format("Handgun", tostring(ini.SimplifyWeapon.Handgun));
  3096.     contents = contents .. ('%s=%s\n'):format("HeavyWeapon", tostring(ini.SimplifyWeapon.HeavyWeapon));
  3097.     contents = contents .. ('%s=%s\n'):format("Katana", tostring(ini.SimplifyWeapon.Katana));
  3098.     contents = contents .. ('%s=%s\n'):format("Knife", tostring(ini.SimplifyWeapon.Knife));
  3099.     contents = contents .. ('%s=%s\n'):format("LMG", tostring(ini.SimplifyWeapon.LMG));
  3100.     contents = contents .. ('%s=%s\n'):format("OneHandBlade", tostring(ini.SimplifyWeapon.OneHandBlade));
  3101.     contents = contents .. ('%s=%s\n'):format("OneHandClub", tostring(ini.SimplifyWeapon.OneHandClub));
  3102.     contents = contents .. ('%s=%s\n'):format("RiflePrecision", tostring(ini.SimplifyWeapon.RiflePrecision));
  3103.     contents = contents .. ('%s=%s\n'):format("Revolver", tostring(ini.SimplifyWeapon.Revolver));
  3104.     contents = contents .. ('%s=%s\n'):format("Shotgun", tostring(ini.SimplifyWeapon.Shotgun));
  3105.     contents = contents .. ('%s=%s\n'):format("ShotgunDual", tostring(ini.SimplifyWeapon.ShotgunDual));
  3106.     contents = contents .. ('%s=%s\n'):format("RifleSniper", tostring(ini.SimplifyWeapon.RifleSniper));
  3107.     contents = contents .. ('%s=%s\n'):format("SMG", tostring(ini.SimplifyWeapon.SMG));
  3108.     contents = contents .. ('%s=%s\n'):format("TwoHandClub", tostring(ini.SimplifyWeapon.TwoHandClub));
  3109.     contents = contents .. ('%s=%s\n'):format("Unique", tostring(ini.SimplifyWeapon.Unique));
  3110.    
  3111.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3112.     contents = contents .. ('%s=%s\n'):format("SimplifyWeapon_Common", tostring(ini.SimplifyWeapon.SimplifyWeapon_Common));
  3113.     contents = contents .. ('%s=%s\n'):format("SimplifyWeapon_Uncommon", tostring(ini.SimplifyWeapon.SimplifyWeapon_Uncommon));
  3114.     contents = contents .. ('%s=%s\n'):format("SimplifyWeapon_Rare", tostring(ini.SimplifyWeapon.SimplifyWeapon_Rare));
  3115.     contents = contents .. ('%s=%s\n'):format("SimplifyWeapon_Epic", tostring(ini.SimplifyWeapon.SimplifyWeapon_Epic));
  3116.     contents = contents .. ('%s=%s\n'):format("SimplifyWeapon_Legendary", tostring(ini.SimplifyWeapon.SimplifyWeapon_Legendary));
  3117.     contents = contents .. ('\n')
  3118.    
  3119.     contents = contents .. ('[%s]\n'):format("SimplifyFeet");
  3120.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3121.     contents = contents .. ('%s=%s\n'):format("SimplifyFeet_Common", tostring(ini.SimplifyFeet.SimplifyFeet_Common));
  3122.     contents = contents .. ('%s=%s\n'):format("SimplifyFeet_Uncommon", tostring(ini.SimplifyFeet.SimplifyFeet_Uncommon));
  3123.     contents = contents .. ('%s=%s\n'):format("SimplifyFeet_Rare", tostring(ini.SimplifyFeet.SimplifyFeet_Rare));
  3124.     contents = contents .. ('%s=%s\n'):format("SimplifyFeet_Epic", tostring(ini.SimplifyFeet.SimplifyFeet_Epic));
  3125.     contents = contents .. ('%s=%s\n'):format("SimplifyFeet_Legendary", tostring(ini.SimplifyFeet.SimplifyFeet_Legendary));
  3126.     contents = contents .. ('\n')
  3127.    
  3128.     contents = contents .. ('[%s]\n'):format("SimplifyHeadArmor");
  3129.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3130.     contents = contents .. ('%s=%s\n'):format("SimplifyHeadArmor_Common", tostring(ini.SimplifyHeadArmor.SimplifyHeadArmor_Common));
  3131.     contents = contents .. ('%s=%s\n'):format("SimplifyHeadArmor_Uncommon", tostring(ini.SimplifyHeadArmor.SimplifyHeadArmor_Uncommon));
  3132.     contents = contents .. ('%s=%s\n'):format("SimplifyHeadArmor_Rare", tostring(ini.SimplifyHeadArmor.SimplifyHeadArmor_Rare));
  3133.     contents = contents .. ('%s=%s\n'):format("SimplifyHeadArmor_Epic", tostring(ini.SimplifyHeadArmor.SimplifyHeadArmor_Epic));
  3134.     contents = contents .. ('%s=%s\n'):format("SimplifyHeadArmor_Legendary", tostring(ini.SimplifyHeadArmor.SimplifyHeadArmor_Legendary));
  3135.     contents = contents .. ('\n')
  3136.    
  3137.     contents = contents .. ('[%s]\n'):format("SimplifyChestArmor");
  3138.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3139.     contents = contents .. ('%s=%s\n'):format("SimplifyChestArmor_Common", tostring(ini.SimplifyChestArmor.SimplifyChestArmor_Common));
  3140.     contents = contents .. ('%s=%s\n'):format("SimplifyChestArmor_Uncommon", tostring(ini.SimplifyChestArmor.SimplifyChestArmor_Uncommon));
  3141.     contents = contents .. ('%s=%s\n'):format("SimplifyChestArmor_Rare", tostring(ini.SimplifyChestArmor.SimplifyChestArmor_Rare));
  3142.     contents = contents .. ('%s=%s\n'):format("SimplifyChestArmor_Epic", tostring(ini.SimplifyChestArmor.SimplifyChestArmor_Epic));
  3143.     contents = contents .. ('%s=%s\n'):format("SimplifyChestArmor_Legendary", tostring(ini.SimplifyChestArmor.SimplifyChestArmor_Legendary));
  3144.     contents = contents .. ('\n')
  3145.    
  3146.     contents = contents .. ('[%s]\n'):format("SimplifyInnerChestArmor");
  3147.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3148.     contents = contents .. ('%s=%s\n'):format("SimplifyInnerChestArmor_Common", tostring(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Common));
  3149.     contents = contents .. ('%s=%s\n'):format("SimplifyInnerChestArmor_Uncommon", tostring(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Uncommon));
  3150.     contents = contents .. ('%s=%s\n'):format("SimplifyInnerChestArmor_Rare", tostring(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Rare));
  3151.     contents = contents .. ('%s=%s\n'):format("SimplifyInnerChestArmor_Epic", tostring(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Epic));
  3152.     contents = contents .. ('%s=%s\n'):format("SimplifyInnerChestArmor_Legendary", tostring(ini.SimplifyInnerChestArmor.SimplifyInnerChestArmor_Legendary));
  3153.     contents = contents .. ('\n')
  3154.    
  3155.     contents = contents .. ('[%s]\n'):format("SimplifyFaceArmor");
  3156.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3157.     contents = contents .. ('%s=%s\n'):format("SimplifyFaceArmor_Common", tostring(ini.SimplifyFaceArmor.SimplifyFaceArmor_Common));
  3158.     contents = contents .. ('%s=%s\n'):format("SimplifyFaceArmor_Uncommon", tostring(ini.SimplifyFaceArmor.SimplifyFaceArmor_Uncommon));
  3159.     contents = contents .. ('%s=%s\n'):format("SimplifyFaceArmor_Rare", tostring(ini.SimplifyFaceArmor.SimplifyFaceArmor_Rare));
  3160.     contents = contents .. ('%s=%s\n'):format("SimplifyFaceArmor_Epic", tostring(ini.SimplifyFaceArmor.SimplifyFaceArmor_Epic));
  3161.     contents = contents .. ('%s=%s\n'):format("SimplifyFaceArmor_Legendary", tostring(ini.SimplifyFaceArmor.SimplifyFaceArmor_Legendary));
  3162.     contents = contents .. ('\n')
  3163.    
  3164.     contents = contents .. ('[%s]\n'):format("SimplifyLegArmor");
  3165.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3166.     contents = contents .. ('%s=%s\n'):format("SimplifyLegArmor_Common", tostring(ini.SimplifyLegArmor.SimplifyLegArmor_Common));
  3167.     contents = contents .. ('%s=%s\n'):format("SimplifyLegArmor_Uncommon", tostring(ini.SimplifyLegArmor.SimplifyLegArmor_Uncommon));
  3168.     contents = contents .. ('%s=%s\n'):format("SimplifyLegArmor_Rare", tostring(ini.SimplifyLegArmor.SimplifyLegArmor_Rare));
  3169.     contents = contents .. ('%s=%s\n'):format("SimplifyLegArmor_Epic", tostring(ini.SimplifyLegArmor.SimplifyLegArmor_Epic));
  3170.     contents = contents .. ('%s=%s\n'):format("SimplifyLegArmor_Legendary", tostring(ini.SimplifyLegArmor.SimplifyLegArmor_Legendary));
  3171.     contents = contents .. ('\n')
  3172.    
  3173.     contents = contents .. ('[%s]\n'):format("SimplifyHealthItems");
  3174.     contents = contents .. ('%s\n'):format(";0=Nothing, 1=AutoSell, 2=AutoDismantle");
  3175.     contents = contents .. ('%s=%s\n'):format("MaxDoc_MK1", tostring(ini.SimplifyHealthItems.MaxDoc_MK1));
  3176.     contents = contents .. ('%s=%s\n'):format("MaxDoc_MK2", tostring(ini.SimplifyHealthItems.MaxDoc_MK2));
  3177.     contents = contents .. ('%s=%s\n'):format("MaxDoc_MK3", tostring(ini.SimplifyHealthItems.MaxDoc_MK3));
  3178.     contents = contents .. ('%s=%s\n'):format("Bounce_Back_MK1", tostring(ini.SimplifyHealthItems.Bounce_Back_MK1));
  3179.     contents = contents .. ('%s=%s\n'):format("Bounce_Back_MK2", tostring(ini.SimplifyHealthItems.Bounce_Back_MK2));
  3180.     contents = contents .. ('%s=%s\n'):format("Bounce_Back_MK3", tostring(ini.SimplifyHealthItems.Bounce_Back_MK3));
  3181.     contents = contents .. ('\n')
  3182.    
  3183.     contents = contents .. ('[%s]\n'):format("SimplifyShards");
  3184.     contents = contents .. ('%s\n'):format(";false=Nothing, true=AutoSell");
  3185.     contents = contents .. ('%s=%s\n'):format("SimplifyShards", tostring(ini.SimplifyShards.SimplifyShards));
  3186.    
  3187.     contents = contents .. ('\n')
  3188.    
  3189.     file:write(contents);
  3190.     file:close();
  3191.    
  3192. end
  3193.  
  3194.  
  3195. --- Returns a table containing all the data from the INI file.
  3196. --@param filename The name of the INI file to parse. [string]
  3197. --@return The table containing all data from the INI file. [table]
  3198. function MyMod:LIP_Load(filename)
  3199.     if(initNotDone) then
  3200.         do return end
  3201.     end
  3202.    
  3203.     filename = getCWD(filename)
  3204.    
  3205.     local file = io.open(filename, 'r');
  3206.    
  3207.    
  3208.    
  3209.     local data = {};
  3210.     local section;
  3211.     for line in file:lines() do
  3212.         local tempSection = line:match('^%[([^%[%]]+)%]$');
  3213.         if(tempSection)then
  3214.             section = tonumber(tempSection) and tonumber(tempSection) or tempSection;
  3215.             data[section] = data[section] or {};
  3216.         end
  3217.         local param, value = line:match('^([%w|_]+)%s-=%s-(.+)$');
  3218.         if(param and value ~= nil)then
  3219.             if(tonumber(value))then
  3220.                 value = tonumber(value);
  3221.             elseif(value == 'true')then
  3222.                 value = true;
  3223.             elseif(value == 'false')then
  3224.                 value = false;
  3225.             end
  3226.             if(tonumber(param))then
  3227.                 param = tonumber(param);
  3228.             end
  3229.             data[section][param] = value;
  3230.         end
  3231.     end
  3232.     file:close();
  3233.    
  3234.     return data;
  3235. end
  3236.  
  3237. function file_exists(filename)
  3238.    local f=io.open(filename,"r")
  3239.    if (f~=nil) then io.close(f) return true else return false end
  3240. end
  3241.  
  3242. function getCWD(filename)
  3243.     if file_exists("./bin/x64/plugins/cyber_engine_tweaks/mods/food/"..filename) then
  3244.         return "./bin/x64/plugins/cyber_engine_tweaks/mods/food/"..filename
  3245.    
  3246.     elseif file_exists("./plugins/cyber_engine_tweaks/mods/food/"..filename) then
  3247.         return "./plugins/cyber_engine_tweaks/mods/food/"..filename
  3248.    
  3249.     elseif file_exists("./cyber_engine_tweaks/mods/food/"..filename) then
  3250.         return "./cyber_engine_tweaks/mods/food/"..filename
  3251.    
  3252.     elseif file_exists("./mods/food/"..filename) then
  3253.         return "./mods/food/"..filename
  3254.    
  3255.     elseif file_exists("./food/"..filename) then
  3256.         return "./food/"..filename
  3257.        
  3258.     elseif  file_exists("./"..filename) then
  3259.         return "./"..filename
  3260.     end
  3261.    
  3262.     --file not found attempt to create settings.ini
  3263.     print("settings.ini not found. Creating!")
  3264.     local modpath = ""
  3265.     modpath =  modDirectory("init.lua")
  3266.     print("Directory found at: ", modpath)
  3267.    
  3268.     modpath = modpath .. "settings.ini"
  3269.     print("There should now be a file at: ", modpath)
  3270.     file = io.open(modpath, "w")
  3271.     file:write("123")
  3272.     file:close()
  3273.    
  3274.     return modpath
  3275.    
  3276. end
  3277.  
  3278. function modDirectory(filename)
  3279.     if file_exists("./bin/x64/plugins/cyber_engine_tweaks/mods/food/"..filename) then
  3280.         return "./bin/x64/plugins/cyber_engine_tweaks/mods/food/"
  3281.    
  3282.     elseif file_exists("./plugins/cyber_engine_tweaks/mods/food/"..filename) then
  3283.         return "./plugins/cyber_engine_tweaks/mods/food/"
  3284.    
  3285.     elseif file_exists("./cyber_engine_tweaks/mods/food/"..filename) then
  3286.         return "./cyber_engine_tweaks/mods/food/"
  3287.    
  3288.     elseif file_exists("./mods/food/"..filename) then
  3289.         return "./mods/food/"
  3290.    
  3291.     elseif file_exists("./food/"..filename) then
  3292.         return "./food/"
  3293.        
  3294.     elseif  file_exists("./"..filename) then
  3295.         return "./"
  3296.     end
  3297. end
  3298.  
  3299. function IsPlayerInAnyMenu()
  3300.     blackboard = Game.GetBlackboardSystem():Get(Game.GetAllBlackboardDefs().UI_System);
  3301.     uiSystemBB = (Game.GetAllBlackboardDefs().UI_System);
  3302.     return(blackboard:GetBool(uiSystemBB.IsInMenu));
  3303. end
  3304.  
  3305. return MyMod:new()
Add Comment
Please, Sign In to add comment