Example of the trigger:
Code: Select all
You have finished forging the platemail greaves.
>>> Total: 101 platemail greaves
Code: Select all
You have forged the following amounts:
1 boots
10 stiletto
1 bracers
101 platemail greaves
Code: Select all
forgecount "item name" 12345
To configure, create a trigger, set it's type to "regexp" and use the following pattern:
Code: Select all
^You have finished forging the (.*)\.$
Code: Select all
if (gwc.userdata.forging === undefined) gwc.userdata.forging = {};
if (gwc.userdata.forging[args[1]] === undefined) gwc.userdata.forging[args[1]] = 0;
gwc.userdata.forging[args[1]]++;
gwc.output.append(">>> Total: " + gwc.userdata.forging[args[1]] + " " + args[1]);
gwc.output.color("#0053B3");
Code: Select all
if (args[1] !== undefined) {
if (args[2] == "remove") {
gwc.output.append("Removed forge count for " + args[1]);
delete gwc.userdata.forging[args[1]];
} else if ($.isNumeric(args[2])) {
gwc.output.append("Set forge count for " + args[1] + " to " + args[2]);
gwc.userdata.forging[args[1]] = parseInt(args[2], 10);
} else {
gwc.output.append("Usage: forgecount \"item\" count/remove");
}
return;
}
if (gwc.userdata.forging === undefined) {
gwc.output.append("No forgings have been counted.");
return;
}
gwc.output.append("You have forged the following amounts:");
gwc.output.color("#0053B3");
for (var key in gwc.userdata.forging) {
var count = gwc.userdata.forging[key].toString();
gwc.output.append(" ".substring(count.length) + count + " " + key);
}