azerothcore / azerothcore-wotlk

Complete Open Source and Modular solution for MMO
http://www.azerothcore.org
GNU Affero General Public License v3.0
6.56k stars 2.63k forks source link

Rate.Drop.Item.GroupAmount does not work as expected #19541

Open drcxd opened 3 months ago

drcxd commented 3 months ago

Current Behaviour

I am not sure if this is a bug but since it does not work as my expectation and makes me confusing, I decide to report it as one.

The problem is with the configuration option Rate.Drop.Item.GroupAmount in the file worldserver.conf. The comment says:

#
#    Rate.Drop.Item.GroupAmount
#        Description: Multiplier for grouped items. Makes many dungeon bosses (and others) drop additional loot.
#        Default:     1

I modified this value to 10, restarted the world server, defeated VanCliff in the Deadmine, found that he only drops two equipable items.

Expected Blizzlike Behaviour

Since there is no Blizzlike behaviour, I just treat this section as expected behavior. What I expected is that this rate can increase the number of items dropped by the Boss determinantly.

From the section above, it does increase the number of items dropped by VanCliff from one to two. However, I was expecting the number of items dropped should be 10. Since some mobs and chests drop items around this number.

Or maybe the configuration file should specify explicitly how this rate affects the number of items dropped in more detail.

Source

No response

Steps to reproduce the problem

  1. Build the core
  2. Edit the Rate.Drop.Item.GroupAmound to some larger number, e.g. 10.
  3. Start the server.
  4. Defeat VanCliff and check the number of items he dropped.

Extra Notes

I actually debug the world server to see what happened exactly and I think this would save you the time doing this.

Frist, this fucntion:

https://github.com/azerothcore/azerothcore-wotlk/blob/f2680d994bc0b0861109ada7fd621a926b9b6bfe/src/server/game/Loot/LootMgr.cpp#L1430

should recursively call itself with the argument nonRefIterationsLeft, which has the value of Rate.Drop.Item.AmountGroup at the first time it gets invoked, decreases each time it gest called.

However, the function body is enclosed in a if statement:

https://github.com/azerothcore/azerothcore-wotlk/blob/f2680d994bc0b0861109ada7fd621a926b9b6bfe/src/server/game/Loot/LootMgr.cpp#L1432

The function Roll might return nullptr at this line:

https://github.com/azerothcore/azerothcore-wotlk/blob/f2680d994bc0b0861109ada7fd621a926b9b6bfe/src/server/game/Loot/LootMgr.cpp#L1317

which stops the whole recursive call process. This is the reason why even I set the rate to 10 but VanCliff still only dropped two items.

The reason that Roll returns nullptr is that possibleLoot becomes more and more emptier when items are dropped:

https://github.com/azerothcore/azerothcore-wotlk/blob/f2680d994bc0b0861109ada7fd621a926b9b6bfe/src/server/game/Loot/LootMgr.cpp#L1286

This is because LootGroudInvalidSelector removes already dropped equipment from possibleLoot:

https://github.com/azerothcore/azerothcore-wotlk/blob/f2680d994bc0b0861109ada7fd621a926b9b6bfe/src/server/game/Loot/LootMgr.cpp#L80

This makes the total chance of dropping of the items remain in the group is less than 1, which in turn makes the program possible to not hit this line:

https://github.com/azerothcore/azerothcore-wotlk/blob/f2680d994bc0b0861109ada7fd621a926b9b6bfe/src/server/game/Loot/LootMgr.cpp#L1305

I have some suggestion about how to fix this problem:

First we have to specify explicity how Rate.Item.Drop.GroupAmound will affect the number of items dropped. Currently, the number of dropped items is somehow random.

One possible solution is to keep the total chance of dropping of the items in possibleLoot always equal to or greater than 1, even when some of the items are removed from the original loot group.

Or maybe to support loot contains duplicate equipments?

AC rev. hash/commit

I am using the fork that support the playerbots module, but I think this problem is the same for both repos.

AzerothCore rev. 22132addce11+ 2024-07-19 17:25:43 +0800 (Playerbot branch) (Win64, RelWithDebInfo, Static)
Connected players: 0. Characters in world: 0.
Connection peak: 0.
Server uptime: 3 hour(s) 56 minute(s) 13 second(s)
Update time diff: 1ms. Last 500 diffs summary:
|- Mean: 2ms
|- Median: 2ms
|- Percentiles (95, 99, max): 6ms, 7ms, 7ms
Using SSL version: OpenSSL 3.0.14 4 Jun 2024 (library: OpenSSL 3.0.14 4 Jun 2024)
Using Boost version: 1.81.0
Using CMake version: 3.30.1
Using MySQL version: 80401
Found MySQL Executable: C:/Program Files/MySQL/MySQL Server 8.4/bin/mysql.exe
Compiled on: Windows
Worldserver listening connections on port 8085
Realmlist (Realm Id: 1) configured in port 8085
VMAPs status: Enabled. LineOfSight: 1, getHeight: 1, indoorCheck: 1
MMAPs status: Enabled
maps directory located in C:/Build/bin/RelWithDebInfo/Data/maps. Total size: 291014951 bytes
vmaps directory located in C:/Build/bin/RelWithDebInfo/Data/vmaps. Total size: 658130721 bytes
mmaps directory located in C:/Build/bin/RelWithDebInfo/Data/mmaps. Total size: 2192910844 bytes
Default DBC locale: enUS.
All available DBC locales: enUS
Using World DB: ACDB 335.12-dev
Using Playerbots DB Revision:
Latest LoginDatabase update: 2024_01_20_00.sql
Latest CharacterDatabase update: trasmorg.sql
Latest WorldDatabase update: zz_optional_aq_quest_nerf.sql
LoginDatabase queue size: 0
CharacterDatabase queue size: 0
WorldDatabase queue size: 0
PlayerbotsDatabase queue size: 0
List of enabled modules:
|- mod-ah-bot
|- mod-autobalance
|- mod-individual-progression
|- mod-npc-enchanter
|- mod-playerbots
|- mod-transmog

Operating system

Windows 10

Custom changes or Modules

No response

RobertSkalko commented 2 months ago

I'd go for a multiplier approach. 0.5 is half the loot, 2 is double the loot. Another option for whether loot can have duplicates. With a value of 9999, bosses should drop all possible loot, or thousands of drops depending if duplicates are on.

I'd also clarify which loot tables this affects. "many bosses and others" is vague.

I also had confusion about these configs, and I think some of them even don't work correctly if used at a value lower than 1 but I didn't feel like testing at the time. I think I deleted the server because my ssd ran out of space and i wanted to try some game. I might try doing server work again when i buy a bigger ssd.