Monthly Archive for November, 2008

WoW API: UnitId is an enum

Snowy Mountains in the Howling Fjord, From Screenshots 2008

Last night I didn’t feel as calm as the area in the screen above looks. I started programming on a very simple addon idea and immediately ran into a big huge blob of “doesn’t work as one would have thought”.

The Basic Idea

Our guild has lots of alts, nearly everybody has between two or three alts. Now with everybody making Death Knights there has been a growth spurt that nobody – well at least not me – can keep track of anylonger. As a rule we write the name of the main character in the guild note so it is possible to find out who is behind a character.

I am lazy however and when I see the “[Funny DK Name I never heard of before:74] has come online.” I want to know who it is without having to mouseover some FuBar social thingy or even having to call up the actual social pane to look up the note. I want the info right where I read that they just came online in my nice ChatFrame1!

Who is this Guildie?

It’s easy to find out the event to register for (CHAT_MSG_SYSTEM), it is not quite as easy to parse the message to extract the name and it wasn’t even that hard to find the method that will give me the info I was looking for and then some. Ok it took me about an hour to do the name parsing thing because I tried to use the string from GlobalStrings.lua to escape any need for localization. In the end I caved in and did some puny variant that will work only on the English client for now. But I managed to extract the name from the message and display the info (using GetNumGuildMembers and GetGuildRosterInfo). (There’s still a bug though because the message appears in chat before the guild roster knows the person is online and I tried to optimize … never mind).

Spying on Friends

But then I had this idea that I could extend my addon to include friends. It’s quite easy to extract the info you need from your friendslist with GetNumFriends and GetFriendInfo.

But because I am insanely curious and like to keep track of former guildies and all that (friendslist is much too small IMO) I wanted to output the guild of any friend that came online.

I spent another hour looking for a way to obtain the guild name of a player by the name of that player. The – seemingly? – only function that allows to retrieve the guild of a player is GetGuildInfo. However this method only takes one parameter: UnitId. It took me a lot of time to figure out UnitId actually is the equivalent of an enum and it only allows values like “player”, “target”, “pet”, “mouseover”, “focus” etc.. There is no UnitId value to signify an arbitrary unit. Of course there wouldn’t be. How would I decide which unit that was? Oh the unit has a name … maybe I could take the name of the unit?

It does not work that way.

The only way I found that allowed retrieval of GuildInfo for an arbitrary “unit” was the /who command which can be triggered with the SendWho function. This actually does execute a /who command including the system message you get when who returns 3 or less results. This is not what I wanted.

How bad can an API be designed that there is no obvious way to obtain the guild of a player unless you have that player targeted or in your party or mouseover that player?

Meh.

PS: when I get home I’ll post the code, I forgot to commit to the svn last night after fishing my way up to 450 I felt kind of stupid – brain had gone to sleep two hours before the rest of me ;)

PPS: and now I realized there is a third category of people I need to spy on … those in our in-game chat channel ;) so at least something good came from this rant.

Visiting Dalaran the first time

From Screenshots 2008

Last night we reached our first big goal in Wrath: our mains dinged 74. We were questing in Howling Fjord doing the quest line for the Worg where you have to meditate in the mountains … very beautiful.

Why was this a big goal? We did not want to get a port to Dalaran, we just wanted to go there together with our mains when it was “time”.

So shortly after midnight Yashima and Tenobaal set foot into Dalaran for the first time. We had heard lots of stories about it, seen a few pictures and saw a bit of the design process on the making-of DvD. But no story is like the *cough* “real thing”.

We spent nearly an hour exploring the city, the sewers, looking for portals, a new home (we reside at “A Hero’s Welcome” now) and playing with our minipets and other fluff with the Horde.

A lovely city and I am glad we waited and took our time to go there, it truly is The Magical Kingdom of Dalaran.

Anniversary Relog Wave

It’s midnight in Europe and all the guild has been relogging to get their anniversary achievement and tiny little ice bear cubs :)

Status Update: Yashima and Tenobaal dinged 73 tonight while questing in the Dragonblight but are now continuing in the Howling Fjord. Yáshimá is questing in Nagrand till 70 – one more level to go and all other characters are on hold. My professions are doing just fine. I know a lot of Minor Glyphs on Yáshimá and Yashima’s Alchemy is coming along nicely. We’ve also been fishing a lot.

