Exemplo n.º 1
0
    def RefreshSlot(self):

        slotPos = 0
        self.inventorySlotPosDict = {}

        getItemVNum = player.GetItemIndex
        getItemCount = player.GetItemCount
        setItemVNum = self.itemSlot.SetItemSlot

        for i in xrange(player.INVENTORY_PAGE_SIZE *
                        player.INVENTORY_PAGE_COUNT):
            slotNumber = i

            itemVNum = getItemVNum(slotNumber)
            if 0 == itemVNum:
                continue

            if not item.IsMetin(itemVNum):
                continue

            itemGrade = player.GetItemGrade(slotNumber)
            if itemGrade > 3:
                continue

            self.inventorySlotPosDict[slotPos] = i

            slotPos += 1

            if slotPos > 54:
                break

        itemCount = len(self.inventorySlotPosDict)
        if itemCount < 15:
            self.SetTableSize(3)

        else:
            lineCount = 3
            lineCount += (itemCount - 15) / 5
            if itemCount % 5:
                lineCount += 1
            self.SetTableSize(lineCount)

        for selectWndPos, inventoryPos in self.inventorySlotPosDict.items():
            itemVNum = getItemVNum(inventoryPos)
            itemCount = getItemCount(inventoryPos)

            if itemCount <= 1:
                itemCount = 0

            setItemVNum(selectWndPos, itemVNum, itemCount)

        self.itemSlot.RefreshSlot()
Exemplo n.º 2
0
    def GetRefineSuccessPercentage(self, scrollSlotIndex, itemSlotIndex):

        if -1 != scrollSlotIndex:
            if player.IsRefineGradeScroll(scrollSlotIndex):
                curGrade = player.GetItemGrade(itemSlotIndex)
                itemIndex = player.GetItemIndex(itemSlotIndex)

                item.SelectItem(itemIndex)
                itemType = item.GetItemType()
                itemSubType = item.GetItemSubType()

                if item.ITEM_TYPE_METIN == itemType:

                    if curGrade >= len(self.upgradeStoneSuccessPercentage):
                        return 0
                    return self.upgradeStoneSuccessPercentage[curGrade]

                elif item.ITEM_TYPE_ARMOR == itemType:

                    if item.ARMOR_BODY == itemSubType:
                        if curGrade >= len(self.upgradeArmorSuccessPercentage):
                            return 0
                        return self.upgradeArmorSuccessPercentage[curGrade]
                    else:
                        if curGrade >= len(
                                self.upgradeAccessorySuccessPercentage):
                            return 0
                        return self.upgradeAccessorySuccessPercentage[curGrade]

                else:

                    if curGrade >= len(self.upgradeSuccessPercentage):
                        return 0
                    return self.upgradeSuccessPercentage[curGrade]

        for i in xrange(player.METIN_SOCKET_MAX_NUM + 1):
            if 0 == player.GetItemMetinSocket(itemSlotIndex, i):
                break

        return self.makeSocketSuccessPercentage[i]