Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with item decay #4013

Merged
merged 3 commits into from
Mar 18, 2022
Merged

Conversation

MillhioreBT
Copy link
Contributor

@MillhioreBT MillhioreBT commented Mar 15, 2022

Pull Request Prelude

  • I have followed [proper The Forgotten Server code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

with these changes you can configure any item for decaying
example:

local talkAction = TalkAction("!test")

function talkAction.onSay(player, words, param, type)
    local armor = Game.createItem(2467, 1, player:getPosition())
    armor:setAttribute(ITEM_ATTRIBUTE_DURATION, 1000)
    armor:setAttribute(ITEM_ATTRIBUTE_DECAYTO, 2173)
    armor:setAttribute(ITEM_ATTRIBUTE_DECAYSTATE, 0) -- or armor:setAttribute(ITEM_ATTRIBUTE_DECAYSTATE, DECAYING_FALSE)
    armor:decay()
    return false
end

talkAction:register()

or

local talkAction = TalkAction("!test")

function talkAction.onSay(player, words, param, type)
    local armor = Game.createItem(2467, 1, player:getPosition())
    armor:setAttribute(ITEM_ATTRIBUTE_DURATION, 1000)
    armor:decay(2173)
    return false
end

talkAction:register()

The problem is that canDecay is checking the time of the itemType only, instead of taking into account the time defined directly to the item

Issues addressed: Nothing!

@EPuncker EPuncker requested review from a team March 15, 2022 14:35
src/game.cpp Outdated Show resolved Hide resolved
src/item.cpp Outdated Show resolved Hide resolved
@MillhioreBT MillhioreBT requested review from nekiro and removed request for a team March 16, 2022 01:25
@EPuncker EPuncker merged commit ddfd4e8 into otland:master Mar 18, 2022
Codinablack pushed a commit to Codinablack/forgottenserver that referenced this pull request Apr 5, 2022
EPuncker pushed a commit to EPuncker/forgottenserver that referenced this pull request May 23, 2023
Tofame added a commit to Tofame/TMS that referenced this pull request Sep 25, 2023
with these changes you can configure any item for decaying

otland/forgottenserver#4013

Added commit made by MillhioreBT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants