Fixes Equipment Set buttons.

Fixes Random Favorite Battle Pet button.
Fixes some spells that could not be cast (Thrash, Stampeding Roar, and probably a lot more).
Fixes dragging out some spells would clear the cursor instead of picking up the spell.
Cette révision appartient à :
dvipid 2018-08-29 20:05:34 -04:00
Parent b3921cf0d5
révision 605204b497
4 fichiers modifiés avec 59 ajouts et 16 suppressions

Voir le fichier

@ -588,9 +588,15 @@ function Button:SetCommandCompanion(MountID)
--local SpellName = GetSpellInfo(SpellId);
self:SetCommandExplicitCompanion(MountID);
end
function Button:SetCommandEquipmentSet(Name)
local Id = select(2, GetEquipmentSetInfoByName(Name)); --Id isn't really used, but since it is available and appears reliable (i.e. doesn't change??) I will store it away just in case
self:SetCommandExplicitEquipmentSet(Id, Name);
function Button:SetCommandEquipmentSet(SetName)
local SetCount = C_EquipmentSet.GetNumEquipmentSets();
for i=0,SetCount-1 do
name, texture, setIndex, isEquipped, totalItems, equippedItems, inventoryItems, missingItems, ignoredSlots = C_EquipmentSet.GetEquipmentSetInfo(i);
if (name == SetName ) then
self:SetCommandExplicitEquipmentSet(setIndex, name);
break;
end
end;
end
function Button:SetCommandBonusAction(Id)
self:SetCommandExplicitBonusAction(Id);
@ -886,7 +892,7 @@ function Button:SetEnvEquipmentSet(Id, Name)
self.Mode = "equipmentset";
self.EquipmentSetId = Id;
self.EquipmentSetName = Name;
self.Texture = select(2, GetEquipmentSetInfo(Index)) or ""; --"Interface/Icons/"..(GetEquipmentSetInfoByName(Name) or ""); --safe provided Name ~= nil
self.Texture = select(2, C_EquipmentSet.GetEquipmentSetInfo(Index)) or ""; --"Interface/Icons/"..(GetEquipmentSetInfoByName(Name) or ""); --safe provided Name ~= nil
self.Target = "target";
self:ResetAppearance();
@ -1001,7 +1007,11 @@ function Button:SetEnvBattlePet(Id)
self.Mode = "battlepet";
self.BattlePetId = Id;
self.Texture = select(9, C_PetJournal.GetPetInfoByPetID(Id));
if (Id == Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID) then
self.Texture = Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_TEXTURE;
else
self.Texture = select(9, C_PetJournal.GetPetInfoByPetID(Id));
end
self.Target = "target";
self:ResetAppearance();
@ -1131,7 +1141,19 @@ function Button:SetAttributes(Type, Value)
self.Widget:SetAttribute("id", nil);
--Now if a valid type is passed in set it
if (Type == "spell" or Type == "item" or Type == "macro") then
if (Type == "spell") then
-- Patch to fix some spell that doesnt like to be cast with ID (Thrash, Stampeding Roar, ...)
local SpellName = GetSpellInfo(Value);
if ( SpellName ) then
self.Widget:SetAttribute("type", Type);
self.Widget:SetAttribute(Type, SpellName);
else
-- fallback to the old method if the name cannot be resolved
self.Widget:SetAttribute("type", Type);
self.Widget:SetAttribute(Type, Value);
end
elseif (Type == "item" or Type == "macro") then
self.Widget:SetAttribute("type", Type);
self.Widget:SetAttribute(Type, Value);
@ -1770,6 +1792,10 @@ function Button:UpdateTooltipBattlePet()
GameTooltip:AddLine(SPELL_CAST_TIME_INSTANT, 1, 1, 1, true);
GameTooltip:AddLine(string.format(BATTLE_PET_TOOLTIP_SUMMON, name), nil, nil, nil, true);
GameTooltip:Show();
elseif (self.BattlePetId == Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID) then
GameTooltip:SetText(PET_JOURNAL_SUMMON_RANDOM_FAVORITE_PET, 1, 1, 1);
GameTooltip:AddLine(SPELL_CAST_TIME_INSTANT, 1, 1, 1, true);
GameTooltip:Show();
end
end
@ -2091,7 +2117,11 @@ end
function Button:RefreshBattlePet()
if (self.Mode == "battlepet") then
self.Texture = select(9, C_PetJournal.GetPetInfoByPetID(self.BattlePetId));
if (self.BattlePetId == Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID) then
self.Texture = Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_TEXTURE;
else
self.Texture = select(9, C_PetJournal.GetPetInfoByPetID(self.BattlePetId));
end
self.Texture = self.Texture or "Interface/Icons/INV_Misc_QuestionMark";
self:DisplayActive();
end
@ -2126,7 +2156,7 @@ function Button:RefreshEquipmentSet()
-- This equip set is gone so clear it from the button
return self:ClearCommand();
end
local TextureName = select(2, GetEquipmentSetInfo(Index));
local TextureName = select(2, C_EquipmentSet.GetEquipmentSetInfo(Index));
if (TextureName) then
self.Texture = TextureName;
self:DisplayActive();