Me and the Baby Blizzard Bear, from Screenshots 2008

Happy Anniversary, World of Warcraft!

The “Hello World” Addon

I am trying to learn to program my own addons. I’ve been installing other people’s addons for a few years now. Being a software developer I am thinking I should be able to do it myself.

Yet I am having a very hard time getting into it and there are very few tutorials especially current ones are rare. It is not trivial to learn from other people’s code either because so many addons use libraries and not all code is equal in readbility.

1) Documentation

Online you can find quite a few resources that all help in certain aspects.

I like learning from other people’s code. My best source for code so far has been Tekkub (whose code you like is very much a question of personal preference). Together with his repositories, the APIs published on WoWWiki and the Lua Manual,  I was finally able to put together a small “Hello World” style addon. One of his simplest addons is the tekJunkSeller. Just take a look at it.

For a bit of offline documentation I ordered a book about WoW addons. Actually there are several books available. I checked the table of contents and this one sounded most promising.

2) Developer Utilities

First things first: installing a few resources.  There are quite a few lua editors out there and a few other developer utilities. Here’s my current list:

  • WoW UI Designer: a nice looking lua ide
  • tekPad to evaluate lua code in the game.
  • BugSack to be able to see errors and stacktraces (I’ve had that forever actually)
  • svn repository. I already had one. I guess most people will not need revision control immediately. I do because I want to be able to access my stuff from different places.
  • Macro to obtain the name of a frame/script DEFAULT_CHAT_FRAME:AddMessage( GetMouseFocus():GetName() );
  • Macro to obtain an item ID /script local infoType, info1, info2 = GetCursorInfo(); if infoType == "item" then DEFAULT_CHAT_FRAME:AddMessage( info1 ); end

3) The Basic Structure

Now that your preparations are all done on to the addon programming stuff. Here’s the basic structure of the simplest WoW Addon:

  • HelloWorld.toc: contains meta information on the addon. For example: name, author, website and loading information. It also has to has a “toc” = table of contents for all the files or libraries included with the addon.
  • HelloWorld.lua: contains the actual code of your addon.
  • You could have an xml file as well to define your frames. Personally I want to try the all-lua approach.
  • Put these files in a HelloWorld folder in your Interface\Addons directory and once you filled them with content you can test your addon.

4) The HelloWorld.toc File

The toc file is more important and versatile than you would think at first. But right now I want to keep it very simple (the LineNumbers are not included in the actual file!):

1-- ## Interface: 30300
2--
3-- ## Title: HelloWorld
4-- ## Notes: Say "Hello!" to the world
5-- ## Author: Yashima
6-- ## Version: Alpha
7--
8-- HelloWorld.lua

Just a quick explanation, most of this is self explanatory.

  • Line 1: contains the version of the interface this addon was written for
  • Line 3-6: basic information on the addon and its’ author
  • Line 8: the table of contents consists of a single file in our case

What you can also do here:

  • control load on demand behaviour (nice example)
  • insert dependencies or optional dependencies
  • give more information on the author etc.

5) The HelloWorld.lua File

Here’s a sample file.

1-- UIErrorsFrame:AddMessage("Hello World",0.5,1.0,1.0,5.0);

As far as I was able to find out all code (except functions which must be called) in the lua file will be executed when the addon is loaded. The one line in this file will simply print a message to the in-game error frame with the AddMessage method. Of course the message here is “Hello World”. The additional parameters control the color and fade time of the message.

Of course keeping it so simple won’t get you far. Here’s another example with some very simple event handling.

1-- local function OnEvent()
2--   UIErrorsFrame:AddMessage(arg1,0.5,1.0,1.0,5.0);
3-- end
4--
5-- local f = CreateFrame("Frame")
6-- f:RegisterEvent("CHAT_MSG_SYSTEM")
7-- f:SetScript("OnEvent",OnEvent)

This code does some very simple event handling. There is a local function called OnEvent() (lines 1-3) that will be executed when the registered event(s) occur and does the same as the previous example: it prints a message to the error frame.

