Some fixes for Notable API changes in Legion
I went through some of these and think I worked out the method to do them properly in Legion, please let me (and the community know) if any of these seem wrong. - animationGroup:SetChange() has been removed
Lua Code:
local flash = item:CreateAnimationGroup() for i = 1, 3 do local fade = flash:CreateAnimation('Alpha') fade:SetDuration(.2) fade:SetChange(-.8) fade:SetOrder(i * 2) local fade = flash:CreateAnimation('Alpha') fade:SetDuration(.3) fade:SetChange(.8) fade:SetOrder(i * 2 + 1) end
Changed to set From and To:
- animationGroup:SetFromAlpha()
- animationGroup:SetToAlpha()
Lua Code:
local flash = item:CreateAnimationGroup() for i = 1, 3 do local fade = flash:CreateAnimation('Alpha') fade:SetDuration(.2) fade:SetFromAlpha(0) fade:SetToAlpha(-.8) fade:SetOrder(i * 2) local fade = flash:CreateAnimation('Alpha') fade:SetDuration(.3) fade:SetFromAlpha(-.8) fade:SetToAlpha(0) fade:SetOrder(i * 2 + 1) end
- GetAuctionItemClasses() has been removed
This one occurs in such circustance:
Lua Code:
local QUEST = select(10, GetAuctionItemClasses())
- _G.GetItemClassInfo(LE_ITEM_CLASS_QUESTITEM) should do the job now
Lua Code:
local QUEST = _G.GetItemClassInfo(LE_ITEM_CLASS_QUESTITEM)
I added to this section of icyblade's original piece as the two functions changed as well
- SetTradeSkillItem() has been removed
- GetTradeSkillReagentItemLink() has been removed
- GetTradeSkillItemLink() has been removed
Lua Code:
local function OnTradeSkill(tooltip, recipe, reagent) if reagent then AddOwners(tooltip, GetTradeSkillReagentItemLink(recipe, reagent)) else AddOwners(tooltip, GetTradeSkillItemLink(recipe)) end end hooksecurefunc(tooltip, 'SetTradeSkillItem', OnTradeSkill)
For the two Get functions below we have to specify the C_TradeSkillUI. portion, for whatever reason it doesn't like it without it.
- SetRecipeReagentItem replaces SetTradeSkillItem for the Reagents of Recipes
- SetRecipeResultItem replaces SetTradeSkillItem for the Results of Recipes
- C_TradeSkillUI.GetRecipeReagentItemLink(,) New function as 'TradeSkill' is replaced with 'Recipe
- C_TradeSkillUI.GetRecipeItemLink() New function as 'TradeSkill' is replaced with 'Recipe
Lua Code:
local function OnTradeSkill(tooltip, recipe, reagent) if reagent then AddOwners(tooltip, C_TradeSkillUI.GetRecipeReagentItemLink(recipe, reagent)) else AddOwners(tooltip, C_TradeSkillUI.GetRecipeItemLink(recipe)) end end hooksecurefunc(tooltip, 'SetRecipeReagentItem', OnTradeSkill) hooksecurefunc(tooltip, 'SetRecipeResultItem', OnTradeSkill)
- GetAuctionItemSubClasses() no longer returns the Text descriptions of the classes, but just a numbered table. The following is an example of existing code to get a list of Un-usable weapons and armor from a pre-determined array:
Lua Code:
for class = 1, 2 do local subs = {GetAuctionItemSubClasses(class)} for i, subclass in ipairs(Unusable[class]) do Unusable[subs[subclass]] = true end Unusable[class] = nil subs = nil end
- GetItemSubClassInfo(,) returns all the Descriptions for various Item types, to include Armor and Weapons. It is also important to note that prior to Legion Weapons = 1 and Armor = 2, however in Legion Weapons = 2 and Armor = 4. I decided to use LE_ITEM_CLASS_WEAPON and LE_ITEM_CLASS_ARMOR to replace hard coding the numbers. Also when setting up my static arrays above I ditched hard coding numbers and leveraged LE_ITEM_WEAPON_AXE1H, etc.BlizzardInterfaceCode/Blizzard_AuctionData.lua
- Rework of the Unfit-1.0.lua library, the new Demon Hunter class was added as well with the Weapon and Armor types that they cannot use.
Lua Code:
elseif Class == 'DEMONHUNTER' then Unusable = {{LE_ITEM_WEAPON_AXE2H, LE_ITEM_WEAPON_BOWS, LE_ITEM_WEAPON_GUNS, LE_ITEM_WEAPON_MACE1H, LE_ITEM_WEAPON_MACE2H, LE_ITEM_WEAPON_POLEARM, LE_ITEM_WEAPON_SWORD2H, LE_ITEM_WEAPON_STAFF, LE_ITEM_WEAPON_THROWN, LE_ITEM_WEAPON_CROSSBOW, LE_ITEM_WEAPON_WAND}, {LE_ITEM_ARMOR_MAIL, LE_ITEM_ARMOR_PLATE, LE_ITEM_ARMOR_SHIELD}} --[[ LE_ITEM_CLASS_WEAPON 2 LE_ITEM_CLASS_ARMOR 4 LE_ITEM_WEAPON_AXE1H 0 LE_ITEM_WEAPON_AXE2H 1 LE_ITEM_WEAPON_BOWS 2 LE_ITEM_WEAPON_GUNS 3 LE_ITEM_WEAPON_MACE1H 4 LE_ITEM_WEAPON_MACE2H 5 LE_ITEM_WEAPON_POLEARM 6 LE_ITEM_WEAPON_SWORD1H 7 LE_ITEM_WEAPON_SWORD2H 8 LE_ITEM_WEAPON_WARGLAIVE 9 (DH Only?) LE_ITEM_WEAPON_STAFF 10 LE_ITEM_WEAPON_BEARCLAW 11 LE_ITEM_WEAPON_CATCLAW 12 LE_ITEM_WEAPON_UNARMED 13 (Fist Weapons) LE_ITEM_WEAPON_GENERIC 14 LE_ITEM_WEAPON_DAGGER 15 LE_ITEM_WEAPON_THROWN 16 Spears? 17 (Not in game) LE_ITEM_WEAPON_CROSSBOW 18 LE_ITEM_WEAPON_WAND 19 LE_ITEM_WEAPON_FISHINGPOLE 20 LE_ITEM_ARMOR_GENERIC 0 LE_ITEM_ARMOR_CLOTH 1 LE_ITEM_ARMOR_LEATHER 2 LE_ITEM_ARMOR_MAIL 3 LE_ITEM_ARMOR_PLATE 4 LE_ITEM_ARMOR_COSMETIC 5 LE_ITEM_ARMOR_SHIELD 6 LE_ITEM_ARMOR_LIBRAM 7 LE_ITEM_ARMOR_IDOL 8 LE_ITEM_ARMOR_TOTEM 9 LE_ITEM_ARMOR_SIGIL 10 LE_ITEM_ARMOR_RELIC 11 ]] local subs = {} for k = 0, 20 do subs[k+1] = GetItemSubClassInfo(LE_ITEM_CLASS_WEAPON,k) end for i, subclass in ipairs(Unusable[1]) do Unusable[subs[subclass+1]] = true end subs = {} for k = 0, 11 do subs[k+1] = GetItemSubClassInfo(LE_ITEM_CLASS_ARMOR,k) end for i, subclass in ipairs(Unusable[2]) do Unusable[subs[subclass+1]] = true end
There might be a cleaner way to get the Weapon/Armor Type descriptions, but this seems pretty full proof.
|