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.
138 lines
3.2 KiB
138 lines
3.2 KiB
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE muclient>
|
|
<!-- Saved on Thursday, July 06, 2023, 10:03 AM -->
|
|
<!-- MuClient version 5.07-pre -->
|
|
|
|
<!-- Plugin "InfoWindow" generated by Plugin Wizard -->
|
|
|
|
<muclient>
|
|
<plugin
|
|
name="PlayerInfoWindow"
|
|
author="Crowley"
|
|
id="51e6d559f53be43ae8f93574"
|
|
language="Lua"
|
|
purpose="Sends player info to window"
|
|
save_state="y"
|
|
date_written="2023-07-06 10:02:24"
|
|
requires="5.07"
|
|
version="1.5"
|
|
>
|
|
|
|
</plugin>
|
|
|
|
|
|
<!-- Aliases -->
|
|
|
|
<aliases>
|
|
<alias
|
|
match="^((?:finger|whois|sc(?:ore)?)(?:.*)?)$"
|
|
enabled="y"
|
|
regexp="y"
|
|
script="onInfoRequest"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
match="^closeinfo$"
|
|
enabled="y"
|
|
regexp="y"
|
|
script="closeWin"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<!-- Script -->
|
|
|
|
|
|
<script>
|
|
<![CDATA[
|
|
local extras = require "aard_lua_extras"
|
|
require "gmcphelper"
|
|
local snapshotV = tonumber(extras.PackageVersion())
|
|
|
|
local prefix = GetAlphaOption("script_prefix")
|
|
|
|
if (snapshotV< 2245) or (snapshotV < 2252 and tonumber(gmcp("char.base.level")) > 201) then
|
|
ColourNote("white", "blue", "Sorry, your snapshot of the AardMUSH package is not compatible for your level and you will not be able to use this script. Please update your snapshot of the AardMUSH package to use this plugin. Unloading plugin to prevent issues.")
|
|
Execute(prefix .. 'DoAfterSpecial(1, "UnloadPlugin(\'' .. GetPluginID() .. '\')", sendto.script)')
|
|
else
|
|
require "wrapped_captures"
|
|
end
|
|
|
|
require 'themed_miniwindows'
|
|
|
|
fontName = GetAlphaOption("output_font_name")
|
|
fontHeight = GetOption("output_font_height")
|
|
|
|
function OnPluginInstall()
|
|
InfoWin = ThemedTextWindow(
|
|
"PlayerInfo",
|
|
200,
|
|
200,
|
|
840,
|
|
500,
|
|
"Player Info",
|
|
"center",
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
fontName,
|
|
fontHeight,
|
|
fontName,
|
|
fontHeight,
|
|
30,
|
|
5,
|
|
true
|
|
)
|
|
end
|
|
|
|
function findBoundaries(tbl)
|
|
for indexStart, v in ipairs(tbl) do
|
|
if v[1].text:find("-------------------") or v[1].text:find("There is no player with that name.") or v[1].text:find("You found nobody online with the name") then
|
|
for indexEnd = #tbl, 1, -1 do
|
|
if tbl[indexEnd][1].text:find("-------------------") or tbl[indexEnd][1].text:find("There is no player with that name.") or tbl[indexEnd][1].text:find("You found nobody online with the name") then
|
|
table.move(tbl, indexStart, indexEnd, 1)
|
|
local len = indexEnd - indexStart + 1
|
|
table.move(tbl, #tbl + 1, #tbl*2 - len, len+1)
|
|
return tbl
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return tbl
|
|
end
|
|
|
|
function onInfoRequest(name, line, wildcards)
|
|
if not WindowInfo("PlayerInfo", 1) then OnPluginInstall() end
|
|
|
|
local param = wildcards[1]
|
|
Capture.untagged_output(param, true, true, false, addToWindow, false)
|
|
end
|
|
|
|
function addToWindow(lines)
|
|
local slines = findBoundaries(lines)
|
|
InfoWin:clear(false)
|
|
if #slines > 0 then
|
|
InfoWin:add_text(slines, false)
|
|
else
|
|
InfoWin:add_text(lines, false)
|
|
end
|
|
InfoWin:fit_contents()
|
|
InfoWin:show()
|
|
end
|
|
|
|
function closeWin()
|
|
InfoWin:hide()
|
|
end
|
|
]]>
|
|
</script>
|
|
|
|
|
|
</muclient>
|