Yardım item yansıtma 7. efsun sorunu

  • Konuyu açan Konuyu açan zibaoyunpvp
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 12
  • Gösterim Gösterim 129
Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

zibaoyunpvp

Metin2 Files Hizmetleri
MT Üye
Mesaj
372
Çözümler
8
Beğeni
237
Puan
789
Ticaret Puanı
0

7. Efsun (Attribute) Hyperlink'te Görünmüyor (Tooltip Sorunu)​


Merhaba arkadaşlar,
item üzerinde efsun düzgün şekilde gözüküyor ama chatte iteme tıklayınca açılan hyperlink tooltip kısmında sadece 6 efsun görünüyor. 7. efsun hiç gözükmüyor.
Ek olarak 3 taş soketini 4 yaptım o görünmüyordu düzenlemesini yaptım sorun yok ama efsunlarda 6. efsun görünüyor 7 yok

pythonplayermodule.cpp:
Genişlet Daralt Kopyala
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:%x:%x",
                                    pPlayerItem->vnum, pPlayerItem->flags,
                                    pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2] , pPlayerItem->alSockets[3],  pPlayerItem->alSockets[4],  pPlayerItem->alSockets[5]);
  
                    for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
                            if (pPlayerItem->aAttr[i].bType != 0)
                            {
                                    len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d",
                                                    pPlayerItem->aAttr[i].bType, pPlayerItem->aAttr[i].sValue);
                                    isAttr = true;
                            }
  
  
                    if( GetDefaultCodePage() == CP_ARABIC ) {
                            if (isAttr)
                                    //"item:锅龋:敲贰弊:家南0:家南1:家南2"
                                    snprintf(buf, sizeof(buf), " |h|r[%s]|cffffc700|H%s|h", pItemData->GetName(), itemlink);
                            else
                                    snprintf(buf, sizeof(buf), " |h|r[%s]|cfff1e6c0|H%s|h", pItemData->GetName(), itemlink);
                    } else {
                            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());
                    }
            }
            else
                    buf[0] = '\0';
  
            return Py_BuildValue("s", buf);
 }

uitooltip.py:
Genişlet Daralt Kopyala
class HyperlinkItemToolTip(ItemToolTip):
    def __init__(self):
        ItemToolTip.__init__(self, isPickable=True)

    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:9]]

            rests = tokens[9:]
            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)

    def OnUpdate(self):
        pass

    def OnMouseLeftButtonDown(self):
        self.Hide()
 

7. Efsun (Attribute) Hyperlink'te Görünmüyor (Tooltip Sorunu)​


Merhaba arkadaşlar,
item üzerinde efsun düzgün şekilde gözüküyor ama chatte iteme tıklayınca açılan hyperlink tooltip kısmında sadece 6 efsun görünüyor. 7. efsun hiç gözükmüyor.
Ek olarak 3 taş soketini 4 yaptım o görünmüyordu düzenlemesini yaptım sorun yok ama efsunlarda 6. efsun görünüyor 7 yok

pythonplayermodule.cpp:
Genişlet Daralt Kopyala
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:%x:%x",
                                    pPlayerItem->vnum, pPlayerItem->flags,
                                    pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2] , pPlayerItem->alSockets[3],  pPlayerItem->alSockets[4],  pPlayerItem->alSockets[5]);
 
                    for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
                            if (pPlayerItem->aAttr[i].bType != 0)
                            {
                                    len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d",
                                                    pPlayerItem->aAttr[i].bType, pPlayerItem->aAttr[i].sValue);
                                    isAttr = true;
                            }
 
 
                    if( GetDefaultCodePage() == CP_ARABIC ) {
                            if (isAttr)
                                    //"item:锅龋:敲贰弊:家南0:家南1:家南2"
                                    snprintf(buf, sizeof(buf), " |h|r[%s]|cffffc700|H%s|h", pItemData->GetName(), itemlink);
                            else
                                    snprintf(buf, sizeof(buf), " |h|r[%s]|cfff1e6c0|H%s|h", pItemData->GetName(), itemlink);
                    } else {
                            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());
                    }
            }
            else
                    buf[0] = '\0';
 
            return Py_BuildValue("s", buf);
 }

