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

[Enhancement] - Optimize decay #2756

Closed beats-dh closed 2 years ago

beats-dh commented 2 years ago

Co-Authored-By: Jakub @SaiyansKing jakubkubina@hotmail.com From: https://github.com/opentibiabr/optimized_forgottenserver/tree/master

Reworked the decay, so the problems with the CPU spike are over, as well as other problems with the decay, like some items resetting the duration when equip/deequip.

New functions: Game::stopDecay(item) Container::stopDecaying() DepotChest::isRemoved() DepotLocker::isRemoved() Inbox::isRemoved() Item::stopDecaying()

From function: decreaseDuration(time) To: setDurationTimestamp(timestamp)

New file decay.cpp/h Decay::startDecay(item, duration) Decay::stopDecay(item, timestamp) Decay::checkDecay()

New attribute: ITEM_ATTRIBUTE_DURATION_TIMESTAMP

gerotib commented 2 years ago

Only issue I see is that magic light wand timer is getting renewed each time we turn it off. I dont know if theres another item like this. (probably torches etc) https://gfycat.com/linedtintedhoopoe

Before this pr it was also like this.

dudantas commented 2 years ago

Only issue I see is that magic light wand timer is getting renewed each time we turn it off. I dont know if theres another item like this. (probably torches etc) https://gfycat.com/linedtintedhoopoe

Before this pr it was also like this.

Fixed.