mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-09-25 09:06:07 +00:00
Fix realm-gate disable for book/options, pet-rank learning, unique beasts
- Hunter's Book and options window now show a full 'DISABLED.' overlay on realm-gated realms instead of rendering content - Pet training: new rank of an already-known ability is now recognised, announced, and reflected in tooltips - Restore curated 'unique appearance' beast allowlist (34 beasts) in data/init.lua - CHANGELOG updated
This commit is contained in:
@@ -650,7 +650,24 @@ function MTH_GetMerchantFoodsByDiet()
|
||||
return result;
|
||||
end
|
||||
|
||||
local function FOM_ItemQuality(itemIdOrLink)
|
||||
if (type(GetItemInfo) ~= "function" or itemIdOrLink == nil) then
|
||||
return nil;
|
||||
end
|
||||
local _, _, quality = GetItemInfo(itemIdOrLink);
|
||||
return quality;
|
||||
end
|
||||
|
||||
local function FOM_DebugLog(message)
|
||||
if (not (FOM_Config and FOM_Config.Debug)) then
|
||||
return;
|
||||
end
|
||||
local text = "[FOM] " .. tostring(message);
|
||||
if (MTH and MTH.Print) then
|
||||
MTH:Print(text, "debug");
|
||||
elseif (DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage) then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(text);
|
||||
end
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -1899,15 +1916,6 @@ end
|
||||
-- Add a food to a list
|
||||
function FOM_AddFood(diet, food)
|
||||
|
||||
if (FOM_Foods[diet] == nil) then
|
||||
FOM_DebugLog("FOM_Foods[diet] == nil");
|
||||
end
|
||||
if (FOM_AddedFoods == nil or FOM_AddedFoods[diet] == nil) then
|
||||
FOM_DebugLog("FOM_AddedFoods == nil or FOM_AddedFoods[diet] == nil");
|
||||
end
|
||||
if (FOM_RemovedFoods == nil or FOM_RemovedFoods[diet] == nil) then
|
||||
FOM_DebugLog("FOM_RemovedFoods == nil or FOM_RemovedFoods[diet] == nil");
|
||||
end
|
||||
if ( GFWTable.IndexOf(FOM_Foods[diet], food) == 0 ) then
|
||||
if (FOM_AddedFoods == nil) then
|
||||
FOM_AddedFoods = {};
|
||||
@@ -1941,15 +1949,6 @@ end
|
||||
-- Remove a food from a list
|
||||
function FOM_RemoveFood(diet, food)
|
||||
|
||||
if (FOM_Foods[diet] == nil) then
|
||||
FOM_DebugLog("FOM_Foods[diet] == nil");
|
||||
end
|
||||
if (FOM_AddedFoods == nil or FOM_AddedFoods[diet] == nil) then
|
||||
FOM_DebugLog("FOM_AddedFoods == nil or FOM_AddedFoods[diet] == nil");
|
||||
end
|
||||
if (FOM_RemovedFoods == nil or FOM_RemovedFoods[diet] == nil) then
|
||||
FOM_DebugLog("FOM_RemovedFoods == nil or FOM_RemovedFoods[diet] == nil");
|
||||
end
|
||||
if ( GFWTable.IndexOf(FOM_Foods[diet], food) ~= 0 ) then
|
||||
if (FOM_RemovedFoods == nil) then
|
||||
FOM_RemovedFoods = {};
|
||||
@@ -2388,7 +2387,12 @@ function FOM_Feed(aFood, options)
|
||||
foodLevel = selectedFoodLevel,
|
||||
})
|
||||
|
||||
FOM_DebugLog("Picked "..FOM_LastFood.." (bag "..foodBag..", slot "..foodItem..") for feeding.");
|
||||
FOM_DebugLog("Picked "..tostring(FOM_LastFood)
|
||||
.." id="..tostring(selectedId)
|
||||
.." foodLevel="..tostring(selectedFoodLevel)
|
||||
.." itemQuality="..tostring(FOM_ItemQuality(selectedId))
|
||||
.." (bag "..tostring(foodBag)..", slot "..tostring(foodItem)..")"
|
||||
.." reason="..tostring(FOM_LastChoiceReason));
|
||||
if (FOM_Config.Debug) then
|
||||
-- don't actually feed anything, just show what we would choose
|
||||
return false;
|
||||
@@ -2606,6 +2610,19 @@ function FOM_FlatFoodList()
|
||||
if (table.getn(foodList) == 0 and table.getn(overflowFoodList) > 0) then
|
||||
foodList = overflowFoodList;
|
||||
end
|
||||
if (FOM_Config and FOM_Config.Debug) then
|
||||
FOM_DebugLog("Candidate foods for pet level "..tostring(petLevel).." ("..tostring(table.getn(foodList)).." in diet):");
|
||||
for i = 1, table.getn(foodList) do
|
||||
local c = foodList[i];
|
||||
FOM_DebugLog(" ["..tostring(i).."] "..tostring(c.link)
|
||||
.." id="..tostring(c.itemId)
|
||||
.." qty="..tostring(c.count)
|
||||
.." foodLevel="..tostring(c.quality)
|
||||
.." itemQuality="..tostring(FOM_ItemQuality(c.itemId))
|
||||
.." known="..tostring(c.knownLevel)
|
||||
.." useful="..tostring(c.useful));
|
||||
end
|
||||
end
|
||||
return foodList;
|
||||
end
|
||||
|
||||
@@ -2689,6 +2706,11 @@ function FOM_NewFindFood(fallback, excludedItemIds, precomputedFoodList, openSlo
|
||||
table.insert(reasonParts, "lower quality preferred");
|
||||
end
|
||||
else
|
||||
-- Bags are full: free a slot by eating a small stack, but still prefer foods
|
||||
-- the pet can actually eat (known food level) so we don't pick an
|
||||
-- unknown-level food the pet will refuse. Falls back to smallest stack
|
||||
-- when nothing has a known level.
|
||||
table.sort(FlatFoodList, FOM_SortKnownThenCount);
|
||||
table.insert(reasonParts, "small stack to free bag space");
|
||||
end
|
||||
if (FOM_Config.AvoidUsefulFood and not fallback) then
|
||||
@@ -2730,6 +2752,15 @@ function FOM_SortCount(a, b)
|
||||
return a.count < b.count;
|
||||
end
|
||||
|
||||
function FOM_SortKnownThenCount(a, b)
|
||||
local aKnown = a.knownLevel and 1 or 0;
|
||||
local bKnown = b.knownLevel and 1 or 0;
|
||||
if (aKnown ~= bKnown) then
|
||||
return aKnown > bKnown; -- edible (known-level) foods first
|
||||
end
|
||||
return a.count < b.count; -- then smallest stack to free bag space
|
||||
end
|
||||
|
||||
function FOM_SortQualityDescending(a, b)
|
||||
return a.quality > b.quality;
|
||||
end
|
||||
@@ -2821,9 +2852,6 @@ function FOM_IsInDiet(food, dietList)
|
||||
if (diet == nil) then
|
||||
diet = "";
|
||||
end
|
||||
if (FOM_Foods[diet] == nil) then
|
||||
FOM_DebugLog("FOM_Foods[diet] == nil");
|
||||
end
|
||||
if (FOM_RemovedFoods ~= nil and FOM_RemovedFoods[diet] ~= nil and GFWTable.IndexOf(FOM_RemovedFoods[diet], food) ~= 0) then
|
||||
return false;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user