Ejemplo n.º 1
0
    def RefreshBagSlotWindow(self):
        getItemVNum = player.GetItemIndex
        getItemCount = player.GetItemCount
        setItemVNum = self.wndItem.SetItemSlot

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

            itemCount = getItemCount(slotNumber)
            # itemCount == 0이면 소켓을 비운다.
            if 0 == itemCount:
                self.wndItem.ClearSlot(i)
                continue
            elif 1 == itemCount:
                itemCount = 0

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

            ## 자동물약 (HP: #72723 ~ #72726, SP: #72727 ~ #72730) 특수처리 - 아이템인데도 슬롯에 활성화/비활성화 표시를 위한 작업임 - [hyo]
            if constInfo.IS_AUTO_POTION(itemVnum):
                # metinSocket - [0] : 활성화 여부, [1] : 사용한 양, [2] : 최대 용량
                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(slotNumber)
                    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)

            if app.WJ_ENABLE_TRADABLE_ICON:
                self.RefreshMarkSlots(i)

        self.wndItem.RefreshSlot()

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

        if app.WJ_ENABLE_TRADABLE_ICON:
            map(lambda wnd: wnd.RefreshLockedSlot(), self.bindWnds)
	def RefreshBagSlotWindow(self):
		getItemVNum=player.GetItemIndex
		getItemCount=player.GetItemCount
		setItemVNum=self.wndItem.SetItemSlot
		for i in xrange(player.INVENTORY_PAGE_SIZE*4):
			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_CHANGELOOK_SYSTEM:
				itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
				if itemTransmutedVnum:
					self.wndItem.DisableCoverButton(i)
				else:
					self.wndItem.EnableCoverButton(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(slotNumber)
					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(i)
			if app.ENABLE_SASH_SYSTEM:
				slotNumberChecked = 0
				if not constInfo.IS_AUTO_POTION(itemVnum):
					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, (238.00 / 255.0), (11.00 / 255.0), (11.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)
			if app.ENABLE_CHANGELOOK_SYSTEM:
				slotClNumberChecked = 0
				if not constInfo.IS_AUTO_POTION(itemVnum):
					self.wndItem.DeactivateSlot(i)
				
				for q in xrange(changelook.WINDOW_MAX_MATERIALS):
					(isHere, iCell) = changelook.GetAttachedItem(q)
					if isHere:
						if iCell == slotNumber:
							self.wndItem.ActivateSlot(i, (238.00 / 255.0), (11.00 / 255.0), (11.00 / 255.0), 1.0)
							if not slotNumber in self.listAttachedCl:
								self.listAttachedCl.append(slotNumber)
							
							slotClNumberChecked = 1
					else:
						if slotNumber in self.listAttachedCl and not slotClNumberChecked:
							self.wndItem.DeactivateSlot(i)
							self.listAttachedCl.remove(slotNumber)		
			else:
				self.wndItem.DeactivateSlot(slotNumber)			
		
		self.wndItem.RefreshSlot()
		if self.wndBelt:
			self.wndBelt.RefreshSlot()