uitooltip.py:
Genişlet Daralt Kopyala
class HyperlinkItemToolTip(ItemToolTip):
    def __init__(self):
        ItemToolTip.__init__(self, isPickable=True)

    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:9]]

            rests = tokens[9:]
            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)

    def OnUpdate(self):
        pass

    def OnMouseLeftButtonDown(self):
        self.Hide()
Hocam şu değeri kontrol eder misin : ATTRIBUTE_SLOT_MAX_NUM buradaki değer nedir
 
Hocam şu değeri kontrol eder misin : ATTRIBUTE_SLOT_MAX_NUM buradaki değer nedir
gametype.h:
Genişlet Daralt Kopyala
enum
{
    ITEM_SOCKET_SLOT_MAX_NUM = 4,
    // refactored attribute slot begin
    ITEM_ATTRIBUTE_SLOT_NORM_NUM    = 5,
    ITEM_ATTRIBUTE_SLOT_RARE_NUM    = 2,

    ITEM_ATTRIBUTE_SLOT_NORM_START    = 0,
    ITEM_ATTRIBUTE_SLOT_NORM_END    = ITEM_ATTRIBUTE_SLOT_NORM_START + ITEM_ATTRIBUTE_SLOT_NORM_NUM,

    ITEM_ATTRIBUTE_SLOT_RARE_START    = ITEM_ATTRIBUTE_SLOT_NORM_END,
    ITEM_ATTRIBUTE_SLOT_RARE_END    = ITEM_ATTRIBUTE_SLOT_RARE_START + ITEM_ATTRIBUTE_SLOT_RARE_NUM,

    ITEM_ATTRIBUTE_SLOT_MAX_NUM        = ITEM_ATTRIBUTE_SLOT_RARE_END, // 7
    // refactored attribute slot end
};
 
.:
Genişlet Daralt Kopyala
                    len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x:%x:%x:%x:%x:%x:%x",
                                    pPlayerItem->vnum, pPlayerItem->flags,
                                    pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2] , pPlayerItem->alSockets[3],  pPlayerItem->alSockets[4],  pPlayerItem->alSockets[5])

Bu ve
.:
Genişlet Daralt Kopyala
    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:9]]

            rests = tokens[9:]

Bu kısımda düzenleme yaptım daha önce pPlayerItem->alSockets[6], ekledim ,
for metin in tokens[3:10]]

rests = tokens[10:] // yaptım ama olmadı
 
Toplamda 8 efsun mu var sende?

şu şekilde değiştirip dene

uitooltip.py:
Genişlet Daralt Kopyala
class HyperlinkItemToolTip(ItemToolTip):
    def __init__(self):
        ItemToolTip.__init__(self, isPickable=True)

    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:6]]

            rests = tokens[6:]
            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)

    def OnUpdate(self):
        pass

    def OnMouseLeftButtonDown(self):
        self.Hide()
 
Toplamda 8 efsun mu var sende?

şu şekilde değiştirip dene

uitooltip.py:
Genişlet Daralt Kopyala
class HyperlinkItemToolTip(ItemToolTip):
    def __init__(self):
        ItemToolTip.__init__(self, isPickable=True)

    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:6]]

            rests = tokens[6:]
            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)

    def OnUpdate(self):
        pass

    def OnMouseLeftButtonDown(self):
        self.Hide()
7 efsun var 6. efsunda görünüyor 7. efsunu attığımda görünmüyor
 
Toplamda 8 efsun mu var sende?

şu şekilde değiştirip dene

uitooltip.py:
Genişlet Daralt Kopyala
class HyperlinkItemToolTip(ItemToolTip):
    def __init__(self):
        ItemToolTip.__init__(self, isPickable=True)

    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:6]]

            rests = tokens[6:]
            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)

    def OnUpdate(self):
        pass

    def OnMouseLeftButtonDown(self):
        self.Hide()
bu şekilde hiç bir yansıtma görünmüyor

syser.txt

syser:
Genişlet Daralt Kopyala
0802 12:40:39784 ::   File "game.py", line 1377, in OnMouseLeftButtonUp

