OpenKore / openkore

A free/open source client and automation tool for Ragnarok Online
http://openkore.com
Other
1.28k stars 1.04k forks source link

Autobuy -> Overweight #1526

Open Fvegini opened 6 years ago

Fvegini commented 6 years ago

------------------ Bug Report Template ------------------

Summary:

Kore keeps trying to "autobuy" when weight is full instead of do an autosell and only then do the autobuy

Affected configuration(s)/ file(s):

config.txt

Impact:

Openkore keeps stucked until manually insert an "autosell" or "autostorage" command

Expected Behavior:

When kore got the error from autobuy, it should try to release from the items exceed, selling or storaging then (if none are configurated, then it should keep stucked)

Actual Behavior:

Kore jeeps stuck in the autobuy routine

peso

sctnightcore commented 6 years ago

Use with New openkore ?

Fvegini commented 6 years ago

Maybe one version from two weeks ago!

I will update and try to simulate it again to see if keeps hapening!

Fvegini commented 6 years ago

Same issue with the last version of openkore.

Kore is with 68% of weight trying to buy red potions.

I think the config is alright:

buyAuto Red Potion { npc payon_in01 5 49 standpoint distance 5 price 50 minAmount 0 maxAmount 300 batchSize disabled 0 label buyredpot }

If I manually send him "autosell", he sells, return to the autobuy routine and go to lockmap

Edit: I think this is an old problem, because I can see in my old macros.txt (two years ago) this automacro:

automacro pesou { console /(excesso de peso)/ timeout 20 overrideAI 1 exclusive 1 call { pause 2 do autosell pause 2 } }

Fadreus commented 6 years ago

I believe this happen when;

You loot items > Then red pot reach minimum > bot autoBuy > your loots in the way = prevent buying 300 red pot.

If this is the case, I wouldn't say it's a bug or problem on kore (unless kore suppose to ignore autobuy when exceed weight).

Fvegini commented 6 years ago

fadreus, this seems to be the exactly scenario when it happens!

In my point of view openkore don't use the weight of the items.. so it can't ignore the autobuy when it checks is "full" But just adding an autosell/autostorage after the prompted message would be enough

One bad way I can think in do it, would be: (bad programming skills)

src/Network/Receive/ServerType0.pm Line 1352

} elsif ($args->{fail} == 2) {
    error T("Buy failed (insufficient weight capacity).\n")
}

to

} elsif ($args->{fail} == 2) {
    error T("Buy failed (insufficient weight capacity).\n")
    if (Autosell == 1) do autosell
    if (Autostorage ==1) do autostorage
}

I know this isn't the correct syntax and not even the correct file to put actions... but I don't know how to get to the file that is calling this sub and never saw perl outside the openkore world.

Mortimal commented 6 years ago

Try src/Network/Receive/ServerType0.pm Line 1352:

    } elsif ($args->{fail} == 2) {
        error T("Buy failed (insufficient weight capacity).\n");
        AI::args->{recv_buy_packet_owg} = 1;

and src/AI/CoreLogic.pm Line 1735:

if (AI::action eq "buyAuto" && AI::args->{'done'}) {
        if (exists $args->{recv_buy_packet_owg}){
            delete $args->{recv_buy_packet_owg};
            delete $args->{recv_buy_packet};
            AI::dequeue;
            AI::queue("sellAuto", {forcedByBuy => 1});
            return;
        }
        if (exists AI::args->{'error'}) {
            error AI::args->{'error'}.".\n";
        }

I cant test this i am not botting now

piichia commented 5 years ago

Tested only once so far and it worked for me.

in src/Network/Receive/ServerType0.pm Line 1105:

    if ($args->{fail} == 2){
         AI::args->{recv_buy_packet_owg} = 1;
    } elsif (AI::is("buyAuto")) {
        AI::args->{recv_buy_packet} = 1;
    }

in src/AI/CoreLogic.om Line 1785:

    if (AI::action eq "buyAuto" && AI::args->{'done'}) {
            my $args = AI::args;
        if (exists $args->{recv_buy_packet_owg}){
            delete $args->{recv_buy_packet_owg};
            delete $args->{recv_buy_packet};
            AI::dequeue;
            AI::queue("sellAuto", {forcedByBuy => 1});
            return;
        }
        if (exists AI::args->{'error'}) {
            error AI::args->{'error'}.".\n";
        }