Skip to content

Commit

Permalink
Add decayImbuementTime function for use of updateInventoryImbuement (#…
Browse files Browse the repository at this point in the history
…293)

Function to avoid sending the message "imbuement already exists" when equipping/unequipping and deterioration of the item's imbue time
  • Loading branch information
dudantas authored Apr 4, 2022
1 parent dd03479 commit 8559f3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void Player::updateInventoryImbuement(bool init /* = false */)
}

int32_t duration = std::max<int32_t>(0, imbuementInfo.duration - EVENT_IMBUEMENT_INTERVAL / 1000);
item->addImbuement(slotid, imbuementInfo.imbuement->getID(), duration);
item->decayImbuementTime(slotid, imbuementInfo.imbuement->getID(), duration);
if (duration == 0) {
removeItemImbuementStats(imbuementInfo.imbuement);
g_game.decreasePlayerActiveImbuements(getID());
Expand Down
10 changes: 10 additions & 0 deletions src/items/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,16 @@ class Item : virtual public Thing
*/
bool getImbuementInfo(uint8_t slot, ImbuementInfo *imbuementInfo);
void addImbuement(uint8_t slot, uint16_t imbuementId, int32_t duration);
/**
* @brief Decay imbuement time duration, only use this for decay the imbuement time
*
* @param slot Slot id to decay
* @param imbuementId Imbuement id to decay
* @param duration New duration
*/
void decayImbuementTime(uint8_t slot, uint16_t imbuementId, int32_t duration) {
return setImbuement(slot, imbuementId, duration);
}
void clearImbuement(uint8_t slot, uint16_t imbuementId) {
return setImbuement(slot, imbuementId, 0);
}
Expand Down

0 comments on commit 8559f3c

Please sign in to comment.