opentibiabr / otservbr-global-archived

Archived, read-only repository. New repository: https://github.com/opentibiabr/otservbr-global
GNU General Public License v2.0
332 stars 335 forks source link

Fix decaying items crash in bosses #2709 #2710

Closed gesior closed 3 years ago

gesior commented 3 years ago

Description

Bosses drop decaying items. If you open 'reward container' in boss corpse, not pick decaying items and corpse disappear, it will crash server.

Behaviour

Actual

Server crash.

Expected

Server does not crash.

Fixes

2709

Type of change

mrhultin commented 3 years ago

I see the return, and unable to test, but wouldnt this make the reward container empty if the first item has decay or do I need more coffee here?

gesior commented 3 years ago

@mrhultin Probably more coffee :) MonsterType.createLootItem(self, lootBlock, chance, lootTable) is called for every loot item in boss: https://github.com/opentibiabr/otservbr-global/blob/cb3e8408dbd2fa6c78a7d5ea3ba83649086ce80c/data/lib/others/reward_boss_lib.lua#L96

It should block only single bugged items.

mrhultin commented 3 years ago

@mrhultin

Probably more coffee :)

MonsterType.createLootItem(self, lootBlock, chance, lootTable) is called for every loot item in boss:

https://github.com/opentibiabr/otservbr-global/blob/cb3e8408dbd2fa6c78a7d5ea3ba83649086ce80c/data/lib/others/reward_boss_lib.lua#L96

It should block only single bugged items.

Yeah you are correct, ofc. I like this fix, its elegant!

ArturKnopik commented 3 years ago

I prefer check such things during startup(check during adding loot to monste[boss] and change/remove decaying items), we don't perform any additional operation during normal gameplay #optymization_lover