WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Cataclysm Beta (https://www.wowinterface.com/forums/forumdisplay.php?f=82)
-   -   Taint in Cataclysm is even worse! (https://www.wowinterface.com/forums/showthread.php?t=34823)

Vlad 09-06-10 04:45 AM

Taint in Cataclysm is even worse!
 
So basically what I did was to redefine a function by copying it from FrameXML and altering 1 line in it so the time format on buffs and debuffs could be what ever I want it to be (format). The problem is that it now does not even accept canceling buffs when you right-click, it asks for the addon to be disabled.

My question is if there are some API changes that I didn't notice? How could one alter the behavior of API such as "UnitAura" (or any other API) that requires pre-hooking and not post-hooking?

Another question of mine is since you now can't use (self, event, ...) and you must specify the amount of arguments such as (self, event, arg1, arg2) -is there a work around? Or did it just mean you can't have variables such as "local self, event, arg1, arg2 = 1,2,3,4" defined in an addon as they are restricted? Just need clarification on this. I prefer using "..." then using "arg1" and such in the body itself.

Ailae 09-06-10 04:51 AM

I believe it's CancelUnitBuff() that's Blizzard only now. Dunno if that's intended or just a bug.

Morsker 09-06-10 04:53 AM

You can still use varargs. What they removed where global vars called this, arg1, arg2, etc., that were set internally before an event was fired.

Vlad 09-06-10 04:56 AM

But why would doing:
function AuraButton_UpdateDuration(auraButton, timeLeft)
<same content of function as found in FrameXML except 1 line changed to format the duration as "MM:SS">
end

Totally break the ability to even cancel a buff? It says "Action blocked, X addon tainted. Disable or Ignore." -_-' It didn't happen before 4.0 and works on 3.3.5!

Morsker 09-06-10 05:16 AM

CancelUnitBuff is protected in Cata. This is probably because of trickery where people considered auto-canceling stam buffs on Lich King to dispose of Infest.

I don't know what the new alternative is.

haste 09-06-10 05:31 AM

There's a secure aura header. The file isn't loaded yet however.

Eyonik 09-06-10 07:16 AM

Does this mean Buff addons won't work anymore? A simple repositioning of the buff and debuff anchors out of combat will work but autosorting in combat while still beeing able to click cancel your buffs possibly won't, issn't it?

nightcracker 09-06-10 08:38 AM

NO ****ING PANICKING

Cancelling buffs is now protected. Action Bar mods work with protected frames, so buff mods can do also.

@OP: Now you shouldn't rewrite the whole function, merely hooksecurefunc() it.

Morsker 09-06-10 08:43 AM

It really depends how extensive the sorting and filtering options in the secure handler are. Filtering sounds like a security nightmare though. There has to be some basic filtering to make the buff box work, but I don't expect much more.

Maul 09-06-10 08:56 AM

Quote:

Originally Posted by Eyonik (Post 205254)
Does this mean Buff addons won't work anymore? A simple repositioning of the buff and debuff anchors out of combat will work but autosorting in combat while still beeing able to click cancel your buffs possibly won't, issn't it?

This is the same sort of panic that occurred when WoW 2.0 rolled out and people thought action bars were done and gone forever.

Buff Bar addons will continue to exist in Cataclysm. They just may need to be re-written to some extent.

The ugly problem that popped up with with CancelUnitBuff() is the exploitation of the druid Eclipse buff prior to patch 3.3. In all likelihood, Blizzard just wants to ensure that when a buff is prematurely canceled by a player it is in response to a hardware event (i.e. a mouseclick)

Vlad 09-06-10 09:03 AM

Quote:

Originally Posted by nightcracker (Post 205259)
@OP: Now you shouldn't rewrite the whole function, merely hooksecurefunc() it.

But I want to with a simple script alter how the time under buff buttons is shown. hooksecurefunc would add more CPU cycles than necessary, right? I mean it's better to replace than to append cycles.

Also I want to for example have the ability to change one argument that UnitAura returns (based on my preferences), it's much simple to do that rather than writing a whole new addon just to alter 1 small thing. :(

We need a "prehooksecurefunc" that alters functionality before the function is called or something, with the ability to skip running the original one. :(

orionshock 09-11-10 06:49 PM

Quote:

Originally Posted by Vladinator (Post 205264)
We need a "prehooksecurefunc" that alters functionality before the function is called or something, with the ability to skip running the original one. :(

This would defeat the point of having a secure environment.

Vlad 09-12-10 07:27 AM

Quote:

Originally Posted by orionshock (Post 205878)
This would defeat the point of having a secure environment.

I know, just sad that stuff like UnitAura must be so darn protected. It only tells you about buff/debuff information, would be nice to change consolidation and how it works. Or the debuff time shown on the default frames, you dont need a lot of code to change it but you do if they make everything so strict, not to mention you just reduce the performance ever so slightly by adding more routines just to edit the original interface. :/

I am depressed.

Iriel 09-12-10 02:40 PM

Bear in mind that the 'secure' part is only required for the actual click-to-do-something functionality. There's absolutely nothing stopping AddOn code from layering on top of the frames any amount of 'decoration', including but not limited to:

* Labels
* Images
* Timers
* Big flashing "Click here now" arrows

The secure snippets already support a RunMethod mechanism on frame handles that executes an arbitrary method non-securely (in a sort of securehook'ish way).

In theory that's all you should need to do practically any kind of presentation (other than sorting/filtering/dynamic placement). If there are any limitations that prevent this from working appropriately please raise concerns and so we can request that the template be improved accordingly.

Vlad 09-12-10 04:16 PM

Would it be too much to ask for a function to hook API (within reason) and alter behavior before it actually runs the arguments trough the function?

For example some addon uses UnitName and you would like to alter the input arguments at specific conditions, so that when UnitName(...) actually runs it uses the modified arguments and not the original once.
I guess what I am getting at is something like a:
Code:

phooksecurefunc("UnitName", function(arg1)
return true, arg1 == "player" and "target" or arg1
end);

Calling /dump UnitName("player") would actually run UnitName("target").
Code:

phooksecurefunc("UnitName", function(arg1, arg2)
return false, arg1, arg2 ~= "" and arg2 or "MyRealm"
end);

In this situation, calling /dump UnitName("player") would return {"Playername", "MyRealm"} and avoid running the original "UnitName". Problem here is that using multiple addons that do this on UnitName would clash but it's just a suggestion and there are probably other ways that this problem can be avoided.

In short, this could be used to alter simple default UI function behavior in a efficient way (no proof to backup my statement, I just suspect it could be if we can avoid making those "local orig = FuncName and re-declaring the function over again).

It's just a suggestion, I think you understand what I am trying to get across.
Thanks for reading my rant. :)

Seerah 09-12-10 06:38 PM

You would be looking to create a pre-hook, as opposed to a post-hook.

See here: http://www.wowwiki.com/Hooking_functions

Iriel 09-12-10 09:29 PM

Quote:

Originally Posted by Vladinator (Post 205968)
Would it be too much to ask for a function to hook API (within reason) and alter behavior before it actually runs the arguments trough the function?

You can do that now, but you can't do it with any functions that the secure part of WoW uses because such a thing would cause massive taint. That's the reason why the existing hooksecurefunc does not allow you to change the result of the function - because if it did you'd either taint the UI, or be able to subvert the protections against automation.

Vlad 09-13-10 03:06 AM

Quote:

Originally Posted by Iriel (Post 205994)
... you can't do it with any functions that the secure part of WoW uses because such a thing would cause massive taint

A specific example, why is UnitAura causing massive taint and makes it impossible to cancel player buffs if tainted in Cataclysm? I guess I just don't see how one could abuse this API by modifying how it's runned...

Also just modifying how buff timers are shown also taints it so bad that you can't cancel buffs, perhaps this is a bug that will be resolved later on? Just curious if not like what other ways could we use to modify the numbers below buffs or what buffs consolidate and not. :)

*Edit*

Iriel: when I use the implemented LevelUpDisplay frame to show a fake message, if I set LevelUpDisplay.level to anything less than 10 (example 0) it will crash the game when the animation tries to play back. Example for a macro that you can use to crash on purpose:
Code:

/run LevelUpDisplay.level=0 LevelUpDisplay.type="character"LevelUpDisplay:Show()
I did submit the crash reports so I hope the core devs have some fun with it. :3

Cladhaire 09-13-10 05:17 AM

Quote:

Originally Posted by Vladinator (Post 206007)
A specific example, why is UnitAura causing massive taint and makes it impossible to cancel player buffs if tainted in Cataclysm? I guess I just don't see how one could abuse this API by modifying how it's runned...

Also just modifying how buff timers are shown also taints it so bad that you can't cancel buffs, perhaps this is a bug that will be resolved later on? Just curious if not like what other ways could we use to modify the numbers below buffs or what buffs consolidate and not. :)

You're missing a few different points here that I'd like to try and clarify. The first and most important is that you don't need to alter the original function in order to do what you want to do. Consider the aura system a completely closed box that you cannot alter the code of in any way. How could you accomplish what you want to do?

You could write a function that hides the original timer FontStrings and replace them with your own, in your own format, with your own conditions. This code can run on top of the Blizzard aura system without any taint and you get precisely what you want.

Alternatively, you can wait and see if there's going to be secure template support for the aura system, in which case you'll almost certainly be able to do what you want in another way entirely.

The reason that altering that function causes taint is because that is how the taint system works. In some cases Blizzard writes their code in a way that makes it easier for us to directly customize things, but that's not always possible or feasible.

To reiterate: You can do what you want to do, get precisely the same effect, you just cannot do it the way you're trying to do it.

Vlad 09-13-10 05:26 AM

I understand. I was just curious if there are ways to do this without affecting performance in a bad way.

Running code on top would in fact cause first the default UI to render it as it is supposed to, then my code would go over and for example consolidate buffs that I want to hide by force. This would reduce performance to a certain extend, it depends on many things tough.

Thanks for explaining in debt Cladhaire. Perhaps we can hope that the devs that work on the default UI may leave some ways for addons to customize certain things, for once having the consolidateBuffs local makes it harder to add or remove entries from it, I guess this being global would have saved us authors a lot of time and performance impact when you think about it. ^_^

Cladhaire 09-13-10 05:38 AM

Quote:

Originally Posted by Vladinator (Post 206019)
I understand. I was just curious if there are ways to do this without affecting performance in a bad way.

Running code on top would in fact cause first the default UI to render it as it is supposed to, then my code would go over and for example consolidate buffs that I want to hide by force. This would reduce performance to a certain extend, it depends on many things tough.

Oh, you likely would not be able to do that, especially in combat, and still retain the ability to right-click to remove them. The post started initially about changing the timers. If you want to be able to filter or consolidate, then that's a different story entirely.

Quote:

Thanks for explaining in debt Cladhaire. Perhaps we can hope that the devs that work on the default UI may leave some ways for addons to customize certain things, for once having the consolidateBuffs local makes it harder to add or remove entries from it, I guess this being global would have saved us authors a lot of time and performance impact when you think about it. ^_^
It also exposes a vector into exploiting their system, I'm certain its intentional. Blizzard tends not to use locals recklessly. That all being said, I hope we'll see a template for auras in a future build.

yssaril 09-13-10 06:03 AM

speaking of taint,

is there any way to modify the world map (move,size,scale, add things to the dropdown, etc) that will not cause it to taint and consequently break during combat?

Also anyone know why it taints in the first place?

Cladhaire 09-13-10 06:32 AM

Mapster seems fully capable of doing these things to the map without causing taint..

yssaril 09-13-10 06:34 AM

Quote:

Originally Posted by Cladhaire (Post 206026)
Mapster seems fully capable of doing these things to the map without causing taint..

currently taints on beta (same with my addon YssBossLoot) neither of which taint on live

Cladhaire 09-13-10 06:37 AM

If there are things that work properly on live that don't work on Cataclysm, with appropriate code changes to ensure there aren't other bugs masking the problem, then they should be reported formally so we can get them resolved before Cataclysm is released. Feel free to write up a post explaining the issue and we'll attempt to get it resolved.

yssaril 09-13-10 06:43 AM

Quote:

Originally Posted by Cladhaire (Post 206028)
If there are things that work properly on live that don't work on Cataclysm, with appropriate code changes to ensure there aren't other bugs masking the problem, then they should be reported formally so we can get them resolved before Cataclysm is released. Feel free to write up a post explaining the issue and we'll attempt to get it resolved.

i posted http://forums.worldofwarcraft.com/th...386&sid=2000#0 on the wow cata UI & macro forums last week should i add anything to this?

also do you know why they seccured the POI stuff in the first place?

Vlad 09-13-10 07:07 AM

Hey look, my reply. =)

Cladhaire 09-13-10 07:14 AM

You can't 'wait' until Beta development is done, because at that point it will almost certainly too late. If you have a specific use-case, write a simple version of that addon that exhibits the problem and post the code. If you want, you can also start a thread here (I can't post on the US forums).

Problems can be reported using the feedback UI in the beta client, or you can try to post examples that show the problem. That's the best way to go about things.

Bluspacecow 09-13-10 09:23 PM

Quote:

Originally Posted by Cladhaire (Post 206034)
I can't post on the US forums).

Not to upbraid you here Cladhaire my dear but with the Cata beta open forums you can :) . In that thread is someone posting on an EU account. EU peeps can post on the US cata beta forums :)

You just need an active battle.net account. Oh wait ....

Vlad 09-14-10 04:01 AM

Another "crash the game" code:
Code:

CreateFrame("FontString", nil, BuffButton1)
Yay :3

Cladhaire 09-14-10 04:12 AM

That's not valid code, but it shouldn't crash the game. I assume you do know what you're supposed to be calling instead?

EDIT: I assume you sent the crash report off to Blizzard or at least reported this problem in-game? I'm not sure why it has anything to do with taint in Cataclysm (it doesn't).

