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.
747 lines
23 KiB
747 lines
23 KiB
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE muclient>
|
|
<!-- Saved on Tuesday, March 29, 2016, 2:45 PM -->
|
|
<!-- MuClient version 5.01 -->
|
|
|
|
<!-- Plugin "Auction_Utilities" generated by Plugin Wizard -->
|
|
|
|
<muclient>
|
|
<plugin
|
|
name="Auction_Utilities"
|
|
author="Arcidayne"
|
|
id="381ff501f4f32c86cc30ad4c"
|
|
language="Lua"
|
|
purpose="Auction Helper"
|
|
save_state="y"
|
|
date_written="2016-03-29 14:40:46"
|
|
requires="4.80"
|
|
version="2.44"
|
|
>
|
|
<description trim="y">
|
|
<![CDATA[
|
|
Pretty automatic. There is one alias that you can utilize to safely bid on items:
|
|
|
|
safe <commands>
|
|
|
|
This prevents you from bidding 35,000,000 when you mean to bid 3,500,000. This is accomplished by entering the following:
|
|
|
|
safe bid 123 3.5m
|
|
|
|
which will then send 'bid 123 3500000'
|
|
|
|
aucutils update -- This will update the plugin if there are new versions available.
|
|
|
|
aucutils buyout <on|off> -- Turns on/off clickable buyouts.
|
|
|
|
Any questions, send a tell or personal note to Arcidayne!
|
|
]]>
|
|
</description>
|
|
|
|
</plugin>
|
|
<!-- Triggers -->
|
|
|
|
<triggers>
|
|
<trigger
|
|
group="Auction_Market"
|
|
keep_evaluating="y"
|
|
match="^\| Current bid.*\|$"
|
|
name="CurrentBid"
|
|
regexp="y"
|
|
send_to="14"
|
|
sequence="100"
|
|
>
|
|
<send>EnableTrigger("BuyoutLink", false)
|
|
EnableTrigger("CurrentBid", false)</send>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
keep_evaluating="y"
|
|
match="^\s+?\*?(\d+)\s+.*?\s+\d+\s+.*?\s+[\d,]+\*?\s+\d+\s+.*?$"
|
|
omit_from_output="y"
|
|
regexp="y"
|
|
send_to="14"
|
|
sequence="100"
|
|
>
|
|
<send>for i,v in pairs(TriggerStyleRuns) do
|
|
if v.text:gsub(" ", "") == "%1" then
|
|
local st, sl, spl = string.find(v.text, "[^%s]"), string.len(v.text), string.len("%1")
|
|
local ls, ts = string.rep(" ", st-1), ""
|
|
if (spl+string.len(ls)) < sl then
|
|
ts = string.rep(" ", sl-(spl+ls))
|
|
end
|
|
ColourTell(RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), ls)
|
|
--Hyperlink("!!381ff501f4f32c86cc30ad4c:lbid_capture(%1)", "%1", "lbid %1", RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), 0)
|
|
Hyperlink("lbid %1", "%1", "", RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), 0)
|
|
ColourTell(RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), ts)
|
|
else
|
|
ColourTell (RGBColourToName (v.textcolour),
|
|
RGBColourToName (v.backcolour),
|
|
v.text)
|
|
end
|
|
end
|
|
Note ("")</send>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
lines_to_match="4"
|
|
match="^\| Market Item Number\s+: (\d+)\s+\|"
|
|
regexp="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>marketbidn, bop = nil, nil
|
|
marketbidn = "%1"
|
|
EnableTrigger("BuyoutLink", true)
|
|
EnableTrigger("CurrentBid", true)</send>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
keep_evaluating="y"
|
|
match="^(?:\{chan ch=.*\})?(?:(Market|Auction|Remort Auction)): \w+ (?:is auctioning|is selling|of).*(?:(?:Level \d+, )?Num (\d+)\))\.?(?: Auction is for .*\.| Current bid is \d+\.)?"
|
|
omit_from_output="y"
|
|
regexp="y"
|
|
send_to="14"
|
|
sequence="100"
|
|
>
|
|
<send>local bida = "bid"
|
|
if "%1" == "Market" then bida = "lbid" elseif "%1" == "Remort Auction" then bida = "rbid" end
|
|
|
|
for i,v in pairs(TriggerStyleRuns) do
|
|
if v.text:gsub(" ", "") == "%2" then
|
|
--Hyperlink("!!381ff501f4f32c86cc30ad4c:" .. bida .. "_capture(%1)", "%1", bida .. "%1", RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), 0)
|
|
Hyperlink(bida .. " %2", v.text, "", RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), 0)
|
|
else
|
|
ColourTell (RGBColourToName (v.textcolour),
|
|
RGBColourToName (v.backcolour),
|
|
v.text)
|
|
end
|
|
end
|
|
Note ("")</send>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
match="^\s{0,3}(\d+)\s+-\s+\w+.*?\d+\s+[\d,]+\s+\d+$"
|
|
omit_from_output="y"
|
|
regexp="y"
|
|
send_to="14"
|
|
sequence="100"
|
|
>
|
|
<send>for i,v in pairs(TriggerStyleRuns) do
|
|
if v.text == "%1" then
|
|
-- Hyperlink("!!381ff501f4f32c86cc30ad4c:bid_capture(%1)", "%1", "bid %1", RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), 0)
|
|
Hyperlink("bid %1", "%1", "", RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), 0)
|
|
else
|
|
ColourTell (RGBColourToName (v.textcolour),
|
|
RGBColourToName (v.backcolour),
|
|
v.text)
|
|
end
|
|
end
|
|
Note ("")</send>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
match="^(\| Auction will end in\s+: (?:(\d+) days? and )?(?:(\d+):)?(\d+):(\d+))(\s+)\|$"
|
|
omit_from_output="y"
|
|
regexp="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>function get_date(days, hours, minutes, seconds)
|
|
daysec = days*86400
|
|
hoursec = hours*3600
|
|
minsec = minutes*60
|
|
|
|
totalsecs = daysec+hoursec+minsec+seconds
|
|
|
|
return os.date('(%H:%M %b %d)', os.time()+totalsecs)
|
|
end
|
|
|
|
local aucd, auch, aucm, aucs = 0, 0, tonumber("%4"), tonumber("%5")
|
|
|
|
if "%2" ~= "" then aucd = tonumber("%2") end
|
|
if "%3" ~= "" then auch = tonumber("%3") end
|
|
|
|
local date_end = get_date(aucd, auch, aucm, aucs)
|
|
|
|
ColourNote("white", "", "%1 ", "cyan", "", date_end, "white", "", string.rep(" ", string.len("%6")-string.len(date_end)-1) .. "|")
|
|
</send>
|
|
</trigger>
|
|
<trigger
|
|
group="Auction_Market"
|
|
match="^\| Buyout Price\s+:\s+([\d,]+)\s+\|$"
|
|
name="BuyoutLink"
|
|
omit_from_output="y"
|
|
regexp="y"
|
|
send_to="14"
|
|
sequence="100"
|
|
>
|
|
<send>
|
|
local bop = string.gsub("%1", ",", "")
|
|
local hlink = "lbid " .. marketbidn .. " " .. bop
|
|
|
|
for i,v in pairs(TriggerStyleRuns) do
|
|
if v.text:gsub(" ", "") == "%1" and BUYOUT_OPTION == 1 then
|
|
Hyperlink(hlink, "%1", "", RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), 0)
|
|
ColourTell("", "", string.rep(" ", v.text:len() - string.len("%1")))
|
|
else
|
|
ColourTell (RGBColourToName (v.textcolour),
|
|
RGBColourToName (v.backcolour),
|
|
v.text)
|
|
end
|
|
end
|
|
Note ("")</send>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
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 -->
|
|
|
|
<aliases>
|
|
<alias
|
|
match="^safe (.*) ([\d\.]+)(k|K|m|M|b|B)(.*)?"
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
regexp="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>local amount = tonumber("%2")
|
|
if "%3" == "k" or "%3" == "K" then amount = amount * 1000 end
|
|
if "%3" == "m" or "%3" == "M" then amount = amount * 1000000 end
|
|
if "%3" == "b" or "%3" == "B" then amount = amount * 1000000000 end
|
|
|
|
Send("%1 " .. amount .. "%4")</send>
|
|
</alias>
|
|
<alias
|
|
match="^aucutils update$"
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
regexp="y"
|
|
script="update_plugin"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
match="^aucutils buyout (on|off)$"
|
|
enabled="y"
|
|
group="Auction_Market"
|
|
regexp="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>if "%1" == "on" then BUYOUT_OPTION = 1 else BUYOUT_OPTION = 0 end
|
|
ColourNote("white", "blue", "Turning %1 clickable buyouts!")</send>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<!-- Script -->
|
|
|
|
|
|
<script>
|
|
<![CDATA[
|
|
|
|
-- Window Creation
|
|
require "movewindow"
|
|
require "mw"
|
|
require "gmcphelper"
|
|
|
|
background_colour = GetNormalColour(1) or 0
|
|
title_colour = 0x292929
|
|
border_colour = 0xdddddd
|
|
title_gradient_col1 = GetNormalColour(1) or 0
|
|
title_gradient_col1 = 0x444444
|
|
default_width = 500
|
|
default_height = 250
|
|
default_x = 658
|
|
default_y = 100
|
|
lbid_lines = {}
|
|
|
|
RESIZE_TAG_SIZE = 10
|
|
MIN_SIZE = 100
|
|
TITLE_HEIGHT = 11
|
|
|
|
startx = ""
|
|
starty = ""
|
|
posx = ""
|
|
posy = ""
|
|
hotspot_id = ""
|
|
page_built = false
|
|
|
|
function lbid_redirect (name, line, wildcards, styles)
|
|
EnableTrigger ("multi_line_lbid", true) -- capture subsequent lines
|
|
EnableTrigger ("lbid_end", true) -- capture ending lines
|
|
if name == "lbid_start" then --- Setup the window.
|
|
line_count = 1
|
|
lbid_lines = {} --reset ready for new lbid listing
|
|
elseif name == "lbid_end" then
|
|
table.insert (lbid_lines, styles)
|
|
EnableTrigger ("multi_line_lbid", false) -- no more lines to go
|
|
page_built = true
|
|
DisplayLbidPage () --end of lbid output from MUD, display the window
|
|
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 lbid_redirect
|
|
|
|
function SetUpHotspotsAndDraw(firstTime)
|
|
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
|
|
background_colour) )
|
|
-- Add the drag handler so they can move the window around
|
|
movewindow.add_drag_handler (win, 0, 0, 0, 0)
|
|
|
|
-- Add handler for resizing
|
|
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) -- fail silently
|
|
else
|
|
-- everything has already been made
|
|
-- just move them back into place
|
|
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
|
|
|
|
--=================================================================================
|
|
-- Called by OnPluginInstall, but also by redraw routine to refresh the screen
|
|
-- and (if the first time) add the resizer tag, otherwise move the resizer relative
|
|
-- to the main window.
|
|
--=================================================================================
|
|
|
|
function DisplayLbidPage()
|
|
|
|
styles = { }
|
|
|
|
WindowRectOp(win, 2, 2,2,-2,-2,background_colour) -- blank
|
|
|
|
-- title rectangle
|
|
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 = "Lbid(rbid/bid) 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
|
|
-- display each line
|
|
imax = 0
|
|
for i, v in ipairs (lbid_lines) do
|
|
Display_Line (i, v)
|
|
imax = i
|
|
end -- for
|
|
|
|
end
|
|
|
|
-- draw edge frame.
|
|
WindowRectOp (win, 1, 0, 0, 0, 0, border_color, 15)
|
|
WindowRectOp (win, 1, 1, 1, -1, -1, 0x777777, 15)
|
|
|
|
-- draw the resize widget bottom right corner.
|
|
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)
|
|
|
|
-- show it now (or refresh)
|
|
WindowShow (win, true)
|
|
--Redraw()
|
|
BroadcastPlugin (999, "repaint")
|
|
|
|
end -- Display_Lbid
|
|
|
|
|
|
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
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Just used to ensure we can send commands (only send "lbid/rbid/bid" when state = 3)
|
|
---------------------------------------------------------------------------------
|
|
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
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Called as the window is dragged around. This function and those below are
|
|
-- only 'handlers' because they are set in WindowAddHotSpot
|
|
---------------------------------------------------------------------------------
|
|
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
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Called after the resize widget is released.
|
|
---------------------------------------------------------------------------------
|
|
function ResizeReleaseCallback()
|
|
SetUpHotspotsAndDraw(true)
|
|
end
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Called when mouse button is pressed on hotspot.
|
|
---------------------------------------------------------------------------------
|
|
function MouseDown(flags, hotspot_id)
|
|
if (hotspot_id == "resize") then
|
|
startx, starty = WindowInfo (win, 17), WindowInfo (win, 18)
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Called when mouse moved away from hotspot. Doesn't really apply for draggables.
|
|
---------------------------------------------------------------------------------
|
|
function CancelMouseDown(flags, hotspot_id)
|
|
end
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Called when mouse button released on hotspot.
|
|
---------------------------------------------------------------------------------
|
|
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
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Called when plugin is saved - store our variables for next time.
|
|
---------------------------------------------------------------------------------
|
|
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()
|
|
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
|
|
|
|
function OnPluginInstall()
|
|
--- 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)
|
|
|
|
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 Window Creation
|
|
|
|
|
|
|
|
function OnPluginInstall()
|
|
PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19)
|
|
PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1)
|
|
BUYOUT_OPTION = 1
|
|
end
|
|
|
|
function update_plugin()
|
|
raw = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Auction_Utilities/Auction_Utilities.xml"
|
|
|
|
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 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
|
|
|
|
if "" == GetAlphaOption("script_prefix") then
|
|
SetAlphaOption("script_prefix", "\\\\\\")
|
|
end
|
|
|
|
Execute(GetAlphaOption("script_prefix") .. "DoAfterSpecial(1, \"ReloadPlugin('" .. GetPluginID() .. "')\", sendto.script)")
|
|
end -- end Update code
|
|
|
|
]]>
|
|
</script>
|
|
|
|
|
|
<!-- Plugin help -->
|
|
|
|
<aliases>
|
|
<alias
|
|
script="OnHelp"
|
|
match="aucutils help"
|
|
enabled="y"
|
|
>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<script>
|
|
<![CDATA[
|
|
function OnHelp ()
|
|
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
|
|
end
|
|
]]>
|
|
</script>
|
|
|
|
</muclient>
|