EC: automatically placing waypoint on map for event boss
For those that are coordinate challenged, the below will automatically add a waypoint "Manifestation" marker based on the barked town crier text. Make sure to right click and delete the waypoint when the boss has died.
Add the below to textparsing.lua, and end of function TextParsing.SpecialTexts(). Ideally, replace the TextSourceId number check with the actual objectID value of your town crier.
p.s. UO team should buff up the boss on atlantic, like 10x. It dies in 30 seconds or so.
p.p.s UO team, the cryer doesn't bark coordinates for at least Valley of Eodon maps.
local header = L"The ground ruptures and darkness spills forth... the Manifestation of Evil has begun to pierce the vale near "
local found = nil
-- replace TextSourceId with the Id number of your town cryer, to avoid spoofing.
if( SystemData.TextSourceID ~= 0 and SystemData.TextSourceID ~= -1 ) then -- originates from town cryer, not SYSTEM.
found = wstring.find(senderText, header)
end
if( found ) then -- adapted from charbydis case, note minimal error checking.
local facet_number = nil
local location = wstring.gsub( senderText, header, L"" )
local coord = location
local text2 = wstring.find(coord, L"[,]")
local first = wstring.sub(coord, 1, text2 - 1)
first = wstring.gsub(first, L"o ", L".")
first = wstring.gsub(first, L"'", L"")
local latDir = wstring.sub(first, -1)
local 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"")
if( second ) then
local facets = {}
-- truncate string around " at " to extract trailing Direction and facet string.
local sep = wstring.find(second, L" at ")
local chopped = wstring.sub(second, 1, sep-1) -- strsub (s, i, [j]) Returns another string, which is a substring of s , starting at i and runing until j .
-- extract facet from end of string.
local tail = wstring.find(second, L" in ")
local facet = wstring.sub(second, tail+4)
local del = wstring.find(facet, L"!")
facet = wstring.sub(facet, 0, del-1) -- remove trailing !
-- convert facet to number
facets = {[L"Felucca"]=0, [L"Trammel"]=1, [L"Ilshenar"]=2, [L"Malas"]=3, [L"Tokuno"]=4, [L"Ter Mur"]=5} -- only trammel, malas verified.
facet_number = facets[facet]
second = chopped -- update string for long value extraction.
end
local longDir = wstring.sub(second, -1)
local longVal = wstring.sub(second,1, -2)
if( facet_number ~= nil ) then
local x,y = MapCommon.ConvertToXYMinutes(tonumber(latVal), tonumber(longVal), latDir, longDir, 1, 1)
-- Debug.PrintToChat(towstring(x) .. L" ".. towstring(y)..L" facet=".. towstring(facet_number))
UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, L"Manifestation" .. L"_ICON_100010_SCALE_" .. 0.69 )
CenterScreenText.SendCenterScreenTexture("battlebegin") -- generate notification.
return
end
end
Comments
ESRB warning: Some Blood. LOTS of Alcohol. Some Violence. LOTS of Bugs
-UO official forums, brought to you by BoardSword studio
local found = nil
-- replace (TextSourceID ~= 0 and TextSourceID ~= -1) with the Id number of your town cryer, to avoid spoofing. 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, not SYSTEM.
found = wstring.find(senderText, header, 1, true)
end
if( found ) then -- adapted from charbydis case, note minimal error checking.
local facet_number = nil
local location = wstring.gsub( senderText, header, L"" ) -- extract trailing location data.
local coord = location
local text2 = wstring.find(coord, L"[,]")
local first = wstring.sub(coord, 1, text2 - 1)
first = wstring.gsub(first, L"o ", L".")
first = wstring.gsub(first, L"'", L"")
local latDir = wstring.sub(first, -1)
local 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"")
if( second ) then
-- 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!
local facets = {}
-- truncate string around " at " to extract trailing Direction and facet string.
local sep = wstring.find(second, L" at ", 1, true)
local chopped = wstring.sub(second, 1, sep-1) -- strsub (s, i, [j]) Returns another string, which is a substring of s , starting at i and runing until j .
-- extract facet from end of string.
local tail = wstring.len(second) -- find terminal !
local facet = wstring.sub(second, tail-12) -- extract based on longest possible facet name.
tail = wstring.find(facet, L" in ", 1, true) -- find trailing " in "
facet = wstring.sub(facet, tail+4) -- extract facet string.
-- convert facet to number
facets = {[L"Felucca!"]=0, [L"Trammel!"]=1, [L"Ilshenar!"]=2, [L"Malas!"]=3, [L"Tokuno!"]=4, [L"Ter Mur!"]=5} -- only trammel, malas verified.
facet_number = facets[facet]
second = chopped -- update string for long value extraction.
end
local longDir = wstring.sub(second, -1)
local longVal = wstring.sub(second,1, -2)
if( facet_number ~= nil ) then
local x,y = MapCommon.ConvertToXYMinutes(tonumber(latVal), tonumber(longVal), latDir, longDir, 1, 1)
-- Debug.PrintToChat(towstring(x) .. L" ".. towstring(y)..L" facet=".. facet.. L" ".. towstring(facet_number))
UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, L"Manifestation" .. L"_ICON_100010_SCALE_" .. 1.50 ) -- was 0.69
CenterScreenText.SendCenterScreenTexture("battlebegin") -- generate notification.
return
end
end
Change the line 308 from
Good change, thanks!
local found = nil
-- replace (TextSourceID ~= 0 and TextSourceID ~= -1) with the Id number of your town cryer, to avoid spoofing. 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.
found = wstring.find(senderText, header, 1, true)
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-12) -- extract from tail based on longest possible facet name.
tail = wstring.find(facet, L" in ", 1, true) -- find trailing " in "
if( tail ~= nil ) then
facet = wstring.sub(facet, tail+4) -- extract facet string.
-- convert facet to number
local facets = {[L"Felucca!"]=0, [L"Trammel!"]=1, [L"Ilshenar!"]=2, [L"Malas!"]=3, [L"Tokuno!"]=4, [L"Ter Mur!"]=5} -- only trammel, malas verified.
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: ".. towstring(x).. L","..towstring(y)..L" facet:".. towstring(facet_number))
end
return
end
end
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: ".. 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