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.
519 lines
15 KiB
519 lines
15 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.57"
|
|
>
|
|
<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 = "%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
|
|
marketbidn = "%2"
|
|
|
|
for i,v in pairs(TriggerStyleRuns) do
|
|
if v.text:gsub(" ", "") == "%2" then
|
|
Hyperlink("!!381ff501f4f32c86cc30ad4c:" .. bida .. "_capture(%2)", "%2", bida .. "%2", 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>marketbidn = "%1"
|
|
|
|
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>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
|
|
|
|
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"
|
|
enabled="n"
|
|
regexp="y"
|
|
send_to="14"
|
|
sequence="100"
|
|
>
|
|
<send>
|
|
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
|
|
match="\{bid\}"
|
|
name="bid_start"
|
|
script="bid_redirect"
|
|
omit_from_output="y"
|
|
enabled="n"
|
|
regexp="y"
|
|
sequence="100"
|
|
></trigger>
|
|
<trigger
|
|
match="*"
|
|
name="bid_line_output"
|
|
script="bid_redirect"
|
|
omit_from_output="y"
|
|
keep_evaluating="y"
|
|
enabled="n"
|
|
sequence="10"
|
|
></trigger>
|
|
<trigger
|
|
match="\{/bid\}"
|
|
name="bid_end"
|
|
script="bid_redirect"
|
|
regexp="y"
|
|
enabled="n"
|
|
omit_from_output="y"
|
|
sequence="5"
|
|
></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!")
|
|
SetVariable("buyoutoption", BUYOUT_OPTION)</send>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<!-- Script -->
|
|
|
|
|
|
<script>
|
|
<![CDATA[
|
|
function OnPluginInstall()
|
|
PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19)
|
|
PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1)
|
|
BUYOUT_OPTION = GetVariable("buyoutoption") or 1
|
|
|
|
require "movewindow"
|
|
require "mw"
|
|
require 'tprint'
|
|
|
|
-- Window initialization
|
|
|
|
win = "Auction_Utilities_" .. GetPluginID()
|
|
font_size = 8
|
|
|
|
wininfo = movewindow.install(win, miniwin.pos_center_right, 0)
|
|
|
|
local font_families = utils.getfontfamilies()
|
|
|
|
if font_families["Dina"] then
|
|
font_name = "Dina"
|
|
elseif font_families["Lucida Sans Console"] then
|
|
font_name = "Lucida Sans Console"
|
|
font_size = 10
|
|
else
|
|
font_name = "Consolas"
|
|
font_size = 10
|
|
end
|
|
|
|
WindowCreate(win, wininfo.window_left, wininfo.window_top, 0, 0, miniwin.pos_center_right, wininfo.window_flags, 0)
|
|
WindowFont(win, "f1", font_name, font_size, false, false, false, false)
|
|
WindowFont(win, "f2", "Consolas", 12, true, false, false, false)
|
|
|
|
max_width = WindowTextWidth(win, "f1", "+-----------------------------------------------------------------+") + 10
|
|
font_height = WindowFontInfo(win, "f1", 1)
|
|
button_height = WindowFontInfo(win, "f2", 1) + 10
|
|
bidbuttonWidth = WindowTextWidth(win, "f2", "Bid") + 30
|
|
proxybuttonx = bidbuttonWidth + 1
|
|
proxybuttonWidth = proxybuttonx + WindowTextWidth(win, "f2", "Proxy bid") + 30
|
|
buyoutbuttonx = proxybuttonWidth + 1
|
|
buyoutbuttonWidth = buyoutbuttonx + WindowTextWidth(win, "f2", "Buyout") + 30
|
|
datetextx = buyoutbuttonWidth + 5
|
|
closebuttonx = max_width - 25
|
|
|
|
|
|
-- End Window Initialization
|
|
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)")
|
|
ColourNote("white", "blue", "Update complete!")
|
|
end -- end Update code
|
|
|
|
function lbid_capture(bidnum)
|
|
bid_action = "lbid"
|
|
EnableTrigger("bid_start", true)
|
|
Send("echo {bid}")
|
|
Send("lbid " .. bidnum)
|
|
Send("echo {/bid}")
|
|
end
|
|
|
|
function bid_capture(bidnum)
|
|
bid_action = "bid"
|
|
EnableTrigger("bid_start", true)
|
|
Send("echo {bid}")
|
|
Send("bid " .. bidnum)
|
|
Send("echo {/bid}")
|
|
end
|
|
|
|
function rbid_capture(bidnum)
|
|
bid_action = "rbid"
|
|
EnableTrigger("bid_start", true)
|
|
Send("echo {bid}")
|
|
Send("rbid " .. bidnum)
|
|
Send("echo {/bid}")
|
|
end
|
|
|
|
function bid_redirect(name, line, wildcards, styles)
|
|
EnableTrigger("bid_line_output", true)
|
|
EnableTrigger("bid_end", true)
|
|
if name == "bid_start" then
|
|
bid_lines = {}
|
|
bop, date_end = nil, nil
|
|
EnableTrigger("bid_start", false)
|
|
elseif name == "bid_end" then
|
|
EnableTrigger("bid_line_output", false)
|
|
EnableTrigger("bid_end", false)
|
|
DrawWindow()
|
|
elseif name == "bid_line_output" then
|
|
if styles[1] then
|
|
if string.match(styles[1].text, "^[%|%+]") then
|
|
table.insert(bid_lines, styles)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function get_date(days, hours, minutes, seconds)
|
|
daysec = days*86400
|
|
hoursec = hours*3600
|
|
minsec = minutes*60
|
|
totalsecs = daysec+hoursec+minsec+seconds
|
|
|
|
return os.date('%I:%M%p %b %d', os.time()+totalsecs)
|
|
end
|
|
|
|
function DrawWindow()
|
|
WindowCreate(win, wininfo.window_left, wininfo.window_top, max_width, font_height * #bid_lines + (button_height + 3), miniwin.pos_center_right, miniwin.create_absolute_location+miniwin.create_keep_hotspots, ColourNameToRGB("black"))
|
|
WindowRectOp(win, miniwin.rect_draw_edge, 0, 0, max_width, font_height * #bid_lines + (button_height + 3), miniwin.rect_edge_raised, miniwin.rect_edge_at_all)
|
|
|
|
-- Buttons
|
|
WindowRectOp(win, miniwin.rect_draw_edge, 0, 0, bidbuttonWidth, button_height, miniwin.rect_edge_raised, miniwin.rect_edge_at_all)
|
|
WindowAddHotspot(win, "bid", 0, 0, bidbuttonWidth, button_height + 10, "mouseover", "cancelmouseover", "mousedown", "cancelmousedown", "mouseup", "Bid on item", miniwin.cursor_hand, 0)
|
|
WindowText(win, "f2", "Bid", 15, 5, 0, 0, ColourNameToRGB("darkgreen"), false)
|
|
|
|
if bid_action == "lbid" then
|
|
WindowRectOp(win, miniwin.rect_draw_edge, proxybuttonx, 0, proxybuttonWidth, button_height, miniwin.rect_edge_raised, miniwin.rect_edge_at_all)
|
|
WindowAddHotspot(win, "proxy", proxybuttonx, 0, proxybuttonWidth, button_height, "mouseover", "cancelmouseover", "mousedown", "cancelmousedown", "mouseup", "Place proxy bid", miniwin.cursor_hand, 0)
|
|
WindowText(win, "f2", "Proxy bid", proxybuttonx + 15, 5, 0, 0, ColourNameToRGB("yellow"), false)
|
|
|
|
if bop then
|
|
WindowRectOp(win, miniwin.rect_draw_edge, buyoutbuttonx, 0, buyoutbuttonWidth, button_height, miniwin.rect_edge_raised, miniwin.rect_edge_at_all)
|
|
WindowAddHotspot(win, "buyout", buyoutbuttonx, 0, buyoutbuttonWidth, button_height, "mouseover", "cancelmouseover", "mousedown", "cancelmousedown", "mouseup", "Buyout item", miniwin.cursor_hand, 0)
|
|
WindowText(win, "f2", "Buyout", buyoutbuttonx + 15, 5, 0, 0, ColourNameToRGB("white"), false)
|
|
end
|
|
end
|
|
|
|
if date_end then
|
|
WindowText(win, "f2", "Ends " .. date_end, datetextx, 5, 0, 0, ColourNameToRGB("cyan"), false)
|
|
end
|
|
|
|
WindowAddHotspot(win, "close", closebuttonx, 0, max_width, button_height, "mouseover", "cancelmouseover", "mousedown", "cancelmousedown", "mouseup", "Close window", miniwin.cursor_hand, 0)
|
|
WindowText(win, "f2", "X", max_width - 15, 5, 0, 0, ColourNameToRGB("red"), false)
|
|
|
|
WindowLine(win, 0, button_height + 1, max_width, button_height + 1, ColourNameToRGB("gray"), miniwin.pen_solid, 2)
|
|
|
|
local y = button_height + 3
|
|
|
|
for i, styles in ipairs(bid_lines) do
|
|
|
|
if styles[1] then
|
|
local x = 5
|
|
for _,style in ipairs(styles) do
|
|
x = x + WindowText(win, "f1", style.text, x, y, 0, 0, style.textcolour)
|
|
end
|
|
y = y + font_height
|
|
end
|
|
end
|
|
|
|
movewindow.add_drag_handler(win, 0, button_height + 3, 0, 0, miniwin.cursor_both_arrow)
|
|
|
|
WindowSetZOrder(win, 999)
|
|
|
|
movewindow.save_state (win)
|
|
|
|
WindowShow(win, true)
|
|
end
|
|
|
|
function mouseover()
|
|
return
|
|
end
|
|
|
|
function cancelmouseover()
|
|
return
|
|
end
|
|
|
|
function mousedown ()
|
|
return
|
|
end
|
|
|
|
function cancelmousedown()
|
|
return
|
|
end
|
|
|
|
function mouseup (flags, hotspot_id)
|
|
if hotspot_id == "bid" then
|
|
bid_amount = utils.inputbox("How much would you like to bid?", "Safe bid enabled! (1k, 1.5m, etc)", "")
|
|
Execute("safe " .. bid_action .. " " .. marketbidn .. " " .. bid_amount .. " confirm")
|
|
elseif hotspot_id == "proxy" then
|
|
proxy_amount = utils.inputbox("How much would you like you to proxy bid?", "Safe bid enabled! (1k, 1.5m, etc)", "")
|
|
Execute("safe lbid " .. marketbidn .. " " .. proxy_amount .. " proxy confirm")
|
|
elseif hotspot_id == "buyout" then
|
|
Send("lbid " .. marketbidn .. " " .. bop)
|
|
elseif hotspot_id == "close" then
|
|
movewindow.save_state (win)
|
|
WindowShow(win, false)
|
|
end
|
|
end
|
|
|
|
function OnPluginSaveState()
|
|
movewindow.save_state (win)
|
|
end
|
|
|
|
]]>
|
|
</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>
|