When I set the "passive" to "0" and the "minAmount" to some number.
But it only is checked once, before open storage.
I traced the code. I found the following:
The code in src/Network/Receive/ServerType0.pm
Code: Select all
sub storage_opened {
my ($self, $args) = @_;
$storage{items} = $args->{items};
$storage{items_max} = $args->{items_max};
$ai_v{temp}{storage_opened} = 1;
if (!$storage{opened}) {
$storage{opened} = 1;
$storage{openedThisSession} = 1;
message T("Storage opened.\n"), "storage";
Plugins::callHook('packet_storage_open');
}
}
And then, it is never set back to "0".
The code in src/AI/CoreLogic.pm
Code: Select all
if ($config{"getAuto_${i}_minAmount"} ne "" &&
$config{"getAuto_${i}_maxAmount"} ne "" &&
!$config{"getAuto_${i}_passive"} &&
(!$item ||
($amount <= $config{"getAuto_${i}_minAmount"} &&
$amount < $config{"getAuto_${i}_maxAmount"})
)
) {
if ($storage{opened} && findKeyString(\%storage, "name", $config{"getAuto_$i"}) eq '') {
if ($config{"getAuto_${i}_dcOnEmpty"}) {
message TF("Disconnecting on empty %s!\n", $config{"getAuto_$i"});
chatLog("k", TF("Disconnecting on empty %s!\n", $config{"getAuto_$i"}));
quit();
}
} else {
if ($storage{openedThisSession} && findKeyString(\%storage, "name", $config{"getAuto_$i"}) eq '') {
} else {
my $sti = $config{"getAuto_$i"};
if ($needitem eq "") {
$needitem = "$sti";
} else {$needitem = "$needitem, $sti";}
}
}
}
.......
.......
# Only autostorage when we're on an attack route, or not moving
if ((!defined($routeIndex) || $attackOnRoute > 1) && $needitem ne "" &&
$char->inventory->size() > 0 ){
message TF("Auto-storaging due to insufficient %s\n", $needitem);
AI::queue("storageAuto");
}
$timeout{'ai_storageAuto'}{'time'} = time;
If the $needitem is empty, then never do the "storageAuto" task !