diff --git a/Classes/PassiveTreeView.lua b/Classes/PassiveTreeView.lua index 7bdc8563..dd8eeee9 100644 --- a/Classes/PassiveTreeView.lua +++ b/Classes/PassiveTreeView.lua @@ -319,7 +319,7 @@ function TreeViewClass:DrawTree(build, viewPort, inputEvents) if node.ascendancyName and node.ascendancyName ~= spec.curAscendClassName then SetDrawColor(0.5, 0.5, 0.5) end - if IsKeyDown("ALT") then + if launch.devMode and IsKeyDown("ALT") then if node.extra then SetDrawColor(1, 0, 0) elseif node.unknown then @@ -456,7 +456,7 @@ function TreeViewClass:AddNodeTooltip(node, build) if jewel then build.items:AddItemTooltip(jewel, build) else - main:AddTooltipLine(24, "^7"..node.dn..(IsKeyDown("ALT") and " ["..node.id.."]" or "")) + main:AddTooltipLine(24, "^7"..node.dn..(launch.devMode and IsKeyDown("ALT") and " ["..node.id.."]" or "")) end main:AddTooltipSeperator(14) main:AddTooltipLine(14, "^x80A080Tip: Right click this socket to go to the items page and choose the jewel for this socket.") @@ -464,8 +464,8 @@ function TreeViewClass:AddNodeTooltip(node, build) end -- Node name - main:AddTooltipLine(24, "^7"..node.dn..(IsKeyDown("ALT") and " ["..node.id.."]" or "")) - if IsKeyDown("ALT") and node.power and node.power.dps then + main:AddTooltipLine(24, "^7"..node.dn..(launch.devMode and IsKeyDown("ALT") and " ["..node.id.."]" or "")) + if launch.devMode and IsKeyDown("ALT") and node.power and node.power.dps then main:AddTooltipLine(16, string.format("DPS power: %g Defence power: %g", node.power.dps, node.power.def)) end @@ -474,7 +474,7 @@ function TreeViewClass:AddNodeTooltip(node, build) main:AddTooltipLine(16, "") for i, line in ipairs(node.sd) do if node.mods[i].list then - if IsKeyDown("ALT") then + if launch.devMode and IsKeyDown("ALT") then local modStr for k, v in pairs(node.mods[i].list) do modStr = (modStr and modStr..", " or "^2") .. string.format("%s = %s", k, tostring(v)) diff --git a/Launch.lua b/Launch.lua index 0f3a78da..4a599a24 100644 --- a/Launch.lua +++ b/Launch.lua @@ -13,6 +13,11 @@ local launch = { } SetMainObject(launch) function launch:OnInit() + if GetScriptPath() ~= GetRuntimePath() then + -- We are running from an external runtime + -- Force developer mode to disable update checks + self.devMode = true + end ConPrintf("Loading main script...") local mainFile = io.open("Modules/Main.lua") if mainFile then @@ -40,7 +45,10 @@ function launch:OnInit() self:ShowErrMsg("In 'Init': %s", errMsg) end end - self:CheckForUpdate(true) + if not self.devMode then + -- Run a background update check if developer mode is off + self:CheckForUpdate(true) + end end function launch:OnExit() @@ -78,7 +86,9 @@ function launch:OnKeyDown(key, doubleClick) if key == "F5" then self.doRestart = true elseif key == "u" and IsKeyDown("CTRL") then - self:CheckForUpdate() + if not self.devMode then + self:CheckForUpdate() + end elseif self.promptMsg then local errMsg, ret = PCall(self.promptFunc, key) if errMsg then @@ -157,7 +167,7 @@ function launch:ApplyUpdate(mode) -- Update can be applied while normal environment is running LoadModule("Update") Restart() - self.doRestart = true -- Will show "Restarting" message if main window is showing + self.doRestart = true -- Will show "Restarting" message if main window is open end end @@ -166,7 +176,7 @@ function launch:CheckForUpdate(inBackground) self.updateChecking = not inBackground self.updateMsg = "" local update = io.open("Update.lua", "r") - LaunchSubScript(update:read("*a"), "MakeDir", "ConPrintf", "CHECK") + LaunchSubScript(update:read("*a"), "GetWorkDir,MakeDir", "ConPrintf", "CHECK") update:close() end end diff --git a/Modules/Items.lua b/Modules/Items.lua index 7ffcf09f..225fbe19 100644 --- a/Modules/Items.lua +++ b/Modules/Items.lua @@ -318,7 +318,7 @@ function items:AddItemTooltip(item) end end end - if IsKeyDown("ALT") then + if launch.devMode and IsKeyDown("ALT") then main:AddTooltipSeperator(10) local nameList = { } for k in pairs(modList) do diff --git a/Modules/Main.lua b/Modules/Main.lua index c08e62b7..f9451a62 100644 --- a/Modules/Main.lua +++ b/Modules/Main.lua @@ -75,6 +75,10 @@ function main:OnFrame() common.controlsDraw(self) + if launch.devMode then + DrawString(4, 4, "RIGHT", 18, "VAR", "^1Dev Mode") + end + wipeTable(self.inputEvents) end @@ -139,7 +143,7 @@ function main:LoadSettings() end self.buildPath = node.attrib.path elseif node.elem == "DevMode" then - self.devMode = node.attrib.enable == "true" + launch.devMode = node.attrib.enable == "true" end end end @@ -161,7 +165,7 @@ function main:SaveSettings() end t_insert(setXML, mode) t_insert(setXML, { elem = "BuildPath", attrib = { path = self.buildPath } }) - t_insert(setXML, { elem = "DevMode", attrib = { enable = self.devMode and "true" or "false" } }) + t_insert(setXML, { elem = "DevMode", attrib = { enable = launch.devMode and "true" or "false" } }) local res, errMsg = common.xml.SaveXMLFile(setXML, "Settings.xml") if not res then launch:ShowErrMsg("Error saving 'Settings.xml': %s", errMsg) diff --git a/Update.lua b/Update.lua index 6b8eef3f..24946e12 100644 --- a/Update.lua +++ b/Update.lua @@ -210,22 +210,21 @@ if mode == "CHECK" then xml.SaveXMLFile(localManXML, "Update/manifest.xml") -- Build list of operations to apply the update - local coreUpdate = false + local updateMode = "normal" local ops = { } for _, data in pairs(updateFiles) do - if data.platform then - -- Core platform file, will need to update from the basic environment - coreUpdate = true - -- Tell update code to pause until this file is writable - table.insert(ops, 'wait "'..data.name..'"') - end - end - for _, data in pairs(updateFiles) do + -- Ensure that the destination path of this file exists local dirStr = "" for dir in data.name:gmatch("([^/]+/)") do dirStr = dirStr .. dir MakeDir(dirStr) end + if data.platform then + -- Core platform file, will need to update from the basic environment + updateMode = "basic" + -- Tell update code to pause until this file is writable + table.insert(ops, 'wait "'..data.name..'"') + end table.insert(ops, 'copy "'..data.updateFileName..'" "'..data.name..'"') table.insert(ops, 'delete "'..data.updateFileName..'"') end @@ -234,7 +233,8 @@ if mode == "CHECK" then end table.insert(ops, 'copy "Update/manifest.xml" "manifest.xml"') table.insert(ops, 'delete "Update/manifest.xml"') - if coreUpdate then + if updateMode == "basic" then + -- Update script will need to relaunch the normal environment after updating table.insert(ops, 'launch') end @@ -244,7 +244,7 @@ if mode == "CHECK" then opFile:close() ConPrintf("Update is ready.") - return coreUpdate and "basic" or "normal" + return updateMode end print("Applying update...") diff --git a/manifest.xml b/manifest.xml index 17a6cdcb..723c9f5c 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,8 +1,8 @@ - - + + diff --git a/runtime-win32.zip b/runtime-win32.zip new file mode 100644 index 00000000..db294b41 Binary files /dev/null and b/runtime-win32.zip differ