Quantcast Notable API changes in Legion - Page 5 - WoWInterface
 
Thread Tools Display Modes
07-12-16, 02:18 AM   #81
Torsin
A Murloc Raider
Join Date: Nov 2014
Posts: 5
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:
    1. local flash = item:CreateAnimationGroup()
    2. for i = 1, 3 do
    3.     local fade = flash:CreateAnimation('Alpha')
    4.     fade:SetDuration(.2)
    5.     fade:SetChange(-.8)
    6.     fade:SetOrder(i * 2)
    7.  
    8.  
    9.     local fade = flash:CreateAnimation('Alpha')
    10.     fade:SetDuration(.3)
    11.     fade:SetChange(.8)
    12.     fade:SetOrder(i * 2 + 1)
    13. end

    Changed to set From and To:
  • animationGroup:SetFromAlpha()
  • animationGroup:SetToAlpha()
    Lua Code:
    1. local flash = item:CreateAnimationGroup()
    2.     for i = 1, 3 do
    3.         local fade = flash:CreateAnimation('Alpha')
    4.         fade:SetDuration(.2)
    5.         fade:SetFromAlpha(0)
    6.         fade:SetToAlpha(-.8)
    7.         fade:SetOrder(i * 2)
    8.  
    9.         local fade = flash:CreateAnimation('Alpha')
    10.         fade:SetDuration(.3)
    11.         fade:SetFromAlpha(-.8)
    12.         fade:SetToAlpha(0)
    13.         fade:SetOrder(i * 2 + 1)
    14.     end
  • GetAuctionItemClasses() has been removed
    This one occurs in such circustance:
    Lua Code:
    1. local QUEST = select(10, GetAuctionItemClasses())
  • _G.GetItemClassInfo(LE_ITEM_CLASS_QUESTITEM) should do the job now
    Lua Code:
    1. 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:
    1. local function OnTradeSkill(tooltip, recipe, reagent)
    2.     if reagent then
    3.         AddOwners(tooltip, GetTradeSkillReagentItemLink(recipe, reagent))
    4.     else
    5.         AddOwners(tooltip, GetTradeSkillItemLink(recipe))
    6.     end
    7. end
    8.  
    9. 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:
    1. local function OnTradeSkill(tooltip, recipe, reagent)
    2.     if reagent then
    3.         AddOwners(tooltip, C_TradeSkillUI.GetRecipeReagentItemLink(recipe, reagent))
    4.     else
    5.         AddOwners(tooltip, C_TradeSkillUI.GetRecipeItemLink(recipe))
    6.     end
    7. end
    8.  
    9. hooksecurefunc(tooltip, 'SetRecipeReagentItem', OnTradeSkill)
    10. 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:
    1. for class = 1, 2 do
    2.     local subs = {GetAuctionItemSubClasses(class)}
    3.     for i, subclass in ipairs(Unusable[class]) do
    4.         Unusable[subs[subclass]] = true
    5.     end
    6.  
    7.     Unusable[class] = nil
    8.     subs = nil
    9. 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:
    1. elseif Class == 'DEMONHUNTER' then
    2.     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}}
    3.  
    4.  
    5. --[[
    6. LE_ITEM_CLASS_WEAPON    2
    7. LE_ITEM_CLASS_ARMOR     4
    8.  
    9. LE_ITEM_WEAPON_AXE1H        0
    10. LE_ITEM_WEAPON_AXE2H        1
    11. LE_ITEM_WEAPON_BOWS         2
    12. LE_ITEM_WEAPON_GUNS         3
    13. LE_ITEM_WEAPON_MACE1H       4
    14. LE_ITEM_WEAPON_MACE2H       5
    15. LE_ITEM_WEAPON_POLEARM      6
    16. LE_ITEM_WEAPON_SWORD1H      7
    17. LE_ITEM_WEAPON_SWORD2H      8
    18. LE_ITEM_WEAPON_WARGLAIVE    9   (DH Only?)
    19. LE_ITEM_WEAPON_STAFF        10
    20. LE_ITEM_WEAPON_BEARCLAW     11
    21. LE_ITEM_WEAPON_CATCLAW      12
    22. LE_ITEM_WEAPON_UNARMED      13  (Fist Weapons)
    23. LE_ITEM_WEAPON_GENERIC      14
    24. LE_ITEM_WEAPON_DAGGER       15
    25. LE_ITEM_WEAPON_THROWN       16
    26. Spears?                     17  (Not in game)
    27. LE_ITEM_WEAPON_CROSSBOW     18
    28. LE_ITEM_WEAPON_WAND         19
    29. LE_ITEM_WEAPON_FISHINGPOLE  20
    30.  
    31. LE_ITEM_ARMOR_GENERIC   0
    32. LE_ITEM_ARMOR_CLOTH     1
    33. LE_ITEM_ARMOR_LEATHER   2
    34. LE_ITEM_ARMOR_MAIL      3
    35. LE_ITEM_ARMOR_PLATE     4
    36. LE_ITEM_ARMOR_COSMETIC  5
    37. LE_ITEM_ARMOR_SHIELD    6
    38. LE_ITEM_ARMOR_LIBRAM    7
    39. LE_ITEM_ARMOR_IDOL      8
    40. LE_ITEM_ARMOR_TOTEM     9
    41. LE_ITEM_ARMOR_SIGIL     10
    42. LE_ITEM_ARMOR_RELIC     11
    43. ]]
    44.  
    45. local subs = {}
    46. for k = 0, 20 do
    47.     subs[k+1] = GetItemSubClassInfo(LE_ITEM_CLASS_WEAPON,k)
    48. end
    49.  
    50. for i, subclass in ipairs(Unusable[1]) do
    51.     Unusable[subs[subclass+1]] = true
    52. end
    53.  
    54. subs = {}
    55. for k = 0, 11 do
    56.     subs[k+1] = GetItemSubClassInfo(LE_ITEM_CLASS_ARMOR,k)
    57. end
    58.  
    59. for i, subclass in ipairs(Unusable[2]) do
    60.     Unusable[subs[subclass+1]] = true
    61. end

