Update AardClock2.0_Beta.xml

pull/2/head
AardCrowley 6 years ago
parent d15a1e3f25
commit 9ca936ea76

@ -6,7 +6,7 @@
<!-- Plugin "Aardwolf_Clock" generated by Plugin Wizard --> <!-- Plugin "Aardwolf_Clock" generated by Plugin Wizard -->
<muclient> <muclient>
<plugin name="Aardwolf_Clock" author="Crowley" id="28a36788fa20aa062e760ee2" language="Lua" purpose="Displays a realtime clock based on Aardwolf game time" save_state="y" date_written="2018-05-15 11:43:22" requires="4.90" version="2.0"> <plugin name="Aardwolf_Clock" author="Crowley" id="28a36788fa20aa062e760ee2" language="Lua" purpose="Displays a realtime clock based on Aardwolf game time" save_state="y" date_written="2018-05-15 11:43:22" requires="4.90" version="2.1">
</plugin> </plugin>
@ -440,40 +440,45 @@ require 'mw_theme_base'
print("Mouseup!") print("Mouseup!")
end end
function update_plugin() function OnPluginInstall()
raw = "https://raw.githubusercontent.com/AardCrowley/Aardwolf-Scripts/master/Auction_Utilities/AardClock2.0_Beta.xml" PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19)
PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1)
end
async_ok, async = pcall (require, "async") function update_plugin()
raw = "https://raw.githubusercontent.com/AardCrowley/Aardwolf-Scripts/master/Auction_Utilities/AardClock2.0_Beta.xml"
if async_ok then async_ok, async = pcall (require, "async")
plugin_page = async.doAsyncRemoteRequest(raw, raw_get, "HTTPS")
else if async_ok then
ColourNote("white", "blue", "Error on plugin update!") plugin_page = async.doAsyncRemoteRequest(raw, raw_get, "HTTPS")
end else
ColourNote("white", "blue", "Error on plugin update!")
end
end end
function raw_get(retval, page, status, headers, full_status, request_url) function raw_get(retval, page, status, headers, full_status, request_url)
if status == 200 then if status == 200 then
raw_version = tonumber(string.match(page, '%s%s+version="([0-9%.]+)"')) raw_version = tonumber(string.match(page, '%s%s+version="([0-9%.]+)"'))
end end
if raw_version == PLUGIN_VERSION then if raw_version == PLUGIN_VERSION then
ColourNote("white", "blue", PLUGIN_NAME .. " is up-to-date.") ColourNote("white", "blue", PLUGIN_NAME .. " is up-to-date.")
elseif raw_version > PLUGIN_VERSION then elseif raw_version > PLUGIN_VERSION then
ColourNote("white", "blue", "Updating from version " .. PLUGIN_VERSION .. " to " .. raw_version .. ". Do not touch anything!") ColourNote("white", "blue", "Updating from version " .. PLUGIN_VERSION .. " to " .. raw_version .. ". Do not touch anything!")
local file = io.open(GetPluginInfo(GetPluginID(), 6), "w") local file = io.open(GetPluginInfo(GetPluginID(), 6), "w")
file:write(page) file:write(page)
file:close() file:close()
end end
raw_version = nil raw_version = nil
if "" == GetAlphaOption("script_prefix") then if "" == GetAlphaOption("script_prefix") then
SetAlphaOption("script_prefix", "\\\\\\") SetAlphaOption("script_prefix", "\\\\\\")
end end
Execute(GetAlphaOption("script_prefix") .. "DoAfterSpecial(1, \"ReloadPlugin('" .. GetPluginID() .. "')\", sendto.script)") Execute(GetAlphaOption("script_prefix") .. "DoAfterSpecial(1, \"ReloadPlugin('" .. GetPluginID() .. "')\", sendto.script)")
ColourNote("white", "blue", "Update complete!") ColourNote("white", "blue", "Update complete!")
end -- end Update code end -- end Update code
]]> ]]>
</script> </script>

Loading…
Cancel
Save