Hello ragezone,
is it possible to detect if an item is 'invalid'?
What I mean is that when I hover my mouse over an item that does not exist in my wz's but is in my inventory I crash.
Is there any way to check if an item is like that?
Printable View
Hello ragezone,
is it possible to detect if an item is 'invalid'?
What I mean is that when I hover my mouse over an item that does not exist in my wz's but is in my inventory I crash.
Is there any way to check if an item is like that?
First off, wrong section. Suppose to be in Wz Editing section.
Secondly, there are multiple reasons why you would crash. All is listed as followed:
-You may just have a null item.
-You need to remove "SetItemEffect" or "SetEffect"
-You have some nodes that aren't coded into your current verison.
-If dealing with a cash shop item, mostly in weapons, you got wrong weapon sets inside the XML.
-You didn't export/import correctly.
Or.. he means if some people are dumb and generate items that couldn't possibly exist, how to check for them (currently, it will just put them in your inventory regardless if the id was 133337 or 1302000)
Few checks would be when creating the item would be,
A) Check the nTI (Inventory Type). Divide the Item's ID by 1,000,000 and make sure it exists as an InventoryType.
B) Check if an XML exists. When your server starts in OdinMS, it parses item xmls into MapleItemInformationProvider. Call an instance, and get an item from it with that (like ii.getEquipStats(itemID)) and if it returns null (getEquipStats(itemID) == null), then return or don't create the item.
C) Make sure the item's ID length is 7digits long and greater than 1,000,000 (the lowest itemid, for Caps).
With these checks implemented the server won't generate any item that you did not personally add to your server. Where you place them is up to you. You can add it into !item, !drop, or you can place them in a better area like MapleInventoryManipulator.addById so that whenever it adds the item it refuses if it fails to meet any of the requirements mentioned above.