Fixes made. New features soon!

Contrast_Picker
Arcidayne 9 years ago
parent 523c23392b
commit 9bf04bf997

@ -201,30 +201,6 @@ for i,v in pairs(TriggerStyleRuns) do
end
Note ("")</send>
</trigger>
<trigger
enabled="n"
match="^\{lbid\}$"
script="lbid_redirect"
omit_from_output="y"
name="lbid_start"
sequence="100"
></trigger>
<trigger
enabled="n"
match="*"
script="lbid_redirect"
name="multi_line_lbid"
omit_from_output="y"
sequence="110"
></trigger>
<trigger
enabled="n"
match="^\{/lbid\}"
script="lbid_redirect"
omit_from_output="y"
name="lbid_end"
sequence="100"
></trigger>
</triggers>
<!-- Aliases -->
@ -272,31 +248,6 @@ Send("%1 " .. amount .. "%4")</send>
<script>
<![CDATA[
function lbid_capture(wildcards)
if state ~= 3 then
Send("echo {lbid}")
Send("lbid " .. wildcards)
Send("echo {/lbid}")
end
end
function rbid_capture(wildcards)
if state ~= 3 then
Send("echo {lbid}")
Send("rbid " .. wildcards)
Send("echo {/lbid}")
end
end
function bid_capture(wildcards)
if state ~= 3 then
Send("echo {lbid}")
Send("bid " .. wildcards)
Send("echo {/lbid}")
end
end
function OnPluginInstall()
PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19)
PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1)
@ -327,349 +278,8 @@ function OnPluginInstall()
posy = ""
hotspot_id = ""
page_built = false
--- Pull some state variables.
title_colour = tonumber (GetVariable ("title_colour")) or title_colour
height = tonumber (GetVariable ("height")) or default_height
width = tonumber (GetVariable ("width")) or default_width
also_echo_lbid = tonumber (GetVariable("also_echo_lbid")) or 0
-- make window so I can grab the font info
WindowCreate (win, 1, 1, width, height, 0, 0, background_colour or 0)
font_id = "lbid_font"
font_id_bold = "lbid_bold"
local fonts = utils.getfontfamilies ()
-- if not there already, add it
if not fonts.Dina then
AddFont (GetInfo (66) .. "\\Dina.fon")
fonts = utils.getfontfamilies ()
end -- if Dina not installed
if fonts ["Dina"] then
default_font_size = 8
default_font_name = "Dina" -- the actual font
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 -- if
font_name = GetVariable("font_name") or default_font_name
font_size = tonumber(GetVariable("font_size")) or default_font_size
--- Load the fonts into the temp window.
WindowFont (win, font_id, font_name, font_size, false, false, false, false) -- normal font
WindowFont (win, font_id_bold, font_name, font_size+1, false, false, false, false) -- bold font
--- Grab font size settings.
font_height = WindowFontInfo (win, font_id, 1) - WindowFontInfo (win, font_id, 4) + 1 -- height
font_width = WindowFontInfo (win, font_id, 6) -- avg width
line_height = font_height + 1
--- install the window movement handler, get back the window position.
windowinfo = movewindow.install (win, miniwin.pos_top_right, miniwin.create_absolute_location, false, nil, {mouseup=MouseUp, mousedown=LeftClickOnly, dragmove=LeftClickOnly, dragrelease=LeftClickOnly},{x=default_x, y=default_y})
-- Draw the initial lbid window
SetUpHotspotsAndDraw(true)
-- Info (Legend) window
-- our window frame/background colours
border_colour = ColourNameToRGB "dimgray"
-- a unique ID
infowin = "~~~~~~"..GetPluginID () .. ":info" -- name hack to make the popup go on top of everything
-- font IDs
popup_font_id = "popup_font"
heading_font_id = "popup_heading_font"
-- load fonts - mouseover window
WindowCreate (infowin, 0, 0, 1, 1, 0, 0, 0) -- make 1-pixel wide window
WindowSetZOrder(infowin, 99999)
-- install the fonts (49 is modern / fixed pitch)
WindowFont (infowin, popup_font_id, font_name, font_size, false, false, false, false, 0, 49)
WindowFont (infowin, heading_font_id, font_name, font_size + 2, false, false, false, false, 0, 49)
-- update on reload
if IsConnected() then
OnPluginConnect()
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
end
end
function lbid_redirect(name, line, wildcards, styles)
EnableTrigger ("multi_line_lbid", true)
EnableTrigger ("lbid_end", true)
if name == "lbid_start" then
line_count = 1
lbid_lines = {}
elseif name == "lbid_end" then
table.insert(lbid_lines, styles)
EnableTrigger ("multi_line_lbid", false)
page_built = true
DisplayLbidPage ()
else
table.insert(lbid_lines, styles)
if also_echo_lbid == 1 then
line_count = line_count + 1
if line_count == 4 then
SetTriggerOption("multi_line_lbid", "omit_from_output", "n")
elseif line_count == 20 then
SetTriggerOption ("multi_line_lbid", "omit_from_output", "y")
end
end
end
end
function SetUpHotspotsAndDraw(firstTime)
if firstTime == true then
check (WindowCreate (win,
windowinfo.window_left, windowinfo.window_top,
width,
height,
windowinfo.window_mode,
windowinfo.window_flags,
background_colour or 0))
movewindow.add_drag_handler (win, 0, 0, 0, 0)
WindowAddHotspot(win, "resize", width-RESIZE_TAG_SIZE, height-RESIZE_TAG_SIZE, width, height, "MouseOver", "CancelMouseOver", "MouseDown", "", "MouseUp", "", 6, 0)
WindowDragHandler(win, "resize", "ResizeMoveCallback", "ResizeReleaseCallback", 0)
CallPlugin("462b665ecb569efbf261422f", "registerMiniwindow", win)
else
WindowResize(win, width, height, background_colour)
WindowMoveHotSpot(win, "legend", 5, height-font_height-2, 3*font_width, height)
WindowMoveHotspot (win, "resize", width-RESIZE_TAG_SIZE, height-RESIZE_TAG_SIZE, width, height)
end
DisplayLbidPage()
end
function DisplayLbidPage()
styles = {}
WindowRectOp(win, 2, 2, 2, -2, -2, background_colour)
WindowGradient (win, 2, 2, -2, font_height * 2 + TITLE_HEIGHT, title_gradient_col1, title_gradient_col2, 2)
WindowLine (win, 0, font_height * 2 + TITLE_HEIGHT, width, font_height * 2 + TITLE_HEIGHT, 0xeeeeee, 0, 1)
if not page_built then
txt = "Identification output will appear here"
txtlen = WindowTextWidth (win, font_id, txt)
WindowText (win, font_id, txt, (width-txtlen)/2, height/2, 0, 0, 0xeeeeee, utf8)
txt = "once you click a hyperlink."
txtlen = WindowTextWidth(win, font_id, txt)
WindowText (win, font_id, txt, (width-txtlen)/2, height/2 + font_height, 0, 0, 0xeeeeee, utf8)
else
imax = 0
for i, v in pairs(lbid_lines) do
Display_Line (i, v)
imax = i
end
end
WindowRectOp (win, 1, 0, 0, 0, 0, border_colr, 15)
WindowRectOp (win, 1, 1, 1, -1, -1, 0x777777, 15)
WindowLine(win, width-3, height-2, width-2, height-3, 0xffffff, 0, 2)
WindowLine(win, width-4, height-2, width-2, height-4, 0x696969, 0, 1)
WindowLine(win, width-6, height-2, width-2, height-6, 0xffffff, 0, 2)
WindowLine(win, width-7, height-2, width-2, height-7, 0x696969, 0, 1)
WindowLine(win, width-9, height-2, width-2, height-9, 0xffffff, 0, 2)
WindowLine(win, width-10, height-2, width-2, height-10, 0x696969, 0, 1)
WindowLine(win, width-12, height-2, width-2, height-12, 0xffffff, 0, 2)
WindowLine(win, width-13, height-2, width-2, height-13, 0x696969, 0, 1)
WindowShow (win, true)
BroadcastPlugin (999, "repaint")
end
function Display_Line (line, styles)
local id = font_id
local left = 10
local top = (line - 1) * font_height + 20
for _, v in ipairs (styles) do
left = left + WindowText (win, id, v.text,
left, top, 0, 0, v.textcolour)
end -- for each style run
end -- Display_Line
-- right click menu
function right_click_menu ()
menustring ="Change Font"
menustring = (menustring .."|-|Bring To Front|Send To Back|-|"..(((also_echo_lbid == 1) and "+") or "").."Echo Lbid output In Main Output|Reset Defaults")
result = WindowMenu (win,
WindowInfo (win, 14), -- x position
WindowInfo (win, 15), -- y position
menustring) -- content
if result == "Change Font" then
wanted_font = utils.fontpicker (font_name, font_size) --font dialog
if wanted_font then
font_name = wanted_font.name
font_size = wanted_font.size
-- save and reload
OnPluginSaveState()
OnPluginInstall()
end
elseif result == "Bring To Front" then
CallPlugin("462b665ecb569efbf261422f","boostMe", win)
elseif result == "Send To Back" then
CallPlugin("462b665ecb569efbf261422f","dropMe", win)
elseif result == "Echo Lbid(rbid/bid) output In Main Output" then
also_echo_lbid = (((also_echo_lbid == 0) and 1) or 0)
elseif result == "Reset Defaults" then
font_name = default_font_name
font_size = default_font_size
height = default_height
width = default_width
also_echo_lbid = 0
-- save and reload
OnPluginSaveState()
OnPluginInstall()
end -- if
end -- right_click_menu
function OnPluginBroadcast(msg, id, name, text)
-- Look for GMCP handler.
if (id == '3e7dedbe37e44942dd46d264') then
if text == "char.status" then -- only watch for char.status.state change
res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char.status") -- get the char.status values
luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
assert (loadstring (luastmt or "")) ()
state = gmcpdata.state
end
end
end -- onpluginbroadcast
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
if (height < MIN_SIZE) then
height = MIN_SIZE
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 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 OnPluginConnect()
Send_GMCP_Packet("request char")
end
function OnPluginSaveState ()
movewindow.save_state (win) -- save window current location for next time
SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
SetVariable ("title_colour", title_colour)
SetVariable ("width", width)
SetVariable ("height", height)
SetVariable ("font_name", font_name)
SetVariable ("font_size", font_size)
SetVariable ("also_echo_lbid", also_echo_lbid)
end -- OnPluginSaveState
function OnPluginClose ()
OnPluginDisable()
WindowDelete(win)
end
function OnPluginDisable ()
WindowShow( win, false )
OnPluginSaveState()
end -- OnPluginDisable
function OnPluginEnable ()
WindowShow (win, true)
if IsConnected() then
OnPluginConnect()
end
OnPluginSaveState()
end -- OnPluginEnable
win = GetPluginID() .. ":lbid"
require "checkplugin"
function OnPluginListChanged ()
do_plugin_check_now ("abc1a0944ae4af7586ce88dc", "aard_repaint_buffer") -- check we have the repaint buffer plugin
do_plugin_check_now ("3e7dedbe37e44942dd46d264", "aard_GMCP_handler") -- check we have GMCP plugin
do_plugin_check_now ("462b665ecb569efbf261422f", "aard_miniwindow_z_order_monitor") -- check we have z order plugin
end -- OnPluginListChanged
-- End Windows Creation
function update_plugin()
raw = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Auction_Utilities/Auction_Utilities.xml"

Loading…
Cancel
Save