cmangos / issues

This repository is used as a centralized point for all issues regarding CMaNGOS.
180 stars 47 forks source link

[Classic][Regression] Bots won't use items #1645

Closed Trystanosaurus closed 6 years ago

Trystanosaurus commented 6 years ago

Current behavior: Currently the command use [item link] isn't working. Bots won't use items. I've tried food/water, hearthstones and clicky quest items (the moonwell water vials in the night elf starter zone), all with no luck.

I've only tried it on classic, not tbc or wotlk.

Expected behavior: Bots should use the linked item.

I did a bit of digging to see how far they were getting by adding the below code to line 5339 of PlayerbotAI.cpp, I couldn't see anything odd though, it gets as far as queueing the packet. I'm afraid I don't know enough to know if what it's sending is right but it looks okay, alternatively they might be doing something later to override the queued packet?

TellMaster("USING ITEM: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, spell_count: %u, Item: %u, Target: %u", bagIndex, slot, spell_count, item->GetEntry(), targetFlag);

itemuse

Steps to reproduce:

  1. Add a bot to your party
  2. Whisper them with use [Hearthstone]
  3. Nothing happens

Client version: 1.12.1 (5875)

Commit hash: f1d799b

Database version: 1.9 - 2695dae

Operating system: Windows 10

cala commented 6 years ago

Could you check with some scroll like stamina or whatever (just remove all buffs from the bot before to prevent any aura stacking issue), please?

Also, do mana user bots automatically use drinks when OOC and OOM? Same question with injured bots having food?

This was working a few weeks ago (at least the cases I described above), so we need to confirm this further to see if the issue lies in PlayerBot system or if some change elsewhere in the core created the issue.

Trystanosaurus commented 6 years ago

I've tried just now asking a bot to use a scroll of stamina and had no luck (the first scroll of stamina, id 1180 and a level 5 warrior bot with no buffs).

I've not seen bots automatically using food or drink either, I've tried giving a priest mage water, the bot will whisper me saying they need a drink but didn't drink the mage water.

My install is a pretty fresh unmodified install so I don't think it's something I've done.

Trystanosaurus commented 6 years ago

I've just been playing a bit now and it seems when the bots do need to eat they're getting as far as whispering me that debug message with what item they're eating and it's bag slot and things but they didn't actually sit down to eat.

Using items to start quests is working fine though.

cala commented 6 years ago

Thank you very much for these feedbacks. :+1:

I spent some time to have the auto consumption of items by bots to work nicely, one or two years ago, because this a very helpful feature in dungeons. And I am adamant it was still working in late May-early June 2018.

So this is a regression introduced recently. There were very few changes made in the past weeks to PlayerBot code and I will investigate them. But IIRC, none of them was related to that feature, so the issue is probably caused by some other change in the core...

Currently, I face issues with my PC, so I don't know when I will be able to look at this...

cala commented 6 years ago

I was right, the issue appears with commit https://github.com/cmangos/mangos-classic/commit/c6eeec15a2dceeec2583f2d1ddb2abb576b512db, see my comment there.

cala commented 6 years ago

Fixed for Classic. I'll check tomorrow if this needs to be also pushed to TBC and WotLK (I guess so).