You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
816 lines
26 KiB
816 lines
26 KiB
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE muclient>
|
|
<muclient>
|
|
<plugin
|
|
name="Adapted_Aardwolf_Group_Monitor"
|
|
author="Koopa-Fiendish"
|
|
id="f178e68512c685b3be1e9e07"
|
|
language="Lua"
|
|
purpose="Adapted Aardwolf Group Monitor"
|
|
date_written="2010-12-13 15:35:02"
|
|
requires="4.73"
|
|
version="2.0"
|
|
save_state="y"
|
|
>
|
|
|
|
<description trim="y">
|
|
|
|
Aardwolf Group Monitor
|
|
|
|
Gives a persistent compressed display of the status of your group members using
|
|
details captured through GMCP.
|
|
|
|
</description>
|
|
|
|
</plugin>
|
|
|
|
<aliases>
|
|
|
|
<alias
|
|
match="resetaard"
|
|
enabled="y"
|
|
sequence="100"
|
|
ignore_case="y"
|
|
script="reset_aard"
|
|
></alias>
|
|
|
|
-- show the group window
|
|
<alias
|
|
match="ktgroupon"
|
|
enabled="y"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
script="ShowIt"
|
|
></alias>
|
|
|
|
-- hide the group window
|
|
<alias
|
|
match="ktgroupoff"
|
|
enabled="y"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
script="HideIt"
|
|
></alias>
|
|
</aliases>
|
|
|
|
<triggers>
|
|
<trigger
|
|
enabled="y"
|
|
match="^(\w+) has invited you to join group: (.*)\.$"
|
|
script="group_invite"
|
|
regexp="y"
|
|
sequence="100"
|
|
custom_colour="17"
|
|
other_text_colour="#FFFFFF"
|
|
other_back_colour="#0000FF"
|
|
></trigger>
|
|
|
|
<trigger
|
|
enabled="y"
|
|
match="^(\w+) has cancelled your invitation to join group: (.*)\.$"
|
|
script="group_cancel"
|
|
regexp="y"
|
|
sequence="100"
|
|
custom_colour="17"
|
|
other_text_colour="#FFFFFF"
|
|
other_back_colour="#FF0000"
|
|
></trigger>
|
|
|
|
<trigger
|
|
enabled="y"
|
|
match="^You have declined the group invitation from (\w+)\.$"
|
|
script="group_cancel"
|
|
regexp="y"
|
|
sequence="100"
|
|
custom_colour="17"
|
|
other_text_colour="#FFFFFF"
|
|
other_back_colour="#FF0000"
|
|
></trigger>
|
|
|
|
<trigger
|
|
enabled="y"
|
|
match="^You have no invitation outstanding from (\w+)\.$"
|
|
script="group_cancel"
|
|
regexp="y"
|
|
sequence="100"
|
|
custom_colour="17"
|
|
other_text_colour="#FFFFFF"
|
|
other_back_colour="#FF0000"
|
|
></trigger>
|
|
|
|
<trigger
|
|
enabled="y"
|
|
match="^Your group invite from (\w+) is cancelled because the group has been disbanded\.$"
|
|
script="group_cancel"
|
|
regexp="y"
|
|
sequence="100"
|
|
custom_colour="17"
|
|
other_text_colour="#FFFFFF"
|
|
other_back_colour="#FF0000"
|
|
></trigger>
|
|
|
|
<trigger
|
|
enabled="y"
|
|
match="^Your group invitation from (\w+) is cancelled because (\w+) has left that group\.$"
|
|
script="group_cancel"
|
|
regexp="y"
|
|
sequence="100"
|
|
custom_colour="17"
|
|
other_text_colour="#FFFFFF"
|
|
other_back_colour="#FF0000"
|
|
></trigger>
|
|
|
|
<trigger
|
|
enabled="y"
|
|
match="^Your group invitation from (\w+) is cancelled because (\w+) has left the game\.$"
|
|
script="group_cancel"
|
|
regexp="y"
|
|
sequence="100"
|
|
custom_colour="17"
|
|
other_text_colour="#FFFFFF"
|
|
other_back_colour="#FF0000"
|
|
></trigger>
|
|
</triggers>
|
|
|
|
<script>
|
|
<![CDATA[
|
|
require "aard_register_z_on_create"
|
|
|
|
require "mw_theme_base"
|
|
|
|
require "gauge"
|
|
require "movewindow"
|
|
require "gmcphelper"
|
|
require "copytable"
|
|
require "serialize"
|
|
|
|
default_x = 868
|
|
default_y = 336
|
|
default_height = 215
|
|
default_width = 269
|
|
height = tonumber (GetVariable ("height")) or default_height
|
|
width = tonumber (GetVariable ("width")) or default_width
|
|
show_self = tonumber (GetVariable ("show_self")) or 1
|
|
show_hp = tonumber (GetVariable ("show_hp")) or 1
|
|
show_mn = tonumber (GetVariable ("show_mn")) or 1
|
|
show_mv = tonumber (GetVariable ("show_mv")) or 1
|
|
hidden = tonumber (GetVariable ("hidden")) or 0
|
|
flat_gauges = tonumber (GetVariable("flat_gauges")) or 0
|
|
overlay_numbers = tonumber (GetVariable("overlay_numbers")) or 0
|
|
GAP = 2
|
|
font_size = 8
|
|
font_name = ""
|
|
group_members = {}
|
|
group_info = {}
|
|
|
|
local defaultColorVals = {Health={0x00ff00,0x004400}, Mana={0xff5500,0x442200}, Moves={0x00ffff,0x004444}, Align={0x0000ff,0x00ffff}}
|
|
colorVals = defaultColorVals
|
|
assert (loadstring (GetVariable ("colorVals") or "")) ()
|
|
|
|
thresh1active = tonumber (GetVariable("thresh1active")) or 0
|
|
thresh2active = tonumber (GetVariable("thresh2active")) or 0
|
|
thresh1percent = tonumber (GetVariable("thresh1percent")) or 40
|
|
thresh2percent = tonumber (GetVariable("thresh2percent")) or 20
|
|
thresh1color = tonumber (GetVariable("thresh1color")) or 0x00ffff
|
|
thresh2color = tonumber (GetVariable("thresh2color")) or 0x0000ff
|
|
|
|
local barIndex = {"Health", "Mana", "Moves", "Align"}
|
|
|
|
RESIZE_TAG_SIZE = 10
|
|
MIN_SIZE = 100
|
|
|
|
-- Variables not saved.
|
|
startx = ""
|
|
starty = ""
|
|
posx = ""
|
|
posy = ""
|
|
hidden_members = {}
|
|
|
|
-- pull in telnet option handling
|
|
--dofile (GetPluginInfo (GetPluginID(), 20) .. "telnet_options.lua")
|
|
|
|
-- functions for handling Aardwolf color codes
|
|
--dofile (GetPluginInfo (GetPluginID(), 20) .. "aardwolf_colors.lua")
|
|
|
|
function reset_aard()
|
|
font_name = default_font_name
|
|
font_size = default_font_size
|
|
WindowPosition(win, default_x, default_y, 0, 18)
|
|
WindowResize(win, default_width, default_height, Theme.PRIMARY_BODY)
|
|
Repaint() -- hack because WindowPosition doesn't immediately update coordinates
|
|
SaveState()
|
|
OnPluginInstall()
|
|
end
|
|
|
|
function SetUpHotspotsAndDraw(firstTime)
|
|
-- don't use windowcreate after the first time, because it messes with hotspot handlers
|
|
if (firstTime == true) then
|
|
check (WindowCreate (win,
|
|
windowinfo.window_left, windowinfo.window_top, -- left, top (auto-positions)
|
|
width, -- width
|
|
height, -- height
|
|
windowinfo.window_mode, -- auto-position: middle right
|
|
windowinfo.window_flags, -- flags
|
|
Theme.PRIMARY_BODY) )
|
|
-- Add the drag handler so they can move the window around
|
|
movewindow.add_drag_handler (win, 0, 0, 0, 0)
|
|
|
|
if hidden == 0 then
|
|
WindowShow (win, true)
|
|
end
|
|
else
|
|
-- everything has already been made
|
|
-- just move them back into place
|
|
WindowResize(win, width, height, Theme.PRIMARY_BODY)
|
|
end
|
|
DisplayGroupPage()
|
|
end
|
|
|
|
string.lpad = function(str, len, char)
|
|
if char == nil then char = ' ' end
|
|
return string.rep(char, len - #str) .. str
|
|
end
|
|
|
|
string.rpad = function(str, len, char)
|
|
if char == nil then char = ' ' end
|
|
return str .. string.rep(char, len - #str)
|
|
end
|
|
|
|
function RemoveMembersFromGroupDisplay()
|
|
group_members = {}
|
|
if (full_group_data ~= nil) then
|
|
for i,v in ipairs(full_group_data.members) do
|
|
if not (hidden_members[v.name] or ((show_self == 0) and (char_data ~= nil) and (v.name == char_data.name))) then
|
|
table.insert(group_members, v)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
function round(n)
|
|
return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
|
|
end
|
|
|
|
-- put all current group members into the hidden_members list
|
|
function hideAllMembers()
|
|
hidden_members = {}
|
|
if full_group_data and full_group_data.members and char_data and char_data.name then
|
|
for i,v in ipairs(full_group_data.members) do
|
|
if v.name ~= char_data.name then
|
|
hidden_members[v.name] = true
|
|
end
|
|
end
|
|
end
|
|
RemoveMembersFromGroupDisplay()
|
|
end
|
|
|
|
-- build and draw the group display
|
|
function DisplayGroupPage()
|
|
WindowRectOp(win, 2, 2, 2,-2,-2, Theme.PRIMARY_BODY) -- blank
|
|
|
|
if not group_built then
|
|
if next(invitations) == nil then
|
|
txt = "No Group To Display"
|
|
txtlen = WindowTextWidth(win,font_id, txt)
|
|
WindowText(win, font_id, txt, (width-txtlen)/2, title_height/4, 0, 0, Theme.BODY_TEXT, utf8)
|
|
txt = "Group info will appear"
|
|
txtlen = WindowTextWidth(win,font_id,txt)
|
|
WindowText (win, font_id, txt, (width-txtlen)/2, height/2, 0, 0, Theme.BODY_TEXT, utf8)
|
|
txt = "once you create or join one."
|
|
txtlen = WindowTextWidth(win,font_id,txt)
|
|
WindowText (win, font_id, txt, (width-txtlen)/2, height/2+line_height, 0, 0, Theme.BODY_TEXT, utf8)
|
|
else
|
|
local lines = {}
|
|
txt = "Pending Group Invitations"
|
|
txtlen = WindowTextWidth(win, font_id, txt)
|
|
WindowText(win, font_id, txt, (width-txtlen)/2, title_height/4, 0, 0, Theme.BODY_TEXT, utf8)
|
|
table.insert(lines, "[ Leader : Group Name ]")
|
|
table.insert(lines, "---------------------------")
|
|
for k,v in pairs(invitations) do
|
|
table.insert(lines, string.rpad(k,12).." : "..v)
|
|
end
|
|
for i,v in ipairs(lines) do
|
|
WindowText(win, font_id, v, GAP*4, (title_height) + (i*line_height), 0, 0, Theme.BODY_TEXT, utf8)
|
|
end
|
|
end
|
|
else
|
|
y = title_height
|
|
|
|
if #group_members > 0 then
|
|
-- MAIN DISPLAY BODY
|
|
local baseX = GAP
|
|
local baseY = y+GAP
|
|
column_width = WindowTextWidth(win, font_id, "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW")+GAP*4
|
|
if overlay_numbers == 0 then
|
|
column_width = column_width+WindowTextWidth(win, font_id, "WWWW")
|
|
end
|
|
num_columns = math.max(math.floor(width / column_width), 1)
|
|
members_per_col = math.ceil((#group_members)/num_columns)
|
|
labels_width = math.max(WindowTextWidth(win, font_id, "HP"), WindowTextWidth(win, font_id, "MN"), WindowTextWidth(win, font_id, "MV"))
|
|
bar_width = column_width - GAP*4 - labels_width
|
|
if overlay_numbers == 0 then
|
|
bar_width = bar_width - WindowTextWidth(win, font_id, "88888/88888")
|
|
end
|
|
|
|
-- x=248
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="Align",textcolour=0xFFFFFF}}, 248 , y, 0, 0)
|
|
-- x=x-24
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="QT",textcolour=0xFFFFFF}}, x, y, 0, 0)
|
|
-- x=x-40
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="mv",textcolour=0xFFFFFF}}, x, y, 0, 0)
|
|
-- x=x-40
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="mn",textcolour=0xFFFFFF}}, x, y, 0, 0)
|
|
-- x=x-40
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="hp",textcolour=0xFFFFFF}}, x, y, 0, 0)
|
|
-- x=x-14
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="here",textcolour=0xFFFFFF}}, x, y, 0, 0)
|
|
-- x=x-80
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="Name",textcolour=0xFFFFFF}}, x, y, 0, 0)
|
|
|
|
|
|
table.sort(group_members, function(a,b) return a.name < b.name end)
|
|
herecount = 0
|
|
|
|
for i,v in ipairs(group_members) do
|
|
if (i ~= 1) and ((i-1) % members_per_col == 0) then
|
|
baseY = title_height+GAP-1
|
|
y = baseY
|
|
baseX = baseX + column_width
|
|
x = baseX
|
|
else
|
|
baseY = y + GAP-1
|
|
y = baseY
|
|
x = baseX
|
|
end
|
|
-- txt = "["..(("P" and v.info.status.poisoned == true) or "_")..
|
|
-- (("B" and v.info.status.blind == true) or "_")..
|
|
-- (("W" and v.info.status.webbed == true) or "_")..
|
|
-- (("C" and v.info.status.cursed == true) or "_")..
|
|
-- (("*" and v.info.status.attacked == true) or "_").."]"
|
|
-- WindowText(win, font_id, txt, x, y, 0, 0, Theme.BODY_TEXT, utf8)
|
|
-- x = x + math.max(WindowTextWidth(win, font_id, "[PBWC*]"), WindowTextWidth(win, font_id, "[_____]")) + GAP
|
|
--txt = "["..string.lpad(v.info.lvl, 3, ' ').."]"
|
|
--x = x + WindowText(win, font_id, txt, x, y, 0, 0, Theme.BODY_TEXT, utf8) + GAP
|
|
txt = string.rpad(v.name, 12, ' ')
|
|
zeroed_alignment = v.info.align+2500
|
|
align_colour = ((zeroed_alignment<=1625 and colorVals.Align[1]) or ((zeroed_alignment>=3375 and colorVals.Align[2]) or Theme.BODY_TEXT))
|
|
--x = x + WindowText(win, font_id, txt, x, y, 0, 0, name_colour, utf8) + GAP
|
|
if tonumber(v.info.here) == 1 then
|
|
here = "##"
|
|
herecount = herecount + 1
|
|
else
|
|
here = " "
|
|
end
|
|
|
|
greythresh = 0
|
|
whitethresh = 1
|
|
redthresh = 30
|
|
yellowthresh = 59
|
|
dcyanthresh = 74
|
|
|
|
|
|
hpPercent = round(100* (tonumber(v.info.hp) / tonumber(v.info.mhp)),0)
|
|
if hpPercent <= greythresh then
|
|
hpcolor = 0xaaaaaa
|
|
elseif hpPercent <=whitethresh then
|
|
hpcolor = 0xffffff
|
|
elseif hpPercent <=redthresh then
|
|
hpcolor = 0x0000FF
|
|
elseif hpPercent <=yellowthresh then
|
|
hpcolor = 0x00FFFF
|
|
elseif hpPercent <=dcyanthresh then
|
|
hpcolor = 0x808000
|
|
else
|
|
hpcolor = 0x00FF00
|
|
end
|
|
mnPercent = round(100* (tonumber(v.info.mn) / tonumber(v.info.mmn)),0)
|
|
if mnPercent <= greythresh then
|
|
mncolor = 0xaaaaaa
|
|
elseif mnPercent <=whitethresh then
|
|
mncolor = 0xffffff
|
|
elseif mnPercent <=redthresh then
|
|
mncolor = 0x0000FF
|
|
elseif mnPercent <=yellowthresh then
|
|
mncolor = 0x00FFFF
|
|
elseif mnPercent <=dcyanthresh then
|
|
mncolor = 0x808000
|
|
else
|
|
mncolor = 0x00FF00
|
|
end
|
|
mvPercent = round(100* (tonumber(v.info.mv) / tonumber(v.info.mmv)),0)
|
|
if mvPercent <= greythresh then
|
|
mvcolor = 0xaaaaaa
|
|
elseif mvPercent <=whitethresh then
|
|
mvcolor = 0xffffff
|
|
elseif mvPercent <=redthresh then
|
|
mvcolor = 0x0000FF
|
|
elseif mvPercent <=yellowthresh then
|
|
mvcolor = 0x00FFFF
|
|
elseif mvPercent <=dcyanthresh then
|
|
mvcolor = 0x808000
|
|
else
|
|
mvcolor = 0x00FF00
|
|
end
|
|
--txt = v.name ..here.."["..hpPercent.."] ["..mnPercent.."] ["..mvPercent.."] "..v.info.qt
|
|
if tonumber(v.info.qt) == 0 then
|
|
qcolor = 0x0000FF
|
|
elseif tonumber(v.info.qt) <= 5 then
|
|
qcolor = 0x00FFFF
|
|
else
|
|
qcolor = 0xC0C0C0
|
|
end
|
|
|
|
--Left Justified
|
|
-- x=Theme.WindowTextFromStyles(win, font_id, {{text=v.name,textcolour=hpcolor}}, x, y, 0, 0)
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text=here,textcolour=0xffffff}}, x, y, 0, 0)
|
|
-- x=x+14
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="["..string.lpad(tostring(hpPercent),3,' ').."]",textcolour=hpcolor}}, x, y, 0, 0)
|
|
-- x=x+40
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="["..string.lpad(tostring(mnPercent),3,' ').."]",textcolour=mncolor}}, x, y, 0, 0)
|
|
-- x=x+40
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="["..string.lpad(tostring(mvPercent),3,' ').."]",textcolour=mvcolor}}, x, y, 0, 0)
|
|
-- x=x+40
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text=string.lpad(tostring(v.info.qt),2,' '),textcolour=qcolor}}, x, y, 0, 0)
|
|
-- x=x+24
|
|
-- Theme.WindowTextFromStyles(win, font_id, {{text="#",textcolour=align_colour}}, x, y, 0, 0)
|
|
--Right
|
|
x=248
|
|
Theme.WindowTextFromStyles(win, font_id, {{text="#",textcolour=align_colour}}, 248 , y, 0, 0)
|
|
x=x-24
|
|
Theme.WindowTextFromStyles(win, font_id, {{text=string.lpad(tostring(v.info.qt),2,' '),textcolour=qcolor}}, x, y, 0, 0)
|
|
x=x-40
|
|
Theme.WindowTextFromStyles(win, font_id, {{text="["..string.lpad(tostring(mvPercent),3,' ').."]",textcolour=mvcolor}}, x, y, 0, 0)
|
|
x=x-40
|
|
Theme.WindowTextFromStyles(win, font_id, {{text="["..string.lpad(tostring(mnPercent),3,' ').."]",textcolour=mncolor}}, x, y, 0, 0)
|
|
x=x-40
|
|
Theme.WindowTextFromStyles(win, font_id, {{text="["..string.lpad(tostring(hpPercent),3,' ').."]",textcolour=hpcolor}}, x, y, 0, 0)
|
|
x=x-14
|
|
Theme.WindowTextFromStyles(win, font_id, {{text=here,textcolour=0xffffff}}, x, y, 0, 0)
|
|
x=x-80
|
|
|
|
|
|
Theme.WindowTextFromStyles(win, font_id, {{text=v.name,textcolour=hpcolor}}, x, y, 0, 0)
|
|
|
|
|
|
|
|
|
|
y = y + line_height + 1
|
|
y = y + GAP - 2
|
|
end
|
|
else
|
|
txt = "Your group is empty."
|
|
txtlen = WindowTextWidth(win,font_id, txt)
|
|
WindowText(win, font_id, txt, (width-txtlen)/2, (height+line_height)/2, 0, 0, Theme.BODY_TEXT, utf8)
|
|
end
|
|
x= Theme.WindowTextFromStyles(win, font_id, {{text="Player Count [",textcolour=0xFFFFFF}}, 8,y,0,0)
|
|
Theme.WindowTextFromStyles(win, font_id, {{text=#group_members,textcolour=0x00FFFF}}, x,y,0,0)
|
|
x=x+16
|
|
Theme.WindowTextFromStyles(win, font_id, {{text="] Here [",textcolour=0xFFFFFF}}, x,y,0,0)
|
|
x=x+72
|
|
Theme.WindowTextFromStyles(win, font_id, {{text=herecount,textcolour=0x00FFFF}}, x,y,0,0)
|
|
x=x+16
|
|
Theme.WindowTextFromStyles(win, font_id, {{text="]",textcolour=0xFFFFFF}}, x,y,0,0)
|
|
|
|
end
|
|
|
|
Theme.DrawBorder(win)
|
|
Theme.Draw3DRect(win, -1, -1, WindowInfo(win, 3)-1, title_height, false)
|
|
|
|
if group_built then
|
|
styles = ColoursToStyles(full_group_data.groupname)
|
|
local x = GAP
|
|
local y = 2
|
|
local statusBoundary = math.max(GAP, width-WindowTextWidth(win, font_id, full_group_data.status)-3*GAP)
|
|
WindowRectOp(win, 2, statusBoundary+2*GAP - 2, y , -3, y+line_height, ((full_group_data.status=="Private" and 0x000088) or 0x008800))
|
|
WindowText(win, font_id, full_group_data.status, statusBoundary+2*GAP, y, 0, 0, 0xffffff)
|
|
x = x + WindowText(win, font_id, "Group: ", x, y, statusBoundary, 0, Theme.THREE_D_SURFACE_DETAIL, utf8)
|
|
local group_width = WindowTextWidth(win, font_id, strip_colours_from_styles(styles))
|
|
WindowRectOp(win, 2, x-3, y, x+group_width + GAP, y+line_height, Theme.PRIMARY_BODY)
|
|
Theme.WindowTextFromStyles(win, font_id, styles, x, y, statusBoundary, 0)
|
|
y = y + line_height
|
|
local xpKillsBoundary = math.max(GAP,width-WindowTextWidth(win, font_id, "XP:"..full_group_data.exp.." K:"..full_group_data.kills)-3*GAP)
|
|
WindowText(win, font_id, "XP:"..full_group_data.exp.." K:"..full_group_data.kills, xpKillsBoundary+2*GAP, y, 0,0, Theme.THREE_D_SURFACE_DETAIL, utf8)
|
|
WindowText(win, font_id, "Leader: "..full_group_data.leader, GAP, y, xpKillsBoundary, 0, Theme.THREE_D_SURFACE_DETAIL, utf8)
|
|
end
|
|
|
|
Theme.AddResizeTag(win, 1, nil, nil, "MouseDown", "ResizeMoveCallback", "ResizeReleaseCallback")
|
|
|
|
CallPlugin("abc1a0944ae4af7586ce88dc", "BufferedRepaint")
|
|
end -- Display_Group_Page
|
|
|
|
function validate_percent(input)
|
|
if string.sub(input, -1) == "%" then
|
|
input = string.sub(input, 1,-2)
|
|
end
|
|
local inputNum = tonumber(input)
|
|
if not inputNum or inputNum < 1 or inputNum > 100 or inputNum % 1 ~= 0 then
|
|
ColourNote("white","red","'"..input.."' is not a whole number between 1 and 100. Try again.")
|
|
return false
|
|
end
|
|
return true
|
|
end
|
|
|
|
function right_click_menu ()
|
|
-- return false
|
|
menustring =""
|
|
local member_count = 0
|
|
|
|
menustring ="!Change Font|-|Bring To Front|Send To Back|-|Reset Defaults"
|
|
result = WindowMenu (win,
|
|
WindowInfo (win, 14), -- x position
|
|
WindowInfo (win, 15), -- y position
|
|
menustring) -- content
|
|
|
|
if result ~= "" then
|
|
numResult = tonumber(result)
|
|
if numResult == 1 then
|
|
-- change font
|
|
wanted_font = utils.fontpicker (font_name, font_size) --font dialog
|
|
if wanted_font then
|
|
font_name = wanted_font.name
|
|
font_size = wanted_font.size
|
|
end
|
|
elseif numResult == 2 then
|
|
-- bring to front
|
|
CallPlugin("462b665ecb569efbf261422f","boostMe", win)
|
|
elseif numResult == 3 then
|
|
-- send to back
|
|
CallPlugin("462b665ecb569efbf261422f","dropMe", win)
|
|
elseif numResult == 4 then
|
|
-- reset
|
|
font_name = default_font_name
|
|
font_size = default_font_size
|
|
height = default_height
|
|
width = default_width
|
|
show_coords = 0
|
|
end -- if
|
|
|
|
RemoveMembersFromGroupDisplay()
|
|
-- save and reload
|
|
SaveState()
|
|
OnPluginInstall()
|
|
end
|
|
end -- right_click_menu
|
|
|
|
invitations = {}
|
|
|
|
function group_invite(name, line, wildcards, styles)
|
|
invitations[wildcards[1]]=wildcards[2]
|
|
DisplayGroupPage()
|
|
end
|
|
|
|
function group_cancel(name, line, wildcards, styles)
|
|
invitations[wildcards[1]] = nil
|
|
DisplayGroupPage()
|
|
end
|
|
|
|
--=================================================================================
|
|
-- Called when plugin receives telnet data - main entry point for actually running
|
|
-- the plugin.
|
|
--=================================================================================
|
|
function OnPluginBroadcast (msg, id, name, text)
|
|
-- Look for GMCP handler.
|
|
if (id == '3e7dedbe37e44942dd46d264') then
|
|
if (text == 'reload') then
|
|
-- invalidate current data
|
|
group_built = false
|
|
self_built = false
|
|
return
|
|
end
|
|
|
|
if (text=="char.base") then
|
|
char_data = gmcp("char.base")
|
|
self_built = true
|
|
if group_built then
|
|
RemoveMembersFromGroupDisplay()
|
|
DisplayGroupPage()
|
|
end
|
|
end
|
|
|
|
if (text == "group") then
|
|
full_group_data = gmcp("group")
|
|
if (full_group_data.groupname == "") then
|
|
leaveGroup()
|
|
else
|
|
group_built = true
|
|
if self_built then
|
|
RemoveMembersFromGroupDisplay()
|
|
DisplayGroupPage()
|
|
else
|
|
Send_GMCP_Packet("request char")
|
|
end
|
|
end
|
|
end
|
|
elseif (id == "462b665ecb569efbf261422f" and msg==996 and text == "re-register z") then
|
|
CallPlugin("462b665ecb569efbf261422f", "registerMiniwindow", win)
|
|
end
|
|
end
|
|
|
|
function ResizeMoveCallback()
|
|
if GetPluginVariable("c293f9e7f04dde889f65cb90", "lock_down_miniwindows") == "1" then
|
|
return
|
|
end
|
|
posx, posy = WindowInfo (win, 17), WindowInfo (win, 18)
|
|
width = width + posx - startx
|
|
startx = posx
|
|
if (width < MIN_SIZE) then
|
|
width = MIN_SIZE
|
|
startx = windowinfo.window_left+width
|
|
elseif (windowinfo.window_left+width > GetInfo(281)) then
|
|
width = GetInfo(281)-windowinfo.window_left
|
|
startx = GetInfo(281)
|
|
end
|
|
|
|
height = height + posy - starty
|
|
starty = posy
|
|
local min_lines = 1
|
|
if show_hp == 1 then
|
|
min_lines = min_lines + 1
|
|
end
|
|
if show_mn == 1 then
|
|
min_lines = min_lines + 1
|
|
end
|
|
if show_mv == 1 then
|
|
min_lines = min_lines + 1
|
|
end
|
|
if (height < title_height+(min_lines*line_height)+(2*GAP)+min_lines-1) then
|
|
height = title_height+(min_lines*line_height)+(2*GAP)+min_lines-1
|
|
starty = windowinfo.window_top+height
|
|
elseif (windowinfo.window_top+height > GetInfo(280)) then
|
|
height = GetInfo(280)-windowinfo.window_top
|
|
starty = GetInfo(280)
|
|
end
|
|
if (utils.timer() - lastRefresh > 0.0333) then
|
|
SetUpHotspotsAndDraw(false)
|
|
lastRefresh = utils.timer()
|
|
end
|
|
end
|
|
|
|
lastRefresh = 0
|
|
|
|
function ResizeReleaseCallback()
|
|
SetUpHotspotsAndDraw(true)
|
|
end
|
|
|
|
function MouseDown(flags, hotspot_id)
|
|
if (hotspot_id == "resize") then
|
|
startx, starty = WindowInfo (win, 17), WindowInfo (win, 18)
|
|
end
|
|
end
|
|
|
|
function CancelMouseOver (flags, hotspotid)
|
|
end -- cancelmouseover
|
|
|
|
function CancelMouseDown(flags, hotspot_id)
|
|
end
|
|
|
|
function MouseUp(flags, hotspot_id, win)
|
|
if bit.band (flags, miniwin.hotspot_got_rh_mouse) ~= 0 then
|
|
right_click_menu()
|
|
end
|
|
return true
|
|
end
|
|
|
|
function LeftClickOnly(flags, hotspot_id, win)
|
|
if bit.band (flags, miniwin.hotspot_got_rh_mouse) ~= 0 then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
function leaveGroup ()
|
|
invitations = {}
|
|
group_built = false
|
|
full_group_data = nil
|
|
SetUpHotspotsAndDraw(true)
|
|
end
|
|
|
|
function OnPluginConnect()
|
|
Send_GMCP_Packet("rawcolor on")
|
|
Send_GMCP_Packet("group on")
|
|
end
|
|
|
|
function OnPluginSaveState()
|
|
-- save window current location for next time
|
|
movewindow.save_state(win)
|
|
|
|
SetVariable("enabled", tostring(GetPluginInfo(GetPluginID (), 17)))
|
|
if WindowInfo(win, 3) and WindowInfo(win, 4) then
|
|
width = WindowInfo(win, 3)
|
|
height = WindowInfo(win, 4)
|
|
end
|
|
SetVariable("width", width)
|
|
SetVariable("height", height)
|
|
SetVariable("font_name", font_name)
|
|
SetVariable("font_size", font_size)
|
|
SetVariable("show_self", show_self)
|
|
SetVariable("show_hp", show_hp)
|
|
SetVariable("show_mn", show_mn)
|
|
SetVariable("show_mv", show_mv)
|
|
SetVariable("hidden", hidden)
|
|
SetVariable("colorVals", serialize.save ("colorVals"))
|
|
SetVariable("flat_gauges", flat_gauges)
|
|
SetVariable("overlay_numbers", overlay_numbers)
|
|
SetVariable("thresh1active", thresh1active)
|
|
SetVariable("thresh2active", thresh2active)
|
|
SetVariable("thresh1percent", thresh1percent)
|
|
SetVariable("thresh2percent", thresh2percent)
|
|
SetVariable("thresh1color", thresh1color)
|
|
SetVariable("thresh2color", thresh2color)
|
|
end -- OnPluginSaveState
|
|
|
|
function OnPluginClose()
|
|
OnPluginDisable()
|
|
WindowDelete(win)
|
|
end
|
|
|
|
function HideIt()
|
|
WindowShow( win, false )
|
|
hidden = 1
|
|
SaveState()
|
|
end
|
|
|
|
function ShowIt()
|
|
WindowShow (win, true)
|
|
hidden = 0
|
|
SaveState()
|
|
end
|
|
|
|
function OnPluginDisable ()
|
|
SaveState()
|
|
WindowShow(win, false)
|
|
end -- OnPluginDisable
|
|
|
|
function OnPluginEnable ()
|
|
if hidden == 0 then
|
|
WindowShow (win, true)
|
|
end
|
|
if IsConnected() then
|
|
OnPluginConnect()
|
|
end
|
|
SaveState()
|
|
end -- OnPluginEnable
|
|
|
|
win = GetPluginID()
|
|
function OnPluginListChanged ()
|
|
dofile "lua/aard_requirements.lua"
|
|
end
|
|
|
|
function OnPluginInstall()
|
|
|
|
local fonts = utils.getfontfamilies ()
|
|
|
|
-- if Dina not there already, add it
|
|
if not fonts.Dina then
|
|
AddFont (GetInfo (66) .. "\\Dina.fon")
|
|
fonts = utils.getfontfamilies ()
|
|
end
|
|
|
|
if fonts ["Dina"] then
|
|
default_font_size = 8
|
|
default_font_name = "Dina"
|
|
elseif fonts["Courier New"] then
|
|
default_font_size = 9
|
|
default_font_name = "Courier New"
|
|
else
|
|
default_font_size = 9
|
|
default_font_name = "Lucida Console"
|
|
end
|
|
|
|
font_id = "font"
|
|
font_name = GetVariable("font_name") or default_font_name
|
|
font_size = tonumber(GetVariable("font_size")) or default_font_size
|
|
|
|
windowinfo = movewindow.install(win, miniwin.pos_center, miniwin.create_absolute_location, false, nil, {mouseup=MouseUp, mousedown=LeftClickOnly, dragmove=LeftClickOnly, dragrelease=LeftClickOnly},{x=default_x, y=default_y})
|
|
WindowCreate(win, windowinfo.window_left, windowinfo.window_top, width, height, windowinfo.window_mode, windowinfo.window_flags, Theme.SECONDARY_BODY)
|
|
WindowFont(win, font_id, font_name, font_size, false, false, false, false, 0) -- normal font
|
|
|
|
--- Grab font size settings.
|
|
line_height = WindowFontInfo (win, font_id, 1) - WindowFontInfo (win, font_id, 4) + 2
|
|
title_height = line_height*2+4
|
|
|
|
if IsConnected() then
|
|
OnPluginConnect()
|
|
Send_GMCP_Packet("request group")
|
|
end
|
|
|
|
-- if disabled last time, stay disabled
|
|
if GetVariable ("enabled") == "false" then
|
|
ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
|
|
check (EnablePlugin(GetPluginID (), false))
|
|
return
|
|
end -- they didn't enable us last time
|
|
|
|
-- Draw the initial group window
|
|
SetUpHotspotsAndDraw(true)
|
|
end
|
|
|
|
function getmemoryusage()
|
|
collectgarbage('collect')
|
|
return collectgarbage('count')
|
|
end
|
|
|
|
]]>
|
|
|
|
</script>
|
|
</muclient>
|