Multi itemInfo Files

“Multi itemInfo Files”?

First, as we know, newer clients are using itemInfo.lua/lub to replaces TXT files for item info on client-side, inside System folder of client’s folder.

Back then, when I adding some items from other RO such idRO, iRO, & jRO for rAthena item_db.txt, I always get “Unknown Item” & “Apples”, and I just don’t know the true form of the item, except I switch the itemInfo.lua files.

Then, I saw NEO posted a guide how to enable multi-itemInfo files. Example, I have itemInfo.lua from Translation project, from kRO itself, from iRO, and idRO, and make those can replace non-existing info from other files. Sadly, tested and it doesn’t work for me. I asked Dastgir -I know he have more knowledge about LUA language- but he seems kinda busy with his stuffs. xD

Started with Google for simple guides, and at least these are the codes I used my test client for this multi itemInfo.lua. These the steps from me:

  1. Prepare the files, example “itemInfo_Translation.lua” from Translation project, “itemInfo_iRO.lua” from iRO, “itemInfo_idRO.lua” from idRO, and the last from kRO itself rename the file to “itemInfo_kRO.lua“.
  2. Make an empty LUA file, give the name “itemInfo.lua“, this is will be main file to being read by client.
  3. Edit the “itemInfo.lua“, and put this codes

    main = function()
    iiFiles = {
    “System/itemInfo_Translation.lua”, — 1st priority
    “System/itemInfo_iRO.lua”, — 2nd
    “System/itemInfo_idRO.lua”, — 3rd
    “System/itemInfo_kRO.lua”, — 4th
    }

    _TempItems = {}
    _Num = 0

    — check existing item
    function CheckItem(ItemID, DESC)
    if not (_TempItems[ItemID]) then
    _TempItems[ItemID] = DESC
    _Num = _Num + 1
    else
    myTbl = {}
    for pos,val in pairs(_TempItems[ItemID]) do
    myTbl[pos] = val
    end

    for pos,val in pairs(DESC) do
    if not (myTbl[pos]) or myTbl[pos] == “” then
    myTbl[pos] = val
    end

    end

    _TempItems[ItemID] = myTbl
    end

    end
    — end check

    — Read all files
    for i,iiFile in pairs(iiFiles) do
    d = dofile(iiFile)
    end
    — Read all files

    — process _TempItems
    for ItemID,DESC in pairs(_TempItems) do
    –print(“ItemID”,ItemID,”Name”,DESC.identifiedDisplayName)
    result, msg = AddItem(ItemID, DESC.unidentifiedDisplayName, DESC.unidentifiedResourceName, DESC.identifiedDisplayName, DESC.identifiedResourceName, DESC.slotCount, DESC.ClassNum)
    if not result then
    return false, msg
    end
    for k,v in pairs(DESC.unidentifiedDescriptionName) do
    result, msg = AddItemUnidentifiedDesc(ItemID, v)
    if not result then
    return false, msg
    end
    end
    for k,v in pairs(DESC.identifiedDescriptionName) do
    result, msg = AddItemIdentifiedDesc(ItemID, v)
    if not result then
    return false, msg
    end
    end
    end
    — process _TempItems

    _TempItems = nil

    return true, “good”
    end

    Click this for better snippets!

  4. Edit the “itemInfo_kRO.lua” then go to the last line, remove a whole main function, and replace by these code lines. Repeat this step for other LUA files (except the itemInfo.lua itself). Make sure those files has table with name “tbl”

    — tbl = {
    — …
    — }

    for ItemID,DESC in pairs(tbl) do
    CheckItem(ItemID,DESC)
    end

    Click this for better snippets!

  5. You can order the files, first file will be the highest priority for its contents to be used. Function in “itemInfo.lua” will does a check such “If in my first file doesn’t have this entry, use the content from the second file”
  6. Enjoy your multi itemInfo files!


As note, all files must be decompiled lua, not the compiled one. 😀

And if you get empty icon for your items, that means your client doesn’t have the sprite/texture needed or your itemInfo files has empty “unidentifiedResourceName” or “identifiedResourceName”.

And one thing, I’m beginner in LUA, so maybe you’ll find better guide than this for your Ragnarok client, or you can make better one, please tell me! 😛

Tell your friends

Leave a Reply