Модуль:Песочница/Pok: различия между версиями

мНет описания правки
мНет описания правки
Строка 124: Строка 124:
                     if foundJob then
                     if foundJob then
                         table.insert(results, "Job: " .. foundJob .. " (слот: " .. slot .. ")")
                         table.insert(results, "Job: " .. foundJob .. " (слот: " .. slot .. ")")
                    else
                        table.insert(results, "Gear: " .. currentGearId .. " (слот: " .. slot .. ")")
                     end
                     end
                 end
                 end
Строка 133: Строка 131:


     -- Обработка loadout (loadoutData)
     -- Обработка loadout (loadoutData)
     for _, loadout in ipairs(loadoutData) do
     for _, loadout in pairs(loadoutData) do
         if loadout.equipment then
         if loadout.equipment then
             for slot, equipId in pairs(loadout.equipment) do
             for slot, equipId in pairs(loadout.equipment) do
                 if equipId == targetId and (not slotFilter or slot == slotFilter) then
                 if equipId == targetId and (not slotFilter or slot == slotFilter) then
                     local foundGroupId = nil
                     local foundGroupId = nil
-- Поиск группы в loadoutGroupData, в которой присутствует loadout.id
                    -- Поиск группы в loadoutGroupData, в которой присутствует loadout.id
for _, group in pairs(loadoutGroupData) do
                    for _, group in pairs(loadoutGroupData) do
    if group.loadouts and type(group.loadouts) == "table" then
                        if group.loadouts and type(group.loadouts) == "table" then
        for _, lId in ipairs(group.loadouts) do
                            for _, lId in ipairs(group.loadouts) do
            if lId == loadout.id then
                                if lId == loadout.id then
                foundGroupId = group.id
                                    foundGroupId = group.id
                break
                                    break
            end
                                end
        end
                            end
    end
                        end
    if foundGroupId then break end
                        if foundGroupId then break end
end
                    end
                     local foundJob = nil
                     local foundJob = nil
                     -- Поиск роли в gearRoleLoadout, где группы содержат найденный id группы
                     -- Поиск роли в gearRoleLoadout, где группы содержат найденный id группы
Строка 167: Строка 165:
                     if foundJob then
                     if foundJob then
                         table.insert(results, "Job: " .. foundJob .. " (слот: " .. slot .. ")")
                         table.insert(results, "Job: " .. foundJob .. " (слот: " .. slot .. ")")
                    else
                        table.insert(results, "Loadout: " .. loadout.id .. " (слот: " .. slot .. ")")
                     end
                     end
                 end
                 end