Vlad 09-14-10 04:15 AM

CreateFontString(). But still, crashing is not good.

Cladhaire 09-14-10 04:22 AM

Yes. Please report the crash through the correct channels, not here =)

Vlad 09-14-10 04:32 AM

Quote:

Originally Posted by Cladhaire (Post 206158)
Yes. Please report the crash through the correct channels, not here =)

Each time I submit the crash report to the devs. :)

kbc8090 09-15-10 01:15 PM

First of all, I'm not very well versed in LUA code, but I know my way around somewhat. I tried using my current version of rBuff (from old RothUI) on Cataclysm and the anchor points were all messed up, but I ended up fixing that, and finally I noticed I couldn't cancel my buffs. Well after looking at the FrameXML on tekkub's github it really left me with no answers, since nBuff (From NeavUI) was working fine. Well there were some constants at the top of the rBuff file, specifically the following:

Code:

  BUFF_FLASH_TIME_ON = 0.8;
  BUFF_FLASH_TIME_OFF = 0.8;
  BUFF_MIN_ALPHA = 0.50;
  BUFF_MAX_DISPLAY = 50;

Well, after removing all of those, I seem to be able to cancel my buffs by right clicking the icon just fine.

I did add the following constant, and everything is still fine:

Code:

BUFFS_PER_ROW = 20;
Not sure if this helps anything, but it's currently working in the latest Cataclysm beta.

