Jump to content

c++ 4 stones per item


Recommended Posts

1 hour ago, PeaceMaker said:

hey guys , im trying to add 4 stones per weapon/armor on 40k client , 
i believe i did everything on server/db/binary just fine but im having difficulties adding the socket3 on the item_proto as the compiler wont read the socket3 value .
is there any solution for this ? 

You don't need a socket3 value, if you did the C++ part correctly, you just need to adapt your item_proto compiler. Search in GameLib:
ItemData.h
 

Spoiler

ITEM_SOCKET_MAX_NUM = 3,

and replace with
 

Spoiler

ITEM_SOCKET_MAX_NUM = 4,

after you need to change in DumpProto source, dumpproto.cpp
 

Spoiler

ITEM_SOCKET_MAX_NUM = 3,

with
 

Spoiler

ITEM_SOCKET_MAX_NUM = 4,

 

  • Love 1

"Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch"

Link to comment
Share on other sites

20 hours ago, AlexxD said:

You don't need a socket3 value, if you did the C++ part correctly, you just need to adapt your item_proto compiler. Search in GameLib:
ItemData.h
 

  Hide contents

ITEM_SOCKET_MAX_NUM = 3,

and replace with
 

  Hide contents

ITEM_SOCKET_MAX_NUM = 4,

after you need to change in DumpProto source, dumpproto.cpp
 

  Hide contents

ITEM_SOCKET_MAX_NUM = 3,

with
 

  Hide contents

ITEM_SOCKET_MAX_NUM = 4,

 

after doing that i got this error after loading screen 
 

0403 09:17:14547 :: CPythonItem::LoadItemTable: invalid item_proto[locale/en/item_proto] STRIDE[156] != sizeof(SItemTable)
0403 09:17:14547 :: LoadLocaleData - LoadItemProto(locale/en/item_proto) Error
0403 09:17:14553 :: import math # builtin
 

Link to comment
Share on other sites

here's the steps i did in client side : 

userinterface/gametype.h :

ITEM_SOCKET_SLOT_MAX_NUM = 

GameLib/ItemData.h : 

 ITEM_SOCKET_MAX_NUM = 4, 

UserInterface/PythonPlayermModule.cpp : 
 

Spoiler

PyObject * playerGetItemLink(PyObject * poSelf, PyObject * poArgs)
{
    TItemPos Cell;

    switch (PyTuple_Size(poArgs))
    {
    case 1:    
        if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
            return Py_BuildException();
        break;
    case 2:
        if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
            return Py_BuildException();
        if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
            return Py_BuildException();
        break;
    default:
        return Py_BuildException();
    }
    const TItemData * pPlayerItem = CPythonPlayer::Instance().GetItemData(Cell);
    CItemData * pItemData = NULL;
    char buf[1024];

    if (pPlayerItem && CItemManager::Instance().GetItemDataPointer(pPlayerItem->vnum, &pItemData))
    {
        char itemlink[256];
        int len;
        bool isAttr = false;

        len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x:%x:%x:%x:%x", 
                pPlayerItem->vnum, pPlayerItem->flags,
                pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2], pPlayerItem->alSockets[3]);

        for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
            if (pPlayerItem->aAttr.bType != 0)
            {
                len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d", 
                        pPlayerItem->aAttr.bType, pPlayerItem->aAttr.sValue);
                isAttr = true;
            }

UserInterface/PythonChatModule.cpp : 

 

Spoiler

PyObject * chatGetLinkFromHyperlink(PyObject * poSelf, PyObject * poArgs)
{
    char * szHyperlink;
    
    if (!PyTuple_GetString(poArgs, 0, &szHyperlink))
        return Py_BuildException();

    std::string stHyperlink(szHyperlink);
    std::vector<std::string> results;

    split_string(stHyperlink, ":", results, false);

    // item:vnum:flag:socket0:socket1:socket2
    if (0 == results[0].compare("item"))
    {
        if (results.size() < 7)
            return Py_BuildValue("s", "");

        CItemData * pItemData = NULL;

        if (CItemManager::Instance().GetItemDataPointer(htoi(results[1].c_str()), &pItemData))
        {
            char buf[1024] = { 0 };
            char itemlink[256];
            int len;
            bool isAttr = false;

            len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x:%x:%x:%x:%x", 
                    htoi(results[1].c_str()),
                    htoi(results[2].c_str()),
                    htoi(results[3].c_str()),
                    htoi(results[4].c_str()),
                    htoi(results[5].c_str()),
                    htoi(results[6].c_str()));

            if (results.size() >= 9)
            {
                for (int i = 7; i < results.size(); i += 2)
                {
                    len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d", 
                            htoi(results.c_str()),
                            atoi(results[i+1].c_str()));
                    isAttr = true;
                }
            }

            if (isAttr)
                //"item:锅龋:敲贰弊:家南0:家南1:家南2"
                snprintf(buf, sizeof(buf), "|cffffc700|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
            else
                snprintf(buf, sizeof(buf), "|cfff1e6c0|H%s|h[%s]|h|r", itemlink, pItemData->GetName());

            return Py_BuildValue("s", buf);
        }
    }

    return Py_BuildValue("s", "");
}

 uitoolip.py:

