Stop FOM feeding below-minimum-level food to high-level pets

This commit is contained in:
DuvelCorp
2026-09-17 10:40:38 +02:00
parent 1680c6fc51
commit b40f9c1095
+13 -3
View File
@@ -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