Flat-Badger-1971 / ArchiveHelper

0 stars 1 forks source link

Fabled detection doesn't work in french #1

Closed Stemuweb closed 5 months ago

Stemuweb commented 5 months ago

In french, the keyword "fabule" used for detection is never at the beginning of the enemy name (the adjective "fabuleux" or "fabuleuse" comes after the noun).

To fix it in my version, I had to retrieve your previous code before the factorization into markerCheck(), that uses :find rather than a comparison.

function AH.FabledCheck()
    local extantMarker = GetUnitTargetMarkerType("reticleover")

    if (extantMarker == _G.TARGET_MARKER_TYPE_NONE) then
        if (GetUnitName("reticleover"):find(fabledText) and not IsUnitDead("reticleover")) then
            local marker = getAvailableMarker()
            AssignTargetMarkerToReticleTarget(marker)
        end
    elseif (extantMarker ~= _G.TARGET_MARKER_TYPE_EIGHT) then
         -- sanity check
         local index = getMarkerIndex(extantMarker)

        if ((not GetUnitName("reticleover"):find(fabledText)) and (not AH.MARKERS[index].manual)) then
            AssignTargetMarkerToReticleTarget(extantMarker)
            makeMarkerAvailable(extantMarker)
        end
    end
end

Either this, or using only :find in function markerCheck (at the cost of bad perfs?), or adding a parameter to markerCheck() to choose the keyword detection method between :find and equality test.

Flat-Badger-1971 commented 5 months ago

You are correct, I recently changed this code to optimise it, but hadn't realised I wasn't using :find anymore