Exemple #1
0
    def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
        dstItemVNum = player.GetItemIndex(dstSlotPos)
        if dstItemVNum == 0:
            return FALSE

        item.SelectItem(dstItemVNum)

        if item.GetItemType() != item.ITEM_TYPE_ARMOR:
            return FALSE

        if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK,
                                         item.ARMOR_EAR):
            return FALSE

        curCount = player.GetItemMetinSocket(dstSlotPos, 0)
        maxCount = player.GetItemMetinSocket(dstSlotPos, 1)

        if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(
                dstItemVNum, item.GetItemSubType()):
            return FALSE

        if curCount >= maxCount:
            return FALSE

        return TRUE
	def __SelectRefineItemSlot(self, selectedSlotPos):
		if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
			return

		try:
			if not selectedSlotPos in self.refineItemInfo:
				# 새로운 아이템을 강화창에 올리는 작업.
				if mouseModule.mouseController.isAttached():
					attachedSlotType = mouseModule.mouseController.GetAttachedType()
					attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
					attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
					attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
					mouseModule.mouseController.DeattachObject()

					if uiPrivateShopBuilder.IsBuildingPrivateShop():
						chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
						return

					attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)

					if player.INVENTORY == attachedInvenType and player.IsEquipmentSlot(attachedSlotPos):
						return

					if player.INVENTORY != attachedInvenType and player.DRAGON_SOUL_INVENTORY != attachedInvenType:
						return

					self.AutoSetItem((attachedInvenType, attachedSlotPos), 1)
				return
			elif mouseModule.mouseController.isAttached():
				return
 
			attachedInvenType, attachedSlotPos, attachedItemCount = self.refineItemInfo[selectedSlotPos]
			selectedItemVnum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
				
			# 강화창에서 삭제 및 원래 인벤의 아이템 카운트 회복
			invenType, invenPos, itemCount = self.refineItemInfo[selectedSlotPos]
			remainCount = player.GetItemCount(invenType, invenPos)
			player.SetItemCount(invenType, invenPos, remainCount + itemCount)
			del self.refineItemInfo[selectedSlotPos]
				
			# 강화창이 비었다면, 초기화
			if not self.refineItemInfo:
				self.__Initialize()
			else:
				item.SelectItem(selectedItemVnum)
				# 없앤 아이템이 강화석이었다면 강화 레피시 초기화
				if (item.ITEM_TYPE_MATERIAL == item.GetItemType() \
					and (item.MATERIAL_DS_REFINE_NORMAL <= item.GetItemSubType() and item.GetItemSubType() <= item.MATERIAL_DS_REFINE_HOLLY)):
					self.currentRecipe = {}
					self.wndMoney.SetText(localeInfo.NumberToMoneyString(0))
				# 용혼석이었다면, 
				# strength강화가 아닌 경우, 강화창에 다른 용혼석이 남아있으므로, 레시피를 초기화하면 안됨.
				# strength강화의 경우, 강화 레시피는 강화석에 종속된 것이므로 다른 처리할 필요가 없음.
				else:
					pass
					
		except Exception, e:
			import dbg
			dbg.TraceError("Exception : __SelectRefineItemSlot, %s" % e)
	def __GetRefineStrengthInfo (self, itemVnum):
		try:
			# 이놈의 위치를 어찌하지....
			# 강화석이 아니면 안됨.
			item.SelectItem(itemVnum)
			if not (item.ITEM_TYPE_MATERIAL == item.GetItemType() \
					and (item.MATERIAL_DS_REFINE_NORMAL <= item.GetItemSubType() and item.GetItemSubType() <= item.MATERIAL_DS_REFINE_HOLLY)):
				return None

			import dragon_soul_refine_settings
			return { "fee" : dragon_soul_refine_settings.strength_fee[item.GetItemSubType()] }
		except:
			return None