The lua code in the global scope that will be executed on load is found on lines 5-7. In Line 5 we create a simple frame with CreateFrame and on this frame we can register events to listen for in our case the CHAT_MSG_SYSTEM (line 6), an event that is fired when a system chat message (they are displayed in yellow) is received.This event has a single argument arg1 that contains the chat message. On line 7 we finally define that when a registered event is fired we want the OnEvent() method to be called. Since we only have a single event registered all this is pretty simple.

So here’s a tiny first addon. I will continue with this topic once I learn how to do more.

Beyond Teachers: Obtaining new Recipes in Wrath

Rhino Hunt. From Screenshots 2008

Yesterday I made a list of faction recipes. I found there were very few and we could also see how very few recipes are known by the teachers.

So how do we learn new recipes for our different professions? The answer is: in different ways for different professions. I really like that there is some diversity to leveling up the different jobs our characters have.

(Disclaimer: this is all I could find out via WoWHead at this moment and their database is far from complete at this point).

  • Alchemy: when we’re done with recipes known by teachers we start doing  Northrend Alchemy Research (at skill 400). Besides discovered recipes there are 3 drop recipes namely the Protection potions. The last potions from the teacher are obtained at skill 435.
  • Blacksmithing: there seem to be 4 drop recipes but other than that it’s all from the teacher? I would guess the information is incomplete.
  • Cooking: more cooking recipes can be picked up with Derek Odds (or Misensi for the Horde) for Dalaran Cooking Awards. The Awards can be obtained through a set of 4 Dailies. Furthermore there are 4 Recipes for the so-called “Emotion Foods” that are obtained through relatively common green drops and 3 or 4 Recipes learned through quests.
  • Enchanting: additional recipes are obtained from Vanessa Sellers in Dalaran. These can be obtained by turning in Dream Shards. There seem to be a couple of drop recipes for resistance cloak enchants as well.
  • Engineering: so far I can find only two recipes Schematic: Mechano-hog and Schematic: Mekengineer’s Chopper.
  • First Aid: there is only one more recipe to obtain and it’s a drop: Manual: Heavy Frostweave BandageThis book drops in instances. Since it is BoP you will have to visit a couple of instances to get this.
  • Inscription: Scribes learn by doing Research. There are no Vendor Recipes or Drop Recipes at all. There are 2 types of research however: Minor Inscription Research (skill 75) and Northrend Inscription Research (skill 385).
  • Jewelcrafting: Tiffany Cartier has a lot of nice recipes for Jewelcrafters, which she sells for Dalaran Jewelcrafter’s Tokens, which in turn are obtained by doing dailies.
  • Leatherworking: while there are a few Reputation based Vendor recipes most are sold by Braeg Stoutbeard in Dalaran for Arctic Fur or Heavy Borean Leather.
  • Tailoring: there are a few Reputation based recipes and a few drops and one very interesting drop: A Guide to Northern Cloth Scavenging.

So far this is all I was able to find out. So we have 2 professions that get new recipes more or less randomly from doing Research (Inscription + Alchemy) and a few professions that obtain recipes from special vendors in Dalaran that are either paid with rare drops or tokens obtained from dailies (Leatherworking, Enchanting, Jewelcrafting and Cooking). For several professions I could not find much yet: Tailoring, Blacksmithing and Engineering

Update: I am just reading a post by BBB on a similar topic as mine “Undecided about professions?” If you want some more knowledge and analysis go to his blog and read. There will most assuredly be tons of interesting comments on his blog.

Wrath: Faction Crafting Recipes

Since I have almost all professions on a high level character somewhere I will need to know which factions carry recipes for my professional completeness. So here’s a hopefully complete list (as far as WoWHead is complete).

Frenzyheart Tribe

Knights of the Ebon Blade

The Oracles

The Argent Crusade

The Wyrmrest Accord

The Kirin Tor

Kalu’ak

The Alliance Vanguard

Horde Expedition

PvP specific (with resilience) Jewelcrafting recipes are sold by the Wintergrasp Quartermaster (Alliance, Horde).

Other Recipe Vendors (aka Token Vendors):

So we can see that there are very few recipes with the factions’ quartermasters for us crafters to look forward to. I am quite ok with that as I know there are other ways to get more recipes like Research for Scribes and Discovery for Alchemists.