Here's the entirety of the LUA for my rBuff if anyone cares:

Code:

  BUFFS_PER_ROW = 20;
 
  local myscale = 1
  local bordertex = "Interface\\AddOns\\rActionButtonStyler\\media\\gloss"
  local castcol = { r = 0.9, g = 0.6, b = 0.4, }
  local bdc = { r = castcol.r*0.2, g = castcol.g*0.2, b = castcol.b*0.2, a = 0.93, }

  local addon = CreateFrame("Frame")
  local _G = getfenv(0)
 
  addon:SetScript("OnEvent", function(self, event, ...)
    local unit = ...;
    if(event=="PLAYER_ENTERING_WORLD")
    then
      BuffFrame:ClearAllPoints()
      TemporaryEnchantFrame:ClearAllPoints()
      TemporaryEnchantFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -9, -10)
      TempEnchant2:ClearAllPoints()
      TempEnchant2:SetPoint('TOPRIGHT', TempEnchant1, 'TOPLEFT', -4, 0)
      TempEnchant3:ClearAllPoints()
      TempEnchant3:SetPoint('TOPRIGHT', TempEnchant2, 'TOPLEFT', -4, 0)
      BuffFrame:SetPoint("TOPRIGHT", TemporaryEnchantFrame, "TOPRIGHT", -9, -10)
      BuffFrame:SetScale(myscale)
      TemporaryEnchantFrame:SetScale(myscale)
      addon:runthroughicons()
     
    end
    if ( event == "UNIT_AURA" ) then
      if ( unit == PlayerFrame.unit ) then
        addon:runthroughicons()
      end
    end
  end)
 
  function addon:runthroughicons()
    local i = 1
    while _G["BuffButton"..i]
    do
      addon:checkgloss("BuffButton"..i,1)
      i = i + 1
    end
    i = 1
    while _G["DebuffButton"..i]
    do
      addon:checkgloss("DebuffButton"..i,2)
      i = i + 1
    end
    i = 1
    while _G["TempEnchant"..i]
    do
      addon:checkgloss("TempEnchant"..i,3)
      i = i + 1
    end
  end

  function addon:checkgloss(name,icontype)
    local b = _G[name.."Border"]
    local i = _G[name.."Icon"]
    local f = _G[name]
    local c = _G[name.."Gloss"]
    local ff = _G[name.."Duration"]
   
    ff:SetFont(NAMEPLATE_FONT, 11, "THINOUTLINE")
    ff:ClearAllPoints()
    ff:SetPoint("TOP",f,"BOTTOM",0,7)

    if not c then

      local fg = CreateFrame("Frame", name.."Gloss", f)
      fg:SetAllPoints(f)

      local t = f:CreateTexture(name.."GlossTexture","BACKGROUND")
      t:SetTexture(bordertex)
      t:SetPoint("TOPLEFT", fg, "TOPLEFT", -0, 0)
      t:SetPoint("BOTTOMRIGHT", fg, "BOTTOMRIGHT", 0, -0)
     
      i:SetTexCoord(0.1,0.9,0.1,0.9)
      i:SetPoint("TOPLEFT", fg, "TOPLEFT", 2, -2)
      i:SetPoint("BOTTOMRIGHT", fg, "BOTTOMRIGHT", -2, 2)
     
    end

    local tex = _G[name.."GlossTexture"]   
   
    if icontype == 2 and b then
      local red,green,blue = b:GetVertexColor();   
      tex:SetTexture(bordertex)
      tex:SetVertexColor(red*0.5,green*0.5,blue*0.5,bdc.a)
    elseif icontype == 3 and b then
      tex:SetTexture(bordertex)
      tex:SetVertexColor(0.5,0,0.5,bdc.a)
    else
      tex:SetTexture(bordertex)
      tex:SetVertexColor(bdc.r,bdc.g,bdc.b,bdc.a)
    end 
   
    if b then b:SetAlpha(0) end
 
  end

  SecondsToTimeAbbrev = function(time)
    local hr, m, s, text
    if time <= 0 then text = ""
    elseif(time < 3600 and time > 60) then
      hr = floor(time / 3600)
      m = floor(mod(time, 3600) / 60 + 1)
      text = format("%dm", m)
    elseif time < 60 then
      m = floor(time / 60)
      s = mod(time, 60)
      text = (m == 0 and format("%ds", s))
    else
      hr = floor(time / 3600 + 1)
      text = format("%dh", hr)
    end
    return text
  end
 
  addon:RegisterEvent("UNIT_AURA");
  addon:RegisterEvent("PLAYER_ENTERING_WORLD");


Vlad 09-15-10 03:02 PM

I see it edits the global SecondsToTimeAbbrev function. This would affect all addons (inc. blizz) using it and that's not nice to hijack global functions -its not a rule but a rule of thumb, recommendation of you will. :<


All times are GMT -6. The time now is 09:02 PM.

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