Jump to content
×
×
  • Create New...
  • 0

Understanding common_drop_item


Vassy

Question

Hi guys. Can you help me to understand common_drop_item table?


 

PAWN                        S_PAWN                        KNIGHT                        S_KNIGHT

초급검    1    15    1.08    도+1    5000     초급검    1    15    1.104    도+1    3846     초급검    1     15     1.12    도+1    3333     초급검    1    15    1.32    도+1    1250

 

I understand from here that this is actually one line

 

초급검    1    15    1.08    도+1    5000

 

But what every value means? 1.08 is probably the chance and 도+1 is the object. But from here im stuck.

 

Thanks.

 

EDIT: Found on Mr. Google that 1 and 15 is the level where you can get the item. Remain only one value.

 

What 5000 means?

Link to comment
  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

1 answer to this question

Recommended Posts

  • 0

Aparently 5000 is the count of item.

case 1: str_to_number(d[i].iLvStart, szTemp);    break;
case 2: str_to_number(d[i].iLvEnd, szTemp);    break;
case 3: d[i].fPercent = atof(szTemp);    break;
case 4: strlcpy(d[i].szItemName, szTemp, sizeof(d[i].szItemName));    break;
case 5: str_to_number(d[i].iCount, szTemp);    break;

 

This is from server funcion ITEM_MANAGER::ReadCommonDropItemFile.

bool ITEM_MANAGER::ReadCommonDropItemFile(const char * c_pszFileName)
{
    FILE * fp = fopen(c_pszFileName, "r");

    if (!fp)
    {
        sys_err("Cannot open %s", c_pszFileName);
        return false;
    }

    char buf[1024];

    int lines = 0;

    while (fgets(buf, 1024, fp))
    {
        ++lines;

        if (!*buf || *buf == '\n')
            continue;

        TDropItem d[MOB_RANK_MAX_NUM];
        char szTemp[64];

        memset(&d, 0, sizeof(d));

        char * p = buf;
        char * p2;

        for (int i = 0; i <= MOB_RANK_S_KNIGHT; ++i)
        {
            for (int j = 0; j < 6; ++j)
            {
                p2 = strchr(p, '\t');

                if (!p2)
                    break;

                strlcpy(szTemp, p, MIN(sizeof(szTemp), (p2 - p) + 1));
                p = p2 + 1;

                switch (j)
                {
                case 0: break;
                case 1: str_to_number(d[i].iLvStart, szTemp);    break;
                case 2: str_to_number(d[i].iLvEnd, szTemp);    break;
                case 3: d[i].fPercent = atof(szTemp);    break;
                case 4: strlcpy(d[i].szItemName, szTemp, sizeof(d[i].szItemName));    break;
                case 5: str_to_number(d[i].iCount, szTemp);    break;
                }
            }

            DWORD dwPct = (DWORD) (d[i].fPercent * 10000.0f);
            DWORD dwItemVnum = 0;

            if (!ITEM_MANAGER::instance().GetVnumByOriginalName(d[i].szItemName, dwItemVnum))
            {
                // 이름으로 못찾으면 번호로 검색
                str_to_number(dwItemVnum, d[i].szItemName);
                if (!ITEM_MANAGER::instance().GetTable(dwItemVnum))
                {
                    sys_err("No such an item (name: %s)", d[i].szItemName);
                    fclose(fp);
                    return false;
                }
            }

            if (d[i].iLvStart == 0)
                continue;

            g_vec_pkCommonDropItem[i].push_back(CItemDropInfo(d[i].iLvStart, d[i].iLvEnd, dwPct, dwItemVnum));
        }
    }

    fclose(fp);

    for (int i = 0; i < MOB_RANK_MAX_NUM; ++i)
    {
        std::vector<CItemDropInfo> & v = g_vec_pkCommonDropItem[i];
        std::sort(v.begin(), v.end());

        std::vector<CItemDropInfo>::iterator it = v.begin();

        sys_log(1, "CommonItemDrop rank %d", i);

        while (it != v.end())
        {
            const CItemDropInfo & c = *(it++);
            sys_log(1, "CommonItemDrop %d %d %d %u", c.m_iLevelStart, c.m_iLevelEnd, c.m_iPercent, c.m_dwVnum);
        }
    }

    return true;
}

 

Note that d.iCount is not used anywhere in the funcion or any game file (searched with Find in Files function), so ymir maybe changed his mind about that part of common_drop_item.

 

About the drop chance, i found this on the same funcion:

DWORD dwPct = (DWORD) (d[i].fPercent * 10000.0f);

*Sorry for my english.

Link to comment

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


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.