<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Sunday, June 25, 2006, 1:47 AM -->
<!-- MuClient version 3.73 -->

<!-- Plugin "Aardwolf_SellAllLUA" generated by Plugin Wizard -->

<muclient>
<plugin
name="Aardwolf_SellAllLUA"
author="NeoFryBoy(Tealos)+ edit Onoitsu2"
id="9b5d0352809c46c0900aec6f"
language="LUA"
purpose="Since Aardwolf doesn't have a sell all feature I decided to add one."
date_written="2006-06-25 01:45:49"
save_state="y"
requires="3.65"
version="1.1"
>
<description trim="n">
<![CDATA[
Aardwolf SellAll LUA Helpfile
-=[ SellAll for MUSHClient done by Tealos.  ]=-
-=[ Modified By: Onoitsu2 AKA Venificius.   ]=-
This plugin is intended to act as an extension to the MUDs current sell command.

Use:
Just head to your favorite clanshop and type sellall. It should automatically scroll through long inventories.
As a side bonus I threw in the command sellkey which takes you to a shopkeeper in stardock who buys most keys.

Note: The MUD is pretty good about sending a massive amount of commands, so there shouldn't be a reachable limit. If you manage to hit it let me know.

]]>
</description>
</plugin>


<!-- Get our standard constants -->

<include name="constants.lua"/>

<!-- Triggers -->

<triggers>
<trigger
group="SellInv"
match="^\[Enter key for more or \'q\' to stop\]$"
regexp="y"
send_to="12"
sequence="100"
>
<send>Send("")</send>
</trigger>
<trigger
group="SellInv"
keep_evaluating="n"
match="^([ ]{5}|\(( \d{1,3})\) )(?:\([BKIGHM]\)){0,}(.*?) (|\[\d{3}\/\d{3}\] )(?:\[\d+\])"
regexp="y"
script="SellAllItems"
sequence="100"
>
</trigger>
</triggers>

<!-- Aliases -->

<aliases>
<alias
match="sellall"
enabled="y"
send_to="12"
sequence="100"
>
<send>EnableTriggerGroup("SellInv",true)
Send("inventory")
DoAfterSpecial(4, 'EnableTriggerGroup("SellInv", false)', 12)
</send>
</alias>
</aliases>

<!-- Script -->


<script>
<![CDATA[
function OnPluginInstall()
sellhelp()
end

function sellhelp()
Note("")
AnsiNote(ANSI(0) .. "-=" .. ANSI(36) .. "[ " .. ANSI(31,22) .. "SellAll for " .. ANSI(33,1) .. "MUSHClient" .. ANSI(31,22) .. " done by " .. ANSI(31,1) .. "T" .. ANSI(31,22,40) .. "ealos." .. ANSI(36) .. " ]" .. ANSI(0) .. "=-")
AnsiNote(ANSI(0) .. "-=" .. ANSI(36) .. "[ " .. ANSI(31,22) .. "Translated to LUA By: " .. ANSI(33,1) .. "Onoitsu2" .. ANSI(31,22) .. " AKA " .. ANSI(31,1) .. "V" .. ANSI(31,22,40) .. "enificius." .. ANSI(36) .. " ]" .. ANSI(0) .. "=-")
AnsiNote(ANSI(36) .. ANSI(1) .. "This plugin is intended to act as an extension to the MUDs current sell command.")
AnsiNote(ANSI(31,22) .. "")
AnsiNote(ANSI(32,1) .. "Use:")
AnsiNote(ANSI(33,1) .. "Just head to your favorite clanshop and type " .. ANSI(36,1) .. "sellall" .. ANSI(33,1) .. ". It should automatically scroll through long inventories.")
AnsiNote(ANSI(31,22) .. "")
AnsiNote(ANSI(31,1) .. "Note: " .. ANSI(37,1) .. "SHORTFLAGS MUST BE ON!!! - type 'help shortflags' for more information")
AnsiNote(ANSI(31,1) .. "Note: " .. ANSI(37,1) .. "The MUD is pretty good about sending a massive amount of commands, so there shouldn't be a reachable limit. If you manage to hit it let me know.")
Note("")
end

function SellAllItems(name, line, wildcards)
local a, itemkeywords


if string.find(wildcards[0],"%(K%)") ~= nil then --It's keep flagged, so skip it.
return
end

if tonumber(wildcards[2]) ~= nil then --It repeats since there are multiples

for a = 1, tonumber(wildcards[2]) do
itemkeywords = Trim(KWShredder(wildcards[3]))
itemkeywords = string.gsub(itemkeywords," ","; sell ")
DoAfterSpecial(3,"sell " .. itemkeywords,10)
end --for

--DoAfterSpecial(3,"sell " .. itemkeywords,,10)
else
itemkeywords = Trim(KWShredder(wildcards[3]))
itemkeywords = string.gsub(itemkeywords," ","; sell ")
DoAfterSpecial(3,"sell " .. itemkeywords,10)

end --if
end --SellAllItems

function KWShredder(curritem) --Called it the Shredder because it's rather messy
curritem = string.gsub(string.lower(curritem),"%s-a "," ")
curritem = string.gsub(string.lower(curritem),"%s-an "," ")
curritem = string.gsub(string.lower(curritem),"%s-the "," ")
curritem = string.gsub(string.lower(curritem),"%s-of "," ")
curritem = string.gsub(string.lower(curritem),"%s-small "," ")
curritem = string.gsub(string.lower(curritem),"%s-big "," ")
curritem = string.gsub(string.lower(curritem),"%s-pair "," ")
curritem = string.gsub(string.lower(curritem),"%(","")
curritem = string.gsub(string.lower(curritem),"%)","")
curritem = string.gsub(string.lower(curritem),"%-","")
curritem = string.gsub(string.lower(curritem),"%*","")
curritem = string.gsub(string.lower(curritem),"%<","")
curritem = string.gsub(string.lower(curritem),"%=","")
curritem = string.gsub(string.lower(curritem),"%>","")
curritem = string.gsub(string.lower(curritem),"'s","")
curritem = string.gsub(string.lower(curritem),"magical","")
curritem = string.gsub(string.lower(curritem),"glowing","")
curritem = string.gsub(string.lower(curritem),"humming","")
curritem = string.gsub(string.lower(curritem),"invis","")
curritem = string.gsub(string.lower(curritem),"blue","")

return curritem
end --KWShredder

function Trim(str)
if string.byte(str,1) == 32 then
	if string.byte(str,-1) == 32 then
		str = string.sub(str,2,-2)
	else
		str = string.sub(str,2,-1)
	end --if
elseif string.byte(str,-1) == 32 then
	if string.byte(str,1) == 32 then
		str = string.sub(str,2,-2)
	else
		str = string.sub(str,1,-2)
	end --if
end --if
return str
end --Trim
]]>
</script>


</muclient>