Jump to content

Problem shash absorcion bonus in chat


Recommended Posts

  • Premium

Hello Metin2dev,

 

 

I have little problem that i was trying to fix but i didn`t find the way

 

Please look this Gif  i absob the weapon bonus in shash but in inventory i showing correct bonuses of my weapon 

 

if i do Ctrl+ click to show in a global chat or in PM is show other Bonuses

 

https://metin2.download/picture/47065SP4b2AlYaln0y8ZnXUyLwEl7OUm/.gif

 

Please help :)

Edited by Metin2 Dev
Core X - External 2 Internal

" Don`t pretend things change if you always do the same thing"

"Don`t give up on a dream for how long it will take, time will pass the same"

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Honorable Member

Your hyperlink tokens are messed up, it looks like they’re not in order.
Can you show us:

  • "playerGetItemLink" from UserInterface/PythonPlayerModule.cpp
  • HyperlinkItemToolTip class from root/uiToolTip.py

 

Additional information:

  • Do you use 5 sockets? "METIN_SOCKET_MAX_NUM"
  • Do you have change look system implemented?
Edited by Owsap
Link to comment
Share on other sites

  • Premium
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))
	{
#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",
				pPlayerItem->vnum, pPlayerItem->flags,
				pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2]);
#ifdef ENABLE_CHANGELOOK_SYSTEM
		len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x", pPlayerItem->transmutation);
#endif
		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

 

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, 1)
				else:
					self.AddItemData(itemVnum, metinSlot, attrSlot, 1, 0, 0, player.INVENTORY, -1, transmutation)
			else:
				self.AddItemData(itemVnum, metinSlot, attrSlot, 1)#try
			ItemToolTip.OnUpdate(self)

	def OnUpdate(self):
		pass

	def OnMouseLeftButtonDown(self):
		self.Hide()

 

Yes i use change look system

" Don`t pretend things change if you always do the same thing"

"Don`t give up on a dream for how long it will take, time will pass the same"

Link to comment
Share on other sites

  • Honorable Member

Give this a try,

 

root/uiToolTip.py

Spoiler

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 - 1 if app.ENABLE_CHANGELOOK_SYSTEM else minTokenCount) and len(tokens) <= maxTokenCount:
			head, vnum, flag = tokens[:3]
			itemVnum = int(vnum, 16)
			metinSlot = [int(metin, 16) for metin in tokens[3:6]]

			if app.ENABLE_CHANGELOOK_SYSTEM:
				changelookvnum = int(tokens[6], 16)
				rests = tokens[7:]
			else:
				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()
			if app.ENABLE_CHANGELOOK_SYSTEM:
				if not changelookvnum:
					self.AddItemData(itemVnum, metinSlot, attrSlot, 1)
				else:
					self.AddItemData(itemVnum, metinSlot, attrSlot, 1, 0, 0, player.INVENTORY, -1, changelookvnum)
			else:
				self.AddItemData(itemVnum, metinSlot, attrSlot, 1)

			ItemToolTip.OnUpdate(self)

	def OnUpdate(self):
		pass

	def OnMouseLeftButtonDown(self):
		self.Hide()

 

 

Edited by Owsap
Link to comment
Share on other sites

  • Premium
0526 23:53:25663 :: Traceback (most recent call last):

0526 23:53:25663 ::   File "game.py", line 1802, in OnMouseLeftButtonUp

0526 23:53:25663 ::   File "interfaceModule.py", line 462, in MakeHyperlinkTooltip

0526 23:53:25663 ::   File "uiToolTip.py", line 2549, in SetHyperlinkItem

0526 23:53:25663 :: NameError
0526 23:53:25663 :: : 
0526 23:53:25663 :: global name 'transmutation' is not defined

When i try to click in chat  https://metin2.download/picture/m6iaJxZwBitV23oXZEBzO32A7n8Y9KWu/.png

 

 

Sorry but i hate python always fucked up 

Edited by Metin2 Dev
Core X - External 2 Internal

" Don`t pretend things change if you always do the same thing"

"Don`t give up on a dream for how long it will take, time will pass the same"

Link to comment
Share on other sites

  • Honorable Member
1 minute ago, Arkane2 said:

0526 23:53:25663 :: Traceback (most recent call last): 0526 23:53:25663 ::   File "game.py", line 1802, in OnMouseLeftButtonUp 0526 23:53:25663 ::   File "interfaceModule.py", line 462, in MakeHyperlinkTooltip 0526 23:53:25663 ::   File "uiToolTip.py", line 2549, in SetHyperlinkItem 0526 23:53:25663 :: NameError 0526 23:53:25663 :: :  0526 23:53:25663 :: global name 'transmutation' is not defined


0526 23:53:25663 :: Traceback (most recent call last):

0526 23:53:25663 ::   File "game.py", line 1802, in OnMouseLeftButtonUp

0526 23:53:25663 ::   File "interfaceModule.py", line 462, in MakeHyperlinkTooltip

0526 23:53:25663 ::   File "uiToolTip.py", line 2549, in SetHyperlinkItem

0526 23:53:25663 :: NameError
0526 23:53:25663 :: : 
0526 23:53:25663 :: global name 'transmutation' is not defined

When i try to click in chat  https://metin2.download/picture/m6iaJxZwBitV23oXZEBzO32A7n8Y9KWu/.png

Check again, I have updated it.

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

  • Premium

Still fucked up :v 

Showing the bonuses wrong way 

 

https://metin2.download/picture/HnbkI5PVZSFCw1iRn8T7xDtoV6F6Jb9d/.gif

 

The problem still because when u absorb the bonuses of any item weapon or armour 

 

in invetory u look good but in "General chat"  showing duplicates bonuses if weapon has "valor de ataque+1 "

you use the shash in chat ctrl+click u will see "valor de ataque+1" x 2

@owsap

 can u read Discord  please?

 

Edited by Metin2 Dev
Core X - External 2 Internal

" Don`t pretend things change if you always do the same thing"

"Don`t give up on a dream for how long it will take, time will pass the same"

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.