Jump to content

python effect in inventor bug


Recommended Posts

have problem with fast run effect in inventor: https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

i think problem in uiinventory in refreshbugslot, how can fix that?

function def refreshbugslot

 

def RefreshBagSlotWindow(self):
		getItemVNum=player.GetItemIndex
		getItemCount=player.GetItemCount
		setItemVNum=self.wndItem.SetItemSlot
		if app.ENABLE_INVENTORY_PROTECT_SYSTEM:
			setLock=self.wndItem.SetLock

		for i in xrange(player.INVENTORY_PAGE_SIZE):
			slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)

			itemCount = getItemCount(slotNumber)
			if 0 == itemCount:
				self.wndItem.ClearSlot(i)
				continue
			elif 1 == itemCount:
				itemCount = 0

			itemVnum = getItemVNum(slotNumber)
			setItemVNum(i, itemVnum, itemCount)
			

			if app.ENABLE_INVENTORY_PROTECT_SYSTEM:
				if constInfo.InventoryLocked():
					setLock(True, i)
				else:
					setLock(False, i)

			if app.ENABLE_CHANGE_LOOK_SYSTEM:
				GlobalSlot = self.__InventoryLocalSlotPosToGlobalSlotPos(i)

				if player.GetItemLook(GlobalSlot):
					self.wndItem.EnableSlotCoverImage(i)
				else:
					self.wndItem.DisableSlotCoverImage(i)

				if player.FindActivedChangeLookSlot(0) == GlobalSlot or player.FindActivedChangeLookSlot(1) == GlobalSlot:
					self.wndItem.ActivateChangeLookSlot(i)
				else:
					self.wndItem.DeactivateChangeLookSlot(i)

			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:
					slotNumber -= player.INVENTORY_PAGE_SIZE

				isActivated = 0 != metinSocket[0]
				if isActivated:
					self.wndItem.ActivateSlot(i)
					potionType = 0;
					if constInfo.IS_AUTO_POTION_HP(itemVnum):
						potionType = player.AUTO_POTION_TYPE_HP
					elif constInfo.IS_AUTO_POTION_SP(itemVnum):
						potionType = player.AUTO_POTION_TYPE_SP						
					
					usedAmount = int(metinSocket[1])
					totalAmount = int(metinSocket[2])					
					player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))

				else:
					self.wndItem.DeactivateSlot(slotNumber)

			elif app.ENABLE_HIGHLIGHT_SYSTEM:
				if slotNumber in self.listHighlightedSlot:
					self.wndItem.ActivateSlot(i)
			if app.ENABLE_SASH_SYSTEM:
				slotNumberChecked = 0
				if not constInfo.IS_AUTO_POTION(itemVnum):
					if app.ENABLE_HIGHLIGHT_SYSTEM:
						if not slotNumber in self.listHighlightedSlot:
							self.wndItem.DeactivateSlot(i)
					else:
						self.wndItem.DeactivateSlot(i)
				
				for j in xrange(sash.WINDOW_MAX_MATERIALS):
					(isHere, iCell) = sash.GetAttachedItem(j)
					if isHere:
						if iCell == slotNumber:
							self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
							if not slotNumber in self.listAttachedSashs:
								self.listAttachedSashs.append(slotNumber)
							
							slotNumberChecked = 1
					else:
						if slotNumber in self.listAttachedSashs and not slotNumberChecked:
							self.wndItem.DeactivateSlot(i)
							self.listAttachedSashs.remove(slotNumber)

		self.wndItem.RefreshSlot()

		if self.wndBelt:
			self.wndBelt.RefreshSlot()

function def OverInItem(self, overSlotPos):

 

