915
edits
Falterfire (talk | contribs) (added code to quickly find all lifesteal weapons. Not used anywhere, but I'm saving it in case it's useful later) |
(Add gem link to gem equipment slot) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 112: | Line 112: | ||
if result == nil and ZeroIfNil then result = 0 end | if result == nil and ZeroIfNil then result = 0 end | ||
return result | return result | ||
end | |||
function p.getItemValue(item) | |||
if type(item) == 'string' then | |||
-- Specific check if the item is GP (value of 1) | |||
if Shared.compareString('GP', item, true) | |||
or Shared.compareString('Gold Pieces', item, true) then | |||
return 1 | |||
end | |||
item = p.getItem(item) | |||
end | |||
if item then | |||
return item.sellsFor | |||
end | |||
return nil | |||
end | end | ||
Line 167: | Line 185: | ||
function p.hasCombatStats(item) | function p.hasCombatStats(item) | ||
-- Checks if the combat stat is a valid, non-zero combat stat | |||
-- Ensure that, only in the case where the item is a Familar AND | |||
-- the checked stat is summoningMaxhit, the result is ignored. | |||
function isNonZeroStat(statName, statVal) | |||
if statName == 'summoningMaxhit' and (p._canItemUseSlot(item, 'Summon1') or p._canItemUseSlot(item, 'Summon2')) then | |||
return false | |||
end | |||
return statVal ~= 0 | |||
end | |||
if item.equipmentStats ~= nil then | if item.equipmentStats ~= nil then | ||
-- Ensure at least one stat has a non-zero value | -- Ensure at least one stat has a non-zero value | ||
for statName, statVal in pairs(item.equipmentStats) do | for statName, statVal in pairs(item.equipmentStats) do | ||
if statVal | if isNonZeroStat(statName, statVal) then | ||
return true | return true | ||
end | end | ||
end | end | ||
end | end | ||
return false | return false | ||
end | end | ||
Line 342: | Line 371: | ||
["Passive"] = 'Combat Passive Slot', | ["Passive"] = 'Combat Passive Slot', | ||
["Summon1"] = 'Summoning', | ["Summon1"] = 'Summoning', | ||
["Summon2"] = 'Summoning' | ["Summon2"] = 'Summoning', | ||
["Gem"] = "Gems_(Equipment)" | |||
} | } | ||
local slotText = {} | local slotText = {} |
edits