Spoiler

    def SetHyperlinkItem(self, tokens):
        minTokenCount = 3 + player.METIN_SOCKET_MAX_NUM
        maxTokenCount = minTokenCount + 2 * player.ATTRIBUTE_SLOT_MAX_NUM
        if tokens and len(tokens) >= minTokenCount and len(tokens) <= maxTokenCount:
            head, vnum, flag = tokens[:3]
            itemVnum = int(vnum, 16)
            metinSlot = [int(metin, 16) for metin in tokens[3:7]]

            rests = tokens[7:]
            if rests:
                attrSlot = []

                rests.reverse()
                while rests:
                    key = int(rests.pop(), 16)
                    if rests:
                        val = int(rests.pop())
                        attrSlot.append((key, val))

                attrSlot += [(0, 0)] * (player.ATTRIBUTE_SLOT_MAX_NUM - len(attrSlot))
            else:
                attrSlot = [(0, 0)] * player.ATTRIBUTE_SLOT_MAX_NUM

            self.ClearToolTip()
            self.AddItemData(itemVnum, metinSlot, attrSlot)

            ItemToolTip.OnUpdate(self)

 

Link to comment
Share on other sites

5 minutes ago, PeaceMaker said:

here's the steps i did in client side : 

userinterface/gametype.h :


ITEM_SOCKET_SLOT_MAX_NUM = 

GameLib/ItemData.h : 


 ITEM_SOCKET_MAX_NUM = 4, 

UserInterface/PythonPlayermModule.cpp : 
 

  Reveal hidden contents

PyObject * playerGetItemLink(PyObject * poSelf, PyObject * poArgs)
{
    TItemPos Cell;

    switch (PyTuple_Size(poArgs))
    {
    case 1:    
        if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
            return Py_BuildException();
        break;
    case 2:
        if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
            return Py_BuildException();
        if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
            return Py_BuildException();
        break;
    default:
        return Py_BuildException();
    }
    const TItemData * pPlayerItem = CPythonPlayer::Instance().GetItemData(Cell);
    CItemData * pItemData = NULL;
    char buf[1024];

    if (pPlayerItem && CItemManager::Instance().GetItemDataPointer(pPlayerItem->vnum, &pItemData))
    {
        char itemlink[256];
        int len;
        bool isAttr = false;

        len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x:%x:%x:%x:%x", 
                pPlayerItem->vnum, pPlayerItem->flags,
                pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2], pPlayerItem->alSockets[3]);

        for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
            if (pPlayerItem->aAttr.bType != 0)
            {
                len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d", 
                        pPlayerItem->aAttr.bType, pPlayerItem->aAttr.sValue);
                isAttr = true;
            }

UserInterface/PythonChatModule.cpp : 

 

  Reveal hidden contents

PyObject * chatGetLinkFromHyperlink(PyObject * poSelf, PyObject * poArgs)
{
    char * szHyperlink;
    
    if (!PyTuple_GetString(poArgs, 0, &szHyperlink))
        return Py_BuildException();

    std::string stHyperlink(szHyperlink);
    std::vector<std::string> results;

    split_string(stHyperlink, ":", results, false);

    // item:vnum:flag:socket0:socket1:socket2
    if (0 == results[0].compare("item"))
    {
        if (results.size() < 7)
            return Py_BuildValue("s", "");

        CItemData * pItemData = NULL;

        if (CItemManager::Instance().GetItemDataPointer(htoi(results[1].c_str()), &pItemData))
        {
            char buf[1024] = { 0 };
            char itemlink[256];
            int len;
            bool isAttr = false;

            len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x:%x:%x:%x:%x", 
                    htoi(results[1].c_str()),
                    htoi(results[2].c_str()),
                    htoi(results[3].c_str()),
                    htoi(results[4].c_str()),
                    htoi(results[5].c_str()),
                    htoi(results[6].c_str()));

            if (results.size() >= 9)
            {
                for (int i = 7; i < results.size(); i += 2)
                {
                    len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d", 
                            htoi(results.c_str()),
                            atoi(results[i+1].c_str()));
                    isAttr = true;
                }
            }

            if (isAttr)
                //"item:锅龋:敲贰弊:家南0:家南1:家南2"
                snprintf(buf, sizeof(buf), "|cffffc700|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
            else
                snprintf(buf, sizeof(buf), "|cfff1e6c0|H%s|h[%s]|h|r", itemlink, pItemData->GetName());

            return Py_BuildValue("s", buf);
        }
    }

    return Py_BuildValue("s", "");
}

 

If you change

Spoiler

ITEM_SOCKET_MAX_NUM = 3,

with
 

Spoiler

ITEM_SOCKET_MAX_NUM = 4,

in GameLib binary source, you need to change it in DumpProto source too if you want to read 4 socket slots from your item_proto client.

Capture.PNG

  • Love 1

"Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch"

Link to comment
Share on other sites

yeah forgot to mention i did that https://metin2.download/picture/lF1q94FyGdnlU95bFwRrWCcVVwCVSGgH/.png but whats next , can you guide me on how to build the Dump_proto tool ? because once i try to do it i get all these errors in vc https://metin2.download/picture/G3YXt2Kmq04mPx20oGrsDhBUIJ14PmMd/.png

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

35 minutes ago, AlexxD said:

If you change

  Reveal hidden contents

ITEM_SOCKET_MAX_NUM = 3,

with
 

  Reveal hidden contents

ITEM_SOCKET_MAX_NUM = 4,

in GameLib binary source, you need to change it in DumpProto source too if you want to read 4 socket slots from your item_proto client.

Capture.PNG

okey it works now i got those https://metin2.download/picture/x76jFL3dYQ9yMix4GTYuq6E6XdEL0Mpw/.png can you tell me what to do next please ? :D

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

1 minute ago, PeaceMaker said:

okey it works now i got those https://metin2.download/picture/x76jFL3dYQ9yMix4GTYuq6E6XdEL0Mpw/.png can you tell me what to do next please ? :D

In DumpProto folder you have dump_proto subfolder, lzo and Importer.sln.
In dump_proto subfolder after you compiled it, VS will create a folder named Release.
In that folder you have dump_proto.exe
Copy and paste item_proto.txt, item_names.txt, mob_proto.txt and mob_names.txt in Release folder and double-click on the .exe

Capture.PNG

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1

"Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch"

Link to comment
Share on other sites

2 minutes ago, AlexxD said:

In DumpProto folder you have dump_proto subfolder, lzo and Importer.sln.
In dump_proto subfolder after you compiled it, VS will create a folder named Release.
In that folder you have dump_proto.exe
Copy and paste item_proto.txt, item_names.txt, mob_proto.txt and mob_names.txt in Release folder and double-click on the .exe

Capture.PNG

got it ! but 1 more thing i use sql not txt :P

Link to comment
Share on other sites

1 minute ago, PeaceMaker said:

got it ! but 1 more thing i use sql not txt :P

I think it doesn't matter. You need to use txt files for compile it to item_proto for client. Maybe you will find a converter from sql to txt and it'll be better. I also recommend to use txt because sql for me it's way !HARDER!

  • Love 1

"Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch"

Link to comment
Share on other sites

12 minutes ago, AlexxD said:

I think it doesn't matter. You need to use txt files for compile it to item_proto for client. Maybe you will find a converter from sql to txt and it'll be better. I also recommend to use txt because sql for me it's way !HARDER!

got it i can go ingame now but i have 1 more problem :/ i cant see half items xD 

https://metin2.download/picture/zt3sL6ZD2WZatZNS2DO1Kd2OiDp67gi5/.png 

and got this in client syserr 

Spoiler

0403 10:44:42186 :: 󸮵ÇÁö ¾ÊÀº ÆÐŶ Çì´õ 7, state Loading

0403 10:45:58554 :: Cannot find item by 45000
0403 10:45:58554 :: Cannot find item by 45000
0403 10:45:58556 :: Cannot find item by 67120130
0403 10:45:58556 :: Cannot find item by 67120130
0403 10:45:58556 :: Cannot find item by 11906827
0403 10:45:58556 :: Cannot find item by 11906827
0403 10:45:00911 :: Cannot find item by 45000
0403 10:45:01621 :: Cannot find item by 45000
0403 10:45:02811 :: Cannot find item by 45000
0403 10:45:03173 :: Cannot find item by 45000
0403 10:45:06786 :: Cannot find item by 45000
0403 10:45:08733 :: Cannot find item by 45000
 

 

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

25 minutes ago, PeaceMaker said:

got it i can go ingame now but i have 1 more problem :/ i cant see half items xD 

https://metin2.download/picture/zt3sL6ZD2WZatZNS2DO1Kd2OiDp67gi5/.png 

and got this in client syserr 

  Reveal hidden contents

0403 10:44:42186 :: 󸮵ÇÁö ¾ÊÀº ÆÐŶ Çì´õ 7, state Loading

0403 10:45:58554 :: Cannot find item by 45000
0403 10:45:58554 :: Cannot find item by 45000
0403 10:45:58556 :: Cannot find item by 67120130
0403 10:45:58556 :: Cannot find item by 67120130
0403 10:45:58556 :: Cannot find item by 11906827
0403 10:45:58556 :: Cannot find item by 11906827
0403 10:45:00911 :: Cannot find item by 45000
0403 10:45:01621 :: Cannot find item by 45000
0403 10:45:02811 :: Cannot find item by 45000
0403 10:45:03173 :: Cannot find item by 45000
0403 10:45:06786 :: Cannot find item by 45000
0403 10:45:08733 :: Cannot find item by 45000
 

 

Maybe because of your item_proto. I think converter sql to txt it's not good.

Edited by Metin2 Dev
Core X - External 2 Internal

"Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch"

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.