WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR API and Graphics Changes (https://www.wowinterface.com/forums/forumdisplay.php?f=175)
-   -   Missing Frames, Events and Functions in Battle For Azeroth (https://www.wowinterface.com/forums/showthread.php?t=56163)

Fizzlemizz 04-25-18 09:26 AM

In the latest export, Blizzard is still using:
Code:

elseif ( event == "UNIT_POWER_BAR_HIDE" ) then
        if ( arg1 == self.unit ) then
                UnitPowerBarAlt_UpdateAll(self);
        end


thomasjohnshannon 04-25-18 10:12 AM

Quote:

Originally Posted by Rilgamon (Post 327707)
Is an invite required? I just installed beta and logged in.

Yeah you only have the option of installing beta if your account has been flagged for it.

zork 04-27-18 06:01 AM

Got my invite yesterday too. Eager to test my addons against the beta. Hopefully not all of them are bricked?! >_<

zork 04-30-18 09:14 AM

My Vignette addon stopped working. The event VIGNETTE_ADDED is nowhere to be found. Is there a new system for rare mob icons on the minimap? If so how can it be accessed?

Lua Code:
  1. local function OnVignetteAdded(self,event,id)
  2.   if not id then return end
  3.   self.vignettes = self.vignettes or {}
  4.   if self.vignettes[id] then return end
  5.   local x, y, name, icon = C_Vignettes.GetVignetteInfoFromInstanceID(id)
  6.   local left, right, top, bottom = GetObjectIconTextureCoords(icon)
  7.   PlaySoundFile("Sound\\Interface\\RaidWarning.ogg")
  8.   local str = "|TInterface\\MINIMAP\\ObjectIconsAtlas:0:0:0:0:256:256:"..(left*256)..":"..(right*256)..":"..(top*256)..":"..(bottom*256).."|t"
  9.   RaidNotice_AddMessage(RaidWarningFrame, str..name.." spotted!", ChatTypeInfo["RAID_WARNING"])
  10.   print(str..name,"spotted!")
  11.   self.vignettes[id] = true
  12. end
  13.  
  14. --eventHandler
  15. local eventHandler = CreateFrame("Frame")
  16. eventHandler:RegisterEvent("VIGNETTE_ADDED")
  17. eventHandler:SetScript("OnEvent", OnVignetteAdded)

sezz 04-30-18 11:54 AM

Quote:

Originally Posted by zork (Post 327828)
My Vignette addon stopped working. The event VIGNETTE_ADDED is nowhere to be found. Is there a new system for rare mob icons on the minimap? If so how can it be accessed?

the new event is VIGNETTE_MINIMAP_UPDATED vignetteGUID, onMinimap
C_VignetteInfo.GetVignetteInfo(vignetteGUID) returns a table containing name and other stuff

zork 04-30-18 12:39 PM

Thanks that worked. I cannot find a replacement for the icon though. I had to disable the icon for now. The name is working fine but I seem to not find any information on the texture.

thomasjohnshannon 04-30-18 02:46 PM

Quote:

Originally Posted by zork (Post 327832)
Thanks that worked. I cannot find a replacement for the icon though. I had to disable the icon for now. The name is working fine but I seem to not find any information on the texture.

The api says this is the table structure.

Code:

Name = "VignetteInfo",
Type = "Structure",
Fields =
{
        { Name = "vignetteGUID", Type = "string", Nilable = false },
        { Name = "name", Type = "string", Nilable = false },
        { Name = "isDead", Type = "bool", Nilable = false },
        { Name = "onWorldMap", Type = "bool", Nilable = false },
        { Name = "onMinimap", Type = "bool", Nilable = false },
        { Name = "isUnique", Type = "bool", Nilable = false },
        { Name = "inFogOfWar", Type = "bool", Nilable = false },
        { Name = "atlasName", Type = "string", Nilable = false },
        { Name = "hasTooltip", Type = "bool", Nilable = false },
        { Name = "vignetteID", Type = "number", Nilable = false },
},

Can you use the atlasName to get the icon? I would check but I haven't gotten an invite yet.

zork 04-30-18 04:48 PM

Thanks. The missing link was GetAtlasInfo() which is not described anywhere.

It is working now.

Lua Code:
  1. local function OnVignetteAdded(self,event,id)
  2.   if not id then return end
  3.   self.vignettes = self.vignettes or {}
  4.   if self.vignettes[id] then return end
  5.   local vignetteInfo = C_VignetteInfo.GetVignetteInfo(id)
  6.   if not vignetteInfo then return end
  7.   local _, width, height, txLeft, txRight, txTop, txBottom = GetAtlasInfo(vignetteInfo.atlasName)
  8.   PlaySoundFile("Sound\\Interface\\RaidWarning.ogg")
  9.   local str = "|TInterface\\MINIMAP\\ObjectIconsAtlas:0:0:0:0:256:256:"..(txLeft*256)..":"..(txRight*256)..":"..(txTop*256)..":"..(txBottom*256).."|t"
  10.   RaidNotice_AddMessage(RaidWarningFrame, str.." "..vignetteInfo.name.." spotted!", ChatTypeInfo["RAID_WARNING"])
  11.   print(str.." "..vignetteInfo.name,"spotted!")
  12.   self.vignettes[id] = true
  13. end
  14.  
  15. -----------------------------
  16. -- Init
  17. -----------------------------
  18.  
  19. --eventHandler
  20. local eventHandler = CreateFrame("Frame")
  21. eventHandler:RegisterEvent("VIGNETTE_MINIMAP_UPDATED")
  22. eventHandler:SetScript("OnEvent", OnVignetteAdded)

Btw here is sth I found in the Blizzard_TutorialLogic.lua. It is a atlas to string texture converter if I see that right. It might be able to upgrade my current solution.

Lua Code:
  1. function TutorialHelper:FormatAtlasString(str)
  2.     return (string.gsub(str, "{Atlas|([%w_]+):?(%d*)}", function(atlasName, size)
  3.                 size = tonumber(size) or 0;
  4.  
  5.                 local filename, width, height, txLeft, txRight, txTop, txBottom = GetAtlasInfo(atlasName);
  6.  
  7.                 if (not filename) then return; end
  8.  
  9.                 local atlasWidth = width / (txRight - txLeft);
  10.                 local atlasHeight = height / (txBottom - txTop);
  11.  
  12.                 local pxLeft    = atlasWidth    * txLeft;
  13.                 local pxRight   = atlasWidth    * txRight;
  14.                 local pxTop     = atlasHeight   * txTop;
  15.                 local pxBottom  = atlasHeight   * txBottom;
  16.  
  17.                 return string.format("|T%s:%d:%d:0:0:%d:%d:%d:%d:%d:%d|t", filename, size, size, atlasWidth, atlasHeight, pxLeft, pxRight, pxTop, pxBottom);
  18.             end));
  19. end

Nice that actually was helpful. Instead of the texture path hard coded you can use the texture file id instead. Got it working now.

Xrystal 05-07-18 04:00 PM

C_Map api in BfA
 
Updated 2nd May

Code:

api C_Map list
MapUI

functions:
string name = C_Map.GetAreaInfo(areaID)
number uiMapID = C_Map.GetBestMapForUnit(unitToken)
number uiMapID = C_Map.GetCurrentMapID()
string atlasName = C_Map.GetMapArtBackgroundAtlas(uiMapID)
MapCanvasPosition position = C_Map.GetMapArtHelpTextPosition(uiMapID)
table textures { numbers values} = C_Map.GetMapArtLayerTextures(uiMapID, layerIndex)
table layerInfo { uiMapLayerInfo values } C_Map.GetMapArtLayers(uiMapID)
table info {uiMapDetails values } C_Map.GetMapChildrenInfo(uiMapID, opt mapType, opt allDescendants)
bool hideIcons = C_Map.GetMapDisplayInfo(uiMapID)
number uiMapGroupID = C_Map.GetMapGroupID(uiMapID)
table info {uiMapGroupMemberInfo values } = C_Map.GetMapGroupMembersInfo(uiMapGroupID)
fileDataID, texturePercentageX, texturePercentageY, textureX, textureY, scrollChildX, scrollChildY = C_Map.GetMapHighlightInfoAtPosition(uiMapID, x,y)
uiMapDetails info = C_Map.GetMapInfo(uiMapID)
uiMapDetails info = C_Map.GetMapInfoAtPosition(uiMapID,x,y)
playerMinLevel, playerMaxLevel, petMinLevel, petMaxLevel = C_Map.GetMapLevels(uiMapID)
minX, maxX, minY, maxY = C_Map.GetMapRectOnMap(uiMapID,topUIMapID)
C_Map.RequestPreloadMap(uiMapID)
C_Map.SetMap(uiMapID)

enumerations:
Enum.MapCanvasPosition { None, BottomLeft, BottomRight, TopLeft, TopRight }
Enum.UIMapType { Cosmic, World, Continent, Zone, Dungeon, Micro, Orphan }
Enum.UIMapSystem { World, Taxi, Adventure }

structures:
UIMapLayerInfo { layerWidth, layerHeight, tileWidth, tileHeight, minScale, maxScale, additionalZoomSteps }
UIMapDetails { mapID, name, mapType, parentMapID }
UIMapGroupMemberInfo { mapID, relativeHeightIndex, name }


Rainrider 05-20-18 08:09 PM

RegisterUnitEvent is still bugged.

Frame:RegisterUnitEvent(event, unit) behaves as if Frame:RegisterEvent(event) was called - it register the event for all units. Submitted this, but since it was reported a month ago, maybe this needs a push

Xrystal 05-21-18 12:16 PM

UNIT_SPELLCAST_SUCCEEDED changes
 
The UNIT_SPELLCAST_SUCCEEDED event now returns 3 values:

1. unit
2. code string - see below for an example
3. spell id

Teleport Dalaran (Northrend) resulted in the following

1. player
2. Cast-3-2084-571-11759-53140-000503097C
3. 53140

Portal Dalaran (Northrend) resulted in the following

1. player
2. Cast-3-2084-571-11759-53142-0000830AEF
3. 53142

After doing a few tests only the last two values changed, the spell ID depending on the spell cast and the last value intermittently and may be the same on different spells cast close together so could be a timestamp of sorts.

Edit: Correction, it appears that last value changes per cast, with multiples sometimes appearing on a single button click. Looks like validating argument 2 against the previous to confirm if it is a repeat or not may be required

Edit2: Correction again ... forgot that my code was doing the event test on several buttons with each checking its relevance rofl. Only 1 event per spell cast

aallkkaa 05-24-18 07:40 AM

Quote:

Originally Posted by Xrystal (Post 327692)
What is interesting is that the following code block
Code:

    GameTooltip:AddLine(IsHarmfulSpell(spellName) or "Helpful",1.0,1.0,1.0)
    GameTooltip:AddLine(IsHelpfulSpell(spellName) or "Harmful",1.0,1.0,1.0)

Resulted in Helpful in all cases except for the spells I didn't know/have in my spellbook, or were party specific spells - AKA Portals. Those returned both settings.

The logic in that block is literally reversed, but should not - i.e. "noharm" does not equate "help" nor vice versa.
Try this instead:
Code:

    GameTooltip:AddLine(IsHarmfulSpell(spellName) and "Harmful",1.0,1.0,1.0)
    GameTooltip:AddLine(IsHelpfulSpell(spellName) and "Helpful",1.0,1.0,1.0)


Xrystal 05-24-18 11:04 AM

You are right of course .. can't think what I was doing there... but seeing as it was more the case of testing the results of the function and avoiding a nil it might explain the results I mentioned rofl. Thanks for pointing it out, in case someone decided to use it :)

aallkkaa 05-24-18 11:01 PM

Yeah, I didn't think of it as a mere test for whether the function is present or not - though the thread title does imply that... lol

Still, getting "Helpful" as the result for a spell known as harmful being tested against IsHarmfulSpell might mean either that the function were present but bugged or that the function weren't there at all. Then again, the later case would also raise a Lua error, thus alerting you to the function being amiss, so...

Well, at least, like you said, it might prevent false results "in case someone decided to use" the code. :D

sezz 05-31-18 09:51 AM

RegisterUnitEvent is fixed :banana:
GetFramesRegisteredForEvent is completely broken and always returns nil :(

Edit: GetFramesRegisteredForEvent fixed aswell.

Voxxel 06-12-18 04:19 AM

Does anyone know how to get the Map IDs in BfA? The "/dump GetCurrentMapAreaID()" doesn't seem to work anymore.

Rilgamon 06-12-18 05:02 AM

Take a look a little up ...

Quote:

number uiMapID = C_Map.GetBestMapForUnit(unitToken)
number uiMapID = C_Map.GetCurrentMapID()

Voxxel 06-12-18 06:40 AM

I found that I'm just noob enough to convert it into a working script. :p Would you elaborate please?

Code:

/run print(C_Map.GetCurrentMapID())
doesn't return anything for me, no idea why.

I heard somewhere the map ID for Tiragarde Sound is supposed to be 895. And when doing
Code:

/run for k, v in pairs(C_Map.GetMapInfo(895)) do print(k, v) end
it returns
Code:

mapType 3
mapID 895
name Tiragarde Sound
parentMapID 876

My problem is it doesn't seem to do anything with mapIDs used by wowhead, wowdb and other dataminer sites. I'm looking for a way to print the current map ID (where my character is) used by dataminer sites. For example, Tiragarde Sound is 8567 (same as the zone ID). But what is it for Boralus map where there's no standalone zone?

Is there a way to get information about those map IDs?

Nimhfree 06-12-18 06:25 PM

The various sites do not use the new mapIds that the new Blizzard API returns. If you need to be able to use a value from in game and refer to values various sites use, you will have to come up with a mapping for them, and have your addon use that mapping.

Using the new Blizzard map API you can get access to every map in the system very easily. However, mapping those to external sites is not easy.

I would advise everyone to use the new Blizzard mapIDs for all maps.

Xrystal 06-12-18 06:46 PM

That number might be a reference to the map image they display on their website.

It may not have an in game api equivalent if it was retrieved via data mining. Maybe contact wowhead to see where they get their numbers from ( they may have generated their own set of numbers for their site after all).

Using the various available map functions I haven't seen any number remotely similar.


However, I can't remember what zone related functions are available pre BFA. Maybe the old zone IDs match the ones on the website but the new ones are just followed on to make the site consistent due to the big map api change.


Edit ... Or as Nimh says :)


All times are GMT -6. The time now is 10:05 AM.

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