Jump to content

Little BUG Inventory with COSTUME BONUS


Recommended Posts

  • Developer

No man , 
I just read the python code responsible for the effect in question.
 

	def OverInItem(self, overSlotPos):
		overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
		self.wndItem.SetUsableItem(False)

		if mouseModule.mouseController.isAttached():
			attachedItemType = mouseModule.mouseController.GetAttachedType()
			if player.SLOT_TYPE_INVENTORY == attachedItemType:

				attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
				attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
				
				if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
					self.wndItem.SetUsableItem(True)
					self.ShowToolTip(overSlotPos)
					return
				
		self.ShowToolTip(overSlotPos)

 

 

if self.__CanUseSrcItemToDstItem  -> green image on item

that methods :

	def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
		"대상 아이템에 사용할 수 있는가?"

		if srcSlotPos == dstSlotPos:
			return False

		if item.IsRefineScroll(srcItemVNum):
			if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
				return True
		elif item.IsMetin(srcItemVNum):
			if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
				return True
		elif item.IsDetachScroll(srcItemVNum):
			if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
				return True
		elif item.IsKey(srcItemVNum):
			if player.CanUnlock(srcItemVNum, dstSlotPos):
				return True

		elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
			return True

		else:
			useType=item.GetUseType(srcItemVNum)

			if "USE_CLEAN_SOCKET" == useType:
				if self.__CanCleanBrokenMetinStone(dstSlotPos):
					return True
			elif "USE_CHANGE_ATTRIBUTE" == useType:
				if self.__CanChangeItemAttrList(dstSlotPos):
					return True
			elif "USE_ADD_ATTRIBUTE" == useType:
				if self.__CanAddItemAttr(dstSlotPos):
					return True
			elif "USE_ADD_ATTRIBUTE2" == useType:
				if self.__CanAddItemAttr(dstSlotPos):
					return True
			elif "USE_ADD_ACCESSORY_SOCKET" == useType:
				if self.__CanAddAccessorySocket(dstSlotPos):
					return True
			elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:								
				if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
					return True;
			elif "USE_PUT_INTO_BELT_SOCKET" == useType:								
				dstItemVNum = player.GetItemIndex(dstSlotPos)
				item.SelectItem(dstItemVNum)
				if item.ITEM_TYPE_BELT == item.GetItemType():
					return True

		return False

 

 

so the problem is probably the type/flags  of item assigned (into proto)  to the item in question.

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

14 hours ago, riku11 said:

No man , 
I just read the python code responsible for the effect in question.
 


	def OverInItem(self, overSlotPos):
		overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
		self.wndItem.SetUsableItem(False)

		if mouseModule.mouseController.isAttached():
			attachedItemType = mouseModule.mouseController.GetAttachedType()
			if player.SLOT_TYPE_INVENTORY == attachedItemType:

				attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
				attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
				
				if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
					self.wndItem.SetUsableItem(True)
					self.ShowToolTip(overSlotPos)
					return
				
		self.ShowToolTip(overSlotPos)

 

 

if self.__CanUseSrcItemToDstItem  -> green image on item

that methods :


	def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
		"대상 아이템에 사용할 수 있는가?"

		if srcSlotPos == dstSlotPos:
			return False

		if item.IsRefineScroll(srcItemVNum):
			if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
				return True
		elif item.IsMetin(srcItemVNum):
			if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
				return True
		elif item.IsDetachScroll(srcItemVNum):
			if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
				return True
		elif item.IsKey(srcItemVNum):
			if player.CanUnlock(srcItemVNum, dstSlotPos):
				return True

		elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
			return True

		else:
			useType=item.GetUseType(srcItemVNum)

			if "USE_CLEAN_SOCKET" == useType:
				if self.__CanCleanBrokenMetinStone(dstSlotPos):
					return True
			elif "USE_CHANGE_ATTRIBUTE" == useType:
				if self.__CanChangeItemAttrList(dstSlotPos):
					return True
			elif "USE_ADD_ATTRIBUTE" == useType:
				if self.__CanAddItemAttr(dstSlotPos):
					return True
			elif "USE_ADD_ATTRIBUTE2" == useType:
				if self.__CanAddItemAttr(dstSlotPos):
					return True
			elif "USE_ADD_ACCESSORY_SOCKET" == useType:
				if self.__CanAddAccessorySocket(dstSlotPos):
					return True
			elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:								
				if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
					return True;
			elif "USE_PUT_INTO_BELT_SOCKET" == useType:								
				dstItemVNum = player.GetItemIndex(dstSlotPos)
				item.SelectItem(dstItemVNum)
				if item.ITEM_TYPE_BELT == item.GetItemType():
					return True

		return False

 

 

so the problem is probably the type/flags  of item assigned (into proto)  to the item in question.

My OverInItem is this 

 

