<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="KillArea"
author="Quit"
id="1257642da6518030a25c93c4"
language="Lua"
purpose="List Area to level in"
date_written="2015-05-03 20:32:36"
requires="4.97"
version="1.0"
save_state="y"
>
</plugin>
<aliases>
<alias
match="killlist"
enabled="y"
send_to="12"
sequence="100"
>
<send>
WindowShow (win, true)
</send>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
require "movewindow" -- load the movewindow.lua module
win = GetPluginID () .. "_KillArea"
font = "f"
-----------------------------------------
-- one entry for each hyperlink you want drawn
-----------------------------------------
links = {
{ text = "Jungles of Verume", tip = "Goto Jungle of Verume", send = "mapper goto 30599" },
{ text = "Seven Wonders", tip = "Goto Seven Wonders", send = "mapper goto 32981" },
-- more here ...
} -- end of links table
-----------------------------------------
-- draw hyperlink text in required colour
-----------------------------------------
function drawText (which, colour)
Redraw ()
return WindowText (win, font, which.text, which.x, which.y, 0, 0, ColourNameToRGB (colour))
end -- drawText
-----------------------------------------
-- mouse up
-----------------------------------------
function mouseup_hyperlink (flags, hotspotid)
Send (links [tonumber (hotspotid)].send)
end -- mouseup_hyperlink
-----------------------------------------
-- mouse over
-----------------------------------------
function mouseover_hyperlink (flags, hotspotid)
drawText (links [tonumber (hotspotid)], "blue")
end -- mouseover_hyperlink
-----------------------------------------
-- cancel mouse over
-----------------------------------------
function cancel_mouseover_hyperlink (flags, hotspotid)
drawText (links [tonumber (hotspotid)], "yellow")
end -- cancel_mouseover_hyperlink
-----------------------------------------
-- mouse down
-----------------------------------------
function mousedown_hyperlink (flags, hotspotid)
drawText (links [tonumber (hotspotid)], "white")
end -- mousedown_hyperlink
-----------------------------------------
-- cancel mouse down
-----------------------------------------
function cancel_mousedown_hyperlink (flags, hotspotid)
drawText (links [tonumber (hotspotid)], "yellow")
end -- cancel_mousedown_hyperlink
-----------------------------------------
-- make one hyperlink at current x,y location
-----------------------------------------
function MakeHyperlink (item, which)
-- remember current x and y in the links table
which.x = x
which.y = y
width = drawText (which, "yellow")
WindowAddHotspot (win, item, which.x, which.y, which.x + width, which.y + font_height,
"mouseover_hyperlink", -- MouseOver
"cancel_mouseover_hyperlink", -- CancelMouseOver
"mousedown_hyperlink", -- MouseDown
"cancel_mousedown_hyperlink", -- CancelMouseDown
"mouseup_hyperlink", -- MouseUp
which.tip,
miniwin.cursor_hand,
0) -- Flag
y = y + font_height
end -- MakeHyperlink
function OnPluginInstall ()
-- install the window movement handler, get back the window position
windowinfo = movewindow.install (win, miniwin.pos_top_right) -- default to top right
-- make window so I can grab the font info
WindowCreate (win, 0, 0, 0, 0, miniwin.pos_top_right, 0, 0)
-- add the font
WindowFont (win, font, "Lucida Console", 9)
-- find its height
font_height = WindowFontInfo (win, font, 1) -- height
-- position for first hyperlink
x = 10 -- all text indented this far in
y = 25 -- first hyperlink this far down
maxTextWidth = 0
-- find maximum width
for k, v in ipairs (links) do
maxTextWidth = math.max (maxTextWidth, WindowTextWidth(win, font, v.text))
end -- for
-- make the proper window
WindowCreate (win,
windowinfo.window_left,
windowinfo.window_top,
maxTextWidth + (x * 2),
y + (#links * font_height) + 5,
windowinfo.window_mode,
windowinfo.window_flags,
ColourNameToRGB "black")
-- title background
WindowRectOp (win, miniwin.rect_fill, 0, 0, 0, font_height + 5, ColourNameToRGB "gray", 0)
-- draw a border
WindowRectOp (win, miniwin.rect_draw_edge, 0, 0, 0, 0,
miniwin.rect_edge_raised,
miniwin.rect_edge_at_all + miniwin.rect_option_softer_buttons) -- draw border
movewindow.add_drag_handler (win, 0, 0, 0, font_height) -- add the drag handler
-- first line
WindowText (win, font, "Kill Areas", x, 5, 0, 0, ColourNameToRGB "gainsboro")
-- add all hyperlinks
for k, v in ipairs (links) do
MakeHyperlink (k, v)
end -- for
end -- OnPluginInstall
function OnPluginSaveState ()
-- save window current location for next time
movewindow.save_state (win)
end -- function OnPluginSaveState
]]>
</script>
</muclient>
|