Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×
  • 0

Refine yang long long bug


xGalardo

Question

Hello! Today I successfully added the max yang to the server, but unfortunately I found 1 "bug", which I tried to fix, but unfortunately I couldn't.

If anyone could help me with this, I would appreciate it. Also, please excuse my bad English.
 

Bug

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  • Premium
33 minutes ago, xGalardo said:

Hello! Today I successfully added the max yang to the server, but unfortunately I found 1 "bug", which I tried to fix, but unfortunately I couldn't.

If anyone could help me with this, I would appreciate it. Also, please excuse my bad English.
 

Bug

Show the relative codes

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 0

tables.h
 

Quote

typedef struct SRefineTable
{
    //DWORD src_vnum;
    //DWORD result_vnum;
    DWORD id;
    BYTE material_count;
#ifdef ENABLE_LONG_LONG_GOLD
    long long cost;
#else    
    int cost;
#endif
    int prob;
    TRefineMaterial materials[REFINE_MATERIAL_MAX_NUM];
} TRefineTable;

server/packet.h

Quote

typedef struct SPacketGCRefineInformaion
{
    BYTE    header;
    BYTE    type;
    WORD    pos;
    DWORD    src_vnum;
    DWORD    result_vnum;
    BYTE    material_count;
#ifdef ENABLE_LONG_LONG_GOLD
    long long    cost;
#else    
    int        cost;
#endif
    int        prob;
    TRefineMaterial materials[REFINE_MATERIAL_MAX_NUM];
} TPacketGCRefineInformation;

char_item.cpp
 

Quote

    // REFINE_COST
#ifdef ENABLE_LONG_LONG_GOLD
    long long cost = ComputeRefineFee(prt->cost);
#else    
    int cost = ComputeRefineFee(prt->cost);
#endif

    int RefineChance = GetQuestFlag("main_quest_lv7.refine_chance");

    if (RefineChance > 0)
    {
        if (!item->CheckItemUseLevel(20) || item->GetType() != ITEM_WEAPON)
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ą«·á °ł·® ±âȸ´Â 20 ŔĚÇĎŔÇ ą«±â¸¸ °ˇ´ÉÇŐ´Ď´Ů"));
            return false;
        }

        cost = 0;
        SetQuestFlag("main_quest_lv7.refine_chance", RefineChance - 1);
    }
    // END_OF_REFINE_COST

Client/Packet.h

Quote

typedef struct SRefineTable
{
    DWORD src_vnum;
    DWORD result_vnum;
    BYTE material_count;
#ifdef ENABLE_LONG_LONG_GOLD
    long long cost;
#else
    int cost;
#endif
    int prob;
    TMaterial materials[REFINE_MATERIAL_MAX_NUM];
} TRefineTable;

PythonNetworkStreamPhaseGame.cpp

Quote

bool CPythonNetworkStream::RecvRefineInformationPacket()
{
    TPacketGCRefineInformation kRefineInfoPacket;
    if (!Recv(sizeof(kRefineInfoPacket), &kRefineInfoPacket))
        return false;

    TRefineTable & rkRefineTable = kRefineInfoPacket.refine_table;
    PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
        "OpenRefineDialog",
        Py_BuildValue("(iiii)",
            kRefineInfoPacket.pos,
            kRefineInfoPacket.refine_table.result_vnum,
            rkRefineTable.cost,
            rkRefineTable.prob));

    for (int i = 0; i < rkRefineTable.material_count; ++i)
    {
        PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "AppendMaterialToRefineDialog", Py_BuildValue("(ii)", rkRefineTable.materials[i].vnum, rkRefineTable.materials[i].count));
    }

#ifdef _DEBUG
    Tracef(" >> RecvRefineInformationPacket(pos=%d, result_vnum=%d, cost=%d, prob=%d)\n",
                                                        kRefineInfoPacket.pos,
                                                        kRefineInfoPacket.refine_table.result_vnum,
                                                        rkRefineTable.cost,
                                                        rkRefineTable.prob);
#endif

    return true;
}

bool CPythonNetworkStream::RecvRefineInformationPacketNew()
{
    TPacketGCRefineInformationNew kRefineInfoPacket;
    if (!Recv(sizeof(kRefineInfoPacket), &kRefineInfoPacket))
        return false;

    TRefineTable & rkRefineTable = kRefineInfoPacket.refine_table;
    PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
        "OpenRefineDialog",
        Py_BuildValue("(iiiii)",
            kRefineInfoPacket.pos,
            kRefineInfoPacket.refine_table.result_vnum,
            rkRefineTable.cost,
            rkRefineTable.prob,
            kRefineInfoPacket.type)
        );

    for (int i = 0; i < rkRefineTable.material_count; ++i)
    {
        PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "AppendMaterialToRefineDialog", Py_BuildValue("(ii)", rkRefineTable.materials[i].vnum, rkRefineTable.materials[i].count));
    }

#ifdef _DEBUG
    Tracef(" >> RecvRefineInformationPacketNew(pos=%d, result_vnum=%d, cost=%d, prob=%d, type=%d)\n",
                                                        kRefineInfoPacket.pos,
                                                        kRefineInfoPacket.refine_table.result_vnum,
                                                        rkRefineTable.cost,
                                                        rkRefineTable.prob,
                                                        kRefineInfoPacket.type);
#endif

    return true;
}

I suspect PythonNetworkPhaseGame, I haven't found much code related to refine elsewhere.
Where there is sysser, I have also rewritten them, of course.

Edited by xGalardo
forget
Link to comment
Share on other sites

  • 0
11 hours ago, xGalardo said:

tables.h
 

server/packet.h

char_item.cpp
 

Client/Packet.h

PythonNetworkStreamPhaseGame.cpp

I suspect PythonNetworkPhaseGame, I haven't found much code related to refine elsewhere.
Where there is sysser, I have also rewritten them, of course.

PythonNetworkStreamPhaseGame.cpp

        Py_BuildValue("(iiii)",
            kRefineInfoPacket.pos,
            kRefineInfoPacket.refine_table.result_vnum,
            rkRefineTable.cost,
            rkRefineTable.prob));



to 

        Py_BuildValue("(iiLi)",
            kRefineInfoPacket.pos,
            kRefineInfoPacket.refine_table.result_vnum,
            rkRefineTable.cost,
            rkRefineTable.prob));

and search under (iiiii) to iiLii)

 

Edited by Avvex
Link to comment
Share on other sites

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


×
×
  • 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.