https://github.com/OpenKore/openkore/bl ... erType0.pm
Code: Select all
# Your shop has sold an item -- one packet sent per item sold.
#
sub shop_sold {
	my ($self, $args) = @_;
	# sold something
	my $number = $args->{number};
	my $amount = $args->{amount};
	$articles[$number]{sold} += $amount;
	my $earned = $amount * $articles[$number]{price};
	$shopEarned += $earned;
	$articles[$number]{quantity} -= $amount;
	my $msg = TF("sold: %s - %s %sz\n", $amount, $articles[$number]{name}, $earned);
	shopLog($msg);
	message($msg, "sold");
	# Call hook before we possibly remove $articles[$number] or
	# $articles itself as a result of the sale.
	Plugins::callHook(
		'vending_item_sold',
		{
			#These first two entries are equivalent to $args' contents.
			'vendShopIndex' => $number,
			'amount' => $amount,
			'vendArticle' => $articles[$number], #This is a hash
		}
	);
	# Adjust the shop's articles for sale, and notify if the sold
	# item and/or the whole shop has been sold out.
	if ($articles[$number]{quantity} < 1) {
		message TF("sold out: %s\n", $articles[$number]{name}), "sold";
		#$articles[$number] = "";
		if (!--$articles){
			message T("Items have been sold out.\n"), "sold";
			closeShop();
		}
	}
}##end shop_sold()
but i can only get values from $args->{amount}, other $args return nothing.package tmNotify;
use Plugins;
use Globals;
Plugins::register('tmNotify','vending notification using terminal-notifier', \&onUnload);
my $hooks = Plugins::addHooks(
['start3', \&onLoad, undef],
['packet_privMsg', \&onPrivMsg, undef],
['map_loaded', \&onMapLoaded, undef],
['vending_item_sold', \&onItemSold, undef],
['packet_vender_store', \&onItemSold, undef]
);
my $cmd = Commands::register(
["tmnotify", "test notification", \&cmdNotify],
);
my $dead = 0;
sub cmdNotify {
my @args = @_;
print qx(terminal-notifier -title 'cmdNotify' -message 'tmNotify is working !');
}
sub onLoad {
print qx(terminal-notifier -title 'onLoad' -message 'Notify is loaded !');
}
sub onPrivMsg {
my @args = @_;
# growlMessage("From $args[1]{'privMsgUser'} : $args[1]{privMsg}", 1);
$user = $args[1]{'privMsgUser'};
$msg = $args[1]{'privMsg'};
print qx(terminal-notifier -title 'onPrivMsg' -message '$user : $msg');
}
sub onItemSold {
my $number = $args->{number};
my $amount = $args->{amount};
$articles[$number]{sold} += $amount;
my $earned = $amount * $articles[$number]{price};
$shopEarned += $earned;
$articles[$number]{quantity} -= $amount;
my $msg = $args->{RAW_MSG};
print qx(terminal-notifier -title 'onItemSold' -message '$number - $amount - $msg');
}
sub onMapLoaded {
# Prevents multiple notifications on death.
$dead = 0;
}
sub onUnload {
Plugins::delHooks($hooks);
undef $ucname;
}
1;
how to get other $args value so i can get item name ?
thanks


