Jump to content

Reload item_attr InGame


Recommended Posts

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
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Announcements



×
×
  • Create New...

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.