critCount
Posted: 30 Jul 2008, 13:38
UPDATED: New hook name committed to SVN, plugin has been updated. No more complicated install procedure!
This is what it does:
No more editing required to install!
This is what it does:
This plugin isn't for those who aren't comfortable modifying OpenKore's source. If you don't like how I implemented the plugin, then you do it your own way. I wanted my crit percent displayed after every kill with the experience gained. Don't be surprised if it says 100% crit the first few times. Here's the plugin:Exp gained: 1293/0 (0.01%/0.00%)
Critical Percentage: 8.18% (Atks: 272 | Crits: 22)
Code: Select all
package critCount;
use Plugins;
Plugins::register('critCount','Various crit stats.', \&onUnload);
my $hooks = Plugins::addHooks(
['packet_attack', \&onAttack, undef],
['target_died', \&onKill, undef]
);
my $crits = 0;
my $attacks = 0;
my $critPerc = 0;
sub onAttack {
my @args = @_;
$attacks++;
if ($args[1]{'type'} == 10) {
$crits++;
$critPerc = ($crits / $attacks) * 100;
}
}
sub onKill {
printf "Critical Percentage: %.2f%% (Atks: %d | Crits: %d)\n", $critPerc, $attacks, $crits;
}
sub onUnload {
Plugins::deleteHooks($hooks);
}