Openkore.com

OpenKore Forums
It is currently 21 Oct 2017, 11:37

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 119 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12
Author Message
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 16 Sep 2012, 06:50 
Offline
Noob
Noob

Joined: 30 Jul 2012, 09:35
Posts: 16
Quote:
################################
# Name of Plugin: follow_wait.pl
# Author: dijedodol@yahoo.com
# Instruction:
# follow_wait 1
# follow_wait_minDistance 5
# follow_wait_maxDistance 20
# follow_wait_preLostTimeOut 1
# follow_wait_timeout 0
# follow_wait_positionTimeOut 2
# follow_wait_searchAttackOnRoute 1
# Description:
# follow_wait = enable / disabled follow_wait
# follow_wait_minDistance = wait until this distance is reached
# follow_wait_maxDistance = distance before follow wait trigger lost check
# follow_wait_preLostTimeOut = when max distance is reached, keep ignoring for x sec before party member is marked as lost
# follow_wait_timeout = when party member is lost, wait x sec (sitting) until party member is arrived
# follow_wait_positionTimeOut = when party member is lost and wait timeout has been triggered, start moving to search for party member and check his latest location every x sec
# follow_wait_searchAttackOnRoute = openkore route AI, allow to attack monster or not while moving to search for party member
################################

package follow_wait;

use Time::HiRes qw(time);
use Plugins;
use Globals;
use Utils::DataStructures qw(existsInList);
use Log qw(message warning error debug);

Plugins::register('follow_wait', 'Wait for party member following you', \&unload, \&reload);
my $hooks = Plugins::addHooks(['mainLoop_pre', \&followWaitMainWrapper, undef]);

my $checkInterval = 500_000 / 1000_000;
my $lastCheckTick = 0;

my $isSearching = 0;
my $lostMemberUserId = 0;
my $preLostTimeOutTick = 0;
my $pauseMovementTimeOutTick = 0;
my $lostMemberPositionLastTick = 0;

sub unload {
Plugins::delHooks($hooks);
}

sub reload {
Plugins::delHooks($hooks);
}

sub followWaitMainWrapper {
return unless ($config{'follow_wait'});
return unless ((time() - $lastCheckTick) > $checkInterval);
followWaitMain();
$lastCheckTick = time();
}