There might be a cleaner way to get the Weapon/Armor Type descriptions, but this seems pretty full proof.

Last edited by Torsin : 07-12-16 at 02:25 AM.
 
07-12-16, 09:30 AM   #82
Tercioo
An Aku'mai Servant
 
Tercioo's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 38
New event? QUEST_LOOT_RECEIVED

Can't find nothing about it on google.
Signature is: questID, item, amount.
It's triggering when receiving an equipable item, didn't triggered when receiving a gold only reward.
 
07-12-16, 04:17 PM   #83
Torsin
A Murloc Raider
Join Date: Nov 2014
Posts: 5
Originally Posted by Tercioo View Post
New event? QUEST_LOOT_RECEIVED

Can't find nothing about it on google.
Signature is: questID, item, amount.
It's triggering when receiving an equipable item, didn't triggered when receiving a gold only reward.
You might review:

BlizzardInterfaceCode/AlertFrames.lua

As this might shed some light on when it gets triggered.
 
07-26-16, 08:32 PM   #84
Razor_Storm
A Kobold Labourer
Join Date: Jul 2016
Posts: 1
The functions of Garrison Follower Tooltip have additional parameters
GarrisonFollowerTooltip_Show(garrisonFollowerID, collected, quality, level, xp, levelxp, itemLevel, spec1, ability1, ability2, ability3, ability4, trait1, trait2, trait3, trait4, noAbilityDescriptions, underBiased, tooltipFrame, xpWidth)

FloatingGarrisonFollower_Toggle(garrisonFollowerID, quality, level, itemLevel, spec1, ability1, ability2, ability3, ability4, trait1, trait2, trait3, trait4)

FloatingGarrisonFollower_Show(floatingTooltip, garrisonFollowerID, followerTypeID, quality, level, itemLevel, spec1, ability1, ability2, ability3, ability4, trait1, trait2, trait3, trait4)
Be ware of the parameter "spec1", if you use these functions like you did in 6.x, then it will get errors.

The "spec1" can be got from
Lua Code:
  1. C_Garrison.GetFollowerSpecializationAtIndex(followerID, 1)
and for all followers in WOD Garrison, it is always 0.

This parameter may be used for the followers in Legion Order Hall.

Last edited by Razor_Storm : 07-26-16 at 08:34 PM.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Notable API changes in Legion

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off