EC: automatically placing waypoint on map for Matriarch boss

ForeverFunForeverFun Posts: 1,041
edited October 14 in General Discussions

For those that are coordinate challenged, the below will automatically add a waypoint "Manifestation" marker based on the barked town crier text, and then switch the current EC map radar to the proper facet.  

Make sure to right click and delete the waypoint when the boss has died.

  • Similar to what is posted at link.
  • You can replace all of the code edits related to the above link with below, if you were using that for the "Manifestation of Evil" event.
  • For the grousing that arose at the above linked post, this is just a QoL "Progress!".  It's like a GPS device to help with driving.
  • If you're using EC + Pinco, point Pinco to this post, so Pinco can integrate into that EC UI addin.

Add the below to textparsing.lua, start of function TextParsing.SpecialTexts().


function TextParsing.SpecialTexts()
    local senderText = SystemData.Text
    local find = wstring.find

    local found = nil

    -- SourceID will be player if they are involved in treasure hunting.
    if( (SystemData.TextSourceID == WindowData.PlayerStatus.PlayerId) or (SystemData.TextSourceID ~= 0 and SystemData.TextSourceID ~= -1) ) then    -- originates from town cryer/player, not SYSTEM.
        if( SystemData.TextID == 1164891 ) then    -- A vast shadow spreads as wings blot out the sun... the Umbrascale Matriarch descends upon <loc> at <coord> in <facet>!
            found = senderText
        else
            -- commented out, as event inactive.
            -- local header = L"The ground ruptures and darkness spills forth... the Manifestation of Evil has begun to pierce the vale near "
            -- found = wstring.find(senderText, header, 1, true)
        end
    end
    
    if ( found ) then    -- adapted from charbydis case, note minimal error checking.
        -- eg. 61o 32'N, 45o 8'W at Malas in Malas!
        -- eg. 107o 45'S, 17o 26'E at a location in the wilderness in Trammel! (town cryer order)
        -- eg. a forest outside Skara Brae at 26o 37'S, 30o 52'W in Trammel!   (treasure map hunter notification, flipped area order)
        local facet_number = nil
        local coord = wstring.match(senderText, L"%d+o%s%d+['][NS][,].*%d+o%s%d+['][EW]")    -- extract the coordinates per rigid syntax.  note ".*" search pattern at long/lat, appears there may be alternate whitespace/control character(s) in the middle.
        
        local latDir
        local latVal
        local longDir
        local longVal
        
        if( coord ~= nil ) then
            local text2 = wstring.find(coord, L"[,]")
            first = wstring.sub(coord, 1, text2-1)
        
            first = wstring.gsub(first, L"o ", L".")
            first = wstring.gsub(first, L"'", L"")

            latDir = wstring.sub(first, -1)
            latVal = wstring.sub(first,1, -2)
            
            local second = wstring.sub(coord, text2 + 2)
            second = wstring.gsub(second, L"o ", L".")
            second = wstring.gsub(second, L"'", L"")
        
            longDir = wstring.sub(second, -1)    
            longVal = wstring.sub(second,1, -2)                
            
            -- extract facet from end of string.

            local tail = wstring.len(senderText)                    

            local facet = wstring.sub(senderText, tail-7)    -- match on the last 8 characters.
            if(facet ~= nil) then
                local facets = {[L"Felucca!"]=0,
                                [L"Trammel!"]=1,
                        [L"lshenar!"]=2,
                        [L"n Malas!"]=3,
                        [L"Islands!"]=4,    -- (is "Tokuno Islands!")    
                        [L"Ter Mur!"]=5}    
                facet_number = facets[facet]
            end
        end
        
        if( facet_number ~= nil ) then
            local x,y = MapCommon.ConvertToXYMinutes(tonumber(latVal), tonumber(longVal), latDir, longDir, 1, 1)    

            if( x ~= nil and y ~= nil ) then
                UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, L"Manifestation" .. L"_ICON_100010_SCALE_" .. 1.50 )    -- was 0.69        
                CenterScreenText.SendCenterScreenTexture("battlebegin")
--                Debug.PrintToChat(L"Manifestation,Matriarch: ".. towstring(x).. L","..towstring(y)..L" facet:".. towstring(facet_number))
                -- new code follows to switch the map to the facet in question, centered on the x,y coordinates.
                MapWindow.CenterOnPlayer = false
                ButtonSetPressedFlag( "MapWindowCenterOnPlayerButton", false )
                UORadarSetCenterOnPlayer( false )
                -- change map facet and center x,y position.
                UOCenterRadarOnLocation(x, y, facet_number, 0, false)
                MapCommon.UpdateZoomValues(facet_number, 0)
                MapCommon.AdjustZoom(0)    
            end
            
            return            
        end
    end



-- existing code follows.

Sign In or Register to comment.