sub followWaitMain {
return if (!$net || $net->getState() != Network::IN_GAME);
return unless ($AI == AI::AUTO);
return unless ($char->{party});
return unless (!AI::inQueue("storageAuto","storageGet","sellAuto","buyAuto"));

if ($isSearching != 1 && $isSearching != 2) {
resumeMovement();
}

if ($isSearching == 0) {
for (my $i = 0; $i < @partyUsersID; $i++) {
my $memberUserId = $partyUsersID[$i];
next if ($memberUserId eq "");
next if ($memberUserId eq $accountID);
next unless ($char->{'party'}{'users'}{$memberUserId}{'online'});
next unless $config{'follow_wait_list'} eq "" || existsInList($config{'follow_wait_list'}, $char->{'party'}{'users'}{$memberUserId}{'name'});

my $isMemberAround = isMemberAround($memberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
next;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
next;
} elsif ($isMemberAround == 2) {
#ignore offline party member
next;
} elsif ($isMemberAround == 3) {
#ignore unknown party member location
next;
} elsif ($isMemberAround == 4) {
#party member is on the different map, skip directly to party member search
$isSearching = 4;
$lostMemberUserId = $memberUserId;
last;
} elsif ($isMemberAround == 5) {
#party member is on the same map, try pausing movement to wait
$lostMemberUserId = $memberUserId;
if ($config{'follow_wait_timeout'} == 0) {
#skip directly to party member search, waiting has been disabled
$isSearching = 3;
} elsif ($config{'follow_wait_preLostTimeOut'}) {
#ignore until pre-lost timeout occured
warning "Party member pre-lost: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 5;
$preLostTimeOutTick = time();
} else {
#wait party member until timeout
$isSearching = 1;
}
last;
} elsif ($isMemberAround == 255) {
#party member is currently on sight
next;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
next;
}
}
} elsif ($isSearching == 1) {
$pauseMovementTimeOutTick = time();
pauseMovement();
$isSearching = 2;
} elsif ($isSearching == 2) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to user offline!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 3) {
if (Utils::timeOut($pauseMovementTimeOutTick, $config{'follow_wait_timeout'})) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." wait due to timeout and unknown user location!\n";
$isSearching = 0;
resumeMovement();
}
} elsif ($isMemberAround == 255) {
warning "Party member arrived: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 4 || $isMemberAround == 5) {
if (Utils::timeOut($pauseMovementTimeOutTick, $config{'follow_wait_timeout'})) {
#timeout on waiting party member to arrive, initiate party member search
warning "Timeout waiting for party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} .", initiating party member search!\n";
if($isMemberAround == 4) {
#not on the same map
$isSearching = 4;
} else {
#on the same map
$isSearching = 3;
}
resumeMovement();
}
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
resumeMovement();
}
} elsif ($isSearching == 3) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to user offline!\n";
$isSearching = 0;
} elsif ($isMemberAround == 3) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to unknown user location!\n";
$isSearching = 0;
} elsif ($isMemberAround == 4) {
#not on the same map
$isSearching = 4;
} elsif ($isMemberAround == 5) {
if (Utils::timeOut($lostMemberPositionLastTick, $config{'follow_wait_positionTimeOut'})) {
#warning "Updating search location for party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." too far away!\n";
$lostMemberPositionLastTick = time();
searchPartyMember($lostMemberUserId);
}
} elsif ($isMemberAround == 255) {
warning "Party member found: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
}
} elsif ($isSearching == 4) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to user offline!\n";
$isSearching = 0;
} elsif ($isMemberAround == 3) {
#unknown position on the same map, initiate wait
$isSearching = 1;
} elsif ($isMemberAround == 4) {
if (Utils::timeOut($lostMemberPositionLastTick, $config{'follow_wait_positionTimeOut'})) {
(my $memberMap = $char->{'party'}{'users'}{$memberUserId}{'map'}) =~ s/\.gat//;
if ($memberMap eq $config{'saveMap'} && $config{'follow_wait_saveMapTeleport'}) {
Misc::useTeleport(2);
} else {
#warning "Updating search location for party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." not on the same map!\n";
$lostMemberPositionLastTick = time();
searchPartyMember($lostMemberUserId);
}
}
} elsif ($isMemberAround == 5) {
#on the same map
$isSearching = 3;
} elsif ($isMemberAround == 255) {
warning "Party member found: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
}
} elsif ($isSearching == 5) {
if (Utils::timeOut($preLostTimeOutTick, $config{'follow_wait_preLostTimeOut'})) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." pre-lost due to user offline!\n";
$isSearching = 0;
} elsif ($isMemberAround == 3) {
#unknown position on the same map, initiate wait
$isSearching = 1;
} elsif ($isMemberAround == 4) {
#party member is on the different map
$isSearching = 4;
} elsif ($isMemberAround == 5) {
#party member is on the same map, try pausing movement to wait
if ($config{'follow_wait_timeout'} == 0) {
#skip directly to party member search, waiting has been disabled
$isSearching = 3;
} else {
#wait party member until timeout
$isSearching = 1;
}
} elsif ($isMemberAround == 255) {
#party member is currently on sight
warning "Pre-lost party member arrived: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
}
}
} else {
warning "Unexpected isSearching value: " .$isMemberAround ."!\n";
$isSearching = 0;
}
}

sub isMemberAround {
my $memberUserId = @_[0];
if ($memberUserId && $char->{'party'}{'users'}{$memberUserId}) {
if ($memberUserId eq $accountID) {
return 1;
} elsif (!$char->{'party'}{'users'}{$memberUserId}{'online'}) {
return 2;
} else {
(my $masterMap = $field->name) =~ s/\.gat//;
(my $memberMap = $char->{'party'}{'users'}{$memberUserId}{'map'}) =~ s/\.gat//;

if ($char->{'party'}{'users'}{$memberUserId}{'pos'}{'x'} == 0 && $char->{'party'}{'users'}{$memberUserId}{'pos'}{'y'} == 0) {
if ($masterMap eq $memberMap) {
return 3;
} else {
return 4;
}
} elsif ($masterMap ne $memberMap) {
return 4;
} else {
$memberDistance = Utils::distance($char->{'party'}{'users'}{$memberUserId}{'pos'}, $char->{'pos_to'});
if ($isSearching) {
if ($memberDistance <= $config{'follow_wait_minDistance'}) {
return 255;
} else {
return 5;
}
} else {
if ($memberDistance <= $config{'follow_wait_maxDistance'}) {
return 255;
} else {
return 5;
}
}
}
}
} else {
return 0;
}
}