I couldn’t find a lot of info on the Alliance and Horde specific factions and I would be surprised if the information I could find was complete and there were no faction items and recipes from those factions. If I find out more I will update this list.

The Clown Factor

Yashima Level 71
Yáshimá Level 64

Comparing “leveling outfits” in Burning Crusade and Wrath I find that there is some improvement.

While Yáshimá looked like a colorful clown in Burning Crusade, in Wrath the items aren’t as pretty as shiny purple epics but for a few quest rewards and instance drops they go surprisingly well together with the old Kara shoulders and the S3 chest still going strong ;)

I am glad I am not looking all funny again.

PS: As you can see I also got myself a new hair cut.

Spec Decisions

So I have a plan now.

A few days ago I wasn’t sure what to do with my 2 druids and their specs.

Here’s what I’ll try to do now after experiencing my first 2 Wrath instances (Nexus + Keep):

Yashima will level as Moonkin. She collects caster gear and can also heal in instances at least that’s what it looks like now. If we are going to have dual specs she’ll have Balance + Restoration available to her. She is questing with Tenobaal and they AoE very well as a team. Even should I need to respec to tree for a time she’ll not be alone. She stays Herbalist/Alchemist and already has her Swift Flight Form.

Yáshimá will level as Feral (as soon as I get enough Feral quest rewards to switch – I dissed all feral gear). I’ll probably go for a DPS spec as well and once we get dualspecs she’ll have a pure tank and pure DPS spec available. I will collect feral gear of both types and I’m hoping to be able to use several items for both purposes. She will level solo mostly which is fine because that way I can Stealth a lot to speed up certain quests. She is Scribe/Enchanter and will get her Swift Flight Form out of the Family Fund managed by my Priestess as soon as she can fly in Northrend.

After those two, I will level Thalya (Mage) and after that I’ll see about Lakshmi (Shaman), the unknown Death Knight or Ifirnia my lowbie Huntress. I think I have solved my problem with Druid specs: one caster Druid and one melee Druid …

Leveling Again

Borean Tundra, From Screenshots 2008

So while waiting for Wrath to finally come out, we were so excited it spilled over on twitter and the blogosphere – and it was a fun event to follow on blogs and twitter all over the world. Right now everything’s a bit calmer while people are still leveling and exploring.

We did play a lot these last couple of days. We managed to get to 71 and then completed both Utgarde Keep and the Nexus. Both instances were very nice and I was happy to be able to go in as a healer while specced Moonkin. This is very important for me that I can use my leveling DPS spec for something besides …

I mostly quested in Borean Tundra with Tenobaal who is a hunter. We also discovered that there is lots of fun to be had in the Tundra with the herds of Rhinos wandering around there … with two people you can easily AoE herd after herd and if one of the two is a professional Skinner he can easily max out his skill and make tons of gold on the side – unless he wants to keep the Leather of course – but Teno didn’t.

One of the things that impressed me the most was the entry into the Howling Fjord by ship and doing the first “welcome” quest. We have reports from several other people that the same thing happened to them as happened to little Yáshimá … they ran out of the gate combating the wolves and attackers and killed many more than the 12 needed for the quest and kept fighting until they died. This is what I always thought quests should feel like – you get so engrossed in this dynamic fight with lots of NPCs involved on either side that you keep at it when you’re already done.

If you haven’t gone yet – go to Howling Fjord, enjoy the Disney-like ride on the ship and then take the first quest you get and just run with it! Try not to die – if you do you’re in good company though ;)

What is weird about leveling again at the same time as everyone else – leveling alts is different – is the queueing for quest mobs the ganking for getting to quest mobs first and my re-ignited hatred for Rogues.

Meet the Death Knight

Last night I did one more important thing:

I deleted the Level 19 place holder and created my Death Knight. So here she is posing in front of a certain big dark guy with some big-ass sword in his hand – he was to big to fit the picture.

After logging in to pose, I went to bed. My plan is to to do Death Knight intro sequence this coming week-end and then see if I want to continue playing the class.

I am not ready to disclose the name just yet since I want to do the intro by myself and without guildchat I think – this is of course subject to change :)

From World of Warcraft Character Images