1. I thought I would give Tuller's Winter Veil contest a crack, and as usual, both your book and the site are indespensable. The APIs about companions (critters) are helping a lot. In short, what I want to accomplish is that while the player is out of combat, summon a Winter Veil non combat pet to keep him or her company. Once such a pet is summoned, then stop summoning unless the player has died and come back from the grave, as it were. So far, so good, as I found APIs to accomplish most of that.

    The trouble is finding out which companions are known to the player, and filtering just the Winter Veil ones. Right, so finding out which companions are known is easy, but the filtering is hard. Furthermore, some of them require snowballs to summon, and I will have to check if the player has any in the inventory, and if not, check the bank and remove a stack (or up to as close a stack, if the player has less).

    I haven't got to the bank APIs yet, however, there are some critters, like the steam tonk, which do not show up in the pets learned tab, and remain soaking a bank or inventory slot.

    Having the bright idea of searching wowhead, I kind of dead ended myself on the filtering for IDs or names.

    Here is the code so far (which probably has enormous bugs) http://pastey.net/129893

    Any suggestions, sir?

  2. I'd suggest making a table of the valid ids, and list them by their type. For example:

     petInfo = {
       spells = {
          -- List of spellIds here
       },
       items = {
          -- List of item ids here
       },
     }
    
     reagentInfo = {
       spells = {
         -- [id] = itemID,
       },
       items = {
         -- [id] = itemID,
       },
     }
    

    Once you've built this table manually, you can use it to determine which companions the player know, which item companions they have, and which ones require reagents. I'm afraid I'm not sure how much more I can help.. do you have a specific question perhaps?

    And good luck!

  3. I was afraid of that, having to find out which pets were from Winter Veil manually. I guess I will have to go from memory, rather than my hope of using APIs to do the heavy lifting.

    Should you, or any readers choose to enter Tuller's competition, then good luck to you as well!

  4. Alright, maybe I do have a question, about comparing the current date with the Winter Veil days. Knowing the Winter Veil falls over several days, and usually covers both December and January, I know that I still need to do something like

     local veilHoliday = CalendarGetHolidayInfo(0) -- don't need the day or index, do I?
     if veilHoliday == "Winter Veil" then
         -- psueudoCode here
         get the startDate
         get the endDate
         get the currentDate
         compare currentDate with startDate
         compare currentDate with endDate
         -- I know there will be => and <= usage
         if currentDate => startDate and currentDate <= endDate then
             -- do stuff
         end
     end
    

    Between all the calendar APIs, my poor brain has overloaded with how to do the comparison, especially since the current month, along with the days the holiday falls on, changes every year.

    Was I on the right track with my pastey?

  5. I think you're making things way too complicated. I haven't tested this but something like this should work:

     local weekday, month, day, year = CalendarGetDate()
     for index = 1, CalendarGetNumDayEvents(0, day)
       local name, description, texture = CalendarGetHolidayInfo(0, day, index)
       if name == "Winter Veil" then
         -- Do something because it's Winter Veil today!
         return
       end
     end
    

    You are much better off using the texture return from CalendarGetHolidayInfo().. since then it will work on all clients. Just print it out once to see what it is.

  6. I will give it a shot, thanks!