sub searchPartyMember {
my $memberUserId = @_[0];
(my $memberMap = $char->{'party'}{'users'}{$memberUserId}{'map'}) =~ s/\.gat//;
my $memberX = $char->{'party'}{'users'}{$memberUserId}{'pos'}{'x'};
my $memberY = $char->{'party'}{'users'}{$memberUserId}{'pos'}{'y'};

if ($memberX == 0 && $memberY == 0) {
undef $memberX;
undef $memberY;
}

if (!AI::ai_getAggressives()) {
warning "Searching for party member: " .$char->{'party'}{'users'}{$memberUserId}{'name'} ." on map: " .$memberMap ."(" .$memberX .", " .$memberY .")!\n";
AI::clear("move", "route", "mapRoute");
AI::ai_route($memberMap, $memberX, $memberY,
attackOnRoute => $config{'follow_wait_searchAttackOnRoute'},
noSitAuto => 1,
notifyUponArrival => 1);
}
}

sub pauseMovement {
if (!$char->{'sitting'}) {
warning "Pausing AI movement!\n";
Commands::cmdSit();
}
}

sub resumeMovement {
if ($char->{'sitting'}) {
warning "AI movement has been resumed!\n";
Commands::cmdStand();
}
}

return 1;



Thanks for this plugins this works as a charm cheers


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 13 Sep 2014, 10:44 
Offline
Human
Human

Joined: 04 Aug 2010, 05:46
Posts: 21
Mucilon wrote:
This plugin was made and posted at old forum by Chontrad, at this address: http://bibian.ath.cx/openkore/viewtopic.php?t=38379
Originaly it was made upon modifications to openkore base code, so to get this work to the original openkore, I made some changes to this plugin.

What it does:
This great plugin was made to be used at the party's masterbot, checking if the follow bot is around, if not, the masterbot will search for it, walking to followbot's last known position. When they found each other, the masterbot will clear the AI and return to its AI normal sequence...
This plugin can replace the followBot option at config.txt, where the followbot sends pms to masterbot, telling him where to go (the place where the followbot is).
This plugin is better then followBot option at config.txt, cause at this option the masterbot normally pass thru the followbot, walking to the position where the followbot was a few seconds ago and both walk back some steps before the masterbot return to its normal AI sequence. At this plugin as soon as the followbot is insight of the masterbot (based on followDistanceMax of the masterbot) the masterbot returns to its normal AI sequence.
TIP: If you have a buffer and a melee in a party, just use the follow 1 at the buffer bot and the follow_wait 1 at the melee bot. You don't need to use the follow_wait 1 to both. In this case, masterbot = melee bot and followbot = buffer bot.

Changes:
v1.0
- Inserted the AI_pre hook, so the plugin could work, since I don't know where were placed the new hooks made by Chontrad at the mod openkore base code.
- Take off the sit and stand commands, with the new hook (AI_pre), the bot was playing of sit and stand...
- I didn't take off the other hooks, but I think that most of them don't exist!
- Translated the messages.
- Added follow_wait_inLockOnly option, thanks to fco2783. (16/05/2008)

v1.1
- Added follow_wait_noPartyMember option (03/10/2008)
- Added follow_wait_timeOut option (03/10/2008)

How to Install:
1) Download the file waitParty.pl.
2) Place it at plugins folder.

How to Use:
Just use this at config.txt.
Code:
follow_wait 1       #(0|1) Use 1 to enable the plugin to run.
follow_wait_inLockOnly        #(0|1) Use 1 to enable the bot to wait for party only at lock map
follow_wait_timeOut 20       #Number of seconds between each check of distance to the followbot
follow_wait_noPartyMember <partyname>       #Name of a player at the party to do not wait for him (only one name)


File:
Attachment:
waitParty.pl


Author's Version (Chontrad) DON'T USE THIS VERSION, IT'S OUTDATED.
How to install :
The author uses self defined hooks instead of 'AI_pre' to reduce PC usage.
So you must copy the modified <Src\Network\Receive.pm> file.
The author use 'Bahasa' instead of 'English' to promote INDONESIA. :D
But it is already translated.