Exemple #4
0
        def __SetCoolTimePetItemSlot(self, slot, Position, slotNumber,
                                     itemVnum):

            item.SelectItem(itemVnum)
            itemSubType = item.GetItemSubType()

            if itemSubType not in [item.PET_UPBRINGING, item.PET_BAG]:
                return

            if itemSubType == item.PET_BAG:
                id = player.GetItemMetinSocket(Position, 2)
                if id == 0:
                    return

            (limitType, limitValue) = item.GetLimit(0)

            if itemSubType == item.PET_UPBRINGING:
                limitValue = player.GetItemMetinSocket(Position, 1)

            if limitType in [
                    item.LIMIT_REAL_TIME, item.LIMIT_REAL_TIME_START_FIRST_USE
            ]:
                sock_time = player.GetItemMetinSocket(Position, 0)
                remain_time = max(0, sock_time - app.GetGlobalTimeStamp())

                slot.SetSlotCoolTimeInverse(slotNumber, limitValue,
                                            limitValue - remain_time)
Exemple #5
0
        def __SetCoolTimePetItemSlot(self, slotNumber, itemVnum):
            if 0 == itemVnum:
                return

            item.SelectItem(itemVnum)
            itemSubType = item.GetItemSubType()

            if itemSubType not in [item.PET_UPBRINGING, item.PET_BAG]:
                return

            if itemSubType == item.PET_BAG:
                id = safebox.GetItemMetinSocket(slotNumber, 2)
                if id == 0:
                    return

            (limitType, limitValue) = item.GetLimit(0)

            if itemSubType == item.PET_UPBRINGING:
                limitValue = safebox.GetItemMetinSocket(slotNumber, 1)

            if limitType in [
                    item.LIMIT_REAL_TIME, item.LIMIT_REAL_TIME_START_FIRST_USE
            ]:

                sock_time = safebox.GetItemMetinSocket(slotNumber, 0)
                remain_time = max(0, sock_time - app.GetGlobalTimeStamp())

                if slotNumber >= safebox.SAFEBOX_PAGE_SIZE:
                    slotNumber -= (self.curPageIndex *
                                   safebox.SAFEBOX_PAGE_SIZE)

                self.wndItem.SetSlotCoolTimeInverse(slotNumber, limitValue,
                                                    limitValue - remain_time)
	def SelectEmptyEquipSlot(self, selectedSlot):
		if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
			return

		selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(player.INVENTORY, selectedSlot)

		if mouseModule.mouseController.isAttached():
			attachedSlotType = mouseModule.mouseController.GetAttachedType()
			attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
			attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
			attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()

			if player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType:
				if 0 == player.GetItemMetinSocket(player.DRAGON_SOUL_INVENTORY, attachedSlotPos, 0):
					self.wndPopupDialog.SetText(localeInfo.DRAGON_SOUL_EXPIRED)
					self.wndPopupDialog.Open()
					return
			
				item.SelectItem(attachedItemIndex)
				subType = item.GetItemSubType()
				if subType != (selectedSlot - player.DRAGON_SOUL_EQUIPMENT_SLOT_START):
					self.wndPopupDialog.SetText(localeInfo.DRAGON_SOUL_UNMATCHED_SLOT)
					self.wndPopupDialog.Open()
				else:
					srcItemPos = (player.DRAGON_SOUL_INVENTORY, attachedSlotPos)
					dstItemPos = (player.INVENTORY, selectedSlotPos)
					self.__OpenQuestionDialog(TRUE, srcItemPos, dstItemPos)

			mouseModule.mouseController.DeattachObject()
Exemple #7
0
	def IsWeaponArch(self):
		idx = player.GetItemIndex(player.EQUIPMENT,item.EQUIPMENT_WEAPON)
		if idx == 0:
			return False
		item.SelectItem(idx)
		if item.GetItemType() == item.ITEM_TYPE_WEAPON and item.GetItemSubType() == item.WEAPON_BOW:
			return True
		return False
	def __EquipItem(self, slotIndex):	
		ItemVNum = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, slotIndex)
		item.SelectItem(ItemVNum)
		subType = item.GetItemSubType()
		equipSlotPos = player.DRAGON_SOUL_EQUIPMENT_SLOT_START + self.deckPageIndex * player.DRAGON_SOUL_EQUIPMENT_FIRST_SIZE + subType
		srcItemPos = (player.DRAGON_SOUL_INVENTORY, slotIndex)
		dstItemPos = (player.INVENTORY, equipSlotPos)
		self.__OpenQuestionDialog(TRUE, srcItemPos, dstItemPos)
