# Monk Combo Assistant by Spherical ## # This plugin will automatically continue combos for monk class. ## # Version .9 ## # Optional Config values: # autoCombo (0|1) - #1 = on, 2 = off # autoCombo_spMin - Minimum sp percent to continue the combo. # autoCombo_combo - #1 = Quad blow, 2 = Thrust, 3 = Asura package comboAssist; use Plugins; use Globals; use Task; use Actor; use Commands; #Commands::cmdUseSkill use Log qw(message); Plugins::register('Monk Combo Assistant', 'Monk Combo Assistant', \&Unload, \&Reload); my $hooks = Plugins::addHooks( ['in_game', \&doSetUp], ['packet_skilluse', \&onSkillUseComplete] ); ## #Variables in Config file my $autoCombo; #1 = on, 2 = off my $autoCombo_spMin; #minimum sp percent to continue the combo. my $autoCombo_combo; #1 = Quad blow, 2 = Thrust, 3 = Asura ## #Plugin variables my $combo; my $combo_attempts; my $combo_success; sub Unload { foreach my $hook (@{$hooks}) { Plugins::delHook($hook); } undef @{$hooks}; } sub Reload { &Unload; message "[MCA] : Reload Successful.\n"; } sub doSetUp { $autoCombo = ( (exists $config{autoCombo}) ? $config{autoCombo} : 1 ); if ( $autoCombo && ( $char->{'jobID'} == 15 || 4016 || 4070 ) ) { #jobIDs can be found in globals.pm message "[MCA] : Monk Combo Assistant Activate.\n"; message "[MCA] : Loading Settings.\n"; $combo = 0; $autoCombo = ( (exists $config{autoCombo}) ? $config{autoCombo} : 1 ); $autoCombo_spMin = ( (exists $config{autoCombo_spMin}) ? $config{autoCombo_spMin} : 60 ); $autoCombo_combo = ( (exists $config{autoCombo_combo}) ? $config{autoCombo_combo} : 1 ); message "[MCA] : Settings Loaded $autoCombo , $autoCombo_spMin , $autoCombo_combo.\n"; } else { &Unload } } sub onSkillUseComplete { my ($self, $args) = @_; my $tmp = $args->{targetID}; if ($autoCombo) { if ($args->{sourceID} == $accountID) { if (int($char->{'sp'}/$char->{'sp_max'} * 100) >= $autoCombo_spMin) { if ($args->{skillID} == 263 && $autoCombo_combo > 0) { #Raging Trifecta Blow if (!$combo) { $taskManager->add(Task::Timeout->new( object => undef, function => sub{ \&castSkill(272, $tmp); }, seconds => (((200-($char->{'attack_speed'}))/50)+.05), inGame => 1, weak => 1 )); $combo = 1; } } } if ($args->{skillID} == 272) { #Raging Quadruple Blow $combo_success++; my $percentSuccess = int($combo_success/$combo_attempts*100); message "[MCA] : Combo successfully continued. [$percentSuccess \% success rate of $combo_attempts attempts.]\n"; if (!$combo && $char->{spirits} > 0 && $autoCombo_combo > 1) { $taskManager->add(Task::Timeout->new( object => undef, function => sub{ \&castSkill(273, $args->{targetID}); }, seconds => (((200-$char->{'attack_speed'})/50)+.05), inGame => 1, weak => 1 )); $combo = 1; } } elsif ($args->{skillid} == 273 && $autoCombo_combo > 2) { #Raging Thrust if (!$combo && $char->{spirits} == 4) { #need test for fury $taskManager->add(Task::Timeout->new( object => undef, function => sub{ \&castSkill(273, $args->{targetID}); }, seconds => (((200-$char->{'attack_speed'})/50)+.05), inGame => 1, weak => 1 )); $combo = 1; } } } } } sub castSkill { my $target = ($_[1] ne undef) ? Actor::get($_[1]) : undef; #if ($target->{dead}) { #my $tmp = $monsters_old{$_[1]}{dead}; #message "Monster is dead : $tmp.\n"; #if ($monsters_old{$_[1]}{dead}) { $combo = 0; } my $targetDead = ($target) ? $target->{dead} : 1; if ($combo && !$targetDead) { $combo_attempts++; Commands::cmdUseSkill("ss", "$_[0]"); } $combo = 0; } 1;