How to use :
<config.txt>
wait4party (0|1) Wait4Party On or Off
wait4party_sameMapOnly (0|1) Only activate if the party member are in the same map
wait4party_waitBySitting (0|1) Don't search, just sit and wait
wait4party_followSit (0|1) Sitting when party is sitting
ATTENTION! Turn off 'followSitAuto' or they'll sit forever!

Attachment:
waitForParty.pl

Attachment:
Receive.pm

I hope you enjoy it! ;)




LINK UPDATE PLEASE


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 13 Sep 2014, 18:01 
Offline
Human
Human

Joined: 04 Aug 2010, 05:46
Posts: 21
LINK UPDATE PLEASE FOR LAST VERSION OPENKORE


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 22 Apr 2017, 15:59 
Offline
Human
Human

Joined: 28 Mar 2017, 03:08
Posts: 39
Would be gr8 to have newest version :)


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 23 Apr 2017, 00:58 
Offline
Moderators
Moderators
User avatar

Joined: 16 Dec 2011, 02:53
Posts: 1148
Location: Brazil
3 years my brother ? why !

_________________
"'There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.'" :P

Click here and travel to a new world -> Newbies
Read before asking something.
How to connect to private servers


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 25 Jul 2017, 02:18 
Offline
Human
Human

Joined: 11 Jul 2017, 00:49
Posts: 37
unholysin wrote:
Quote:
################################
# Name of Plugin: follow_wait.pl
# Author: dijedodol@yahoo.com
# Instruction:
# follow_wait 1
# follow_wait_minDistance 5
# follow_wait_maxDistance 20
# follow_wait_preLostTimeOut 1
# follow_wait_timeout 0
# follow_wait_positionTimeOut 2
# follow_wait_searchAttackOnRoute 1
# Description:
# follow_wait = enable / disabled follow_wait
# follow_wait_minDistance = wait until this distance is reached
# follow_wait_maxDistance = distance before follow wait trigger lost check
# follow_wait_preLostTimeOut = when max distance is reached, keep ignoring for x sec before party member is marked as lost
# follow_wait_timeout = when party member is lost, wait x sec (sitting) until party member is arrived
# follow_wait_positionTimeOut = when party member is lost and wait timeout has been triggered, start moving to search for party member and check his latest location every x sec
# follow_wait_searchAttackOnRoute = openkore route AI, allow to attack monster or not while moving to search for party member
################################

package follow_wait;

use Time::HiRes qw(time);
use Plugins;
use Globals;
use Utils::DataStructures qw(existsInList);
use Log qw(message warning error debug);

Plugins::register('follow_wait', 'Wait for party member following you', \&unload, \&reload);
my $hooks = Plugins::addHooks(['mainLoop_pre', \&followWaitMainWrapper, undef]);

my $checkInterval = 500_000 / 1000_000;
my $lastCheckTick = 0;

my $isSearching = 0;
my $lostMemberUserId = 0;
my $preLostTimeOutTick = 0;
my $pauseMovementTimeOutTick = 0;
my $lostMemberPositionLastTick = 0;

sub unload {
Plugins::delHooks($hooks);
}

sub reload {
Plugins::delHooks($hooks);
}

sub followWaitMainWrapper {
return unless ($config{'follow_wait'});
return unless ((time() - $lastCheckTick) > $checkInterval);
followWaitMain();
$lastCheckTick = time();
}

