コード例 #1
0
ファイル: uiInventory.py プロジェクト: Reizonr1/metin2-adv
    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)
コード例 #2
0
ファイル: uitaskbar.py プロジェクト: Reizonr1/metin2-adv
	def RefreshQuickSlot(self):

		pageNum = player.GetQuickPage()

		try:
			self.quickPageNumImageBox.LoadImage(TaskBar.QUICKPAGE_NUMBER_FILENAME[pageNum])
		except:
			pass

		startNumber = 0
		for slot in self.quickslot:

			for i in xrange(4):

				slotNumber = i+startNumber

				(Type, Position) = player.GetLocalQuickSlot(slotNumber)

				if player.SLOT_TYPE_NONE == Type:
					slot.ClearSlot(slotNumber)
					continue

				if player.SLOT_TYPE_INVENTORY == Type:

					itemIndex = player.GetItemIndex(Position)
					itemCount = player.GetItemCount(Position)
					if itemCount <= 1:
						itemCount = 0

					## 자동물약 (#72723, #72724) 특수처리 - 아이템인데도 슬롯에 활성화/비활성화 표시를 위한 작업임 - [hyo]
					if constInfo.IS_AUTO_POTION(itemIndex):
						# metinSocket - [0] : 활성화 여부, [1] : 사용한 양, [2] : 최대 용량
						metinSocket = [player.GetItemMetinSocket(Position, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]

						if 0 != int(metinSocket[0]):
							slot.ActivateSlot(slotNumber)
						else:
							slot.DeactivateSlot(slotNumber)

					slot.SetItemSlot(slotNumber, itemIndex, itemCount)

				elif player.SLOT_TYPE_SKILL == Type:

					skillIndex = player.GetSkillIndex(Position)
					if 0 == skillIndex:
						slot.ClearSlot(slotNumber)
						continue

					skillType = skill.GetSkillType(skillIndex)
					if skill.SKILL_TYPE_GUILD == skillType:
						import guild
						skillGrade = 0
						skillLevel = guild.GetSkillLevel(Position)

					else:
						skillGrade = player.GetSkillGrade(Position)
						skillLevel = player.GetSkillLevel(Position)

					slot.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
					slot.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
					slot.SetCoverButton(slotNumber)

					## NOTE : CoolTime 체크
					if player.IsSkillCoolTime(Position):
						(coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
						slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)

					## NOTE : Activate 되어 있다면 아이콘도 업데이트
					if player.IsSkillActive(Position):
						slot.ActivateSlot(slotNumber)

				elif player.SLOT_TYPE_EMOTION == Type:

					emotionIndex = Position
					slot.SetEmotionSlot(slotNumber, emotionIndex)
					slot.SetCoverButton(slotNumber)
					slot.SetSlotCount(slotNumber, 0)

			slot.RefreshSlot()
			startNumber += 4
コード例 #3
0
	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()
コード例 #4
0
    def RefreshQuickSlot(self):

        pageNum = player.GetQuickPage()

        try:
            self.quickPageNumImageBox.LoadImage(
                TaskBar.QUICKPAGE_NUMBER_FILENAME[pageNum])
        except:
            pass

        startNumber = 0
        for slot in self.quickslot:

            for i in xrange(4):

                slotNumber = i + startNumber

                (Type, Position) = player.GetLocalQuickSlot(slotNumber)

                if player.SLOT_TYPE_NONE == Type:
                    slot.ClearSlot(slotNumber)
                    continue

                if player.SLOT_TYPE_INVENTORY == Type:

                    itemIndex = player.GetItemIndex(Position)
                    itemCount = player.GetItemCount(Position)
                    if itemCount <= 1:
                        itemCount = 0

                    if constInfo.IS_AUTO_POTION(itemIndex):
                        metinSocket = [
                            player.GetItemMetinSocket(Position, j)
                            for j in xrange(player.METIN_SOCKET_MAX_NUM)
                        ]

                        if 0 != int(metinSocket[0]):
                            slot.ActivateSlot(slotNumber)
                        else:
                            slot.DeactivateSlot(slotNumber)

                    if app.ENABLE_GROWTH_PET_SYSTEM:
                        if constInfo.IS_PET_ITEM(itemIndex):
                            self.__SetCoolTimePetItemSlot(
                                slot, Position, slotNumber, itemIndex)

                            slot.DeactivateSlot(slotNumber)

                            active_id = player.GetActivePetItemId()
                            if active_id and active_id == player.GetItemMetinSocket(
                                    Position, 2):
                                slot.ActivateSlot(slotNumber)

                    slot.SetItemSlot(slotNumber, itemIndex, itemCount)

                elif player.SLOT_TYPE_SKILL == Type:

                    skillIndex = player.GetSkillIndex(Position)
                    if 0 == skillIndex:
                        slot.ClearSlot(slotNumber)
                        continue

                    skillType = skill.GetSkillType(skillIndex)
                    if skill.SKILL_TYPE_GUILD == skillType:
                        import guild
                        skillGrade = 0
                        skillLevel = guild.GetSkillLevel(Position)

                    else:
                        skillGrade = player.GetSkillGrade(Position)
                        skillLevel = player.GetSkillLevel(Position)

                    slot.SetSkillSlotNew(slotNumber, skillIndex, skillGrade,
                                         skillLevel)
                    slot.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
                    slot.SetCoverButton(slotNumber)

                    if player.IsSkillCoolTime(Position):
                        (coolTime,
                         elapsedTime) = player.GetSkillCoolTime(Position)
                        slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)

                    if player.IsSkillActive(Position):
                        slot.ActivateSlot(slotNumber)

                elif player.SLOT_TYPE_EMOTION == Type:

                    emotionIndex = Position
                    slot.SetEmotionSlot(slotNumber, emotionIndex)
                    slot.SetCoverButton(slotNumber)
                    slot.SetSlotCount(slotNumber, 0)

            slot.RefreshSlot()
            startNumber += 4