Suggestion to replace special value with names

Topics: Rawr.Base
Oct 10, 2009 at 3:55 PM

I noticed in the Elemental Shaman calculations that the gems are listed by item id rather than by name. It occured to me that we were using the item id and I was able to look up the gem names via wowhead.com. While I know there are a lot of items in the game I was wondering if we wanted to have a name space and classes for items. That way people don't have to remember 41285 is Chaotic Skyflare diamond. For example,


namespace Meta.Gems { class Meta { public static int ChaoticSkyflare = 41285; } class CommonRed { public static int RunedBloodstone = 39911; public static int PerfectRunedBloodstone = 41438; } class RareRed { public static int RunedScarletRuby = 39998; } class EpicRed { public static int RunedCardinalRuby = 40113; }
class JC
{
public static int RunedDragonEye = 42144;
}
}

That way we can replace code like:

 

int[] runed= { 39911, 41438, 39998, 40113, 42144 };

 

with

int [] runed = { Meta.Gems.CommonRed.RunedBloodstone,
Meta.Gems.CommonRed.PerfectRunedBloodstone,
Meta.Gems.RareRed.RunedScarletRuby,
Meta.Gems.EpicRed.RunedCardinalRuby };

So far I still learning the code. So I don't know where gems are also used beyond the character classes (e.g. CalculationsElemental.cs) but it would make for readable code. It would reduce the probability that we could enter an off by one entry (e.g. 42145 instead of 42144).

Coordinator
Oct 10, 2009 at 4:10 PM

Hey. These are only used in that one single spot, to create the default gemming templates. Therefore, we prefer to keep them in-line. If we used them more places, I'd agree that we should have them in a shared set of constants.

Oct 10, 2009 at 4:15 PM

Ok. Where should I be focusing my time? Understanding and improving Rawr 2 or 3?

 

Coordinator
Oct 10, 2009 at 4:26 PM

Well the difference between Rawr 2 and 3 is 99% UI, so looking at the model code will apply to both. That's probably easiest to do in Rawr2, however it'd probably be handy to get Rawr3 running if you have time.