Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • Oto Avsız • 10 Temmuz 21:00 HEMEN TIKLA!
Hello all
I need help adding a fourth socket for armor and weapons in the perceptive system in order for armor and weapons to be displayed without problems.
I made several attempts, but I failed because I did not understand the code and how to amend it. I hope someone helps me and thank you
PythonChatModule.cpp
and
PythonPlayerModule.cpp
and
uitooltip.py
Hope someone help me please
I need help adding a fourth socket for armor and weapons in the perceptive system in order for armor and weapons to be displayed without problems.
I made several attempts, but I failed because I did not understand the code and how to amend it. I hope someone helps me and thank you
PythonChatModule.cpp
Kod:
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() < 6)
return Py_BuildValue("s", "");
CItemData * pItemData = NULL;
if (CItemManager::Instance().GetItemDataPointer(htoi(results[1].c_str()), &pItemData))
{
char buf[1024] = { 0 };
#ifdef ENABLE_CHANGELOOK_SYSTEM
char itemlink[256 + 12];
#else
char itemlink[256];
#endif
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()));
#ifdef ENABLE_CHANGELOOK_SYSTEM
if (results.size() >= 9)
#else
if (results.size() >= 8)
#endif
{
#ifdef ENABLE_CHANGELOOK_SYSTEM
for (int i = 7; i < results.size(); i += 2)
#else
for (int i = 6; i < results.size(); i += 2)
#endif
{
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", "");
}
and
PythonPlayerModule.cpp
Kod:
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 + 12];
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->transmutation);
for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
{
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);
}
and
uitooltip.py
Kod:
class HyperlinkItemToolTip(ItemToolTip):
def __init__(self):
ItemToolTip.__init__(self, isPickable=True)
def SetHyperlinkItem(self, tokens):
minTokenCount = 3 + player.METIN_SOCKET_MAX_NUM
if app.ENABLE_CHANGELOOK_SYSTEM:
minTokenCount += 1
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:]
transmutation = 0
if app.ENABLE_CHANGELOOK_SYSTEM:
rests = tokens[7:]
cnv = [int(cnv, 16) for cnv in tokens[6:7]]
transmutation = int(cnv[0])
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()
if app.ENABLE_CHANGELOOK_SYSTEM:
if not transmutation:
self.AddItemData(itemVnum, metinSlot, attrSlot)
else:
self.AddItemData(itemVnum, metinSlot, attrSlot, 0, 0, player.INVENTORY, -1, transmutation)
else:
self.AddItemData(itemVnum, metinSlot, attrSlot)
ItemToolTip.OnUpdate(self)
def OnUpdate(self):
pass
def OnMouseLeftButtonDown(self):
self.Hide()
Hope someone help me please