I've made a real effort today to wrap my head around how everything is supposed to come together. It's more complex than you might think. Consider this; What if you are looking for a plural of a card or recipe? First we would get the npc or item id. First question, do we use the plural of the mob or item to make the name? Some recipes actually have names and plurals so we don't have to get the item and make the name. One of them at least doesn't have a plural. So in fact we have to check the name first. If it doesn't have a name then we check if it's a card or recipe then make the name.
So basically we are saying; check the plural, if no plural then check the singular, if no singular then, check if card or recipe, if card or recipe check plural, if no plural check singular.
I've decided to simplify it. The only time I can see plurals being used is for the getTEXT strings. So I did a search for "[<s>55" and "[<s>77" and came up with no results. So I'm going to just return the singular if I have to look up a recipe item or card mob.
So the logic will be; check the plural, if no plural then check the singular, if no singular then check if card or recipe, if card or recipe then return the singular.
And another thing, I think if the plural address is 0x902EFC, then it doesn't have a plural name and returns "". That means that if the game calls for that items plural it will get "". If it's used in a key string it will have "". That means if our function returns the singular then the string wont match. I'd assume that anywhere in the game that calls for a plural of an id then that id will have a plural. So there shouldn't be any need to return the singular of an id if it doesn't have a plural. Of course it might be possible that the game also returns the singular if it doesn't have a plural but we don't have any evidence of that.
And then there is the issue of the GetCraftRequestItem command in the GetIdName function and when it's necessary. It only runs if the name read is initially nil. If the name address is 0x902EFC then the name returned is "" GetCraftRequestItem doesn't run. I think name is initially nil only if the name address is 0 but I can't be 100% sure. According to this post
http://www.solarstrike.net/phpBB3/viewt ... 530#p25530 it needs it because sometimes the name address is "missing". I'm not 100% sure what I meant by missing. I believe the area where all the strings are are always there so if the name address is an address I'm assuming it will point to a string. So I'm assuming the only way the name would be nil is if the address = 0.
Feel free to comment but just writing it all down helped to clarify it in my mind. I'll be going to a party soon so I wont get much more done now but I will work on it after I get back.