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 -->
<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>
@ -440,40 +440,45 @@ require 'mw_theme_base'
print("Mouseup!")
end
function update_plugin()
raw = "https://raw.githubusercontent.com/AardCrowley/Aardwolf-Scripts/master/Auction_Utilities/AardClock2.0_Beta.xml"
function OnPluginInstall()
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
plugin_page = async.doAsyncRemoteRequest(raw, raw_get, "HTTPS")
else
ColourNote("white", "blue", "Error on plugin update!")
end
async_ok, async = pcall (require, "async")
if async_ok then
plugin_page = async.doAsyncRemoteRequest(raw, raw_get, "HTTPS")
else
ColourNote("white", "blue", "Error on plugin update!")
end
end
function raw_get(retval, page, status, headers, full_status, request_url)
if status == 200 then
raw_version = tonumber(string.match(page, '%s%s+version="([0-9%.]+)"'))
end
if status == 200 then
raw_version = tonumber(string.match(page, '%s%s+version="([0-9%.]+)"'))
end
if raw_version == PLUGIN_VERSION then
ColourNote("white", "blue", PLUGIN_NAME .. " is up-to-date.")
elseif raw_version > PLUGIN_VERSION then
ColourNote("white", "blue", "Updating from version " .. PLUGIN_VERSION .. " to " .. raw_version .. ". Do not touch anything!")
local file = io.open(GetPluginInfo(GetPluginID(), 6), "w")
file:write(page)
file:close()
end
if raw_version == PLUGIN_VERSION then
ColourNote("white", "blue", PLUGIN_NAME .. " is up-to-date.")
elseif raw_version > PLUGIN_VERSION then
ColourNote("white", "blue", "Updating from version " .. PLUGIN_VERSION .. " to " .. raw_version .. ". Do not touch anything!")
local file = io.open(GetPluginInfo(GetPluginID(), 6), "w")
file:write(page)
file:close()
end
raw_version = nil
raw_version = nil
if "" == GetAlphaOption("script_prefix") then
SetAlphaOption("script_prefix", "\\\\\\")
end
if "" == GetAlphaOption("script_prefix") then
SetAlphaOption("script_prefix", "\\\\\\")
end
Execute(GetAlphaOption("script_prefix") .. "DoAfterSpecial(1, \"ReloadPlugin('" .. GetPluginID() .. "')\", sendto.script)")
ColourNote("white", "blue", "Update complete!")
Execute(GetAlphaOption("script_prefix") .. "DoAfterSpecial(1, \"ReloadPlugin('" .. GetPluginID() .. "')\", sendto.script)")
ColourNote("white", "blue", "Update complete!")
end -- end Update code
]]>
</script>

Loading…
Cancel
Save