[Question]Other.ItemType(uint item)

09/02/2008 11:49 Rechocto#1
newbie coder (\scriptkiddie) here rewriting ShadowCO to learn C#.. I was wondering if someone could explain the following part to me:

Code:
        public static int ItemType(uint item)
        {
            string Item = Convert.ToString(item);
            string type = Item.Remove(1, Item.Length - 1);

            return int.Parse(type);
        }

        public static int ItemType2(uint item)
        {
            string Item = Convert.ToString(item);
            string type = Item.Remove(2, Item.Length - 2);

            return int.Parse(type);
        }
from what I've seen in Entities.cs and some other files, ItemTypes 4 and 5 are some kind of weapon(s)... could someone tell me what itemtypes are what?


EDIT:
Figured it out, lol... I didn't realize how organized the item database that came with it was!

here's the results:

Code:
            /*
             *
             *  ItemType        =       Type
             *  0               =       (None)
             *  1(0)            =       Miscconsumable
             *  1(>0)         =       Other Armors, not shield (Helmet - ItemType2() = 11)
             *  2               =       Talisman
             *  3               =       (None)
             *  4               =       Blade
             *  5               =       other weapon (itemtype2):
             *  <---
             *  50              =       Bow
             *  51              =       Glaive
             *  53              =       Poleaxe
             *  54              =       LongHammer
             *  56              =       SpearWand (wierd... 560 = Spear, 561 = Wand..no ItemType3 exists yet :P)
             *  58              =       Halberd
             *  --->
             *  6               =       (None)
             *  7               =       RareItem (Gems, scrolls, amulets, etc)
             *  8               =       (None)
             *  9               =       Shield
            */
09/02/2008 22:27 InfamousNoone#2
=/ thats a really shitty method to do what it's doing; here's a better one (from what I can see it just returns the first digit)

Code:
public static byte ItemType(uint item)
        {
            return (int)(item / 100000);
        }