parent
fa75190184
commit
c26d17ef9e
@ -0,0 +1,239 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!DOCTYPE muclient>
|
||||||
|
<!-- Saved on Saturday, June 13, 2015, 2:37 AM -->
|
||||||
|
<!-- MuClient version 4.98 -->
|
||||||
|
|
||||||
|
<!-- Plugin "Aardwolf_Clock" generated by Plugin Wizard -->
|
||||||
|
|
||||||
|
<muclient>
|
||||||
|
<plugin
|
||||||
|
name="Aardwolf_Clock"
|
||||||
|
author="Arcidayne"
|
||||||
|
id="1865d33576c3fe2134cee7ba"
|
||||||
|
language="Lua"
|
||||||
|
purpose="Displays an updating clock"
|
||||||
|
save_state="y"
|
||||||
|
date_written="2015-06-13 02:36:03"
|
||||||
|
requires="4.70"
|
||||||
|
version="1.0"
|
||||||
|
>
|
||||||
|
<description trim="y">
|
||||||
|
<![CDATA[
|
||||||
|
Displays the time in Aardwolf and updates at tick.
|
||||||
|
]]>
|
||||||
|
</description>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Triggers -->
|
||||||
|
|
||||||
|
<triggers>
|
||||||
|
<trigger
|
||||||
|
enabled="y"
|
||||||
|
match="^\s+\*\s+It is ((?:\d+|Noon|Midnight))((?:p|a))?m? on the (\d+)(?:rd|th|nd|st) day of the Season of (?:the )?(\w+).*$"
|
||||||
|
regexp="y"
|
||||||
|
send_to="12"
|
||||||
|
sequence="100"
|
||||||
|
>
|
||||||
|
<send>imagecount = 1
|
||||||
|
clock_current = {Season = "%4", day = tonumber("%3"), order = clock_seasons["%4"][4]}
|
||||||
|
local sunrise, sunset = clock_seasons[clock_current.Season][2], clock_seasons[clock_current.Season][3]
|
||||||
|
if "%1" == "Noon" then
|
||||||
|
winimg = "im12"
|
||||||
|
imgcount = 12
|
||||||
|
bgcolour = bgday
|
||||||
|
elseif "%1" == "Midnight" then
|
||||||
|
winimg = "im12"
|
||||||
|
imgcount = 24
|
||||||
|
bgcolour = bgnight
|
||||||
|
else
|
||||||
|
winimg = "im%1"
|
||||||
|
if "%2" == "a" then
|
||||||
|
imgcount = tonumber("%1")
|
||||||
|
else
|
||||||
|
imgcount = tonumber("%1") + 12
|
||||||
|
end
|
||||||
|
if imgcount >= sunrise and imgcount < sunset then
|
||||||
|
bgcolour = bgday
|
||||||
|
elseif imgcount >= sunset or imgcount < sunrise then
|
||||||
|
bgcolour = bgnight
|
||||||
|
end
|
||||||
|
end
|
||||||
|
update_image(winimg)</send>
|
||||||
|
</trigger>
|
||||||
|
</triggers>
|
||||||
|
|
||||||
|
<!-- Aliases -->
|
||||||
|
<aliases>
|
||||||
|
<alias
|
||||||
|
match="^clock settings$"
|
||||||
|
regexp="y"
|
||||||
|
enabled="y"
|
||||||
|
sequence="100"
|
||||||
|
send_to="12"
|
||||||
|
>
|
||||||
|
<send>tprint(clock_current)
|
||||||
|
tprint(clock_seasons[clock_current.Season])</send>
|
||||||
|
</alias>
|
||||||
|
</aliases>
|
||||||
|
<!-- Script -->
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
<![CDATA[
|
||||||
|
function OnPluginInstall()
|
||||||
|
|
||||||
|
clock_seasons = {
|
||||||
|
Sun = {149, 3, 19, 1},
|
||||||
|
Scourge = {183, 21, 6, 2},
|
||||||
|
River = {139, 7, 18, 3},
|
||||||
|
Song = {151, 6, 19, 4},
|
||||||
|
Energy = {149, 6, 20, 5},
|
||||||
|
Nature = {121, 5, 19, 6},
|
||||||
|
Snake = {133, 5, 20, 7},
|
||||||
|
Sword = {131, 7, 18, 8},
|
||||||
|
Freeze = {139, 9, 19, 9},
|
||||||
|
Thought = {149, 8, 20, 10},
|
||||||
|
Darkness = {115, 10, 18, 11},
|
||||||
|
Corrosion = {127, 8, 20, 12},
|
||||||
|
Dagger = {101, 9, 18, 13},
|
||||||
|
Storm = {131, 8, 19, 14},
|
||||||
|
Piety = {153, 7, 18, 15},
|
||||||
|
Suffering = {131, 6, 19, 16},
|
||||||
|
Burning = {145, 7, 20, 17},
|
||||||
|
Tornado = {113, 7, 21, 18},
|
||||||
|
Stone = {97, 7, 21, 19},
|
||||||
|
Magi = {119, 6, 19, 20},
|
||||||
|
}
|
||||||
|
|
||||||
|
clock_season_order = {"Sun", "Scourge", "River", "Song", "Energy", "Nature", "Snake", "Sword", "Freeze", "Thought", "Darkness", "Corrosion", "Dagger", "Storm", "Piety", "Suffering", "Burning", "Tornado", "Stone", "Magi"}
|
||||||
|
clock_current = {Season = "Sun", day = 1, order = 1}
|
||||||
|
|
||||||
|
require 'movewindow'
|
||||||
|
require 'tprint'
|
||||||
|
|
||||||
|
clock = "clock_" .. GetPluginID()
|
||||||
|
|
||||||
|
wininfo = movewindow.install (clock, miniwin.pos_center_right, 0)
|
||||||
|
|
||||||
|
if not WindowInfo(clock, 1) then
|
||||||
|
WindowCreate (clock, wininfo.window_left, wininfo.window_top, 0, 0, 6, 0, 0)
|
||||||
|
WindowFont (clock, "f", "Dina", 8)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
WindowShow (clock, true)
|
||||||
|
|
||||||
|
-- MUST CHANGE THE PATH TO WHERE YOU STORED IMAGES!
|
||||||
|
|
||||||
|
WindowLoadImage (clock, "im1", "C:/MUSHclient/Images/1oclock.png")
|
||||||
|
WindowLoadImage (clock, "im2", "C:/MUSHclient/Images/2oclock.png")
|
||||||
|
WindowLoadImage (clock, "im3", "C:/MUSHclient/Images/3oclock.png")
|
||||||
|
WindowLoadImage (clock, "im4", "C:/MUSHclient/Images/4oclock.png")
|
||||||
|
WindowLoadImage (clock, "im5", "C:/MUSHclient/Images/5oclock.png")
|
||||||
|
WindowLoadImage (clock, "im6", "C:/MUSHclient/Images/6oclock.png")
|
||||||
|
WindowLoadImage (clock, "im7", "C:/MUSHclient/Images/7oclock.png")
|
||||||
|
WindowLoadImage (clock, "im8", "C:/MUSHclient/Images/8oclock.png")
|
||||||
|
WindowLoadImage (clock, "im9", "C:/MUSHclient/Images/9oclock.png")
|
||||||
|
WindowLoadImage (clock, "im10", "C:/MUSHclient/Images/10oclock.png")
|
||||||
|
WindowLoadImage (clock, "im11", "C:/MUSHclient/Images/11oclock.png")
|
||||||
|
WindowLoadImage (clock, "im12", "C:/MUSHclient/Images/12oclock.png")
|
||||||
|
|
||||||
|
-- End must change
|
||||||
|
|
||||||
|
imageorder = {"im1", "im2", "im3", "im4", "im5", "im6", "im7", "im8", "im9", "im10", "im11", "im12", "im1", "im2", "im3", "im4", "im5", "im6", "im7", "im8", "im9", "im10", "im11", "im12"}
|
||||||
|
imgcount = 0
|
||||||
|
|
||||||
|
-- Change these colours to your liking.
|
||||||
|
bgday = "khaki" -- Defaulted at gold.
|
||||||
|
bgnight = "gray" -- Defaulted at gray.
|
||||||
|
clock_text_colour = "darkblue" -- Deafulted at tomato.
|
||||||
|
bgcolour = "white" -- Defaulted on initial setup
|
||||||
|
winimg = ""
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function update_image(img)
|
||||||
|
if not img then
|
||||||
|
if imgcount == 0 then
|
||||||
|
Send("time")
|
||||||
|
else
|
||||||
|
if imgcount == 24 then
|
||||||
|
imgcount = 1
|
||||||
|
winimg = imageorder[imgcount]
|
||||||
|
if clock_current.day == clock_seasons[clock_current.Season][1] then
|
||||||
|
local newseason = clock_season_order[(clock_current.order+1)]
|
||||||
|
clock_current.Season = newseason
|
||||||
|
clock_current.day = 1
|
||||||
|
clock_current.order = clock_seasons[newseason][4]
|
||||||
|
else
|
||||||
|
clock_current.day = clock_current.day + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
imgcount = imgcount + 1
|
||||||
|
winimg = imageorder[imgcount]
|
||||||
|
if imgcount == clock_seasons[clock_current.Season][2] then
|
||||||
|
bgcolour = bgday
|
||||||
|
elseif imgcount == clock_seasons[clock_current.Season][3] then
|
||||||
|
bgcolour = bgnight
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local current_time = ""
|
||||||
|
|
||||||
|
if imgcount < 12 then
|
||||||
|
current_time = imgcount .. "am"
|
||||||
|
elseif imgcount == 12 then
|
||||||
|
current_time = "12pm"
|
||||||
|
else
|
||||||
|
current_time = (imgcount-12) .. "pm"
|
||||||
|
end
|
||||||
|
|
||||||
|
local font = "f"
|
||||||
|
local title = "Day " .. clock_current.day .. " in " .. clock_current.Season
|
||||||
|
|
||||||
|
-- Change these settings to your liking
|
||||||
|
|
||||||
|
local window_width = 150 -- Defaulted at 150.
|
||||||
|
local window_height = 150 -- Defaulted at 150.
|
||||||
|
local clock_width = 100 -- Defaulted at 100.
|
||||||
|
local clock_height = 100 -- Defaulted at 100.
|
||||||
|
|
||||||
|
-- End change options
|
||||||
|
|
||||||
|
local clock_x1 = math.floor((window_width - clock_width)/2)
|
||||||
|
local clock_y1 = math.floor((window_height - clock_height)/2)
|
||||||
|
local clock_x2 = clock_x1 + clock_width
|
||||||
|
local clock_y2 = clock_y1 + clock_height
|
||||||
|
local titlex = math.floor((window_width - WindowTextWidth(clock, font, title))/2)
|
||||||
|
local footerx = math.floor((window_width - WindowTextWidth(clock, font, current_time))/2)
|
||||||
|
local font_name = "Dina"
|
||||||
|
local font_size = "8"
|
||||||
|
|
||||||
|
WindowCreate (clock, wininfo.window_left, wininfo.window_top, window_width, window_height, wininfo.window_mode, wininfo.window_flags, ColourNameToRGB(bgcolour))
|
||||||
|
WindowFont (clock, font, font_name, font_size)
|
||||||
|
WindowRectOp (clock, 5, 0, 0, 0, 0, 9, 15 + 0x1000)
|
||||||
|
WindowText (clock, font, title, titlex, 5, 0, 0, ColourNameToRGB(clock_text_colour))
|
||||||
|
WindowDrawImage(clock, winimg, clock_x1, clock_y1, clock_x2, clock_y2, miniwin.image_stretch)
|
||||||
|
WindowText (clock, font, current_time, footerx, 130, 0, 0, ColourNameToRGB(clock_text_colour))
|
||||||
|
movewindow.add_drag_handler (clock, 0, 0, 0, 0, 1)
|
||||||
|
WindowSetZOrder (clock, 20)
|
||||||
|
movewindow.save_state (clock)
|
||||||
|
WindowShow(clock, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function OnPluginBroadcast (msg, id, name, text)
|
||||||
|
if (id == '3e7dedbe37e44942dd46d264') then
|
||||||
|
if (text == 'comm.tick') then
|
||||||
|
update_image()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</muclient>
|
Loading…
Reference in new issue