Spoiler

    def OverInItem(self, overSlotPos):
        if app.ENABLE_HIGHLIGHT_SYSTEM:
            stat = 0
            slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
            itemVnum = player.GetItemIndex(slotNumber)
            if constInfo.IS_AUTO_POTION(itemVnum):
                metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
                if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
                    slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
                
                isActivated = 0 != metinSocket[0]
                if isActivated:
                    stat = 1
            
            if not stat:
                if slotNumber in self.liHighlightedItems:
                    self.wndItem.DeactivateSlot(overSlotPos)
                    try:
                        if app.ENABLE_SASH_SYSTEM:
                            if not slotNumber in self.listAttachedSashs:
                                self.liHighlightedItems.remove(slotNumber)
                        else:
                            self.liHighlightedItems.remove(slotNumber)
                    except:
                        pass
        overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
        self.wndItem.SetUsableItem(FALSE)

        if mouseModule.mouseController.isAttached():
            attachedItemType = mouseModule.mouseController.GetAttachedType()
            if player.SLOT_TYPE_INVENTORY == attachedItemType:

                attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
                attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
                
                if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
                    self.wndItem.SetUsableItem(TRUE)
                    self.ShowToolTip(overSlotPos)
                    return
                
        self.ShowToolTip(overSlotPos)

 

Link to comment
Share on other sites

  • Developer

I'm not a guesser, and so having not way to see what you did , I can not tell you the fix that's best to do....
I can tell u a "dirty" methods to resolve the problem......

 

change this:


 if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):

 

with this :

 

 if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos) or attachedItemVNum == ID_OF_YOUR_WRONG_ITEM:

 

where ID_OF_YOUR_WRONG_ITEM is a number (vnum of your problematic item)

 

this is a shit method man , but probably it works....

If you want to fix with a much cleaner method , post everything we need.

 

edited with correct if statement , sorry

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

2 hours ago, riku11 said:

I'm not a guesser, and so having not way to see what you did , I can not tell you the fix that's best to do....
I can tell u a "dirty" methods to resolve the problem......

 

change this:


 if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):

 

with this :

 

 if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos) or attachedItemVNum == ID_OF_YOUR_WRONG_ITEM:

 

where ID_OF_YOUR_WRONG_ITEM is a number (vnum of your problematic item)

 

this is a shit method man , but probably it works....

If you want to fix with a much cleaner method , post everything we need.

 

edited with correct if statement , sorry

not work ... 

Link to comment
Share on other sites

5 minutes ago, riku11 said:

could you post the line you changed?

add this

Spoiler

                if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
                    if attachedItemVNum == 70063 or attachedItemVNum == 70064:
                        self.wndItem.SetUsableItem(TRUE)
                        self.ShowToolTip(overSlotPos)
                        return

 

Link to comment
Share on other sites

  • Developer
Just now, tristano98 said:

add this

  Hide contents

                if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
                    if attachedItemVNum == 70063 or attachedItemVNum == 70064:
                        self.wndItem.SetUsableItem(TRUE)
                        self.ShowToolTip(overSlotPos)
                        return

 

Is not the same man ..

             if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos) or attachedItemVNum == 70063 or attachedItemVNum == 70064:
                    self.wndItem.SetUsableItem(TRUE)
                    self.ShowToolTip(overSlotPos)
                    return

that's right 

 

not copy paste by this code because the web page have not "tab"

write it like that without paste it

  • Love 1

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

9 minutes ago, riku11 said:

Is not the same man ..


             if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos) or attachedItemVNum == 70063 or attachedItemVNum == 70064:
                    self.wndItem.SetUsableItem(TRUE)
                    self.ShowToolTip(overSlotPos)
                    return

that's right 

 

not copy paste by this code because the web page have not "tab"

write it like that without paste it

SOLVED <3

Link to comment
Share on other sites

  • Premium

its not better to add something like itemtype = costume?

 

something like this but a better approach would be separate the item type with a new COSTUME_WITH_BONUS type

if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos) or attachedItemVNum.GetItemType() == ITEM_TYPE_COSTUME:
  self.wndItem.SetUsableItem(TRUE)
  self.ShowToolTip(overSlotPos) 
  return
Link to comment
Share on other sites

  • 2 weeks later...
  • Developer
On 27/9/2017 at 1:05 PM, Fleon said:

its not better to add something like itemtype = costume?

 

something like this but a better approach would be separate the item type with a new COSTUME_WITH_BONUS type


if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos) or attachedItemVNum.GetItemType() == ITEM_TYPE_COSTUME:
  self.wndItem.SetUsableItem(TRUE)
  self.ShowToolTip(overSlotPos) 
  return

 

attachedItemVnum is the costume change bonuses is not costume .

My youtube channel  on which you can see my works here

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



  • Similar Content

  • Activity

    1. 13

      Metin2 Closed Beta Content (2003-2004)

    2. 25

      [SRC] Metin2 on LINUX - The Old Metin2 Project

    3. 2

      United/Club/Midgard serverfiles?

    4. 13

      Metin2 Closed Beta Content (2003-2004)

    5. 13

      Metin2 Closed Beta Content (2003-2004)

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.