sub followWaitMain {
return if (!$net || $net->getState() != Network::IN_GAME);
return unless ($AI == AI::AUTO);
return unless ($char->{party});
return unless (!AI::inQueue("storageAuto","storageGet","sellAuto","buyAuto"));

if ($isSearching != 1 && $isSearching != 2) {
resumeMovement();
}

if ($isSearching == 0) {
for (my $i = 0; $i < @partyUsersID; $i++) {
my $memberUserId = $partyUsersID[$i];
next if ($memberUserId eq "");
next if ($memberUserId eq $accountID);
next unless ($char->{'party'}{'users'}{$memberUserId}{'online'});
next unless $config{'follow_wait_list'} eq "" || existsInList($config{'follow_wait_list'}, $char->{'party'}{'users'}{$memberUserId}{'name'});

my $isMemberAround = isMemberAround($memberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
next;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
next;
} elsif ($isMemberAround == 2) {
#ignore offline party member
next;
} elsif ($isMemberAround == 3) {
#ignore unknown party member location
next;
} elsif ($isMemberAround == 4) {
#party member is on the different map, skip directly to party member search
$isSearching = 4;
$lostMemberUserId = $memberUserId;
last;
} elsif ($isMemberAround == 5) {
#party member is on the same map, try pausing movement to wait
$lostMemberUserId = $memberUserId;
if ($config{'follow_wait_timeout'} == 0) {
#skip directly to party member search, waiting has been disabled
$isSearching = 3;
} elsif ($config{'follow_wait_preLostTimeOut'}) {
#ignore until pre-lost timeout occured
warning "Party member pre-lost: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 5;
$preLostTimeOutTick = time();
} else {
#wait party member until timeout
$isSearching = 1;
}
last;
} elsif ($isMemberAround == 255) {
#party member is currently on sight
next;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
next;
}
}
} elsif ($isSearching == 1) {
$pauseMovementTimeOutTick = time();
pauseMovement();
$isSearching = 2;
} elsif ($isSearching == 2) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to user offline!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 3) {
if (Utils::timeOut($pauseMovementTimeOutTick, $config{'follow_wait_timeout'})) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." wait due to timeout and unknown user location!\n";
$isSearching = 0;
resumeMovement();
}
} elsif ($isMemberAround == 255) {
warning "Party member arrived: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
resumeMovement();
} elsif ($isMemberAround == 4 || $isMemberAround == 5) {
if (Utils::timeOut($pauseMovementTimeOutTick, $config{'follow_wait_timeout'})) {
#timeout on waiting party member to arrive, initiate party member search
warning "Timeout waiting for party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} .", initiating party member search!\n";
if($isMemberAround == 4) {
#not on the same map
$isSearching = 4;
} else {
#on the same map
$isSearching = 3;
}
resumeMovement();
}
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
resumeMovement();
}
} elsif ($isSearching == 3) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to user offline!\n";
$isSearching = 0;
} elsif ($isMemberAround == 3) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to unknown user location!\n";
$isSearching = 0;
} elsif ($isMemberAround == 4) {
#not on the same map
$isSearching = 4;
} elsif ($isMemberAround == 5) {
if (Utils::timeOut($lostMemberPositionLastTick, $config{'follow_wait_positionTimeOut'})) {
#warning "Updating search location for party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." too far away!\n";
$lostMemberPositionLastTick = time();
searchPartyMember($lostMemberUserId);
}
} elsif ($isMemberAround == 255) {
warning "Party member found: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
}
} elsif ($isSearching == 4) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." search due to user offline!\n";
$isSearching = 0;
} elsif ($isMemberAround == 3) {
#unknown position on the same map, initiate wait
$isSearching = 1;
} elsif ($isMemberAround == 4) {
if (Utils::timeOut($lostMemberPositionLastTick, $config{'follow_wait_positionTimeOut'})) {
(my $memberMap = $char->{'party'}{'users'}{$memberUserId}{'map'}) =~ s/\.gat//;
if ($memberMap eq $config{'saveMap'} && $config{'follow_wait_saveMapTeleport'}) {
Misc::useTeleport(2);
} else {
#warning "Updating search location for party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." not on the same map!\n";
$lostMemberPositionLastTick = time();
searchPartyMember($lostMemberUserId);
}
}
} elsif ($isMemberAround == 5) {
#on the same map
$isSearching = 3;
} elsif ($isMemberAround == 255) {
warning "Party member found: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
}
} elsif ($isSearching == 5) {
if (Utils::timeOut($preLostTimeOutTick, $config{'follow_wait_preLostTimeOut'})) {
my $isMemberAround = isMemberAround($lostMemberUserId);
if ($isMemberAround == 0) {
warning "Unknown party member User ID: " .$lostMemberUserId ."!\n";
$isSearching = 0;
} elsif ($isMemberAround == 1) {
warning "Unexpected follow_wait searching own self!\n";
$isSearching = 0;
} elsif ($isMemberAround == 2) {
warning "Canceling party member: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ." pre-lost due to user offline!\n";
$isSearching = 0;
} elsif ($isMemberAround == 3) {
#unknown position on the same map, initiate wait
$isSearching = 1;
} elsif ($isMemberAround == 4) {
#party member is on the different map
$isSearching = 4;
} elsif ($isMemberAround == 5) {
#party member is on the same map, try pausing movement to wait
if ($config{'follow_wait_timeout'} == 0) {
#skip directly to party member search, waiting has been disabled
$isSearching = 3;
} else {
#wait party member until timeout
$isSearching = 1;
}
} elsif ($isMemberAround == 255) {
#party member is currently on sight
warning "Pre-lost party member arrived: " .$char->{'party'}{'users'}{$lostMemberUserId}{'name'} ."!\n";
$isSearching = 0;
} else {
warning "Unexpected isMemberAround result: " .$isMemberAround ."!\n";
$isSearching = 0;
}
}
} else {
warning "Unexpected isSearching value: " .$isMemberAround ."!\n";
$isSearching = 0;
}
}

