EC: Tracking skill UI and additional improvement (part 2)
This is a version 1 of some UI / behavior improvements to tracking.
- Introduces Interface.ForcedTrackingType (defaulted to tracking players) to allow the first tracking gump to be auto-selected. See this thread for background on EC auto-selecting gump choices.
- Second tracking gump will automatically be handled for player tracking, if forced by #1.
- New TrackingIgnoreList provides a list of target names to avoid tracking.
- New TrackingEnemyList provides a list of target names to prioritize tracking.
- Target selection will automatically ignore already tracked targets.
- Target selection will automatically ignore party members.
- Target selection will automatically ignore guild members. (must have green mobiles dock enabled)
- Target selection will automatically prioritize orange targets as enemy (must have orange mobiles dock enabled).
- Player target selection is generally automatic. and will hide gump when no suitable targets (based on logic above).
The logic can be easilly extended to cover prioritizing reds/blues, etc. Uncomment out the Debug.PrintToChat() statements for debugging purposes.
Feel free to suggest changes/other logic.
First, pickup the changes at this link.
The changes in this thread are all made to GumpsParsing.lua
Add this right under GumpsParsing.SOSTids. Note the names are case-sensitive unicode, with no titles or suffixes.
GumpsParsing.TrackingEnemyList = {L"Yoshi",L"Mervyn"} -- enemies to prioritize tracking. All entries are Unicode strings (must have L prefix)
GumpsParsing.TrackingIgnoreList = {L"Trinity",L"Neo",L"Morphius"} -- players to ignore for tracking. All entries are Unicode strings (must have L prefix)
GumpsParsing.TrackingForcedType = 0
Add this under following line in GumpsParsing.ShowHide:
for gumpID, value in pairs(GumpData.Gumps) do
if (gumpID == 12350000) then -- GUMP_TRACKING_ONE
local buttonID = 0
-- 1= Animals, 2=Monsters, 3=NPCs, 4=Players
if(Interface.ForcedTrackingType) then
buttonID = Interface.ForcedTrackingType
else
buttonID = 4 -- default to tracking players if no type set
end
if(buttonID ~= 0) then
GumpsParsing.PressButton(gumpID, buttonID)
GumpsParsing.ToShow[gumpID] = 0
GumpsParsing.TrackingForcedType = buttonID -- save away type that was automatically selected
end
elseif (gumpID == 12350001) then -- GUMP_TRACKING_TWO
local enemyindex = 0
local foundEnemy = false
local founddata = {}
-- you see no evidence of those in the area (avoids tracking_two)
if( GumpsParsing.TrackingForcedType == 4 ) then -- if players were automatically selected in GUMP_TRACKING_ONE, trigger additional logic.
for labels, data in pairs(GumpData.Gumps[12350001].Labels) do
if(data.text ~= nil) then
founddata = data.text
break
end
end
end
for entry, textentry in pairs(founddata) do
local foundIgnore = false
local trimmedname = textentry
-- strip out Lord+Lady from returned string choices. tracking gump data doesn't include suffix in name
trimmedname = wstring.gsub(trimmedname, L"Lady ", L"")
trimmedname = wstring.gsub(trimmedname, L"Lord ", L"")
local ofPos = wstring.find(trimmedname, L"%sof%s") -- tracking names can include trailing "of Vesper"
if(ofPos) then
trimmedname = wstring.sub(trimmedname, 0, ofPos-1)
end
-- skip ignorelist targets
for i = 1, #GumpsParsing.TrackingIgnoreList do
if(trimmedname == GumpsParsing.TrackingIgnoreList[i]) then -- exact string match
foundIgnore = true
break
end
end
if(foundIgnore == true) then
--Debug.PrintToChat(L"foundIgnore, ignoreList ".. trimmedname)
continue
end
-- skip party members
for mobileId, bho in pairs (PartyHealthBar.PartyMembers) do
if(PartyHealthBar.PartyMembers[mobileId].name) then
pname = PartyHealthBar.PartyMembers[mobileId].name
pname = wstring.gsub(pname, L"Lady ", L"")
pname = wstring.gsub(pname, L"Lord ", L"")
if (wstring.find(pname, trimmedname)) then -- pname can have suffixes, etc
foundIgnore = true
break
end
end
end
if(foundIgnore == true) then
--Debug.PrintToChat(L"foundIgnore, partymember "..trimmedname)
continue
end
-- skip guild/friendly
for mob, value in pairs(MobilesOnScreen.MobilesGreen) do
if(WindowData.MobileName[value] ~= nil and WindowData.MobileName[value].MobName ~= nil) then
mobname = WindowData.MobileName[value].MobName
if(wstring.find(mobname, trimmedname)) then -- first parameter may have stray [XXX] (young), " The " " Of "suffixes
foundIgnore = true
break
end
end
end
if(foundIgnore == true) then
--Debug.PrintToChat(L"foundIgnore, guild "..trimmedname)
continue
end
-- skip target already being tracked.
for waypointId, whocare in pairs (TrackingPointer.TrackWaypoints) do
-- if(WindowData.MobileName[waypointId] ~= nil and WindowData.MobileName[waypointId].MobName ~= nil) then
-- local mobname = WindowData.MobileName[waypointId].MobName --wstring.trim(WindowData.MobileName[waypointId].MobName)
if(TrackingPointer.TrackWaypoints[waypointId] ~= nil and TrackingPointer.TrackWaypoints[waypointId].MobName ~= nil) then
local mobname = TrackingPointer.TrackWaypoints[waypointId].MobName
if(wstring.find(mobname, trimmedname)) then -- first parameter has suffix, guild etc.
foundIgnore = true
break
end
end
end
if(foundIgnore == true) then
--Debug.PrintToChat(L"foundIgnore, already_tracked ".. trimmedname)
continue
end
-- check enemylist
for i = 1, #GumpsParsing.TrackingEnemyList do
if(trimmedname == GumpsParsing.TrackingEnemyList[i]) then -- exact string match
foundEnemy = true
enemyindex = entry
break
end
end
if( foundEnemy == true ) then
--Debug.PrintToChat(L"foundEnemy, EnemyList ".. trimmedname)
break -- exit loop.
end
-- check for enemy/orange
for mob, value in pairs(MobilesOnScreen.MobilesOrange) do
if(WindowData.MobileName[value] ~= nil and WindowData.MobileName[value].MobName ~= nil) then
mobname = WindowData.MobileName[value].MobName
if(wstring.find(mobname, trimmedname)) then -- first parameter may have stray [XXX] (young), " The " suffixes
foundEnemy = true
enemyindex = entry
break
end
end
end
if(foundEnemy == true) then
--Debug.PrintToChat(L"foundEnemy, enemy/orange "..trimmedname)
break
end
-- default to selecting current item (not marked enemy, not marked ignore), continue search for better match
enemyindex = entry
end -- found tracking (players) target names loop
if( enemyindex ~= 0 ) then
GumpsParsing.PressButton(gumpID, enemyindex)
GumpsParsing.ToShow[gumpID] = 0
--Debug.PrintToChat(L"Tracking selected targetname ".. founddata[enemyindex])
elseif( GumpsParsing.TrackingForcedType == 4 ) then
GumpsParsing.ToShow[gumpID] = 0 -- avoid showing the gump if no enemy identified, and Players checking was used
--Debug.PrintToChat(L"Nothing to do, hiding tracking gump")
end
end