예제 #1
0
	def __CanChangeItemAttrList(self, dstSlotPos):
		dstItemVNum = player.GetItemIndex(dstSlotPos)
		if dstItemVNum == 0:
			return FALSE

		item.SelectItem(dstItemVNum)
		
		if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):	 
			return FALSE

		for i in xrange(player.METIN_SOCKET_MAX_NUM):
			if player.GetItemAttribute(dstSlotPos, i) != 0:
				return TRUE

		return FALSE
예제 #2
0
    def Open(self, targetItemPos, nextGradeItemVnum, cost, prob, type):

        if FALSE == self.isLoaded:
            self.__LoadScript()

        self.__Initialize()

        self.targetItemPos = targetItemPos
        self.vnum = nextGradeItemVnum
        self.cost = cost
        self.percentage = prob
        self.type = type

        self.probText.SetText(locale.REFINE_SUCCESS_PROBALITY %
                              (self.percentage))
        self.costText.SetText(locale.REFINE_COST % (self.cost))

        if app.WJ_ENABLE_TRADABLE_ICON:
            self.SetCantMouseEventSlot(targetItemPos)

        self.toolTip.ClearToolTip()
        metinSlot = []
        for i in xrange(player.METIN_SOCKET_MAX_NUM):
            metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))

        attrSlot = []
        for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
            attrSlot.append(player.GetItemAttribute(targetItemPos, i))
        self.toolTip.AddRefineItemData(nextGradeItemVnum, metinSlot, attrSlot)

        item.SelectItem(nextGradeItemVnum)
        self.itemImage.LoadImage(item.GetIconImageFileName())
        xSlotCount, ySlotCount = item.GetItemSize()
        for slot in self.slotList:
            slot.Hide()
        for i in xrange(min(3, ySlotCount)):
            self.slotList[i].SetPosition(-35, i * 32 - (ySlotCount - 1) * 16)
            self.slotList[i].Show()

        self.dialogHeight = self.toolTip.GetHeight() + 46
        self.UpdateDialog()

        self.SetTop()
        self.Show()
예제 #3
0
	def __CanAddItemAttr(self, dstSlotPos):
		dstItemVNum = player.GetItemIndex(dstSlotPos)
		if dstItemVNum == 0:
			return False

		item.SelectItem(dstItemVNum)
		
		if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):	 
			return False
			
		attrCount = 0
		for i in xrange(player.METIN_SOCKET_MAX_NUM):
			if player.GetItemAttribute(dstSlotPos, i) != 0:
				attrCount += 1

		if attrCount<4:
			return True
								
		return False
예제 #4
0
	def __OnSelectEmptySlot(self, selectedSlotPos):
		isAttached = mouseModule.mouseController.isAttached()
		if isAttached:
			attachedSlotType = mouseModule.mouseController.GetAttachedType()
			attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
			targetIndex = player.GetItemIndex(attachedSlotPos)

			if attachedSlotType != player.SLOT_TYPE_INVENTORY or player.IsEquipmentSlot(attachedSlotPos):
				return

			if selectedSlotPos == 0:
				item.SelectItem(targetIndex)
				if item.GetItemType() == item.ITEM_TYPE_TRANSFER_SCROLL:
					if self.def_mediumSlot != 999:
						self.mediumSlot.ClearSlot(0)
						self.def_mediumSlot = 999
					
					self.mediumSlot.SetItemSlot(0, player.GetItemIndex(attachedSlotPos), player.GetItemCount(attachedSlotPos))
					net.SendChatPacket("/attrtransfer add %d %d" % (0, attachedSlotPos))

					self.ItemCombBackgroundImage.Show()
					self.combSlot.Show()

					self.def_mediumSlot = selectedSlotPos
					
					for slotPos, invenPos in self.itemInfo.items():
						if invenPos == attachedSlotPos:
							del self.itemInfo[slotPos]
					
					self.itemInfo[selectedSlotPos] = attachedSlotPos
				
					if app.ENABLE_SLOT_MARKING_SYSTEM:
						self.CantTradableItem(selectedSlotPos, attachedSlotPos)
						self.interface.SetOnTopWindow(player.ON_TOP_WND_ATTR_TRANSFER_PHASE2)
						self.interface.RefreshMarkInventoryBag()
				
				mouseModule.mouseController.DeattachObject()
			else:
				mouseModule.mouseController.DeattachObject()
				if self.def_mediumSlot == 999:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT1)
					return
				
				if self.def_combSlot_1 == 999 and selectedSlotPos == 2:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT2)
					return
				
				if selectedSlotPos == 3:
					return
				
				item.SelectItem(targetIndex)
				itemType = item.GetItemType()
				itemSubType = item.GetItemSubType()
				if itemType != item.ITEM_TYPE_COSTUME:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT3)
					return
				
				if ATTR_TRANSFER_LIMIT == 1:
					if not itemSubType in (item.COSTUME_TYPE_BODY, item.COSTUME_TYPE_HAIR, item.COSTUME_TYPE_ACCE):
						chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT4)
						return
				else:
					if itemSubType != item.COSTUME_TYPE_BODY:
						chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT5)
						return
				
				if selectedSlotPos == 2 and self.def_combSlot_1 == attachedSlotPos:
					return
				
				has_attr = 0
				check_attrSlot = [player.GetItemAttribute(player.INVENTORY, attachedSlotPos, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
				if check_attrSlot != 0:
					for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
						type = check_attrSlot[i][0]
						value = check_attrSlot[i][1]
						if type > 0 and value > 0:
							has_attr = 1
							break
				
				if not has_attr:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT6)
					return
				
				if ATTR_TRANSFER_LIMIT == 1 and selectedSlotPos == 2:
					item.SelectItem(player.GetItemIndex(self.def_combSlot_1))
					Costume_1_SubType = item.GetItemSubType()
					if Costume_1_SubType != itemSubType:
						chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT4)
						return
				
				self.combSlot.SetItemSlot(selectedSlotPos, player.GetItemIndex(attachedSlotPos), player.GetItemCount(attachedSlotPos))
				net.SendChatPacket("/attrtransfer add %d %d" % (selectedSlotPos, attachedSlotPos))
				if selectedSlotPos == 1:
					self.def_combSlot_1 = attachedSlotPos
				elif selectedSlotPos == 2:
					self.def_combSlot_2 = attachedSlotPos
				
				for slotPos, invenPos in self.itemInfo.items():
					if invenPos == attachedSlotPos:
						del self.itemInfo[slotPos]
				
				self.itemInfo[selectedSlotPos] = attachedSlotPos
				if selectedSlotPos == 2:
					self.combSlot.SetItemSlot(3, player.GetItemIndex(self.def_combSlot_1), 1)

				if app.ENABLE_SLOT_MARKING_SYSTEM:
					self.CantTradableItem(selectedSlotPos, attachedSlotPos)
