Jump to content
×
×
  • Create New...

Reload item_attr InGame


Recommended Posts

  • Moon

Hey devs,

As some of you noticed, /reload p doesn't actually reload the item attr ingame. it does reload ItemAttr vector from database(via query) but that's not enough.

With my simple guide,you'll be able to reload item_attr table ingame.

Let's begin:

Open input_db.cpp, look for:

Spoiler

if (wSize)
    {
        CMobManager::instance().Initialize((TMobTable *) c_pData, wSize);
        c_pData += wSize * sizeof(TMobTable);
    }

Add below:

Spoiler

wSize = decode_2bytes(c_pData);
    c_pData += 2;
    sys_log(0, "RELOAD: ITEM_ATTR: %d", wSize);

    if (wSize)
    {
        TItemAttrTable * p = (TItemAttrTable *)c_pData;

        for (int i = 0; i < wSize; ++i, ++p)
        {
            if (p->dwApplyIndex >= MAX_APPLY_NUM)
                continue;

            g_map_itemAttr[p->dwApplyIndex] = *p;
            sys_log(0, "ITEM_ATTR[%d]: %s %u", p->dwApplyIndex, p->szApply, p->dwProb);
        }
    }

c_pData += wSize * sizeof(TItemAttrTable);

Open ClientManager.cpp

Look for:

Spoiler

tmp->EncodeHeader(HEADER_DG_RELOAD_PROTO, 0, 
                sizeof(WORD) + sizeof(TSkillTable) * m_vec_skillTable.size() +
                sizeof(WORD) + sizeof(TBanwordTable) * m_vec_banwordTable.size() +
                sizeof(WORD) + sizeof(TItemTable) * m_vec_itemTable.size() +
                sizeof(WORD) + sizeof(TMobTable) * m_vec_mobTable.size())

Replace with:

Spoiler

tmp->EncodeHeader(HEADER_DG_RELOAD_PROTO, 0, 
                sizeof(WORD) + sizeof(TSkillTable) * m_vec_skillTable.size() +
                sizeof(WORD) + sizeof(TBanwordTable) * m_vec_banwordTable.size() +
                sizeof(WORD) + sizeof(TItemTable) * m_vec_itemTable.size() +
                sizeof(WORD) + sizeof(TMobTable) * m_vec_mobTable.size() + 
                sizeof(WORD) + sizeof(TItemAttrTable) * m_vec_itemAttrTable.size());

Look for:

Spoiler

tmp->EncodeWORD(m_vec_mobTable.size());
        tmp->Encode(&m_vec_mobTable[0], sizeof(TMobTable) * m_vec_mobTable.size());

Add below:

Spoiler

tmp->EncodeWORD(m_vec_itemAttrTable.size());
        tmp->Encode(&m_vec_itemAttrTable[0], sizeof(TItemAttrTable) * m_vec_itemAttrTable.size());

 

That's all! compile game & db and it should work fine now.

To reload ingame you could either use the command /reload p or just /reload.

Please like this post if it helped you.

 

Regards.

Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


  • Read our Rules
  • Activity

    1. 3

      Quest Craft

    2. 3

      Quest Craft

    3. 414

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    4. 11

      Metin2 Patcher with Electron

    5. 17

      I Want Find freebsd 11.4 with remove unnecessary codes

    6. 17

      I Want Find freebsd 11.4 with remove unnecessary codes

    7. 3

      Quest Craft

  • Recently Browsing

    • No registered users viewing this page.

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.