Wisling / tibiaauto

Tibia Auto is made to excel in the automation of various aspects of the playing the MMORPG Tibia
31 stars 16 forks source link

Autolooting enhancements #33

Open dmarszk opened 8 years ago

dmarszk commented 8 years ago
felipetnh commented 8 years ago

This would be really cool! It would be very profitable to ranged hunts... :D

Would this check for the item to be actually looted? Let's say my RP kills a Demon, and I begin to loot it, but then another Demon shows up and TA starts to run away from it. After killing this second Demon, would it go back to the first one if there was still something inside it that wasn't looted?

Would it loot two monsters that were killed in the same SQM?

dmarszk commented 8 years ago

That's the idea.

Wisling commented 7 years ago

The cavebot has a helpful Queue for the "Loot While Killing" feature. After guessing which creatures died at the hand of the character, they can be added to this queue and it will eventually approach and loot them(if the user has loot while killing enabled)

This is the thread that loots creatures while killing: https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2113

The thread in the cavebot that adds to the CorpseQueue is here: https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2078

The way the cavebot adds to the queue is here: https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2709

So really, adding something to the spellcaster (or even make a python script) that picks which creatures to loot after casting an AoE spell and puts info into the "autolootTm" variable, the cavebot will automatically grab from the "autolootTm" variable and loot from the corpse when it gets around to it. Just to reiterate, the way to add to the "autolootTm" is shown here https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2709 but in python the function name is "tasender.setGlobalVariabl()" and "tasender.getGlobalVariable()"

So the infrastructure is there, it just needs to be implemented.

Javieracost commented 7 years ago

@Wisling This is great news! Since I want to try some things out through python i have a few comments: To make it clear, the autolooterTm variable consists of two space delimited values, the first one being the tibiaId of a creature to be looted and the second a timestamp with a time limit to loot it, which is by default 10 seconds (this one i find it strange). Also, upon settting the variable, its necessary to wait for the cavebot to set it to 'wait' before adding any other value, to avoid overwriting and therefore skipping monsters. Ah and its too bad that avoiding monsters that looted nothing had to be disabled, it would be very helpful! Last but not least, it would be nice if there was a way to remove pending monsters from the queue, for us to filter out the ones that shouldnt be looted! Using python or the cavebot itself, though the latter would probably take more to implement.

2016-07-20 15:16 GMT-04:00 Wisling notifications@github.com:

If you're going to dig into the C++ code, the cavebot has a helpful Queue for the "Loot While Killing" feature. If you are able to guess which creatures died at your hand, you can add them to this queue and it will eventually approach and loot them(if the user has loot while killing enabled)

Here is the thread that loots creatures while killing:

https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2113

The thread in the cavebot that adds to the CorpseQueue is here:

https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2078

The way the cavebot adds to the queue is here:

https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2709

So really, if you add something to the spellcaster (or even make a python script) that picks which creatures to loot after casting an AoE spell and puts info into the "autolootTm" variable, the cavebot will automatically grab from the "autolootTm" variable and loot from the corpse when it gets around to it. Just to reiterate, the way to add to the "autolootTm" is shown here

https://github.com/Wisling/tibiaauto/blob/master/tibiaauto-pub/mods/mod_cavebot/mod_cavebot.cpp#L2709 but in python the function name is "tasender.setGlobalVariabl()" and "tasender.getGlobalVariable()"

So the infrastructure is there, it just needs to be implemented.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Wisling/tibiaauto/issues/33#issuecomment-234052453, or mute the thread https://github.com/notifications/unsubscribe-auth/ADmkVduw2gPN0Fw1-6g6zgar_ZMn6xKoks5qXnQagaJpZM4IJv_7 .

Wisling commented 7 years ago

The 'autolooterTm' variable does indeed consist of those two space-delimited values. The 10 seconds is what Tibia uses for unmovable corpses. After that period the item ID changes to something else. I'm pretty sure the looter just goes by x,y,z position and item ID, so if two of the same monster die on the same square, it will loot the same container twice.(but that could be improved upon depending on what you need it to do!)

You can send creatures to the looter through the 'autolooterTm' variable 3-5 times / sec, which is likely more than enough and can be shortened, but yes, the "autolooterTm" writer needs to wait for the "autolooterTm" reader to set it to "wait" or "". The "wait" state tells the writer that the looter hasn't gone through all the corpses it has yet.

Currently the only way to tell the looter to not loot a corpse is by setting a reasonable time limit, having the queue be able to be micro managed would take a lot of infrastructure to do so I kept it simple. I remember the "avoid looting creatures with nothing" feature, but it just wasn't fast enough. It can be made to be fast, but that hasn't been done yet.