Proposed change to item types
Posted: Wed May 16, 2012 9:47 am
A while back I implemented the 3 levels of item types which are saved to "rom/cache/itemtypestable.lua" and the isType function. With it you could write things like
or
It also allows you to specify any types in the autosell options.
Anyway, at the time, seeing as similar armors had similar type name (eg. the 3rd level type name for plate belt is "Belts" and so is the chain, leather and cloth ones) I thought I was being helpful by merging the second and third level type names, eg. instead of the level 2 name being "Plate" and the level 3 name being "Belts", I saved it as level 2 "Plate" and level 3 as "Belts Plate". That way all type names are uniquie and you could use item:isType("Belts Plate") to indicate one type of item.
I long since realised this was a mistake as there is no way to say "is it any type belt". What I should have done is left it as "Belts" and if you wanted to know if an item is a plate belt you could have just used
This is now causing me problems with a function I'm writing for auto equiping gear after getting quest rewards.
The question I'm putting forward is, will people get annoyed if I change this? It will mostly affect people who have used "type" options in their autosell options. It will only affect armor.
I suspect it wont affect anyone as I don't think anyone would be using the 3rd level type names. Probably only the more advanced programmers who could probably easily change it.
I just had a thought. If they don't all have unique names then you can't specify an item such as plate belts in the autosell options. They have to be unique.
I think what I can do is give the third level types both name "Belts" and "Belts Plate" so all existing code and user options will still work and bothand
will work.
Ok, I have a plan of action. Thanks for listening. Seems pointless to post this now but I think some people like to see how I think.
Code: Select all
if item:isType("Armor") or item :isType("Weapons") then -- All gearCode: Select all
if item:isType("Weapons") and not (item:isType("Projectiles") or item:isType("Arrows")) then -- All weapons but not projectiles and arrows.Anyway, at the time, seeing as similar armors had similar type name (eg. the 3rd level type name for plate belt is "Belts" and so is the chain, leather and cloth ones) I thought I was being helpful by merging the second and third level type names, eg. instead of the level 2 name being "Plate" and the level 3 name being "Belts", I saved it as level 2 "Plate" and level 3 as "Belts Plate". That way all type names are uniquie and you could use item:isType("Belts Plate") to indicate one type of item.
I long since realised this was a mistake as there is no way to say "is it any type belt". What I should have done is left it as "Belts" and if you wanted to know if an item is a plate belt you could have just used
Code: Select all
if item:isType("Plate") and item:isType("Belts") thenThe question I'm putting forward is, will people get annoyed if I change this? It will mostly affect people who have used "type" options in their autosell options. It will only affect armor.
I suspect it wont affect anyone as I don't think anyone would be using the 3rd level type names. Probably only the more advanced programmers who could probably easily change it.
I just had a thought. If they don't all have unique names then you can't specify an item such as plate belts in the autosell options. They have to be unique.
I think what I can do is give the third level types both name "Belts" and "Belts Plate" so all existing code and user options will still work and both
Code: Select all
if item:isType("Belts Plate") thenCode: Select all
if item:isType("Belts") and item:isType("Plate") thenOk, I have a plan of action. Thanks for listening. Seems pointless to post this now but I think some people like to see how I think.