• 0

    posted a message on Calculating Unbuffed Stats
    I need to calculate certain stat values for the user given a user-defined set of buffs, while assuming the user's current gear, race, and talents to be constant. To do so, I need to find the user's unbuffed stats. The best way I can think to do this is to use the UnitStat function to get their so-called "base" stats, add on the effects of gear, and then use LibStatLogic for its GetStatMod function to re-add any class/spec passive multipliers rather than writing my own detection.

    Is there a more direct way to do this? It seems like there ought to be, but the closest I can seem to get is UnitStat, which is nigh useless.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Overhead Icons - Nameplates, maybe?
    Heya all. A friend of mine was wondering if it would be possible to pop icons over the heads of people afflicted by {aura set}. I told him that I doubt it because anything in the game world tend to be all sorts of protected, but it occurred to me that it might be possible to attach something to the nameplates? Even if that's possible, there's still the issue of showing/hiding them, which is where I imagine the protection problems would occur.

    Confirm/deny?
    Posted in: Lua Code Discussion
  • 0

    posted a message on New Limitations on SendMail
    If I might bump this with a related question, I seem to be having trouble calling SendMail from a script of mine. I can load that second tab using MailFrameTab2:Click(), and perform all of the other operations I want to (attach some items), but when I actually call SendMail, it accomplishes nothing. I can see from a secure hook that the call is being performed with all of the right arguments, but nothing actually occurs.

    Thoughts?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Target position
    Quote from Cyprias
    QuestHelper has a feature called Radar (off by default). It uses LibRangeCheck to get the distance to your target, then as you run around it triangulates the location of your target and places the possible location on your minimap.

    Would be nice if there was a addon that did just this.


    An idea I had, more relevant for a boss mod, would be to watch the melee. Every time you get a melee swing event, use the location of the source raid member to generate a 5yd radius circle (although, isn't this slightly larger for Tauren?), combine that with a hardcoded table of hitbox sizes, and whittle down the possible locations for the boss.
    Posted in: Lua Code Discussion
  • 0

    posted a message on moving buffFrame
    Bumping up an ancient thread, but it's relevant. I've tried both the method posted originally, and this:
    TemporaryEnchantFrame:HookScript("OnUpdate", function(self)
            self:ClearAllPoints()
            self:SetPoint("TOPRIGHT", MyFrame, "TOPLEFT")
        end)
    Nothing I've done gets the buffs to move a single pixel. What's going on here?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hiding Secure Frames?
    The first time I click on on either the Pets or Mounts tab button (thus bringing up my display via the hooked scripts above), the script I wrapped around CompanionButton1 fires. The second time I click, the script on #2 fires, and so on. Only one of those will fire per click, and after twelve clicks, none fire.

    I cannot explain this, and I suspect that's due to a severe lack of understanding on my part. Would someone be so kind as to attempt an explanation of what a "header" and a "handler" are, or to try to convey some sense of the structure behind it all? I've read Iriel's Field Guide many times, but I think I'm missing some fundamental knowledge or familiarity, because it just doesn't make sense to me.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hiding Secure Frames?
    Gah, I've found an intermittent bug and I can't figure this out. I'm still using the same code to hide the CompanionButtons and the PetPaperDollFrameCompanionFrame:
        for i=1,12 do
            SecureHandlerWrapScript(_G["CompanionButton"..i], "OnShow", _G["CompanionButton"..i],
                [[ self:Hide() self:GetParent():Hide() ]])
        end
    I run this code once, when the addon loads. The addon also hooks the following code onto the "Pet", "Companions", and "Mounts" tab buttons:
    -- "Pet" button
    PetPaperDollFrameTab1:HookScript("OnClick", function(self)
        FUR:Hide(); -- FUR is the frame that I use for listing companions/mounts
    end)
    
    -- "Companions" button
    PetPaperDollFrameTab2:HookScript("OnClick", function(self)
        COMPANIONTYPE = "CRITTER"
        sortbutton:Disable()
        scrollbar:SetMinMaxValues(0, math.max(0, GetNumCompanions(COMPANIONTYPE) - NUMROWS))
        scrollbar:SetValue(0)
        Show(); -- This just does a bit of background work before calling FUR:Show()
    end)
    
    -- "Mounts" button
    PetPaperDollFrameTab3:HookScript("OnClick", function(self)
        COMPANIONTYPE = "MOUNT"
        sortbutton:Enable()
        scrollbar:SetMinMaxValues(0, math.max(0, GetNumCompanions(COMPANIONTYPE) - NUMROWS))
        scrollbar:SetValue(0)
        Show();
    end)
    Now, the reason this has taken so long to notice is that it only happens rarely, after repeated switching. If I sit around and alternately click the three tabs long enough, when I get back to one of "my" tabs (Companions or Mounts) I'll have the PetPaperDollFrameCompanionFrame clearly visible underneath my UI.

    With the hooked script hiding that frame as soon as the CompanionButtons show up, how is that possible?

    Very relevant edit: On further experimentation, the Blizzard UI shows up after I've clicked on the tabs precisely twelve times. Seeing as this is the same as the number of CompanionButtons, this doesn't seem like a meaningless coincidence.
    Posted in: Lua Code Discussion
  • 0

    posted a message on InterfaceOptionsFrame_OpenToCategory opens to wrong panel sometimes
    IIRC = If I Recall/Remember Correctly
    Posted in: Lua Code Discussion
  • 0

    posted a message on Variable Font Height
    Instead of stacking them, place them all side by side (attach BOTTOMLEFT to BOTTOMRIGHT as you move across).You might have to fiddle with GetStringWidth (no clue, speculating) and manually setting the width on each when you update their texts, but you're already looking at setting all of them individually anyways.
    Posted in: Lua Code Discussion
  • 0

    posted a message on JustSTFU AddOn, I'm fairly new >.>
    One easy error is that you aren't concatenating your strings properly. Double period is the operator in Lua:
    SendChatMessage("This user is ignoring you. Reason:" .. reason, "WHISPER", nil, name)

    Beyond that, the only thing I can think to ask is: Are you reloading your UI? That's all you should need to do in order to update your UI with changes to files that were loaded earlier. If you add, remove, or rename addon files, you have to completely re-open the client for anything to reflect that.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Range from player to player?
    Quote from Xinhuan
    Yes, you end up travelling at a faster 3D speed because the 2D-XY plane speed is constant.


    o.0 wat

    Damnit Blizzard. Why do you make things so wierd?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Range from player to player?
    Quote from Xinhuan
    Corveroth, you just described how all addons that add icons to the world map (and minimap) work. :)

    The idea isn't new, its more of a matter of who actually wants to spend time doing it.

    One small problem is that the calculated distance is only accurate on the X-Y plane, and doesn't take into account the Z plane.

    The map to yards ratio of each map can be obtained from the MPQ files directly from one of the .dbc files to about 6 decimal places.


    Heh. I'm considerably less-than-surprised that it's been done before. And back when I was thinking about this originally, I had an idea for charting out Z-distances: basically, collect the time, position, and velocity of your character at every step, and exploit the difference between how far you would've gone if you were moving horizontal and what you actually moved with a vertical component. Unfortunately, the first major issue is distinguishing whether that vertical movement was up or down. But hey, you just have to find some monotonic increasing/decreasing path to chart out in order to solve that... and store a massive value of tables, interpolate to fill the table unless you really want to carefully visit a few thousand points, sample frequently enough that you can treat your character's movement as a straight line...
    Posted in: Lua Code Discussion
  • 0

    posted a message on Range from player to player?
    This is actually possible - if your current zone has a map. If the zone has a map, you can work out a ratio* for game-world-yards to map-percentages (or just check something like QuestHelper and see if you can lift the number from that). Then you can GetPlayerMapPosition for the relevant unit IDs (raid1 - raid25, probably, although you could omit whichever one your target is), convert them to yards, and then compare each of the other 24 positions against your target and run the differences through Pythagoras, and display some cheery feedback thing to the user if at least five of those final results are within the range of Wild Growth.

    * Actually getting this ratio, if you can't find it elsewhere, will require a partner who's willing to stand around and do next to nothing while you inch in and out of some known range. There are also a few fiddly bits: The map is 1.5 times as wide as it is tall, so one vertical percentage point is 1.5 horizontal ones; depending on what you attempt to use as your known range, you might be measuring between the edges of your hitboxes, or between their centers. And, this ratio varies from map to map, sometimes greatly so. Checking some work I did along these lines earlier this year, the ratio for the entry to Ulduar is about 2192, while the ratio for the Coliseum is about 246.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting Initial Login, but not Reloads?
    Another possibility, and potentially simpler. However, if a play session runs from, say, 10pm to 1am? This is an addon designed primarily to address my own curiosities: "How long have I been playing? What did I accomplish (how much gold did I earn/lose, how much experience did I gain, etc)?" The "session" seems like the natural time chunk to look at.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting Initial Login, but not Reloads?
    Just logged on and tested matters: Works perfectly, both for "/run ReloadUI()" and "/console reloadui". Many, many thanks. :)
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.