Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

Commit ccb06b9

Browse files
committed
Legacy code clean 2
1 parent e2c4998 commit ccb06b9

1 file changed

Lines changed: 12 additions & 45 deletions

File tree

Core/MultiBotInit.lua

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4243,15 +4243,6 @@ local function detachTalentLegacyFrameContent(hostFrame)
42434243
if MultiBot.talent.texts and MultiBot.talent.texts["Title"] then
42444244
MultiBot.talent.texts["Title"]:Hide()
42454245
end
4246-
local applyBtn = MultiBot.talent.buttons and MultiBot.talent.buttons[MultiBot.L("info.talent.Apply")]
4247-
if applyBtn and applyBtn.Hide then
4248-
applyBtn:Hide()
4249-
end
4250-
4251-
local copyBtnLegacy = MultiBot.talent.buttons and MultiBot.talent.buttons[MultiBot.L("info.talent.Copy")]
4252-
if copyBtnLegacy and copyBtnLegacy.Hide then
4253-
copyBtnLegacy:Hide()
4254-
end
42554246

42564247
local legacyClose = MultiBot.talent.buttons and MultiBot.talent.buttons["X"]
42574248
if legacyClose then
@@ -4443,53 +4434,35 @@ do
44434434
end
44444435
end
44454436

4446-
MultiBot.talent.wowButton(MultiBot.L("info.talent.Apply"), -474, 966, 100, 20, 12).doHide()
4447-
.doLeft = function(pButton)
4437+
local function buildTalentApplyValues()
44484438
local tValues = ""
44494439

44504440
for i = 1, 3 do
44514441
local tTab = MultiBot.talent.frames["Tab" .. i]
4452-
44534442
for j = 1, table.getn(tTab.buttons) do
44544443
tValues = tValues .. tTab.buttons[j].value
44554444
end
4456-
44574445
if(i < 3) then tValues = tValues .. "-" end
44584446
end
44594447

4460-
SendChatMessage("talents apply " ..tValues, "WHISPER", nil, MultiBot.talent.name)
4461-
pButton.doHide()
4448+
return tValues
44624449
end
44634450

4464-
local tApply = MultiBot.talent.buttons[ MultiBot.L("info.talent.Apply") ]
4465-
4466-
MultiBot.talent.wowButton(MultiBot.L("info.talent.Copy"), -854, 966, 100, 20, 12)
4467-
local copyBtn = MultiBot.talent.buttons[MultiBot.L("info.talent.Copy")]
4468-
copyBtn:Hide() -- caché définitivement, remplacé par Tab9
4451+
local function applyCustomTalents()
4452+
SendChatMessage("talents apply " .. buildTalentApplyValues(), "WHISPER", nil, MultiBot.talent.name)
4453+
end
44694454

4470-
copyBtn.doLeft = function(pButton)
4455+
local function copyCustomTalentsToTarget()
44714456
local tName = UnitName("target")
44724457
if(tName == nil or tName == "Unknown Entity") then return SendChatMessage(MultiBot.L("info.target"), "SAY") end
44734458

4474-
local tLocClass, tClass = UnitClass("target")
4459+
local _, tClass = UnitClass("target")
44754460
if(MultiBot.talent.class ~= MultiBot.toClass(tClass)) then return SendChatMessage("The Classes do not match.", "SAY") end
44764461

44774462
local tUnit = MultiBot.toUnit(MultiBot.talent.name)
44784463
if(UnitLevel(tUnit) ~= UnitLevel("target")) then return SendChatMessage("The Levels do not match.", "SAY") end
44794464

4480-
local tValues = ""
4481-
4482-
for i = 1, 3 do
4483-
local tTab = MultiBot.talent.frames["Tab" .. i]
4484-
4485-
for j = 1, table.getn(tTab.buttons) do
4486-
tValues = tValues .. tTab.buttons[j].value
4487-
end
4488-
4489-
if(i < 3) then tValues = tValues .. "-" end
4490-
end
4491-
4492-
SendChatMessage("talents apply " ..tValues, "WHISPER", nil, tName)
4465+
SendChatMessage("talents apply " .. buildTalentApplyValues(), "WHISPER", nil, tName)
44934466
end
44944467

44954468
MultiBot.talent.wowButton("X", -470, 992, 17, 20, 13)
@@ -4930,7 +4903,6 @@ MultiBot.talent.addTalent = function(pTab, pID, pNeeds, pValue, pMax, piX, piY,
49304903
end
49314904
end
49324905

4933-
if tApply then tApply:Hide() end
49344906
refreshApplyTabVisibility()
49354907
MultiBot.talent.doState()
49364908
end
@@ -4964,7 +4936,6 @@ MultiBot.talent.addTalent = function(pTab, pID, pNeeds, pValue, pMax, piX, piY,
49644936
end
49654937

49664938
MultiBot.talent.doState()
4967-
if tApply then tApply:Hide() end
49684939
refreshApplyTabVisibility()
49694940
end
49704941
tTalent:SetFrameLevel(8)
@@ -5181,7 +5152,6 @@ function MultiBot.talent.setTalentsCustom()
51815152
MultiBot.talent.frames["Tab2"]:Show()
51825153
MultiBot.talent.frames["Tab3"]:Show()
51835154
MultiBot.talent.frames["Tab4"]:Hide()
5184-
if tApply then tApply:Hide() end
51855155
MultiBot.talent.__activeTab = "custom_talents"
51865156
refreshApplyTabVisibility()
51875157
MultiBot.talent.doState()
@@ -5423,7 +5393,6 @@ function MultiBot.talent.showCustomGlyphs()
54235393
end
54245394
end
54255395
end
5426-
if tApply then tApply:Hide() end
54275396
refreshApplyTabVisibility()
54285397
MultiBot.talent.setText("Title", "|cffffff00" .. MultiBot.L("info.glyphscustomglyphsfor") .. " |r" .. (MultiBot.talent.name or "?"))
54295398
end
@@ -5436,11 +5405,9 @@ if MultiBot.talent.frames["Tab9"] then MultiBot.talent.frames["Tab9"]:Hide() end
54365405
Tab9 : Copy — remplace l'ancien bouton Copie
54375406
]]--
54385407

5439-
local copyTabBtn = addTalentBottomTab("Tab9", "Copy", -315)
5408+
local copyTabBtn = addTalentBottomTab("Tab9", MultiBot.L("info.talent.Copy"), -315)
54405409
copyTabBtn.doLeft = function(pButton)
5441-
if copyBtn and copyBtn.doLeft then
5442-
copyBtn.doLeft(copyBtn)
5443-
end
5410+
copyCustomTalentsToTarget()
54445411

54455412
-- Animation pulse du texte
54465413
local btn = tabTextures["Tab9"] and tabTextures["Tab9"].btn
@@ -5483,8 +5450,8 @@ applyTabBtn = applyTab
54835450
applyTabBtn.doHide()
54845451
applyTabBtn.doLeft = function()
54855452
if MultiBot.talent and MultiBot.talent.__activeTab == "custom_talents" then
5486-
if tApply and tApply.doLeft and hasCustomTalentSelection() then
5487-
tApply.doLeft(tApply)
5453+
if hasCustomTalentSelection() then
5454+
applyCustomTalents()
54885455
end
54895456
elseif MultiBot.talent and MultiBot.talent.__activeTab == "custom_glyphs" then
54905457
if hasCustomGlyphSelection() then

0 commit comments

Comments
 (0)