Voir le fichier

@ -9,6 +9,8 @@
local Const = BFConst;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_ID = 268435455;
Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID = "BattlePet-0-FFFFFFFFFFFFFF";
Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_TEXTURE = "Interface/Icons/INV_Pet_Achievement_CaptureAPetFromEachFamily_Battle";
Const.Version = 0.9;
Const.VersionMinor = 50;
Const.MAX_ACCOUNT_MACROS = 120;

Voir le fichier

@ -1536,8 +1536,12 @@ function Util.SetCursor(Command, Data, Subvalue, Subsubvalue)
UILib.StopDraggingIcon();
SpellFlyout:Hide();
if (Command == "spell") then
--PickupSpellBookItem(Data, Subvalue);
PickupSpell(Subsubvalue);
local SpellName = GetSpellInfo(Subsubvalue);
if ( SpellName ) then
PickupSpellBookItem(SpellName)
else
PickupSpell(Subsubvalue);
end
elseif (Command == "item") then
PickupItem(Data);
elseif (Command == "macro") then
@ -1548,7 +1552,14 @@ function Util.SetCursor(Command, Data, Subvalue, Subsubvalue)
--end
C_MountJournal.Pickup(Util.GetMountIndexFromMountID(Data));
elseif (Command == "equipmentset") then
PickupEquipmentSetByName(Data);
local SetCount = C_EquipmentSet.GetNumEquipmentSets();
for i=0,SetCount-1 do
name, _, setIndex = C_EquipmentSet.GetEquipmentSetInfo(i);
if (name == Data) then
C_EquipmentSet.PickupEquipmentSet(setIndex);
break;
end
end;
elseif (Command == "bonusaction") then
local page = 12; --The page for vehicleactionbar
if (HasOverrideActionBar()) then
@ -2534,9 +2545,9 @@ end
function Util.LookupEquipmentSetIndex(EquipmentSetID)
local Total = GetNumEquipmentSets();
for i = 1, Total do
if (select(3, GetEquipmentSetInfo(i)) == EquipmentSetID) then
local Total = C_EquipmentSet.GetNumEquipmentSets();
for i = 0, Total-1 do
if (select(3, C_EquipmentSet.GetEquipmentSetInfo(i)) == EquipmentSetID) then
return i;
end
end

Voir le fichier

@ -1,5 +1,5 @@
# ButtonForge - Legion
# ButtonForge - Battle for Azeroth
.
#### Author: Alternator (Massiner of Nathrezim)
#### Bug Fixes: DT85 (Zaranias - Aman'thul)
#### Bug Fixes: DT85 (Zaranias - Aman'thul), dvipid (Arhenn - Zul'jin)