Exemple #9
0
    def IS_PET_ITEM(itemVnum):
        if itemVnum == 0:
            return 0

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

        if itemType == item.ITEM_TYPE_PET and itemSubType == item.PET_UPBRINGING:
            return 1

        return 0
Exemple #10
0
    def __OnSelectEmptySlot(self, selectedSlotPos):
        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            attachedSlotType = mouseModule.mouseController.GetAttachedType()
            attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber(
            )
            mouseModule.mouseController.DeattachObject()
            if player.SLOT_TYPE_INVENTORY != attachedSlotType:
                return

            item.SelectItem(player.GetItemIndex(attachedSlotPos))
            if constInfo.IS_ACCE_ITEM(
                    player.GetItemIndex(attachedSlotPos), 1
            ) == TRUE and selectedSlotPos == 0 or item.GetItemSubType(
            ) == item.ARMOR_BODY and selectedSlotPos == 1 or item.GetItemType(
            ) == item.ITEM_TYPE_WEAPON and selectedSlotPos == 1:
                if selectedSlotPos == 1 and self.slot_pos_index == 999:
                    return

                if self.slot_index1 == attachedSlotPos and selectedSlotPos == 0 or self.slot_index2 == attachedSlotPos and selectedSlotPos == 1:
                    return
                elif self.slot_index2 == attachedSlotPos and selectedSlotPos == 0 or self.slot_index1 == attachedSlotPos and selectedSlotPos == 1:
                    return

                if selectedSlotPos == 0:
                    self.slot_index1 = attachedSlotPos
                elif selectedSlotPos == 1:
                    self.slot_index2 = attachedSlotPos

                for slotPos, invenPos in self.acceItemInfo.items():
                    if invenPos == attachedSlotPos:
                        del self.acceItemInfo[slotPos]

                self.acceItemInfo[selectedSlotPos] = attachedSlotPos
                self.slot_pos_index = attachedSlotPos
                self.acceSlot.ClearSlot(selectedSlotPos)
                self.acceSlot.SetItemSlot(selectedSlotPos,
                                          player.GetItemIndex(attachedSlotPos),
                                          player.GetItemCount(attachedSlotPos))
                net.SendChatPacket("/acce add %d %d" %
                                   (selectedSlotPos, attachedSlotPos))
                if selectedSlotPos == 1:
                    self.acceSlot.SetItemSlot(
                        2, player.GetItemIndex(self.slot_index1),
                        player.GetItemCount(self.slot_index1))

            self.Refresh()