예제 #5
0
    def Open(self, cell, new_attrSlot=0):
        self.Show()
        self.isUsable = TRUE
        self.targetSlot.SetItemSlot(0, player.GetItemIndex(cell), 0)
        global itemCell
        itemCell = cell

        if self.left_select_btn:
            self.left_select_btn.SetUp()

        if self.right_select_btn:
            self.right_select_btn.SetUp()

        if self.left_attr0:
            self.left_attr0.Hide()
        if self.left_attr1:
            self.left_attr1.Hide()
        if self.left_attr2:
            self.left_attr2.Hide()
        if self.left_attr3:
            self.left_attr3.Hide()
        if self.left_attr4:
            self.left_attr4.Hide()
        if self.left_attr5:
            self.left_attr5.Hide()
        if self.left_attr6:
            self.left_attr6.Hide()

        if self.left_attr0:
            self.left_attr0.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.left_attr1:
            self.left_attr1.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.left_attr2:
            self.left_attr2.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.left_attr3:
            self.left_attr3.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.left_attr4:
            self.left_attr4.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.left_attr5:
            self.left_attr5.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.left_attr6:
            self.left_attr6.SetFontColor(0.3549, 0.3549, 0.3549)

        if self.right_attr0:
            self.right_attr0.Hide()
        if self.right_attr1:
            self.right_attr1.Hide()
        if self.right_attr2:
            self.right_attr2.Hide()
        if self.right_attr3:
            self.right_attr3.Hide()
        if self.right_attr4:
            self.right_attr4.Hide()
        if self.right_attr5:
            self.right_attr5.Hide()
        if self.right_attr6:
            self.right_attr6.Hide()

        if self.right_attr0:
            self.right_attr0.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.right_attr1:
            self.right_attr1.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.right_attr2:
            self.right_attr2.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.right_attr3:
            self.right_attr3.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.right_attr4:
            self.right_attr4.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.right_attr5:
            self.right_attr5.SetFontColor(0.3549, 0.3549, 0.3549)
        if self.right_attr6:
            self.right_attr6.SetFontColor(0.3549, 0.3549, 0.3549)

        attrSlot = [
            player.GetItemAttribute(player.INVENTORY, itemCell, i)
            for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)
        ]
        if 0 != attrSlot:
            for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
                type = attrSlot[i][0]
                value = attrSlot[i][1]
                if 0 == value:
                    continue

                affectString = self.__GetAffectString(type, value)
                if affectString:
                    if i == 0:
                        self.left_attr0.SetText(affectString)
                        self.left_attr0.Show()
                    if i == 1:
                        self.left_attr1.SetText(affectString)
                        self.left_attr1.Show()
                    if i == 2:
                        self.left_attr2.SetText(affectString)
                        self.left_attr2.Show()
                    if i == 3:
                        self.left_attr3.SetText(affectString)
                        self.left_attr3.Show()
                    if i == 4:
                        self.left_attr4.SetText(affectString)
                        self.left_attr4.Show()
                    if i == 5:
                        self.left_attr5.SetText(affectString)
                        self.left_attr5.Show()
                    if i == 6:
                        self.left_attr6.SetText(affectString)
                        self.left_attr6.Show()

        if 0 != new_attrSlot:
            #for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
            for i in xrange(5):
                type = new_attrSlot[i][0]
                value = new_attrSlot[i][1]
                if 0 == value:
                    continue

                affectString = self.__GetAffectString(type, value)
                if affectString:
                    if i == 0:
                        self.right_attr0.SetText(affectString)
                        self.right_attr0.Show()
                    if i == 1:
                        self.right_attr1.SetText(affectString)
                        self.right_attr1.Show()
                    if i == 2:
                        self.right_attr2.SetText(affectString)
                        self.right_attr2.Show()
                    if i == 3:
                        self.right_attr3.SetText(affectString)
                        self.right_attr3.Show()
                    if i == 4:
                        self.right_attr4.SetText(affectString)
                        self.right_attr4.Show()
                    if i == 5:
                        self.right_attr5.SetText(affectString)
                        self.right_attr5.Show()
                    if i == 6:
                        self.right_attr6.SetText(affectString)
                        self.right_attr6.Show()

        global choosedOption
        choosedOption = 0
