Skip to content

Commit

Permalink
fix(Item): Fix edge case in BuffDuration()
Browse files Browse the repository at this point in the history
  • Loading branch information
Cilraaz committed Nov 13, 2023
1 parent bff3134 commit 6150f28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion HeroLib/Class/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ end
function Item:BuffDuration()
if not self:IsUsable() then return 0 end
if not self:OnUseSpell() then return 0 end
local BuffLength = DBC.SpellDuration[self:OnUseSpell():ID()][1]
local BuffLength
if DBC.SpellDuration[self:OnUseSpell():ID()] then
BuffLength = DBC.SpellDuration[self:OnUseSpell():ID()][1]
end
if not BuffLength then return 0 end
if BuffLength > 1000 then BuffLength = BuffLength / 1000 end
return BuffLength
Expand Down

0 comments on commit 6150f28

Please sign in to comment.