Jump to content

Custom - Slot Effect System


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

 

Hello, im here today releasing my version of slot effect system. Is not the same as the official looks like but in the future i will update this to look the same.

Screenshot to see how it looks like.

Spoiler

ZgBtvp7.png

Everything in this system was made by me.

Tutorial:

Go to UserInterface > PythonPlayer.cpp

Search for :

 

void CPythonPlayer::SetItemData(TItemPos Cell, const TItemData & c_rkItemInst)

 

Add in  the end of the funcion:

 

PyCallClassMemberFunc(m_ppyGameWindow, "OnNewItem", Py_BuildValue("(i)", Cell.cell));

 

Compile It.

Go to root > constInfo.py

Add this somewhere:

 

NEWITEMS = []

 

Save it.

Go to root > game.py

Add this function:

 

def OnNewItem(self, cell):
	if not cell in constInfo.NEWITEMS:
		constInfo.NEWITEMS.append(cell)

 

Save It.

Go to root > uiinventory.py

Search for :

 

def RefreshBagSlotWindow(self):

 

Add this before this: (if 0 == itemCount:) :

 

if itemCount == 0 and slotNumber in constInfo.NEWITEMS:
	constInfo.NEWITEMS.remove(slotNumber)
 

Add this under this: (setItemVNum(i, itemVnum, itemCount)) :

 

self.wndItem.EnableCoverButton(i)        
 if slotNumber in constInfo.NEWITEMS:
	self.wndItem.SetCoverButton(i, "d:/ymir work/ui/game/quest/slot_button_00.sub",\
																		 "d:/ymir work/ui/game/quest/slot_button_00.sub",\
																		"d:/ymir work/ui/game/quest/slot_button_00.sub",\
																		"d:/ymir work/ui/new_icon.tga", FALSE, FALSE)
	 self.wndItem.DisableCoverButton(i)

 

Search for:

 

def OverInItem(self, overSlotPos):

 Add under:

 

slotPos = overSlotPos

 

Add in the end:

 

if overSlotPos in constInfo.NEWITEMS:
	self.wndItem.EnableCoverButton(slotPos)    
	constInfo.NEWITEMS.remove(overSlotPos)

 

Save It.

Finally go to ymirwork/ui and add this file:

This is the hidden content, please

Pack root and etc.

Have fun :)

 

This may not be the most optimized way to do this system, but at least you have a way. In the future i will post more updates such as a more optimized versions and with official effects.

If you find any bugs please post it.

#UPDATE

Spoiler

 

I found a little bug that is if you move the item too quickly the item will count as new. Thats because normally if you do at normal speed you should be with your mouse over in item when it is attach to inventory so the code will remove it. But when you are at a faster sometimes you wont call mouse over in function.

Solution:

Goto uiinventory.py

Search for:



self.wndCostume = None


Add under:


self.movedSlot = -1


search for:


itemCount = getItemCount(slotNumber)


 add under:


if self.movedSlot in constInfo.NEWITEMS:
	 constInfo.NEWITEMS.remove(self.movedSlot)


 search for:

def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):


 

add under:



self.movedSlot = dstSlotPos


 

 

 

 

Kind Regards,

Frozen

 

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

Great job! Thank you for sharing


I tested and i found a weird bug, when you have more than 2 inventory's, it seems a little bug, because when you move to another slot appear the icon saying "new" again and when you put the mouse under the item the "new" dont disappear, you need to open another inventory and open again the inventory were you have the item and then disappear "new" ...
Sorry for my bad english!
 
You have my like for sharing :lol:
Link to comment
Share on other sites

  • Bot
13 minutes ago, WhoIsNice said:

Great job! Thank you for sharing


I tested and i found a weird bug, when you have more than 2 inventory's, it seems a little bug, because when you move to another slot appear the icon saying "new" again and when you put the mouse under the item the "new" dont disappear, you need to open another inventory and open again the inventory were you have the item and then disappear "new" ...
Sorry for my bad english!
 
You have my like for sharing :lol:

He says the truth, i checked it..

can you fix that pls? :D

english_banner.gif

Link to comment
Share on other sites

54 minutes ago, WhoIsNice said:

Great job! Thank you for sharing


I tested and i found a weird bug, when you have more than 2 inventory's, it seems a little bug, because when you move to another slot appear the icon saying "new" again and when you put the mouse under the item the "new" dont disappear, you need to open another inventory and open again the inventory were you have the item and then disappear "new" ...
Sorry for my bad english!
 
You have my like for sharing :lol:

Oh i didnt notice that! Thanks for detecting that bug i will see what i can do.

Kind Regards 

7 minutes ago, miguelmig said:

This will work terribly if a player decides to open 2 clients on the same machine at the same time

What?? Why you say that?

Link to comment
Share on other sites

Just now, Frozen said:

Oh i didnt notice that! Thanks for detecting that bug i will see what i can do.

Kind Regards 

What?? Why you say that?

Well, it's quite common for python systems to use constinfo.py to store data, but that usually causes to things to stop working when a player has multiple clients open, since it appears that the constinfo data is shared between clients, or so it was in the old clients, but I'm pretty sure that it will still happen, give it a try

Link to comment
Share on other sites

8 minutes ago, miguelmig said:

Well, it's quite common for python systems to use constinfo.py to store data, but that usually causes to things to stop working when a player has multiple clients open, since it appears that the constinfo data is shared between clients, or so it was in the old clients, but I'm pretty sure that it will still happen, give it a try

Thats incorrect, every time you open client, it gets the constInfo varables and they are set in the client you are in. So you can open as many clients as you want it will have the default constInfo variables and not the ones in the other client open. Every time you set a variable in constInfo is like you are defining in your code, so the storage work like a variable not has a file.

I dont know if you understand, sorry for my bad english,

 

Link to comment
Share on other sites

#EDIT

Bug in second inventory solution:

Search for:

 

def OverInItem(self, overSlotPos):

 

add under:

 

slotPos = overSlotPos

 

replace with this in the end of the function:

 

if overSlotPos in constInfo.NEWITEMS:
	            self.wndItem.EnableCoverButton(slotPos)    
	            constInfo.NEWITEMS.remove(overSlotPos)

 
  • Love 1
Link to comment
Share on other sites

  • Bot
24 minutes ago, Frozen said:

#EDIT

Bug in second inventory solution:

Search for:

 


def OverInItem(self, overSlotPos):


 

add under:

 


slotPos = overSlotPos


 

replace with this in the end of the function:

 


if overSlotPos in constInfo.NEWITEMS:
	            self.wndItem.EnableCoverButton(slotPos)    
	            constInfo.NEWITEMS.remove(overSlotPos)


 

I tried the fix, but when you do that item in the 2./3./4. inventory page, it gets that "New" Tag again :/

english_banner.gif

Link to comment
Share on other sites

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.