WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   Notable API changes in Legion (https://www.wowinterface.com/forums/showthread.php?t=53248)

icyblade 03-22-16 07:32 PM

Notable API changes in Legion
 

Hi everyone, I'd like to share some notable API changes in Legion. All of them have been tested in current alpha realm and I'm pretty sure you guys may in need of them. :-)
  • animationGroup:SetChange() has been removed
    This one occurs in such circustance:
    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
  • GetAuctionItemClasses() has been removed
    This one occurs in such circustance:
    Lua Code:
    1. local QUEST = select(10, GetAuctionItemClasses())
    In fact, QUEST == "Quest" in enUS, just a string indicating quest items.
  • SetTradeSkillItem() has been removed
    This one occurs in such circustance:
    Lua Code:
    1. hooksecurefunc(tooltip, 'SetTradeSkillItem', OnTradeSkill)
  • UnitIsTapped()/UnitIsTappedByPlayer() has been removed
    This one occurs in such circustance:
    Lua Code:
    1. if not isName and (dead or (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then
    2.     return 0.5, 0.5, 0.5
  • UnitPowerMax()/UnitPower() should specify power type now, not an optional one
    We use this code now:
    Lua Code:
    1. local value = UnitPowerMax(unit)
    In Legion we should do something like this:
    Lua Code:
    1. local value = UnitPowerMax(unit, UnitPowerType(unit))
  • texture:SetTexture(r, g, b, a) changes into texture:SetColorTexture(r, g, b, a)
    texture:SetTexture(texture_path) is working as well, but Blizzard creates as new SetColorTexture to cover texture:SetTexture(r, g, b, a) function.
    In Legion if you want to specify texture by a texture path, use SetTexure. For RGBA value, use SetColorTexture instead.
  • item:125794:::::::::: is allowed now
    For item link, we use something like "item:125794:0:0:0:0:0:0" before.
    But in Legion, we can dismiss these zeros.
    For user who wants to regex an item link, this is useful.
  • We can use texture:SetTexture(file_id) now, so GetSpellInfo will not return a texture path as the 3rd return value
    We use this code to set an icon now:
    Lua Code:
    1. local _, _, icon = GetSpellInfo(spell_id)
    2. texture:SetTexture(icon)
    In Legion, that's easier:
    Lua Code:
    1. file_id = GetSpellTexture(spell_id)
    2. texture:SetTexture(file_id)
Here is what I'm using in alpha realm:
https://github.com/icyblade/wow_addons
I did some changes to these addons so they will work in alpha environment.

p3lim 03-23-16 04:51 AM

Quote:

Originally Posted by icyblade (Post 313723)
UnitPowerMax()/UnitPower() should specify power type now
We use this code now:
Lua Code:
  1. local value = UnitPowerMax(unit)
In Legion we should do something like this:
Lua Code:
  1. local value = UnitPowerMax(unit, UnitPowerType(unit))

Not new, this has been in for a few expansions now. Maybe you meant it's not optional any more?

Gello 03-23-16 07:03 AM

Quote:

All of them have been tested in current alpha realm
Are scripts in some capacity working on alpha realms? Or are these just observed in the alpha UI?

icyblade 03-23-16 08:19 AM

Quote:

Originally Posted by p3lim (Post 313730)
Not new, this has been in for a few expansions now. Maybe you meant it's not optional any more?

Yes, it's not optional now

icyblade 03-23-16 08:20 AM

Quote:

Originally Posted by Gello (Post 313731)
Are scripts in some capacity working on alpha realms? Or are these just observed in the alpha UI?



Here is what I'm using in alpha
https://github.com/icyblade/wow_addons

Lombra 03-23-16 08:31 AM

Quote:

Originally Posted by icyblade (Post 313723)
We can use texture:SetTexture(spellId) now, so GetSpellInfo will not return a texture path as the 3rd return value
We use this code to set an icon now:
Lua Code:
  1. local _, _, icon = GetSpellInfo(spell_id)
  2. texture:SetTexuture(icon)
In Legion, that's easier:
Lua Code:
  1. texture:SetTexuture(spell_id)

This seems weird...

Gethe 03-23-16 08:31 AM

Quote:

Originally Posted by Gello (Post 313731)
Are scripts in some capacity working on alpha realms? Or are these just observed in the alpha UI?

Not officially, there are ways to hack the exe and enable addons.

JDoubleU00 03-23-16 01:48 PM

Quote:

Originally Posted by Gethe (Post 313735)
Not officially, there are ways to hack the exe and enable addons.

I've been playing the Alpha (not as a developer) and the Addon button is active and does go to the addon list (I have two libraries for some reason).

Gethe 03-23-16 11:51 PM

Yeah the game recognizes that you have addons installed, but it won't run them.

I currently have RealUI installed on my alpha client (mostly because addons were legit active for that first public build), so if addons were being run it would be very obvious for me.

galvin 03-24-16 02:44 PM

animationGroup:SetCharge()

I think you mean SetChange?
What do we use now, the SetChange is what creates the fade over time. Is there a setting some place else for this.

Was looking thru the code and found SetToAlpha() and SetFromAlpha(). Think these are new animationgroup functions.

I wonder if this fixes a bug from live. If you fade out a parent frame, and its children are also fading out at the same time. You can cause the child frames to be stuck in faded state. Only way is to reloadUI. I had to do some complicated coding in my addon to work around this bug. Be awesome if it was fixed.

icyblade 03-24-16 06:54 PM

Quote:

Originally Posted by galvin (Post 313759)
animationGroup:SetCharge()

I think you mean SetChange?
What do we use now, the SetChange is what creates the fade over time. Is there a setting some place else for this.

Was looking thru the code and found SetToAlpha() and SetFromAlpha(). Think these are new animationgroup functions.

I wonder if this fixes a bug from live. If you fade out a parent frame, and its children are also fading out at the same time. You can cause the child frames to be stuck in faded state. Only way is to reloadUI. I had to do some complicated coding in my addon to work around this bug. Be awesome if it was fixed.

Yes that's SetChange, thanks for pointing out that

galvin 03-25-16 01:54 PM

After looking at WorldMapFrame.lua. My best guess until someone tests.
SetFromAlpha() is where you start from.
SetToAlpha() is where you end at.

Blazeflack 04-11-16 03:56 PM

Quote:

Originally Posted by icyblade (Post 313723)

We can use texture:SetTexture(spellId) now, so GetSpellInfo will not return a texture path as the 3rd return value
We use this code to set an icon now:
Lua Code:
  1. local _, _, icon = GetSpellInfo(spell_id)
  2. texture:SetTexuture(icon)
In Legion, that's easier:
Lua Code:
  1. texture:SetTexuture(spell_id)

Quote:

Originally Posted by Lombra (Post 313734)
This seems weird...

If it does accept spellID, then it isn't limited to spellID only. I think they may have introduced textureIDs too or something like that. The first return of GetLootSlotInfo is now a number and no longer a string path to the texture. This number does not match the itemID of the item in that loot slot, and you can use this number in :SetTexture() as well.

I'm guessing they have made :SetTexture really dynamic.

jeffy162 04-11-16 04:53 PM

Yeah, they're using a "texture atlas" now, but I don't know if that's what is being discussed here. You can find out a very little bit about that HERE.

ykiigor 04-13-16 03:58 PM

Quote:

Originally Posted by icyblade (Post 313723)
local value = UnitPowerMax(unit)
In Legion we should do something like this:
Lua Code:
  1. local value = UnitPowerMax(unit, UnitPowerType(unit))

Power type isn't mandatory, you can use UnitPowerMax(unit) as before

Quote:

Originally Posted by icyblade (Post 313723)
[*] We can use texture:SetTexture(spellId) now, so GetSpellInfo will not return a texture path as the 3rd return value
We use this code to set an icon now:
Lua Code:
  1. local _, _, icon = GetSpellInfo(spell_id)
  2. texture:SetTexuture(icon)
In Legion, that's easier:
Lua Code:
  1. texture:SetTexuture(spell_id)

That is not spellID, it's FileID. So it's only easer if you know exact fileID for texture, otherwise you still need call GetSpellTexture. You can use string path as before.

ObbleYeah 04-14-16 06:38 AM

Quote:

Originally Posted by icyblade (Post 313723)
  • UnitIsTapped()/UnitIsTappedByPlayer() has been removed
    This one occurs in such circustance:
    Lua Code:
    1. if not isName and (dead or (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then
    2.     return 0.5, 0.5, 0.5

does this mean tapped mobs no longer exist in legion?

sirann 04-14-16 10:14 AM

Correct, tagging is no longer a thing, I'm unsure of members of the opposite faction tagging tho.

Gethe 04-14-16 11:51 AM

Tagging is still a thing, but it has changed and the api was consolidated to a single function: UnitIsTapDenied()

ObbleYeah 04-14-16 04:30 PM

that is such a weird call name to choose over just consolidating it all into UnitIsTapped

Fizzlemizz 04-14-16 05:07 PM

Not really because most mobs will be tapable by more than one player ie. UnitIsTapped would return true but you can still kill the mob and get reward. What you will be checking for is the odd occaision you are denied the tap and reward.


All times are GMT -6. The time now is 09:27 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI