Jump to content
  • Register Now

    Sign up and take advantage of the features of our community! Some forums are only accessible to our members!

  • 0

Problem shash absorcion bonus in chat


SukH

Question

  • VIP

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://gyazo.com/74f8a21da50272ee950b32db94819706

 

Please help :)

" 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 post

6 answers to this question

Recommended Posts

  • 0
  • VIP
Posted (edited)

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 (see edit history)
Link to post
  • 0
  • VIP
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 post
  • 0
  • VIP
Posted (edited)

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 (see edit history)
Link to post
  • 0
  • VIP
Posted (edited)
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://gyazo.com/762274377cb42d787f3371b3b4881fb5

 

 

Sorry but i hate python always fucked up 

Edited by Arkane2 (see edit history)

" 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 post
  • 0
  • VIP
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://gyazo.com/762274377cb42d787f3371b3b4881fb5

Check again, I have updated it.

  • Love 1
Link to post
  • 0
  • VIP

Still fucked up :v 

Showing the bonuses wrong way 

 

https://gyazo.com/589b9d69ab8c2d609191541518867854

 

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?

 

" 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 post

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.