def OverInItem(self, overSlotPos):
		if app.ENABLE_INVENTORY_PROTECT_SYSTEM:
			if constInfo.InventoryLocked():
				return
				
		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.listHighlightedSlot:
					self.wndItem.DeactivateSlot(overSlotPos)
					try:
						if app.ENABLE_SASH_SYSTEM:
							if not slotNumber in self.listAttachedSashs:
								self.listHighlightedSlot.remove(slotNumber)
						else:
							self.listHighlightedSlot.remove(slotNumber)
					except:
						pass		

		# overSlotPosGlobal = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
		overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
		self.wndItem.SetUsableItem(False)
		if app.ENABLE_SWAPITEM_SYSTEM:
			global SWAPITEM_STAT
			SWAPITEM_STAT = 1
			self.wndItem.SetSwapItem(False)
		
		if mouseModule.mouseController.isAttached():
			attachedItemType = mouseModule.mouseController.GetAttachedType()
			if player.SLOT_TYPE_INVENTORY == attachedItemType:
				
				attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
				attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
				
				if app.ENABLE_SWAPITEM_SYSTEM:
					item.SelectItem(player.GetItemIndex(attachedSlotPos))
					isItemType = item.GetItemType()
					if isItemType == item.ITEM_TYPE_ARMOR or isItemType == item.ITEM_TYPE_WEAPON or isItemType == item.ITEM_TYPE_COSTUME or isItemType == item.ITEM_TYPE_BELT or isItemType == item.ITEM_TYPE_RING:
						(width1, height1) = item.GetItemSize()
						itemSize = height1
						item.SelectItem(player.GetItemIndex(overSlotPos))
						(width2, height2) = item.GetItemSize()
						itemDestSize = height2
						if itemDestSize > itemSize:
							SWAPITEM_STAT = 0
							self.wndItem.SetSwapItem(FALSE)
						elif itemSize == itemDestSize:
							self.wndItem.SetSwapItem(TRUE)
						elif itemSize > itemDestSize:
							error = 0
							if itemDestSize == 1 and overSlotPos >= 40 and overSlotPos < 45 or itemDestSize == 1 and overSlotPos >= 85 and overSlotPos < 90 or itemDestSize == 1 and overSlotPos >= 130 and overSlotPos < 135 or itemDestSize == 1 and overSlotPos >= 175 and overSlotPos < 180:
								error = 1
							
							if itemDestSize == 1 and itemSize == 3 and overSlotPos >= 35 and overSlotPos < 40 or itemDestSize == 1 and itemSize == 3 and overSlotPos >= 80 and overSlotPos < 85 or itemDestSize == 1 and itemSize == 3 and overSlotPos >= 125 and overSlotPos < 130 or itemDestSize == 1 and itemSize == 3 and overSlotPos >= 170 and overSlotPos < 175:
								error = 1
							
							if itemDestSize == 2 and itemSize == 3 and overSlotPos >= 35 and overSlotPos < 40 or itemDestSize == 2 and itemSize == 3 and overSlotPos >= 80 and overSlotPos < 85 or itemDestSize == 2 and itemSize == 3 and overSlotPos >= 125 and overSlotPos < 130 or itemDestSize == 2 and itemSize == 3 and overSlotPos >= 170 and overSlotPos < 175:
								error = 1
							
							if error:
								SWAPITEM_STAT = 0
								self.wndItem.SetSwapItem(FALSE)
								self.ShowToolTip(attachedSlotPos)
								return
							
							if itemSize == 2 and itemDestSize == 1 or itemSize == 3 and itemDestSize == 2:
								if itemDestSize == 2:
									overSlotPosNew = overSlotPos + 10
								else:
									overSlotPosNew = overSlotPos + 5
								itemCount = player.GetItemCount(overSlotPosNew)
								if itemCount == 0:
									self.wndItem.SetSwapItem(TRUE)
								else:
									item.SelectItem(player.GetItemIndex(overSlotPosNew))
									(width3, height3) = item.GetItemSize()
									itemDest2Size = height3
									if itemDest2Size == 1:
										self.wndItem.SetSwapItem(TRUE)
									else:
										SWAPITEM_STAT = 0
										self.wndItem.SetSwapItem(FALSE)
							elif itemSize == 3 and itemDestSize == 1:
								overSlotPosNew = overSlotPos + 5
								itemCount = player.GetItemCount(overSlotPosNew)
								if itemCount == 0:
									overSlotPosNew = overSlotPos + 10
									itemCountNew = player.GetItemCount(overSlotPosNew)
									if itemCountNew == 0:
										self.wndItem.SetSwapItem(TRUE)
									else:
										item.SelectItem(player.GetItemIndex(overSlotPosNew))
										(width3, height3) = item.GetItemSize()
										itemDest2Size = height3
										if itemDest2Size != 3:
											self.wndItem.SetSwapItem(TRUE)
										else:
											SWAPITEM_STAT = 0
											self.wndItem.SetSwapItem(FALSE)
								else:
									item.SelectItem(player.GetItemIndex(overSlotPosNew))
									(width3, height3) = item.GetItemSize()
									itemDest2Size = height3
									if itemDest2Size == 1:
										overSlotPosNew = overSlotPos + 10
										itemCountNew = player.GetItemCount(overSlotPosNew)
										if itemCountNew == 0:
											self.wndItem.SetSwapItem(TRUE)
										else:
											item.SelectItem(player.GetItemIndex(overSlotPosNew))
											(width3, height3) = item.GetItemSize()
											itemDest2Size = height3
											if itemDest2Size == 1:
												self.wndItem.SetSwapItem(TRUE)
											else:
												SWAPITEM_STAT = 0
												self.wndItem.SetSwapItem(FALSE)
									elif itemDest2Size == 2:
										self.wndItem.SetSwapItem(TRUE)
									else:
										SWAPITEM_STAT = 0
										self.wndItem.SetSwapItem(FALSE)
							else:
								SWAPITEM_STAT = 0
								self.wndItem.SetSwapItem(FALSE)
						else:
							SWAPITEM_STAT = 0
							self.wndItem.SetSwapItem(FALSE)
						
						self.ShowToolTip(attachedSlotPos)
						return
				
				if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
					self.wndItem.SetUsableItem(True)
					self.ShowToolTip(overSlotPos)
					return
		
		self.ShowToolTip(overSlotPos)
Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.