sub isMemberAround {
my $memberUserId = @_[0];
if ($memberUserId && $char->{'party'}{'users'}{$memberUserId}) {
if ($memberUserId eq $accountID) {
return 1;
} elsif (!$char->{'party'}{'users'}{$memberUserId}{'online'}) {
return 2;
} else {
(my $masterMap = $field->name) =~ s/\.gat//;
(my $memberMap = $char->{'party'}{'users'}{$memberUserId}{'map'}) =~ s/\.gat//;

if ($char->{'party'}{'users'}{$memberUserId}{'pos'}{'x'} == 0 && $char->{'party'}{'users'}{$memberUserId}{'pos'}{'y'} == 0) {
if ($masterMap eq $memberMap) {
return 3;
} else {
return 4;
}
} elsif ($masterMap ne $memberMap) {
return 4;
} else {
$memberDistance = Utils::distance($char->{'party'}{'users'}{$memberUserId}{'pos'}, $char->{'pos_to'});
if ($isSearching) {
if ($memberDistance <= $config{'follow_wait_minDistance'}) {
return 255;
} else {
return 5;
}
} else {
if ($memberDistance <= $config{'follow_wait_maxDistance'}) {
return 255;
} else {
return 5;
}
}
}
}
} else {
return 0;
}
}

sub searchPartyMember {
my $memberUserId = @_[0];
(my $memberMap = $char->{'party'}{'users'}{$memberUserId}{'map'}) =~ s/\.gat//;
my $memberX = $char->{'party'}{'users'}{$memberUserId}{'pos'}{'x'};
my $memberY = $char->{'party'}{'users'}{$memberUserId}{'pos'}{'y'};

if ($memberX == 0 && $memberY == 0) {
undef $memberX;
undef $memberY;
}

if (!AI::ai_getAggressives()) {
warning "Searching for party member: " .$char->{'party'}{'users'}{$memberUserId}{'name'} ." on map: " .$memberMap ."(" .$memberX .", " .$memberY .")!\n";
AI::clear("move", "route", "mapRoute");
AI::ai_route($memberMap, $memberX, $memberY,
attackOnRoute => $config{'follow_wait_searchAttackOnRoute'},
noSitAuto => 1,
notifyUponArrival => 1);
}
}

sub pauseMovement {
if (!$char->{'sitting'}) {
warning "Pausing AI movement!\n";
Commands::cmdSit();
}
}

sub resumeMovement {
if ($char->{'sitting'}) {
warning "AI movement has been resumed!\n";
Commands::cmdStand();
}
}

return 1;



Thanks for this plugins this works as a charm cheers

Anyone have an updated version of this or any idea on how to fix this plugin ignoring the follow_wait_preLostTimeOut setting? It works aside from the fact it instantly tries to search soon as the slave is out of range and ignores the timer i set, or is there some other plugin that actually works?


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 16 Sep 2017, 16:02 
Offline
Noob
Noob

Joined: 24 Oct 2008, 01:12
Posts: 2
Has anyone a mirror of the link? It is dead! =X


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 16 Sep 2017, 17:46 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 325
https://github.com/OpenKore/openkore/tr ... arty/trunk

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: waitForParty -- Don't get separeted! by Chontrad
PostPosted: 24 Sep 2017, 11:32 
Offline
Plain Yogurt
Plain Yogurt

Joined: 10 Jul 2008, 08:20
Posts: 52
Mortimal wrote:
https://github.com/OpenKore/openkore/tree/master/plugins/needs-review/wait4party/trunk


Why is it in the "needs review" folder? Is it no longer working?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 119 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group