Ejemplo n.º 1
0
    def RefineItem(self, scrollSlotPos, targetSlotPos):

        scrollIndex = player.GetItemIndex(scrollSlotPos)
        targetIndex = player.GetItemIndex(targetSlotPos)

        if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
            return

        ###########################################################
        self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
        #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
        return
        ###########################################################

        ###########################################################
        #net.SendRequestRefineInfoPacket(targetSlotPos)
        #return
        ###########################################################

        result = player.CanRefine(scrollIndex, targetSlotPos)

        if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
            #snd.PlaySound("sound/ui/jaeryun_fail.wav")
            chat.AppendChat(chat.CHAT_TYPE_INFO,
                            localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)

        elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
            #snd.PlaySound("sound/ui/jaeryun_fail.wav")
            chat.AppendChat(chat.CHAT_TYPE_INFO,
                            localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)

        elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
            #snd.PlaySound("sound/ui/jaeryun_fail.wav")
            chat.AppendChat(chat.CHAT_TYPE_INFO,
                            localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)

        elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
            #snd.PlaySound("sound/ui/jaeryun_fail.wav")
            chat.AppendChat(chat.CHAT_TYPE_INFO,
                            localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)

        elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
            chat.AppendChat(chat.CHAT_TYPE_INFO,
                            localeInfo.REFINE_FAILURE_EQUIP_ITEM)

        if player.REFINE_OK != result:
            return

        self.refineDialog.Open(scrollSlotPos, targetSlotPos)
Ejemplo n.º 2
0
    def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
        "대상 아이템에 사용할 수 있는가?"

        if srcSlotPos == dstSlotPos:
            return FALSE

        if 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