예제 #6
0
    def __OnOverInItem(self, slotIndex):
        if slotIndex == 2:
            if self.slot_index1 != 999:
                abs_chance = 0
                itemVnum = player.GetItemIndex(self.slot_index1)
                self.tooltipItem.SetItemToolTip(itemVnum)
                self.tooltipItem.SetInventoryItem(self.acceItemInfo[0])

                item.SelectItem(player.GetItemIndex(self.slot_index1))
                metinSlot = []
                for i in xrange(player.METIN_SOCKET_MAX_NUM):
                    metinSlot.append(
                        player.GetItemMetinSocket(self.slot_index1, i))

                abs_chance = int(metinSlot[1])

                item.SelectItem(player.GetItemIndex(self.slot_index2))
                itemType = item.GetItemType()
                if item.ITEM_TYPE_WEAPON == itemType:
                    a = int(item.GetValue(3) * abs_chance / 100)
                    b = int(item.GetValue(4) * abs_chance / 100)
                    c = int(item.GetValue(5) * abs_chance / 100)
                    d = int(item.GetValue(1) * abs_chance / 100)
                    e = int(item.GetValue(2) * abs_chance / 100)

                    min_power = a + c
                    max_power = b + c
                    min_magic_power = d + c
                    max_magic_power = e + c
                    if b > a:
                        if a > 0 or b > 0:
                            self.tooltipItem.AppendTextLine(
                                localeInfo.TOOLTIP_ITEM_ATT_POWER %
                                (max_power - min_power, max_power),
                                self.tooltipItem.POSITIVE_COLOR)
                    else:
                        if a > 0:
                            self.tooltipItem.AppendTextLine(
                                localeInfo.TOOLTIP_ITEM_ATT_POWER_ONE_ARG %
                                (min_power), self.tooltipItem.POSITIVE_COLOR)

                    if e > d:
                        if e > 0 or d > 0:
                            self.tooltipItem.AppendTextLine(
                                localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER %
                                (max_magic_power - min_magic_power,
                                 max_magic_power),
                                self.tooltipItem.POSITIVE_COLOR)
                    else:
                        if e > 0:
                            self.tooltipItem.AppendTextLine(
                                localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER_ONE_ARG
                                % (min_magic_power),
                                self.tooltipItem.POSITIVE_COLOR)
                elif item.ITEM_TYPE_ARMOR == itemType:
                    defGradeCalc = item.GetValue(5) * 2 + item.GetValue(
                        1) * abs_chance / 100
                    defGrade = defGradeCalc * abs_chance / 100
                    if defGrade > 0:
                        self.tooltipItem.AppendTextLine(
                            localeInfo.TOOLTIP_ITEM_DEF_GRADE % (defGrade),
                            self.GetChangeTextLineColor(defGrade))

                for g in xrange(item.ITEM_APPLY_MAX_NUM):
                    item.SelectItem(player.GetItemIndex(self.slot_index2))
                    (affectType, affectValue) = item.GetAffect(g)
                    affectValue = affectValue * abs_chance / 100
                    if affectValue <= 0:
                        if affectType != 0:
                            affectValue = 1
                        else:
                            affectValue = 0

                    affectString = self.GetAffectString(
                        affectType, affectValue)
                    if affectString:
                        affectColor = self.GetChangeTextLineColor(affectValue)
                        self.tooltipItem.AppendTextLine(
                            affectString, affectColor)

                attrSlot = []
                for w in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
                    attrSlot.append(
                        player.GetItemAttribute(self.slot_index2, w))

                if 0 != attrSlot:
                    for q in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
                        if q >= 7:
                            continue
                        else:
                            type = attrSlot[q][0]
                            value = attrSlot[q][1]
                            if 0 == value:
                                continue

                            value = value * abs_chance / 100

                            if value <= 0:
                                if type != 0:
                                    value = 1
                                else:
                                    value = 0

                            affectString = self.GetAffectString(type, value)
                            if affectString:
                                affectColor = self.GetAttributeColor(q, value)
                                self.tooltipItem.AppendTextLine(
                                    affectString, affectColor)
            return

        if self.tooltipItem:
            if self.acceItemInfo.has_key(slotIndex):
                self.tooltipItem.SetInventoryItem(self.acceItemInfo[slotIndex])