diff --git a/modules/feedomatic/FeedOMatic.lua b/modules/feedomatic/FeedOMatic.lua index 322fc92..f7c8705 100644 --- a/modules/feedomatic/FeedOMatic.lua +++ b/modules/feedomatic/FeedOMatic.lua @@ -2483,10 +2483,20 @@ function FOM_FlatFoodList() local isExceptionReject = false; local isLevelOverrideReject = not FOM_IsItemPetLevelCompatible(itemID, petLevel); local isQuarantineReject = FOM_IsQuarantined(itemID, petLevel, familyKey); + -- A food whose known level is below the pet's minimum is refused by the + -- server ("not high enough"); skip it up front so FOM never keeps + -- re-feeding a too-low stack just to free a bag slot. + local isLevelRuleReject = false; + if (petLevel > 0 and tonumber(foodLevel) ~= nil and type(MTH_FEED_GetDerivedMinFoodLevel) == "function") then + local minFoodLevel = MTH_FEED_GetDerivedMinFoodLevel(petLevel); + if (minFoodLevel ~= nil and tonumber(foodLevel) < minFoodLevel) then + isLevelRuleReject = true; + end + end if (isExceptionReject) then rejectedByException = rejectedByException + 1; end - if (isLevelOverrideReject) then + if (isLevelOverrideReject or isLevelRuleReject) then rejectedByLevelOverride = rejectedByLevelOverride + 1; end if (isQuarantineReject) then @@ -2500,7 +2510,7 @@ function FOM_FlatFoodList() unknownLevelCandidates = unknownLevelCandidates + 1; end - if (isCompatible and not isExceptionReject and not isLevelOverrideReject and not isQuarantineReject) then + if (isCompatible and not isExceptionReject and not isLevelOverrideReject and not isQuarantineReject and not isLevelRuleReject) then compatibleCount = compatibleCount + 1; local foodQuality = tonumber(foodLevel); if (foodQuality == nil) then @@ -2511,7 +2521,7 @@ function FOM_FlatFoodList() end end table.insert(foodList, {bag=bagNum, slot=itemNum, link=itemLink, itemId=itemID, count=itemCount, quality=foodQuality, useful=isUseful, temp=FOM_IsTemporaryFood(itemLink), knownLevel=hasKnownLevel}); - elseif (isAbovePreferredLevel and not isExceptionReject and not isLevelOverrideReject and not isQuarantineReject) then + elseif (isAbovePreferredLevel and not isExceptionReject and not isLevelOverrideReject and not isQuarantineReject and not isLevelRuleReject) then overflowCompatibleCount = overflowCompatibleCount + 1; local overflowQuality = tonumber(foodLevel); if (overflowQuality == nil) then