Forgottenserver: Decaying item stops decaying when you move it

Created on 21 Sep 2017  路  23Comments  路  Source: otland/forgottenserver

Before creating an issue, please ensure:

  • [x] This is a bug in the software that resides in this repository, and not a
    support matter (use https://otland.net/forums/support.16/ for support)
  • [x] This issue is reproducible without changes to the code in this repository

Steps to reproduce (include any configuration/script required to reproduce)

  1. Make item decay, for example make new item in items.xml
  2. item:decay()
  3. move it to any equipment slot or any other position that it is in currently

This is the item I used:

<item id="28826" article="a" name="diamond arrow">
    <attribute key="weight" value="80" />
    <attribute key="slotType" value="ammo" />
    <attribute key="attack" value="37" />
    <attribute key="weaponType" value="ammunition" />
    <attribute key="ammoType" value="arrow" />
    <attribute key="shootType" value="diamondarrow" />
    <attribute key="maxHitChance" value="95" />
    <attribute key="decayTo" value="0" />
    <attribute key="duration" value="3600" />
    <attribute key="showduration" value="1" />
</item>

Expected behaviour

Item should still be decaying

Actual behaviour

Decaying is stopped.

bug

All 23 comments

Is it in movements.xml with equip/deequip ?

No, it doesn't meant to be. This item should decay from the start, when created/conjured.

I could not recreate this in my server. I was using an item:

<item id="2090" article="a" name="crystal key">
    <attribute key="type" value="key"/>
    <attribute key="weight" value="100"/>
    <attribute key="decayTo" value="0"/>
    <attribute key="duration" value="3600"/>
    <attribute key="showduration" value="1"/>
    <attribute key="slotType" value="ammo" />
</item>

Item was created by NPC, decayed and I was switching it to ammo slot and off few times, logged in or out... It is not in movements too. And it still kept decaying with exact timer. Maybe when using it with a bow as weapon disables decaying?

Maybe because its not actually an ammunition? Also I have it registered in weapons.xml, because its ammunition. It does not happen with normal items, like rings they are decaying.

Paste your weapons.xml entry please

Paste yours entry... it鈥檚 important what action you have set there

Didnt I just say that its exactly the same like this one, link is pointing you to?
Its another ammunition, only the id is changed and level number.

Item id 28826 is on my 11.47 server... a tree. I want to point out one more thing. If your ammo does really remove a count, this can be the issue.

What do you mean "does really remove a count"?
Decaying it's working fine while using the item in arrow slot, its removing the count one by one and is still decaying, it stops only when I move it to another slot in backpack or anywhere.

confirmed

Anyone have any thoughts on this which would help to fix the issue? Because I'm going to fix this in my source and make pull request.

There should be a flag to indicate if the item decays on equip, like rings; or decays normally, like corpses.

Was that fixed already @nekiro ? If not, can you share your progress and let me pick it up?

@pzaj2 nah, it's not fixed. I didn't manage to start working on it, so there is no progress.

@nekiro ok, so to my understanding your arrows work perfectly fine until they're removed from ammo slot? Are they stackable?

I'm just wondering if that's actually a bug... well, it is, but is that something we should consider possible? What happens if you have 10 arrows with duration X left and 10 arrows with duration Y and you want to stack them together?

@pzaj2 thats a bug. It doesnt matter if you move them out of the stack or not, you cant stack arrows that are not equal, even if these have same attribute and different duration, you cant stack them.

They stop decaying when you move them anywhere from the slot you created them in.

Alright. I will look into it.

no news?

probably bugged for the same reason as #1753
any idea which commit caused this bug?

@nekiro
does the item decay if you just create it (goes directly into bag/backpack) instead of ammo slot?
From what I can see if you use ammunition it uses the transformto function from game.cpp as the item is obviously in the ammo slot it then fires up onPlayerEquip which then makes the regular checks for level decay and such, the thing now is, once you deequip it, it removes the decay condition as it was deequiped.
This should however not happen if the item is never in the ammo slot in first place.
We would have to introduce a different decay method for this to fully work.

Same thing if it goes to backpack

found the problem it was something with Item* Item::clone() const resetting the attributes but not initializing the decay again.
Will open a pr soon

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Olrios picture Olrios  路  4Comments

GoularPink picture GoularPink  路  4Comments

zeeb92 picture zeeb92  路  4Comments

RafaelVidaurre picture RafaelVidaurre  路  4Comments

EPuncker picture EPuncker  路  5Comments