does svn support petfeeder.pl?

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
koodpzok
Human
Human
Posts: 26
Joined: 21 Jul 2009, 13:27
Noob?: No

does svn support petfeeder.pl?

#1 Post by koodpzok »

i have petfeeder.pl in my plugins then when i run the bot, the error wouldnt occur, but if i add
petFeeder 1
petSmartFeed 0
petFeedRate 71
petMinHunger 20
petPerformanceRate 30
petPerformanceRateSeed 30
petPerformance_notOnAction attack, skill_use

the error will occured as the pic below

Image

is it related to the openkoresvn version? im using 2.0.7

somebody helpz please
Hi everyone dont scold me plz

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: does svn support petfeeder.pl?

#2 Post by Technology »

nope, tho it shouldn't be too hard to port it to 2.0.7, post it here

moving to plugin section...
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

midnytblu
Developers
Developers
Posts: 90
Joined: 14 Apr 2008, 09:37
Noob?: No
Location: prt_fild08 134 362

Re: does svn support petfeeder.pl?

#3 Post by midnytblu »

Code: Select all

# petFeeder v1.5
# -by punkpudding

package petFeeder;

use strict;
use Time::HiRes qw(time);
use Globals;
use Plugins;
use Log qw(debug message warning error);
use Utils;
use Commands;
use Network;
use Network::Send;

Plugins::register('petFeeder', 'petFeeder by punkpudding', \&onUnload, \&onReload);
my $hookCommandPost = Plugins::addHook('Command_post', \&onCommandPost);
my $hookAIpre = Plugins::addHook('AI_pre', \&onAIpre);
my $hookParseMsgPre = Plugins::addHook('parseMsg/pre', \&onParseMsgPre);

message "Pet feeding plugin loaded\n", "success";

my %pet;
my $hunger = 72;
my $performanceRate = $config{petPerformanceRate};


sub onUnload {
   Plugins::delHook('parseMsg/pre', $hookParseMsgPre);
   Plugins::delHook('AI_pre', $hookAIpre);
   Plugins::delHook('Command_post', $hookCommandPost);
   message "Pet feeding plugin unloaded\n", "success";
}

sub onReload {
   &onUnload;
}

sub onCommandPost {
   my (undef, $args) = @_;
   my ($cmd, $subcmd) = split(' ', $args->{input}, 2);
   if ($cmd eq "pet" && $config{petFeeder}) {
      if ($subcmd eq "s" || $subcmd eq "status") {
         message "Pet status: hungry=$pet{hungry} intimacy=$pet{friendly}\n";
      } elsif ($subcmd eq "f" || $subcmd eq "feed") {
         if ($pet{hungry} <= 72) {
            message "Feeding your pet. [current intimacy : $pet{friendly}]\n";
            sendPetFeed($::net);
            sendPetGetInfo($::net);
         } elsif ($pet{hungry} > 72) {
            message "Your pet's not yet hungry. Feeding him now will lower intimacy.\n";
         }
      } elsif ($subcmd eq "p" || $subcmd eq "performance") {
         message "Playing your pet.\n";
         sendPetPerformance($::net);
      } elsif ($subcmd eq "r" || $subcmd eq "return") {
         message "Returning pet to egg status.\n";
         sendPetReturnToEgg($::net);
      } elsif ($subcmd eq "u" || $subcmd eq "unequip") {
         message "Unequipping pet accessory.\n";
         sendPetUnequipItem($::net);
      } else {
         error "Syntax Error in function 'pet' (pet management)\n" .
            "Usage: pet < s[tatus] | f[eed] | p[erformance] | r[eturn] | u[nequip] >\n";
      }
      $args->{return} = 1;
   }
}

sub onAIpre {
   return unless ($main::conState == 5);
   if ($config{petFeeder}) {
      # request status
      if (timeOut($pet{lastStatusInfo}, 30)) {
         if (timeOut($pet{lastStatusRequest}, 10)) {
            $pet{lastStatusRequest} = time;
            sendPetGetInfo($::net);
            if ($pet{friendly} < 990) { $hunger = 72; }
            elsif ($pet{friendly} >=990) { $hunger = 30; }
         }
      }
      # pet performance
      if ((defined($config{petPerformanceRate}) && timeOut($pet{lastPerformance}, $performanceRate))
        && ((!$config{petPerformance_onAction}) || ($config{petPerformance_onAction} && existsInList($config{petPerformance_notOnAction}, AI::action())))
        && ((!$config{petPerformance_notOnAction}) || ($config{petPerformance_notOnAction} && !existsInList($config{petPerformance_notOnAction}, AI::action())))
      ) {
         sendPetPerformance($::net);
         message "Auto-playing your pet\n";
         $performanceRate = $config{petPerformanceRate} if !defined($performanceRate);
         $performanceRate = $config{petPerformanceRate} + int(rand $config{petPerformanceRateSeed}) if $config{petPerformanceRateSeed};
         $pet{lastPerformance} = time;
      }
   }
}

sub onParseMsgPre {
   my (undef, $args) = @_;
   my $switch = $args->{switch};
   my $msg = $args->{msg};
   # process status
   if ($switch eq "01A2" && $config{petFeeder}) {
      $pet{name} = substr($msg, 2, 24) =~ /([\s\S]*?)\000/;
      $pet{nameflag} = unpack("C1", substr($msg, 26, 1));
      $pet{level} = unpack("S1", substr($msg, 27, 2));
      $pet{hungry} = unpack("S1", substr($msg, 29, 2));
      $pet{friendly} = unpack("S1", substr($msg, 31, 2));
      $pet{accessory} = unpack("S1", substr($msg, 33, 2));
      $pet{lastStatusInfo} = time;
      debug "Pet status: level=$pet{level} hungry=$pet{hungry} intimacy=$pet{friendly}\n";
      if ($config{petSmartFeed}) {
         if ($pet{hungry} < $hunger && timeOut($pet{lastFeed}, 5) && $pet{friendly} > 0) {
            $pet{lastFeed} = time;
            sendPetFeed($::net);
            sendPetGetInfo($::net);
            message "Auto-feeding your pet. [current intimacy : $pet{friendly}]\n";
         }
         if ($pet{hungry} <= $config{petMinHunger} || $pet{hungry} <= 15) {
            sendPetReturnToEgg($::net);
            message "Critical hunger level reached. Pet returned to egg status.\n";
         }   
      } else {
         if ($pet{hungry} < $config{petFeedRate} && timeOut($pet{lastFeed}, 5) && $pet{friendly} > 0) {
            $pet{lastFeed} = time;
            sendPetFeed($::net);
            sendPetGetInfo($::net);
            message "Auto-feeding your pet. [current intimacy : $pet{friendly}]\n";
         }
         if ($pet{hungry} <= $config{petMinHunger} || $pet{hungry} <= 15) {
            sendPetReturnToEgg($::net);
            message "Critical hunger level reached. Pet returned to egg status.\n";
         }   
      }
   }
}

return 1;

kali
OpenKore Monk
OpenKore Monk
Posts: 457
Joined: 04 Apr 2008, 10:10

Re: does svn support petfeeder.pl?

#4 Post by kali »

midnyt, I suggest this be committed to SVN as well.

Checkout the plugins repo and change the petfeeder plugin there so we have a proper history :)

(sorry if that's already been done)
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

midnytblu
Developers
Developers
Posts: 90
Joined: 14 Apr 2008, 09:37
Noob?: No
Location: prt_fild08 134 362

Re: does svn support petfeeder.pl?

#5 Post by midnytblu »

@kali
sorry but that is the unmodified one... Technology asked for it so I posted it.

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: does svn support petfeeder.pl?

#6 Post by Technology »

yea, its not in openkore's repo, thats why i asked for it.
I've added these commands to kore a while ago (not sure if its complete).
But the autofeeding isn't in kore (yet).
This is also a system that can be moved out of kore, like eternal did with deal.

btw, the commands that kore has available are:

Code: Select all

Usage: pet [capture|hatch|status|info|feed|performance|return|unequip|name <name>]
woops, just noticed you can't capture a pet when you have one, thats a mistake ofcourse. ;)
(will fix together with another commit later)
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

Teknoslasher
Noob
Noob
Posts: 15
Joined: 25 Jan 2010, 21:53
Noob?: No

Re: does svn support petfeeder.pl?

#7 Post by Teknoslasher »

I'm going to go out on a limb and ask is there any other way of getting around autofeeding of pets? I've had a look at the Homonculus lines from the Wiki, but it left me with the question still of whether or not it could easily be incorporated into the pets?
The secret to creativity is to say an old thing in a new way or to say a new thing in an old way.” – Richard Harding Davis

maxchu
Noob
Noob
Posts: 4
Joined: 17 Dec 2010, 08:19
Noob?: Yes

Re: does svn support petfeeder.pl?

#8 Post by maxchu »

koodpzok wrote:i have petfeeder.pl in my plugins then when i run the bot, the error wouldnt occur, but if i add
petFeeder 1
petSmartFeed 0
petFeedRate 71
petMinHunger 20
petPerformanceRate 30
petPerformanceRateSeed 30
petPerformance_notOnAction attack, skill_use

the error will occured as the pic below

Image

is it related to the openkoresvn version? im using 2.0.7

somebody helpz please
Hi! I am new in OpenKore and nice to meet u all..

To koodpzok,
I also having the problem. But it is fixed in petFeeder v1.6. I hope this will be helping u..
http://forums.openkore.com/viewtopic.ph ... 1&start=10
Technology wrote:yea, its not in openkore's repo, thats why i asked for it.
I've added these commands to kore a while ago (not sure if its complete).
But the autofeeding isn't in kore (yet).
This is also a system that can be moved out of kore, like eternal did with deal.

btw, the commands that kore has available are:

Code: Select all

Usage: pet [capture|hatch|status|info|feed|performance|return|unequip|name <name>]
woops, just noticed you can't capture a pet when you have one, thats a mistake ofcourse. ;)
(will fix together with another commit later)
To Technology,
I am having question on the pet commands..
When i type "pet s" it only show my pet's name and accessory.
When i type "pet i" it doesn't show anything at all.

Is there a bug or i made a mistake on it?
Does it provide info like intimacy and hunger of pet?

Thanks.
Max
Image

Post Reply