Page 1 of 1

dcBeforeLevelUp

Posted: 04 Apr 2008, 23:12
by kingkevz

Code: Select all

# dcBeforeLevelUp Plugin
# -whatisopenkore (Darkmoon Forums Member)
# (regards to punkpudding for his dcBefore99 Plugin)
# visit the official website at www.openkore.com
# Or join the discussion at the forums: darkmoon.ath.cx

package dcBeforeLevelUp;

use strict;
use Plugins;
use Globals;
use Log qw(message warning error);
use Misc;

Plugins::register('dcBeforeLevelUp', 'disconnect before leveling up', \&Unload);
my $hook = Plugins::addHook('AI_post', \&dcBefore99);

sub Unload {
   Plugins::delHook('AI_post', $hook);
}

my $timeout;

sub dcBeforeLevelUp {
   if (main::timeOut($timeout, 1)) {
      my $basePercent = ($chars[$config{'char'}]{'exp'} / $chars[$config{'char'}]{'exp_max'} * 100) if $chars[$config{'char'}]{'exp_max'};
      if ($chars[$config{'char'}]  && $basePercent >= 99.98) {
         message("Disconnecting before Leveling-Up!!\n", "system");
         quit();
      }
      $timeout = time;
   }
}

return 1;

You can change the exp % wherin kore will disconnect! Search this line: $basePercent >= 99.98) and change 99.98(default) into what % you want!

Re: dcBeforeLevelUp

Posted: 05 Apr 2008, 02:29
by sli
Make the percentage a config value. Users shouldn't have to modify code.