• 0

    posted a message on LibPetJournal-2.0
    Here's a few things I discovered or made use of updating Pokedex. I wanted to remain responsive the changes in the number of pets while trying to avoid getting entangled in PET_JOURNAL_LIST_UPDATE games of tag.

    I added pets by purchasing and using a vendor item as well as capturing some wild pets via pet battle; I removed pets via cage and releasing. I did not see any COMPANION_LEARNED or COMPANION_UNLEARNED events as a result.

    PET_JOURNAL_PET_DELETED is nice in that in also provides the pid of the pet removed and is received after the pet has been removed from the list. However, this event does not appear to fire if you release a pet, only when you cage one.

    To catch when a pet is released you can SecureHook(C_PetJournal, "ReleasePetByID"). The pid will again be passed as a param and your hook called after removal from the list. Oddly, hooking CagePetByID is not as useful as the DELETED event because the hook gets called before the removal has actually happened.

    For additions, I'm looking for CHAT_MSG_SYSTEM events and then trying to match the message to BATTLE_PET_NEW_PET minus the %s part. Of course, you can't assume that there isn't a locale where the %s is in the middle of fixed text, so I might have to break it into multiple substrings. This paste has my approach for that http://www.wowace.com/paste/6185/. This system message fires for pets bought from a vendor, readded from pets I caged or trapped in the wild; not tested against additions from achievements or any other form of acquisition. The one problem with this approach is that you will get the system message before the actual addition. So, what I do in that case is register for the list update event and then as soon as I get it I unregister again. Not really ideal, but I can't find a better method.

    I also noticed some odd behavior if I try to access the C_PetJournal before the first LIST_UPDATE event has fired. If no calls have been made against any of the filtering functions, even if they would not result in the filter setting changing, then the PetJournal would actually return the correct counts from GetNumPets but every pet would return as not being summonable (like a horde balloon on an alliance character). Since the count wouldn't change, I wouldn't rebuild the list and would think the user had no summonable pets. If you call a filter function, even to set it to its current value, the PetJournal instead will return 0,0 for GetNumPets until after the first LIST_UPDATE. I touch a filter during OnInitialize now to try to make sure the pet journal is in that better state. I suppose the only reason I could even get into this state is that I wrote my filter handling code so that if the filters are already in the exact config I want then I won't make any calls; my way of trying to avoid generating unecessary LIST_UPDATE spam. So, the scenario also required the filters to be in the config I use for my list checking.
    Posted in: Libraries
  • 0

    posted a message on LibPetJournal-2.0
    Its so lame that an addon attempting to determine whether the number of pets owned has changed, in response to a PET_JOURNAL_LIST_UPDATE event, may need to change the filtering of the PetJournal to do it triggering further PET_JOURNAL_LIST_UPDATE events ...

    That's going to be fun if a user has multiple addons monitoring and reacting to that event. Even if each is written to temporarily ignore that event whenever it is twiddling the filters to make a pass at the list, which they pretty much have to be if they don't want to worry about infinite loops, you'll still have each addon triggering numerous spurious events for the others to process ...

    For my addon, I don't think I'm even going to bother registering for the PET_JOURNAL_LIST_UPDATE event. I've already stuck the data behind an empty table and an __index metamethod to ensure that I always validate and update if necessary before using it. I think the only gain I get from the event is when my UI is up at the same time as a pet is added; it lets me know I need to fire off a LibStub("AceConfigRegistry-3.0"):NotifyChange.

    What they really need is a PET_JOURNAL_PET_ADDED event to complement the PET_JOURNAL_PET_DELETED they already have.
    Posted in: Libraries
  • 0

    posted a message on Shadowed Unit Frames [official]
    Quote from Shadowed
    Nevermind, it was my fault. It's fixed.

    Fixed for Affliction and Demonology, but not working with Destruction. The space for them is there, unlike before, but its always empty. Its not showing the embers I have.
    Posted in: Unit Frames
  • 0

    posted a message on Shadowed Unit Frames [official]
    I'm not seeing warlock resources on my player frame running on the beta with build v3.4.4-57. I've put an export of my layout at http://www.wowace.com/paste/6046/.

    On live, I see soul shards just fine. I copied that profile over to beta, string replacing server names, and everything looks fine but in affliction spec I don't see soul shards. I've also enabled Demonic Fury to be shown but when in Demo spec its missing as well.

    Not sure if I've just missed some new option or if this is a bug. Any 'locks on the beta running with fresh bits see this working?
    Posted in: Unit Frames
  • 0

    posted a message on ButtonTimers needs a new author
    I'm incredibly lazy and kind of UI phobic and would therefore be a terrible candidate. On the other hand this is one of my favorite addons and one which I've recommended to many people. Since I'd be trying to keep it working for myself, I might as well become a member of the project.

    I'd been meaning to spec out a feature request related to letting users save button config profiles to make it easier to rearrange buttons (my bars mix dots, procs and cooldowns and make liberal use of the fixed timer setting). Mind you, this would have just been what it would have looked like from the user perspective and a rough idea of what the backend would be. But, you know, kind of lazy, hadn't gotten to it. I suppose becoming an author on the project is one way to make it happen, heh.
    Posted in: AddOn HELP!
  • 0

    posted a message on setting toc dependencies for no-lib packages
    Okay, I went and had my "fun with metatables"™ session. I was able to replace
    [SIZE=2]local L = LibStub("AceLocale-3.0"):GetLocale("MyAddon")[/SIZE]
    [SIZE=2]local BZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()[/SIZE]
    with
    local function DelayLoadLibTable(strLib, strMethod, ...)
        local table = nil
        local arglist = { ... }
     
        local function Load()
            LoadAddOn(strLib)
            local lib = LibStub(strLib)
            table = lib[strMethod](lib, unpack(arglist))
        end
     
        local mt = {
            __index = function(t,k)
                if not table then Load() end
                return table[k]
            end,
            __newindex = function(t,k,v)
                if not table then Load() end
                table[k] = v
            end,
        }
     
        return setmetatable( {}, mt );   
    end
     
    local L = DelayLoadLibTable("AceLocale-3.0", "GetLocale", "MyAddon")
    local BZ = DelayLoadLibTable("LibBabble-Zone-3.0", "GetLookupTable")
    and it worked swimmingly.

    However that's as far as my little dream of creating the wow addon version of delay load linking got. The big problem of course is that the moment you try to call a class method, the self param that will be passed is the wrapped lib rather than the lib itself. This will end up being a problem if, for example, code down the line cares about the address of the table, wants to call something like pairs on the table, wants to mess with the metatable, etc.

    I hit those problems right away when I tried wrapping the LibBabble-Zone lib and calling GetLookupTable through that. LibBabbleZone would check that the address of the table being passed as self was one that it recognized.

    Anyway, probably nothing here you didn't already know but I learned a few things playing around with this stuff.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    Quote from sylvanaar
    I am still of the opinion that you should not use OptionalDependancies at all.

    Instead you should load the library via LoadAddOn at the time you are going to use it.
    Hmmm, very interesting. This makes me want to go have fun with metatables. By sticking an empty table in front of the one we're using from the lib we can wait until the first time the metatables __index or __newindex is called to load the lib.

    So, I could possibly replace
    local L = LibStub("AceLocale-3.0"):GetLocale("MyAddon")
    local BZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()

    with something like this http://paste.wowace.com/2646/. Not saying I would need to or want to for those two libs, just using them as an example. I only wish the servers were up so I could test that, heh.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    Quote from Phanx
    It would, actually, if said devs were running an embedded library setup (which isn't incompatible with doing SVN checkouts), since your proposal would mean they would have to manually edit the addon's TOC to remove the Dependencies so WoW would load the addon.
    If you look at my initial "hack" implementation you'll see that the Dependencies line only has one # at the start. Wow looks at that and just sees a comment and ignores it. For a no-libs package, each line in that block will be prefixed by a # to comment it out. Only in the case of that line it goes from just being a comment to ## Dependencies, a tag that wow now recognizes and enforces.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    Quote from Torhal
    It's a bad idea for one reason: Some folks (such as developers) update directly from project repositories, which aren't run through the magical packager replacement utility.
    I'm not sure I see the problem. The idea would be for only the no-lib zips created by the packager to have the Dependencies set. So devs enlisting may not get the "benefits" of having it set, but it certainly wouldn't do them any harm ...

    In the end, Nev's point about Libraries being LOD is probably the one that renders the discussion moot.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    Quote from Xinhuan
    or he used an automated solution such as the Curse Client which handles it all (it installs all the stuff in the .pkgmeta externals as standalone addons).
    What the curse client handles is ensuring that you have all the libs you need to run ALL of the addons you have installed. But I don't usually want to run every addon on every character.

    For example, I usually only run Grid on my healers, the HUD on my rogues and feral druid, I don't run Gatherer on my tailor/enchantor or scribe/jc'er, I don't run raid mods on toons that are leveling, etc etc etc. The curse client doesn't really help me to find the minimum set of libs needed for a specific combination of the addons installed. If they all had their dependcies set, then it would be quite simple.

    There are also some addons like Ackis Recipe List which I generally don't have turned on for any character. On the rare occasions I want to check something with it I'd just pop open ACP, select it, reload ui, do my check and then uncheck it in ACP so that its off again the future. That's also a usage pattern that the client can't help with, but having dependencies set would.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    Well, no, I *don't* want to cater to that case. I just mentioned its sacrifice in the original post out of completeness, to identify it as a side effect that could be seen as negative from a certain point of view. My opinion, and yours I believe, is that the benefits of that case don't out weigh the benefits of specifying the dependencies.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    The confusion/problem is based on this scenario. Addon A is installed without libs; it requires addon B to work. Addon C is installed and contains B as an embedded lib.

    If the toc file for addon A does not specify addon B as a dependency then WoW will happily allow addon A to try and load. As long as C provides lib B, then A will load and work and we have happy user.

    By specifying A's dependency on B in the ToC file, we break that scenario and cause an addon, which would have worked (through luck/fate/etc), to instead explicitly fail until the user goes and installs addon B as a standalone.

    Usually when choosing between options, the case where something works more often would be prefered. I was arguing that its worth sacrificing that case because in the end it gives the user (or addons like ACP) more info to work with for all the other cases.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    Quote from 8tImER
    Why would your addon not be loaded, if another addon embeds some lib that you use?

    WoW is not aware of that, it just loads the addon and all the files it includes.
    Its because WoW doesn't know about the embeds that other addons use that it will fail. Its assuming that loading mine must fail because it doesn't see the missing dependency in the addon list.

    So, for example I just took my addon and added to the toc file:
    ## Dependencies: LibDoesntExist
    Not a real lib name, no other references in my addon. In the addon list my addons is checked, but the name is red and next to the name it says Dependency missing. I log in and my addon is disabled; wow just didn't load it because there was a missing dependency from toc file.

    But the one good thing of setting the dependency is if I mouse over my addon, then wow would tell me that there's a dependency on LibDoesntExist and I could go download it.
    Posted in: Lua Code Discussion
  • 0

    posted a message on setting toc dependencies for no-lib packages
    I was thinking that it might be spiffy in a no-lib package for libs that would have otherwise been embedded to now be listed in the toc file as Dependencies. I believe I can hack that up in the toc file with something like:
    #@no-lib-strip@
    # Dependencies: Ace3, LibBabble-Zone-3.0
    ## OptionalDeps: Ace3, LibBabble-Zone-3.0
    #@end-no-lib-strip@
    So, in the no lib case Dependencies would become uncommented and OptionalDeps would become commented out.

    So, is this idea good? Bad? Meh?

    I know that it will cause my addon to not load in the no-lib case where another addon would provide those libs through their embeds. But in that case the user is sort of getting lucky that the addon worked and should one of those other addons be uninstalled they'll be broken and have no idea why. With the change, the user can see if there's a problem with missing libs.

    If people do think that it is a good idea, could we possibly get something added to the packager that would be less hacky than the way I was looking at doing it? Maybe a X-Dependencies meta tag or something that the packager would turn into Dependencies or OptionalDeps based on whether its a no-libs or libs package.

    Now in truth it doesn't really matter that much for my little addons, and the curse client does an awesome job managing no-lib installs, but it seems like a practice that could benefit some of the bigger addons should it catch on.
    Posted in: Lua Code Discussion
  • 0

    posted a message on ag_UnitFrames Status (What's going on?)
    I'll definately miss agUF. It was very good looking right out of the box. Especially the raid frames which were clean, shiny and nicely sized. As for replacements, I noticed that the overview for oUF_Ammo was "agUF style oUF layout" so I'll probably check that out. <edit> Got on the beta, oUF_Ammo wasn't working - layouts for versions before 1.4 aren't compatible with oUF 1.4 so it might be that </edit>

    One of the things I remember fondly about the original agUF was that additional addon of layouts you could install next to it. You just downloaded the pair, picked the option you liked best for a given type of frame (player, party, etc) and you were rolling. I haven't had a chance to play with oUF, but it looks intriguing and that it might be what I'm looking for.

    <edit> Well oUF doesn't look to be my dream solution, but it is pretty cool and I'll eventually check it out when I have time. But for the short term I'll have to find something else. </edit>
    Posted in: Unit Frames
  • To post a comment, please or register a new account.