Exemple #11
0
    def Open(self, metinItemPos, targetItemPos):
        self.metinItemPos = metinItemPos
        self.targetItemPos = targetItemPos

        metinIndex = player.GetItemIndex(metinItemPos)
        itemIndex = player.GetItemIndex(targetItemPos)
        self.oldToolTip.ClearToolTip()
        self.newToolTip.ClearToolTip()

        item.SelectItem(metinIndex)

        ## Metin Image
        try:
            self.metinImage.LoadImage(item.GetIconImageFileName())
        except:
            dbg.TraceError(
                "AttachMetinDialog.Open.LoadImage - Failed to find item data")

        ## Old Item ToolTip
        metinSlot = []
        for i in xrange(player.METIN_SOCKET_MAX_NUM):
            metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
        self.oldToolTip.AddItemData(itemIndex, metinSlot)

        ## New Item ToolTip
        item.SelectItem(metinIndex)
        metinSubType = item.GetItemSubType()

        metinSlot = []
        for i in xrange(player.METIN_SOCKET_MAX_NUM):
            metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
        for i in xrange(player.METIN_SOCKET_MAX_NUM):
            slotData = metinSlot[i]
            if self.CanAttachMetin(slotData, metinSubType):
                metinSlot[i] = metinIndex
                break
        self.newToolTip.AddItemData(itemIndex, metinSlot)

        self.UpdateDialog()
        self.SetTop()
        self.Show()

        if app.ENABLE_SLOT_MARKING_SYSTEM:
            self.SetCantMouseEventSlot(0, self.metinItemPos)
            self.SetCantMouseEventSlot(1, self.targetItemPos)
    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:
                return

            mouseModule.mouseController.DeattachObject()

            item.SelectItem(targetIndex)
            itemType = item.GetItemType()
            itemSubType = item.GetItemSubType()
            itemVnum = player.GetItemIndex(attachedSlotPos)
            if itemType != item.ITEM_TYPE_COSTUME:
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT3)
                return

            if app.ENABLE_SASH_SYSTEM:
                if itemSubType == item.COSTUME_TYPE_SASH:
                    chat.AppendChat(
                        chat.CHAT_TYPE_INFO,
                        "<Support System> You can not put this item!")
                    return

            if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE):
                chat.AppendChat(
                    chat.CHAT_TYPE_INFO,
                    "<Support System> You can not put this item. Your support is male!"
                )
                return

            self.combSlot.SetItemSlot(selectedSlotPos,
                                      player.GetItemIndex(attachedSlotPos),
                                      player.GetItemCount(attachedSlotPos))

            if selectedSlotPos == 1:
                net.SendChatPacket("/support_system %s" % (str(itemVnum)))
            else:
                net.SendChatPacket("/support_system_d %s" % (str(itemVnum)))

            for i in xrange(4):
                self.combSlot.ClearSlot(i)
	def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
		scrollIndex = player.GetItemIndex(scrollSlotPos)
		targetIndex = player.GetItemIndex(targetSlotPos)
		if app.ENABLE_SASH_SYSTEM:
			if not player.CanDetach(scrollIndex, targetSlotPos):
				item.SelectItem(scrollIndex)
				if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
				else:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
				
				return
		elif app.ENABLE_CHANGELOOK_SYSTEM:
			if not player.CanDetach(scrollIndex, targetSlotPos):
				item.SelectItem(scrollIndex)
				if item.GetValue(0) == changelook.CLEAN_ATTR_VALUE0:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHANGE_LOOK_FAILURE_CLEAN)
				else:
					chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
				
				return
		else:
			if not player.CanDetach(scrollIndex, targetSlotPos):
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
				return
		
		self.questionDialog = uiCommon.QuestionDialog()
		self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
		if app.ENABLE_SASH_SYSTEM:
			item.SelectItem(targetIndex)
			if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
				item.SelectItem(scrollIndex)
				if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
					self.questionDialog.SetText(localeInfo.SASH_DO_YOU_CLEAN)
		if app.ENABLE_CHANGELOOK_SYSTEM:
			item.SelectItem(targetIndex)
			if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR or item.GetItemType() == item.ITEM_TYPE_COSTUME:
				item.SelectItem(scrollIndex)
				if item.GetValue(0) == changelook.CLEAN_ATTR_VALUE0:
					self.questionDialog.SetText(localeInfo.CHANGE_LOOK_DO_YOU_CLEAN)
		self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
		self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
		self.questionDialog.Open()
		self.questionDialog.sourcePos = scrollSlotPos
		self.questionDialog.targetPos = targetSlotPos
Exemple #14
0
	def __CanAddAccessorySocket(self, dstSlotPos):
		dstItemVNum = player.GetItemIndex(dstSlotPos)
		if dstItemVNum == 0:
			return FALSE

		item.SelectItem(dstItemVNum)

		if item.GetItemType() != item.ITEM_TYPE_ARMOR:
			return FALSE

		if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
			return FALSE

		curCount = player.GetItemMetinSocket(dstSlotPos, 0)
		maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
		
		ACCESSORY_SOCKET_MAX_SIZE = 3
		if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
			return FALSE

		return TRUE
