Add an Item
This guide adds an item to the game. It covers the two item families you will use most:
- Gear: weapon, armor, helmet, cloak. These belong to a hero.
- Etc items: packages, tickets, boxes, buffs and everything else players keep in the inventory.
For costumes see Costumes. For selling the item see Shop items. For random boxes see Gacha boxes.
File names come from the code that loads them (ioItemInfoManager.cpp, ioEtcItemManager.cpp, ioEtcItem.cpp, ioExtraItemInfoManager.cpp). Anything not checked is marked not confirmed yet.
Rule 1: the item needs an entry on both sides
Section titled “Rule 1: the item needs an entry on both sides”| Family | Server | Client |
|---|---|---|
| Gear | sp2_item.ini (flat list), sp2_extraitem_info.ini (boxes) |
mercenary\NNN\NNN_item.ini or NNN_extraitem.ini, sp2_extraitem_info.ini |
| Etc item | sp2_etcitem_info.ini |
sp2_etcitem_info.ini |
If one side is missing, the item shows wrong or cannot be used. Check the pair after every change.
Part A: add an etc item
Section titled “Part A: add an etc item”-
Open
sp2_etcitem_info.inion the server. Go to the end. Add a block. The number is the next free one:[etcitem5608]name = Test Tickettype = <an unused type from a range the code knows>can_sell = 0sell_peso = 0active1 = 1value1 = 1peso1 = 0cash1 = 990bonus_peso1 = 0 -
Raise
maxin[common]so that it covers the new block. The client loop isetcitem1toetcitem<max>. A block pastmaxis never read. -
Check the
type. It has the formAABBBBBB. The comment at the top of the file says:AA= 1 count-use, 2 time-use, 3 instant use;BBBBBBis the permission code or the item kind. The type must be one the code knows.ioEtcItemManager::CreateEtcItemcreates an object per known type or range. An unknown type is skipped and the client log showsUNKOWN ETCITEM TYPE. So an etc item with a new behaviour needs code, not only config. -
A type already used by another block is rejected (
Already Exist). Search the file first. -
Copy the block to the client file. The client reads more keys than the server. Add the look:
[etcitem5608]name = Test Tickettype = <the same type as on the server>can_sell = 0sell_peso = 0buy_popup_type = 1extend_use = 1inventory_manual = 17inventory_sub_manual = 0inventory_order = 2000shop_name1 = Test Ticketvalue1 = 1peso1 = 0cash1 = 990bonus_peso1 = 0show_peso1 = 0main_manual1 = 20sub_manual1 = 20shop_order1 = 210shop_mark_type1 = 3shop_tab_type1 = 4active1 = 1icon_name = UIIconPack10#goods_pack2Key Meaning inventory_manual,inventory_sub_manualText block numbers for the inventory tooltip main_manual1,sub_manual1Text block numbers for the shop description shop_order1Sort position. The file says 100 sale or event, 300 new, 500 hot, 1000 normal shop_mark_type1Badge: 1 sale, 2 new, 3 hot, 4 event shop_tab_type1Tab: 1 hero, 2 gear, 3 costume, 4 special icon_nameimageset#image, see Icons belowextend_use,present_use,can_sell,block_buyingUse, gift, sell and buy switches -
Match the prices:
peso1,cash1,bonus_peso1on both sides. The server price is the one the server charges.
Also read value1, value2 and so on: they are the offers (for example 1 piece, 5 pieces). The loop stops at the first value<n> that is missing.
Part B: add a gear piece
Section titled “Part B: add a gear piece”A hero owns its gear. The shipped pattern for hero N is in Add a hero. To add one extra piece for an existing hero:
-
Client, in the hero folder, edit
config\mercenary\NNN\NNN_extraitem.ini(premium gear) orNNN_item.ini(base gear). Raiseitem_cntand add a block:[item5]name = Sample Sword Pluscode = 20940enable_class = 940set_item_code = 700940grade_type = 6item_type = WEAPONsub_type = SABERitem_large_icon0 = ItemIconPack101#n940_weaponequip_mesh0 = sample_swordcodemust be unique over all heroes. The loader readscodeandset_item_codefor each block, andenable_classandgrade_typewhere present. -
Server, add a block at the end of
sp2_item.iniand raiseitem_count:[item3594]name = Sample Sword Pluscode = 20940set_item_code = 700940enable_class = 940default_reinforce_min = 1default_reinforce_max = 10 -
To let players get it, put the code in a gear box: add
itemN_codeanditemN_ratein a[random_machineN]block ofsp2_extraitem_info.ini, and raise that block’sitem_cnt. The chance isitemN_ratedivided by the sum of all rates in the block. Do this on both sides (the client copy shows the list). The server also readsperiod_time_cntandtradetype_cntdata in the same block. -
Or give it directly as a gift: type 5 in a gashapon,
Value1is the code,Value2isenhance x 10000 + hours(see Gacha boxes).
The index comment at the top of the server sp2_extraitem_info.ini lists reserved ranges, for example 1 to 239 for supply boxes and event shops, 1001 to 2000 for timed goods. This is for machine codes, not for gear codes.
Icons are not file names. They are ImagesetName#ImageName. Example: ItemIconPack101#n938_weapon.
- Open
xml\uiimageset.xmlin the client (2021 client, plain file). Find<Imageset Name="ItemIconPack101" File="item_icon_pack101.dds">. - The
Fileis inresource\texture\. The<Image Name="n938_weapon" X=".." Y=".." Width=".." Height=".." />lines cut the pictures out of the sheet. - To add an icon, paint it into a free place of the
.ddssheet (or a new sheet). Then add oneImageline with the position. Use a new uniqueName. - Put the new name in
item_large_icon0(gear) oricon_name(etc item). - In 2014 and 2019,
uiimageset.xmland the.ddsfiles are inside the client packs. Use LosaDev Tools to extract and replace them. Keep any other entries of the file as they are. Add only yours.
-
Names are plain text inside the INI file (
name =,shop_name1 =). They are not in the locale text table. -
Tooltip text lives in manual files. A manual block has lines such as
1SpaceLine,1Color1,1Text1:File Used by sp2_etc_manual.inimain_manual1,sub_manual1(shop)sp2_etc_inven_manual.ini,sp2_etc_inven_sub_manual.iniinventory_manual,inventory_sub_manualsp2_extra_inven_manual.inigear box and gear tooltips sp2_item_manual.inihero gear manual ( item_manualof a set item)Each file starts with
[Info]andMaxManual. Your block number[ManualN]must not be larger thanMaxManual. The top ofsp2_etc_manual.inilists reserved ranges, for example 1 to 2000 for normal items. -
Window text (messages, buttons) is in the locale text table,
text_id.txtfor Indonesia (text.txtfor Korea). It is inside the client packs. Non-Korean clients use%1 %2placeholders where Korea uses%s %d.
- Restart the game server and the client.
- Give the item to a test account (gift or box).
- Check the inventory name, icon and tooltip, then use or equip it.
- Look in the server log for
Already Exist,Add FailedandUNKOWN ETCITEM TYPE.
Differences between versions
Section titled “Differences between versions”| 2014 | 2019 | 2021 | |
|---|---|---|---|
Etc item shop_tab_type, medalitem_max_check keys in the client |
yes | yes | yes |
Gear box grade_type |
not confirmed yet | not confirmed yet | yes (seen in the data) |
| Client config | inside rs.iop |
inside rs.iop |
plain config\ |
Server sp2_item.ini in the repo |
yes | testbed only | yes |
Not confirmed yet: which etc item types need extra server code beyond the config (for example the list of types the server ioEtcItem.cpp handles), and the exact effect of limit_class_num and limit_active_filter on package items.