0802 12:40:39784 ::   File "interfaceModule.py", line 573, in MakeHyperlinkTooltip

0802 12:40:39784 ::   File "uiToolTip.py", line 2318, in SetHyperlinkItem

0802 12:40:39784 :: ValueError
0802 12:40:39784 :: :
0802 12:40:39784 :: invalid literal for int() with base 10: '1b4e2001'
0802 12:40:39784 ::
 
bu şekilde hiç bir yansıtma görünmüyor
bu şekilde değiştirip dener misin?

uitooltip.py:
Genişlet Daralt Kopyala
    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:9]]
            rests = tokens[9:]
            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)

pythonchatmodule.cpp:
Genişlet Daralt Kopyala
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:socket3:socket4:socket5
    if (0 == results[0].compare("item"))
    {
        if (results.size() < 9)
            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:%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()),
                    htoi(results[7].c_str()),
                    htoi(results[8].c_str()));
            if (results.size() >= 11)
            {
                for (int i = 9; i < results.size(); i += 2)
                {
                    len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d",
                            htoi(results[i].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", "");
}

pythonplayermodule.cpp:
Genişlet Daralt Kopyala
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:%x:%x",
                pPlayerItem->vnum, pPlayerItem->flags,
                pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2] , pPlayerItem->alSockets[3], pPlayerItem->alSockets[4], pPlayerItem->alSockets[5]);
        for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
            if (pPlayerItem->aAttr[i].bType != 0)
            {
                len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d",
                        pPlayerItem->aAttr[i].bType, pPlayerItem->aAttr[i].sValue);
                isAttr = true;
            }
        if( GetDefaultCodePage() == CP_ARABIC ) {
            if (isAttr)
                //"item:¹øÈ£:Ç÷¡±×:¼ÒÄÏ0:¼ÒÄÏ1:¼ÒÄÏ2"
                snprintf(buf, sizeof(buf), " |h|r[%s]|cffffc700|H%s|h", pItemData->GetName(), itemlink);
            else
                snprintf(buf, sizeof(buf), " |h|r[%s]|cfff1e6c0|H%s|h", pItemData->GetName(), itemlink);
        } else {
            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());
        }
    }
    else
        buf[0] = '\0';
    return Py_BuildValue("s", buf);
}
 
bu şekilde değiştirip dener misin?

uitooltip.py:
Genişlet Daralt Kopyala
    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:9]]
            rests = tokens[9:]
            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)

pythonchatmodule.cpp:
Genişlet Daralt Kopyala
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:socket3:socket4:socket5
    if (0 == results[0].compare("item"))
    {
        if (results.size() < 9)
            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:%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()),
                    htoi(results[7].c_str()),
                    htoi(results[8].c_str()));
            if (results.size() >= 11)
            {
                for (int i = 9; i < results.size(); i += 2)
                {
                    len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d",
                            htoi(results[i].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", "");
}

pythonplayermodule.cpp:
Genişlet Daralt Kopyala
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:%x:%x",
                pPlayerItem->vnum, pPlayerItem->flags,
                pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2] , pPlayerItem->alSockets[3], pPlayerItem->alSockets[4], pPlayerItem->alSockets[5]);
        for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
            if (pPlayerItem->aAttr[i].bType != 0)
            {
                len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d",
                        pPlayerItem->aAttr[i].bType, pPlayerItem->aAttr[i].sValue);
                isAttr = true;
            }
        if( GetDefaultCodePage() == CP_ARABIC ) {
            if (isAttr)
                //"item:¹øÈ£:Ç÷¡±×:¼ÒÄÏ0:¼ÒÄÏ1:¼ÒÄÏ2"
                snprintf(buf, sizeof(buf), " |h|r[%s]|cffffc700|H%s|h", pItemData->GetName(), itemlink);
            else
                snprintf(buf, sizeof(buf), " |h|r[%s]|cfff1e6c0|H%s|h", pItemData->GetName(), itemlink);
        } else {
            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());
        }
    }
    else
        buf[0] = '\0';
    return Py_BuildValue("s", buf);
}
malesef düzelmedi. 6. efsun varken görünüyor 7 de yok
 
Geri
Üst