Publish122: matriarch sightings board to map location

ForeverFunForeverFun Posts: 1,093
edited February 10 in General Discussions
The changes below will cause a double click on the matriarch sightings board to update the player radar/map with a waypoint placed for the matriarch, if it's active.






file GumpsParsing.lua, function GumpsParsing.ShowHide() 
		elseif (gumpID == 9111) then	-- "matriarch sightings" gump 
for label, data in pairs(GumpData.Gumps[gumpID].Labels) do
if( data.tid == nil or data.tid ~= 1164891 ) then
continue
end

if( data.tidParms == nil ) then
break
end

local senderText = ReplaceTokens(GetStringFromTid(data.tid), data.tidParms)

TextParsing.PlaceMapSpecialWaypoint( senderText, L"UmbrascaleMatriarch" )
break
end -- for

file TextParsing.lua, paste this as a new function at the bottom of the file:

function TextParsing.PlaceMapSpecialWaypoint( senderText, mobName )
-- 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
return
end

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
return
end


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]

if( facet_number == nil ) then
return
end

local x,y = MapCommon.ConvertToXYMinutes(tonumber(latVal), tonumber(longVal), latDir, longDir, 1, 1)

if( x == nil or y == nil ) then
return
end

-- TODO search for existing waypoint, return if exists.

UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, mobName.. L"_ICON_100010_SCALE_" .. 1.00 ) -- was 0.69 was 1.50
CenterScreenText.SendCenterScreenTexture("battlebegin")
--Debug.PrintToChat(mobName..L" ".. 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


Sign In or Register to comment.