Exemple #15
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]
Exemple #16
0
	def Open(self, metinItemPos, targetItemPos):
		self.metinItemPos = metinItemPos
		self.targetItemPos = targetItemPos

		metinIndex = fgGHGjjFHJghjfFG1545gGG.GetItemIndex(metinItemPos)
		itemIndex = fgGHGjjFHJghjfFG1545gGG.GetItemIndex(targetItemPos)
		self.oldToolTip.ClearToolTip()
		self.newToolTip.ClearToolTip()

		item.SelectItem(metinIndex)

		## Metin Image
		try:
			self.metinImage.LoadImage(item.GetIconImageFileName())
		except:
			dbg.TraceError("AttachMetinDialog.Open.LoadImage - Failed to find item data")

		## Old Item ToolTip
		metinSlot = []
		for i in xrange(fgGHGjjFHJghjfFG1545gGG.METIN_SOCKET_MAX_NUM):
			metinSlot.append(fgGHGjjFHJghjfFG1545gGG.GetItemMetinSocket(targetItemPos, i))
		self.oldToolTip.AddItemData(itemIndex, metinSlot)

		## New Item ToolTip
		item.SelectItem(metinIndex)
		metinSubType = item.GetItemSubType()

		metinSlot = []
		for i in xrange(fgGHGjjFHJghjfFG1545gGG.METIN_SOCKET_MAX_NUM):
			metinSlot.append(fgGHGjjFHJghjfFG1545gGG.GetItemMetinSocket(targetItemPos, i))
		for i in xrange(fgGHGjjFHJghjfFG1545gGG.METIN_SOCKET_MAX_NUM):
			slotData = metinSlot[i]
			if self.CanAttachMetin(slotData, metinSubType):
				metinSlot[i] = metinIndex
				break
		self.newToolTip.AddItemData(itemIndex, metinSlot)

		self.UpdateDialog()
		self.SetTop()
		self.Show()
Exemple #17
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)
	def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
		"대상 아이템에 사용할 수 있는가?"

		if srcSlotPos == dstSlotPos:
			return False
			
		if app.ENABLE_ACHIEVEMENT:
			if item.IsAchievementColor(srcItemVNum):
				item.SelectItem(player.GetItemIndex(dstSlotPos))
				if item.GetItemType() == item.ITEM_TYPE_ACHIEVEMENT and item.GetItemSubType() == item.ACHIEVEMENT_TITLE:
					return True	

		if srcItemVNum == player.GetItemIndex(dstSlotPos):
			if player.GetItemCount(dstSlotPos) < 200:
				return True	
		elif item.IsRefineScroll(srcItemVNum):
			if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
				return True
		elif item.IsMetin(srcItemVNum):
			if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
				return True
		elif item.IsDetachScroll(srcItemVNum):
			if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
				return True
		elif item.IsKey(srcItemVNum):
			if player.CanUnlock(srcItemVNum, dstSlotPos):
				return True

		elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
			return True

		else:
			useType=item.GetUseType(srcItemVNum)

			if "USE_CLEAN_SOCKET" == useType:
				if self.__CanCleanBrokenMetinStone(dstSlotPos):
					return True
			elif "USE_CHANGE_ATTRIBUTE" == useType:
				if self.__CanChangeItemAttrList(dstSlotPos):
					return True
			elif "USE_ADD_ATTRIBUTE" == useType:
				if self.__CanAddItemAttr(dstSlotPos):
					return True
			elif "USE_ADD_ATTRIBUTE2" == useType:
				if self.__CanAddItemAttr(dstSlotPos):
					return True
			elif "USE_ADD_ACCESSORY_SOCKET" == useType:
				if self.__CanAddAccessorySocket(dstSlotPos):
					return True
			elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:								
				if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
					return TRUE;
			elif "USE_PUT_INTO_BELT_SOCKET" == useType:								
				dstItemVNum = player.GetItemIndex(dstSlotPos)
				print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum

				item.SelectItem(dstItemVNum)
		
				if item.ITEM_TYPE_BELT == item.GetItemType():
					return True

		return False
Exemple #19
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:
                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.def_mediumSlot = selectedSlotPos

                    for slotPos, invenPos in self.itemInfo.items():
                        if invenPos == attachedSlotPos:
                            del self.itemInfo[slotPos]

                    self.itemInfo[selectedSlotPos] = attachedSlotPos

                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

                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 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_ALERT6)
                        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)