Usage: herbcount
Description: Will list out all bundled herbs, their count in your inventory, and their rent and rent total.
Due to the fact that herbs do not have a common keyword, this alias actually works on ALL bundled items. Because of this, the count and rent of non-herb items will likely be incorrect. I will not fix this unless herbs get a common keyword.
#ALIAS {herbcount}
{
#VAR herbcounttable {};
#SEND offer bundle;
#ACTION {{\(\d+\sat\s\d+\seach\)\s+(\d+)\:\s(.+)}}
{
#LINE gag;
#IF {&herbcounttable[%%3]}
{
#MATH herbcounttable[%%3] {$herbcounttable[%%3] + %%2};
}
{
#VAR herbcounttable[%%3] {%%2};
}
}
{4};
#ACTION {%*}
{
#LINE gag;
}
{5};
#ACTION {{^You can(?:not)? rent here}}
{
#UNACTION {{\(\d+\sat\s\d+\seach\)\s+(\d+)\:\s(.+)}}
#UNACTION {%*};
#UNACTION {{^You can(?:not)? rent here}};
#LINE gag;
#ECHO {You have the following <169>bundled herbs<099>:};
#LOCAL herbcounthlm 0;
#LOCAL herbcounthclm 0;
#LOCAL herbcounthrlm 0;
#FOREACH *herbcounttable[%*] herb
{
#MATH count {$herbcounttable[$herb] / 15};
#FORMAT herbcounthl {%L} {$herb};
#IF {$herbcounthl > $herbcounthlm} {#VAR herbcounthlm $herbcounthl};
#MATH herbcounthclm {$herbcounthclm + $count};
#MATH herbcounthrlm {$herbcounthrlm + $herbcounttable[$herb]};
}
#UNVAR herbcounthl;
#FORMAT herbcounthclm {%L} $herbcounthclm;
#IF {$herbcounthclm < 5} {#VAR herbcounthclm 5};
#FORMAT herbcounthrlm {%L} $herbcounthrlm;
#LOCAL herbcountt 0;
#LOCAL herbcounttr 0;
#ECHO { <199>%-${herbcounthlm}s %+${herbcounthclm}s %+${herbcounthrlm}s<099>} {Herb} {Count} {Rent};
#FOREACH *herbcounttable[%*] herb
{
#MATH count {$herbcounttable[$herb] / 15};
#MATH herbcountt {$herbcountt + $count};
#MATH herbcounttr {$herbcounttr + $herbcounttable[$herb]};
#ECHO { %-${herbcounthlm}s %+${herbcounthclm}s %+${herbcounthrlm}s} {$herb} {$count} {$herbcounttable[$herb]};
}
#ECHO { <169>%-${herbcounthlm}s %+${herbcounthclm}s %+${herbcounthrlm}s<099>} {Total} {$herbcountt} {$herbcounttr};
#UNVAR count;
#UNVAR herbcoutntable;
}
{4};
};