Revert our combat-only nameplates (SIN's Forever Combat Nameplates replaces them)

Reverts 1c33b428e, a7f630fbe and e0f252c1b: the /fb plates switch in ForeverBots, the PLATES add-on request, our server
filter and its corpse fix. The next commit puts in SIN's Forever Combat Nameplates 3.0 in their place.
This commit is contained in:
Karrz1
2026-11-16 20:10:27 +00:00
parent 6f36a6b380
commit f33e4b64fa
5 changed files with 1 additions and 113 deletions
@@ -2143,65 +2143,6 @@ local function Toggle()
UI.SetWindowShown(not open)
end
-- Enemy nameplates in combat only. The client's own setting for it (Enemy Unit Nameplates on, Always Show Nameplates off) shows a
-- bar over every hostile mob in range, fighting you or not. With those two settings the add-on asks the server to filter
-- (PLATES|1, Player::SetCombatPlateFilter): a mob outside your, your pet's or your group's fight keeps its plain red name and one
-- that joins the fight gets its bar; the client draws both itself. Any other setting: no filter (PLATES|0). On by default;
-- /fb plates off leaves the client's own behaviour. The server forgets it on a UI reload, so it is asked again on every
-- loading screen and whenever one of the two settings changes. Up to three tries when no answer comes.
UI.plates = { asked = nil, confirmed = nil, tries = 0, gen = 0 }
local function CVarOn(name)
if C_CVar and C_CVar.GetCVarBool then return C_CVar.GetCVarBool(name) and true or false end
return GetCVar and GetCVar(name) == "1" or false
end
local function PlatesWanted()
return ForeverBotsDB.combatPlates ~= false and CVarOn("nameplateShowEnemies") and not CVarOn("nameplateShowAll")
end
function UI.PlatesSync(force)
local Net = Cmd.ns.Net
if not Net then return end
local want = PlatesWanted()
local st = UI.plates
if not force and st.asked == want and st.confirmed == want then return end
st.asked, st.confirmed, st.tries = want, nil, 0
st.gen = st.gen + 1
local gen = st.gen
local function try()
if gen ~= st.gen then return end
st.tries = st.tries + 1
Net.EnsureMode(function()
Net.Request("PLATES", { want and "1" or "0" }, function(fields)
if gen ~= st.gen then return end
if fields and fields[1] == (want and "1" or "0") then
st.confirmed = want
elseif st.tries < 3 and C_Timer and C_Timer.After then
C_Timer.After(st.tries * 3, try)
end
end)
end)
end
try()
end
function UI.CombatPlates(on)
ForeverBotsDB.combatPlates = on and true or false
UI.PlatesSync(true)
end
do -- kept out of the main chunk: Lua 5.1 allows 200 locals there
local platesFrame = CreateFrame("Frame")
platesFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
platesFrame:RegisterEvent("CVAR_UPDATE")
platesFrame:SetScript("OnEvent", function(_, event, name)
if event == "CVAR_UPDATE" then
if issecretvalue and issecretvalue(name) then return end
name = type(name) == "string" and name:lower() or ""
if name ~= "nameplateshowenemies" and name ~= "nameplateshowall" then return end
UI.PlatesSync(false)
return
end
UI.PlatesSync(true) -- a new session or a UI reload: the server has forgotten
end)
end
do -- kept out of the main chunk: Lua 5.1 allows 200 locals there
local combatFrame = CreateFrame("Frame")
combatFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
@@ -3043,24 +2984,6 @@ SlashCmdList.FOREVERBOTS = function(msg)
Print(L["bot confirmations in chat: %s"]:format(ForeverBotsDB.showChat and L["shown"] or L["hidden (shown in the Bots panel status line)"]) .. " (/fb chat on|off)")
return
end
if verb == "plates" or verb == "nameplates" then
-- "/fb plates" alone shows the state (and asks the server again if it never answered)
if class == "on" then UI.CombatPlates(true)
elseif class == "off" then UI.CombatPlates(false)
elseif UI.plates.confirmed == nil then UI.PlatesSync(true) end
local text
if ForeverBotsDB.combatPlates == false then
text = L["off: the client's own nameplate settings apply."]
elseif not PlatesWanted() then
text = L["on, but it needs Enemy Unit Nameplates on and Always Show Nameplates off (Esc > Options > Nameplates)."]
elseif UI.plates.confirmed == true then
text = L["on: a health bar only over mobs that fight you, your pet or your group; the others keep their name."]
else
text = L["on, waiting for the server to confirm (an older server does not have it)."]
end
Print(L["enemy nameplates only in combat: %s"]:format(text) .. " (/fb plates on|off)")
return
end
if verb == "bots" or verb == "manage" or verb == "roster" then
if Cmd.ns.Windows then Cmd.ns.Windows.Toggle() else Print(L["%s is missing: reinstall the add-on."]:format("ForeverBots_Windows.lua")) end
return
@@ -81,7 +81,7 @@ Net.Unescape = Unescape
local ANSWERS = { ROSTER_RESP = true, BOT_DETAIL_RESP = true, STATS_RESP = true, PONG = true, ALTS_RESP = true,
EVENT_PUSH = true, SUMMON_RESP = true, LOGIN_RESP = true, LOGOUT_RESP = true, SELF_RESP = true,
GEAR_RESP = true, BAGS_RESP = true, QUESTS_RESP = true, SPEC_RESP = true, LFG_RESP = true,
ASSIGN_RESP = true, PLATES_RESP = true }
ASSIGN_RESP = true }
Net.ANSWERS = ANSWERS
Net.seq = math.random(1, 0x3fffffff)
@@ -338,14 +338,6 @@ ForeverBotsLocale = {
[" (type /w %s <message>)"] = " (введите /w %s <сообщение>)",
["whisper to %s failed: %s"] = "шепот игроку %s не удался: %s",
["bot confirmations in chat: %s"] = "подтверждения ботов в чате: %s",
["enemy nameplates only in combat: %s"] = "индикаторы здоровья врагов только в бою: %s",
["off: the client's own nameplate settings apply."] = "выкл.: действуют настройки индикаторов здоровья самого клиента.",
["on, but it needs Enemy Unit Nameplates on and Always Show Nameplates off (Esc > Options > Nameplates)."] =
"вкл., но нужно включить индикаторы здоровья противников и выключить «Всегда показывать индикаторы здоровья» (Esc > Настройки > Индикаторы здоровья).", -- check
["on: a health bar only over mobs that fight you, your pet or your group; the others keep their name."] =
"вкл.: полоска здоровья только над мобами, которые сражаются с вами, вашим питомцем или вашей группой; у остальных только имя.",
["on, waiting for the server to confirm (an older server does not have it)."] =
"вкл., ждем подтверждения сервера (на старом сервере этого нет).",
["shown"] = "включено",
["hidden (shown in the Bots panel status line)"] = "скрыто (отображается в строке состояния панели ботов)",
["minimap button: %s"] = "кнопка у миникарты: %s",
@@ -155,10 +155,6 @@ Built on the client's own portrait window (the one its Raid and Looking For Grou
- `/fb scale <0.7-1.5>` sets the window size (default 1.2, saved).
- `/fb minimap on|off|reset` shows, hides or re-centres the minimap button.
- Enemy nameplates only in combat: with Enemy Unit Nameplates on and Always Show Nameplates off, the client alone shows a health
bar over every hostile mob in range. The add-on has the server fix that: a mob fighting you, your pet or your group gets its
bar, every other one keeps its plain red name, and a mob that joins the fight gets its bar at once. It is on by default and
works only with those two settings; `/fb plates off` turns it off, `/fb plates` shows whether the server confirmed it.
- `/fb quick` fills your group with bots: to five in the open world and 5-player dungeons, to the instance size in a bigger one (10 in Upper Blackrock Spire, 20 or 40 in a raid), with tanks, healers and damage dealers; `/fb resume` and `/fb flee` send those two orders.
- Group finder tab (the fifth tab, after Marks): the bot dungeon finder without typing. Pick your role (Auto, Tank, Heal, DPS;
remembered) and a dungeon with < and > (Any for my level, then the dungeons of your level, then the rest; Upper Blackrock Spire
@@ -1149,24 +1149,6 @@ void HandleAltsReq(uint32 client_seq, WorldSession* sess)
SendFields(sess, client_seq, "ALTS_RESP", fields);
}
// ----------------------------------------------------------------------------
// PLATES — combat-only enemy nameplates for the sender's own client (Player::SetCombatPlateFilter): NPCs outside his, his pet's or
// his group's fight show their plain name, the ones fighting get their health bar. Any player may ask (no bot needed).
//
// Wire: PLATES|1 PLATES|0
// Reply: PLATES_RESP|<1|0> (what will be in force from the player's next update)
// ----------------------------------------------------------------------------
void HandlePlatesReq(uint32 client_seq, WorldSession* sess, std::vector<std::string> const& fields)
{
Player* me = sess ? sess->GetPlayer() : nullptr;
if (!me)
return;
bool const on = !fields.empty() && fields[0] == "1";
me->SetCombatPlateFilter(on);
TC_LOG_DEBUG("playerbot.v2", "[combat_plates] {} turns combat-only nameplates {}", me->GetName(), on ? "on" : "off");
SendFields(sess, client_seq, "PLATES_RESP", { on ? "1" : "0" });
}
// ----------------------------------------------------------------------------
// SELF — addon counterpart to `.playerbot self on|off|status`. Attaches
// or detaches the V2 bot logic to the issuing player's OWN character. Mirrors
@@ -1677,10 +1659,6 @@ void DispatchAssembled(WorldSession* sess, uint32 seq,
{
HandleAltsReq(seq, sess);
}
else if (mtype == "PLATES")
{
HandlePlatesReq(seq, sess, fields);
}
else if (mtype == "SUMMON")
{
HandleSummon(seq, sess, fields);
@@ -1848,7 +1826,6 @@ bool OnAddonWhisper(Player* sender, Player* /*receiver*/,
&& mtype != "LOGOUT_REQ"
&& mtype != "SELF"
&& mtype != "PING"
&& mtype != "PLATES"
&& mtype != "LFG_REQ"
&& mtype != "POP_REQ"
&& mtype != "ASSIGN_REQ")