1. To get the
itemdata_<index>.txt file from the Media.pk2 file, use Drew Benton's pk2 tools
The ID is in the 2nd column of any item entry
Example:
Item entry for chinese sword
Code:
1 76 ITEM_CH_SWORD_02_C ??? ??? xxx SN_ITEM_CH_SWORD_02_C SN_ITEM_CH_SWORD_02_C_TT_DESC 0 0 3 1 6 2 180000 0 0 1 1 1 255 3 1 1 1 0 0 8000 805 1208 0 150 3040 1 13 -1 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 100 0 0 0 item\china\weapon\sword_02.bsr item\etc\drop_ch_equip.bsr item\china\weapon\sword_02.ddj xxx xxx 1 2 0 0 6 0 70.0 85.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 0 0 0 2 0 6 47.0 49.0 52.0 56.0 3.5999999 79.0 84.0 90.0 97.0 6.1999998 389.0 409.0 434.0 465.0 658.0 699.0 750.0 810.0 46.0 56.0 0.0 3.0 15.0 -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx 0 ?? ??? ?? ?? ? 9 0
You get the ID: 76
If you want to code it, take a look at zBot's attempt to solve it:

There should be a couple of other coding examples you can look for.
2. To get the item type from any entry, you'll need 4 type IDs.
This is how they are used in the code for spawns:
These can be found in the 9th, 10th, 11th and 12th column of any item entry.
Example:
Item entry for chinese sword
Code:
1 76 ITEM_CH_SWORD_02_C ??? ??? xxx SN_ITEM_CH_SWORD_02_C SN_ITEM_CH_SWORD_02_C_TT_DESC 0 0 3 1 6 2 180000 0 0 1 1 1 255 3 1 1 1 0 0 8000 805 1208 0 150 3040 1 13 -1 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 100 0 0 0 item\china\weapon\sword_02.bsr item\etc\drop_ch_equip.bsr item\china\weapon\sword_02.ddj xxx xxx 1 2 0 0 6 0 70.0 85.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 0 0 0 2 0 6 47.0 49.0 52.0 56.0 3.5999999 79.0 84.0 90.0 97.0 6.1999998 389.0 409.0 434.0 465.0 658.0 699.0 750.0 810.0 46.0 56.0 0.0 3.0 15.0 -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx 0 ?? ??? ?? ?? ? 9 0
You get the type signature:
3. If you mean the code to use send packet
0x704C USE_ITEM to use an item in your inventory, you will need the itemMall flag from the 8th column too.
Here is the thread explaining the calculation:
Example:
Calculate the item-use-type using the item's cashItem/Item mall value, the value 3, and the item's3-hex pk2Itemtype.
E.g. for an hp pot the value would be 2284, using
Code:
1 4 ITEM_ETC_HP_POTION_01 HP ?? ?? xxx SN_ITEM_ETC_HP_POTION_01 SN_ITEM_ETC_HP_POTION_01_TT_DESC 0 0 3 3 1 1 180000 3 0 1 1 1 255 3 1 0 0 1 0 60 0 0 0 1 21 -1 0 -1 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 100 0 0 0 xxx item\etc\drop_ch_bag.bsr item\etc\hp_potion_01.ddj xxx xxx 1000 2 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 0 0 0 0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 120 HP??? 0 HP???(%) 0 MP??? 0 MP???(%) -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx -1 xxx 0 0
the important part starts after the 7th column:
with 0(cashItem for item Mall) 0(Bionic) 3(type1 (isItem --> always 3)) 3(type2 {1 = equip; 2 = pets; 3 = etc} 1(type3 (item type)) 1(type4 (itemsubtype))
result should be EC 08 -> 8EC -> 2284
CashItem(0) + type1(3*4) + type2(3*32) + type3(1*128) + type4(1* 2048)
= 0 + 12 + 96 + 128 + 2048
= 2248
This is how it is used in an autopot tool for example:
Code:
// Use X-Large HP Potion in itemSlot 13
[C -> S][704C]
0D itemSlot(13)
EC 08 itemCode(2284) https:www.elitepvpers.com/forum/sro-pserver-guides-releases/4396959-0x704c-item-type-calculation-vsro.html
// Server response
[S -> C] [B04C]
01 successFlag
0D itemSlot(13)
E7 03 stackAmount(999)
EC 08 itemcode(2284)