Weapon slots can't be equipped during combat
Road-block opened this issue ยท 10 comments
Weapon slots (main hand, off-hand, ranged) should be able to be equipped during combat (unlike the other slots).
Currently GearMenu triggers an "action forbidden" error when trying to equip a weapon from the menu.
Hi @Road-block,
I agree with you that is indeed a bug and it is intended that weapons can be switched in combat. Blizzard blocks certains actions on secureactions buttons and it looks like I'm currently trying to modify those buttons in a way that is not allowed. I will look into this once I find the time (currently leveling :)).
Reference for me (need to improve show/hide events):
9/1 04:52:28.631 An action was blocked in combat because of taint from GearMenu - GM_GearBarSlot_5:Show()
9/1 04:52:28.631 Interface\AddOns\GearMenu\gui/GM_GearBar.lua:229 UpdateGearBar()
9/1 04:52:28.631 Interface\AddOns\GearMenu\code/GM_Core.lua:89 OnEvent()
9/1 04:52:28.631 GM_MainFrame:OnEvent()
9/1 04:52:28.631 An action was blocked in combat because of taint from GearMenu - GM_GearBarSlot_2:SetPoint()
9/1 04:52:28.631 Interface\AddOns\GearMenu\gui/GM_GearBar.lua:276 UpdateSlotPosition()
9/1 04:52:28.631 Interface\AddOns\GearMenu\gui/GM_GearBar.lua:236 UpdateGearBar()
9/1 04:52:28.631 Interface\AddOns\GearMenu\code/GM_Core.lua:89 OnEvent()
9/1 04:52:28.631 GM_MainFrame:OnEvent()
Cheers,
RagedUnicorn
Hi @Road-block,
Finally found some time to have a closer look at this. Sadly I have to disappoint you. If found that blizzard seems to prevent automatic weaponswitch while the player is in combat.
This can be tested with the following line by replacing the bag positions. Even this line will cause the above mentioned error. I will need to verify this with some warriors. I'm interested how theyr weapon switch macros will look like and how this could be used within this addon.
/run PickupContainerItem(0, 1); PickupInventoryItem(16)
It appears blizzard did this because there were rogues abusing this on retail servers to abuse poisons.
What this means for the addon:
- GearMenu will switch your weapons normally while you're out of combat
- GearMenu will put your weapons into the combatqueue while you're in combat
- You are still able to switch your weapons by using drag and drop or right click in the standart blizzard interface
Log:
9/7 10:28:46.935 Tanaan Jungle()
9/7 10:28:46.935 An action was blocked in combat because of taint from GearMenu - PickupInventoryItem()
9/7 10:28:46.935 Interface\AddOns\GearMenu\code/GM_ItemManager.lua:193 SwitchItems()
9/7 10:28:46.935 Interface\AddOns\GearMenu\code/GM_ItemManager.lua:152 EquipItemById()
9/7 10:28:46.935 Interface\AddOns\GearMenu\gui/GM_ChangeMenu.lua:322 ChangeSlotOnClick()
9/7 10:28:46.935 Interface\AddOns\GearMenu\gui/GM_ChangeMenu.lua:288
Warriors will probably use macros with /equipslot
I'll have to test your findings in-game, I had the feeling that the main issue with GearMenu was it trying to do show/hide on the bar buttons in combat when for example you're going from a 2H to 1H/Shield or vice versa (since it's trying to make a button "empty" by hiding it)
We are not talking about an automatic weapon switch anyway.
We're talking about a weapon switch following a click or keypress which is a hardware event (the typical protected action scenario).
In other words if you are correct and that change from modern wow has carried over into Classic it should still only prevent the queue from working in combat not a user initiated weapon swap from the menu.
Edit: Adding that at the moment GearMenu "breaks" manual weapon swaps as well if you have the bar showing for those slots, due to trying to update it using show/hide on the slots that changed when you right-clicked a weapon from your bags to equip it.
You are correct about using traditional PickupContainerItem/PickupInventoryItem macros.
/equipslot invID ItemName and /equipslot invID bagID slotID work without issue.
So the question becomes: Are there attributes that would make this work with SecureActionButtonTemplate based frames?
That will have to wait a bit cause I've been out of the addon dev for retail business for years and that stuff's faded from memory ๐
I need to catch up again.
Last response for a bit.
local macroBtn = CreateFrame("Button", "myMacroButton", UIParent, "SecureActionButtonTemplate")
macroBtn:SetAttribute("type1", "macro") -- left click causes macro
macroBtn:SetAttribute("macrotext1", "/equipslot 16 Weapon Name")
works.
The usual restrictions apply, you cannot set the macrotext1 attribute in combat, you cannot show or hide the macroBtn manually (but you can use visibility states of the secure system).
Anyway it looks like a pretty significant refactoring, so tabling it for now is fine.
No, auto-queue in combat* are dead, what we would be discussing is if there is a way to do user initiated (manual) weapon equips from the gearmenu bar while in combat. (Or in your case from an ItemRack dropdown)
*Queuing any swaps to happen after combat ends should still be possible.
@Road-block Is it possible to trigger such a macro from the addon?
Hi guys,
There are essentially two things that the addons currently supports.
- Manual switching by hovering over a slot and the choosing an item in the menu that appears. Note that this menu does not consist of SecureActionButtons. My current understanding is that this would not work with SecureActionsButtons because you can't hide/show such buttons during combat. That is why those are normal buttons
- Automatic Switching - This is used for the QuickChange rules
In both cases essentially the following is done with different values:
PickupContainerItem(0, 1); PickupInventoryItem(16)
So even though you might have used the "manual" way of switching a weapon you're still running into the same issue. It is of course possible to create a SecureActionButton and hardcode a macro into that button to switch the weapon. I don't really see how that would help if the addon had such a button because you could also just put your weapon or weapon-switch macro onto your standard actionbars and click it there.
Cheers,
RagedUnicorn