Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ globals = {
"TooltipBackdropTemplateMixin", "NORMAL_FONT_COLOR", "HIGHLIGHT_FONT_COLOR", "GameTooltip_SetDefaultAnchor", "ChatFrame1", "UISpecialFrames", "GetMouseFocus", "ShowUIPanel", "tremove", "min", "max",
"GetMinimapShape", "GetMinimapShape", "PanelTemplates_TabResize", "GetGuildRosterShowOffline", "SetGuildRosterShowOffline", "IsInGuild", "GetGuildInfo", "SetGuildRosterShowOffline", "PLAYER", "INVENTORY_TOOLTIP",
"BAGSLOT", "UNKNOWN", "UnitIsDead", "ShowPrompt", "_MB_GetOrCreateShamanPos", "ensureHiddenTooltip", "MB_TAB_TITLE_DEFAULT", "SPELLBOOK", "MB_PAGE_DEFAULT", "SPELLBOOK_END_NON_SPELL_STREAK", "sendInventoryItemCommand",
"RAID_CLASS_COLORS", "INSPECT", "MB_INVENTORY_LABEL", "LOADING", "ITEM", "ITEMS", "SEARCH", "NO_QUESTS_LABEL", "QUESTS_LABEL", "QUEST_LOG"
"RAID_CLASS_COLORS", "INSPECT", "MB_INVENTORY_LABEL", "LOADING", "ITEM", "ITEMS", "SEARCH", "NO_QUESTS_LABEL", "QUESTS_LABEL", "QUEST_LOG", "UnitIsUnit"
}

read_globals = {
Expand Down
4 changes: 2 additions & 2 deletions Core/MultiBotHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1843,13 +1843,13 @@ function MultiBot.HandleMultiBotEvent(event, ...)
-- EQUIPPING --

if(MultiBot.inventory:IsVisible()) then
if(MultiBot.isInside(arg1, "装备", "使用", "吃", "喝", "盛宴", "摧毁")) then
if(MultiBot.isInside(arg1, "装备", "卸下", "使用", "吃", "喝", "盛宴", "摧毁")) then
tButton.waitFor = "INVENTORY"
SendChatMessage("items", "WHISPER", nil, tButton.name)
return
end

if(MultiBot.isInside(string.lower(arg1), "equipping", "using", "eating", "drinking", "feasting", "destroyed")) then
if(MultiBot.isInside(string.lower(arg1), "equipping", "unequipping", "using", "eating", "drinking", "feasting", "destroyed", "removed", "taking off")) then
tButton.waitFor = "INVENTORY"
SendChatMessage("items", "WHISPER", nil, tButton.name)
return
Expand Down
1 change: 1 addition & 0 deletions MultiBot.toc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ UI\MultiBotSpellBookFrame.lua
UI\MultiBotRewardFrame.lua
UI\MultiBotInventoryFrame.lua
UI\MultiBotInventoryItem.lua
UI\MultiBotInspectUI.lua
UI\MultiBotItemusFrame.lua
UI\MultiBotIconosFrame.lua
UI\MultiBotItem.lua
Expand Down
157 changes: 157 additions & 0 deletions UI/MultiBotInspectUI.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
if not MultiBot then
return
end

local EQUIPMENT_SLOT_BY_NAME = {
HeadSlot = 1,
NeckSlot = 2,
ShoulderSlot = 3,
ShirtSlot = 4,
ChestSlot = 5,
WaistSlot = 6,
LegsSlot = 7,
FeetSlot = 8,
WristSlot = 9,
HandsSlot = 10,
Finger0Slot = 11,
Finger1Slot = 12,
Trinket0Slot = 13,
Trinket1Slot = 14,
BackSlot = 15,
MainHandSlot = 16,
SecondaryHandSlot = 17,
RangedSlot = 18,
TabardSlot = 19,
}

local INSPECT_SLOT_SUFFIXES = {
"HeadSlot",
"NeckSlot",
"ShoulderSlot",
"ShirtSlot",
"ChestSlot",
"WaistSlot",
"LegsSlot",
"FeetSlot",
"WristSlot",
"HandsSlot",
"Finger0Slot",
"Finger1Slot",
"Trinket0Slot",
"Trinket1Slot",
"BackSlot",
"MainHandSlot",
"SecondaryHandSlot",
"RangedSlot",
"TabardSlot",
}

local function getInspectedBotName()
local inspectUnit = InspectFrame and InspectFrame.unit
if inspectUnit and UnitExists(inspectUnit) then
return UnitName(inspectUnit)
end

return UnitName("target")
end

local function canUnequipInspectedBot(botName)
if not botName or botName == "" then
return false
end

if MultiBot.isActive then
return MultiBot.isActive(botName)
end

return UnitIsPlayer("target") and not UnitIsUnit("target", "player")
end

local function requestInventorySync(botName)
if MultiBot.RequestBotInventory then
MultiBot.RequestBotInventory(botName)
return
end

if MultiBot.RefreshInventory then
MultiBot.RefreshInventory(0.15)
end
end

local function getSlotItemLink(inspectButton)
if not inspectButton then
return nil
end

local slotId = inspectButton.GetID and inspectButton:GetID() or nil
if not slotId or slotId <= 0 then
slotId = EQUIPMENT_SLOT_BY_NAME[inspectButton.mbSlotName or ""]
end

local inspectUnit = InspectFrame and InspectFrame.unit
if inspectUnit and UnitExists(inspectUnit) and slotId then
return GetInventoryItemLink(inspectUnit, slotId)
end

return nil
end

local function showRightClickHint(self)
if not GameTooltip or not GameTooltip:IsShown() then
return
end

local botName = getInspectedBotName()
if canUnequipInspectedBot(botName) then
GameTooltip:AddLine(" ")
GameTooltip:AddLine("Clic droit : déséquiper (ue)", 1, 0.82, 0)
GameTooltip:Show()
end
end

local function onInspectSlotClick(self, mouseButton)
if mouseButton ~= "RightButton" then
return
end

local botName = getInspectedBotName()
if not canUnequipInspectedBot(botName) then
return
end

local itemLink = getSlotItemLink(self)
if not itemLink or itemLink == "" then
return
end

SendChatMessage("ue " .. itemLink, "WHISPER", nil, botName)
requestInventorySync(botName)
end

local function hookInspectSlot(slotSuffix)
local buttonName = "Inspect" .. slotSuffix
local button = _G[buttonName]
if not button or button.__mbUnequipHooked then
return
end

button.__mbUnequipHooked = true
button.mbSlotName = slotSuffix
button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
button:HookScript("OnClick", onInspectSlotClick)
button:HookScript("OnEnter", showRightClickHint)
end

local function hookInspectSlots()
for _, suffix in ipairs(INSPECT_SLOT_SUFFIXES) do
hookInspectSlot(suffix)
end
end

local loader = CreateFrame("Frame")
loader:RegisterEvent("ADDON_LOADED")
loader:RegisterEvent("PLAYER_ENTERING_WORLD")
loader:RegisterEvent("INSPECT_READY")
loader:SetScript("OnEvent", function()
hookInspectSlots()
end)
2 changes: 1 addition & 1 deletion UI/MultiBotOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ function MultiBot.BuildOptionsPanel()
if UIErrorsFrame then
UIErrorsFrame:AddMessage(optL("options.layout.error_no_layout_to_delete"), 1, 0.25, 0.25, 1)
end
return
return
end
if not MultiBot.DeleteSavedMainBarLayout then
if UIErrorsFrame then
Expand Down
Loading