def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos): if srcItemSlotPos == dstItemSlotPos: return if item.IsRefineScroll(srcItemVID): self.RefineItem(srcItemSlotPos, dstItemSlotPos) self.wndItem.SetUseMode(FALSE) elif item.IsMetin(srcItemVID): self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos) elif item.IsDetachScroll(srcItemVID): self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos) elif item.IsKey(srcItemVID): self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos) elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE: self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos) elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE: self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos) else: #snd.PlaySound("sound/ui/drop.wav") ## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites] if player.IsEquipmentSlot(dstItemSlotPos): ## 들고 있는 아이템이 장비일때만 if item.IsEquipmentVID(srcItemVID): self.__UseItem(srcItemSlotPos) else: self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
def __SelectRefineEmptySlot(self, selectedSlotPos): try: if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1: return if selectedSlotPos >= self.refineSlotLockStartIndex: return 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 if TRUE == self.__SetItem((attachedInvenType, attachedSlotPos), selectedSlotPos, attachedItemCount): self.Refresh() except Exception, e: import dbg dbg.TraceError("Exception : __SelectRefineEmptySlot, %s" % e)
def __InventoryLocalSlotPosToGlobalSlotPos(self, local): if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or ( app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)): return local return self.inventoryPageIndex * player.INVENTORY_PAGE_SIZE + local
def __SellItem(self, itemSlotPos): if not player.IsEquipmentSlot(itemSlotPos): self.sellingSlotNumber = itemSlotPos itemIndex = player.GetItemIndex(itemSlotPos) itemCount = player.GetItemCount(itemSlotPos) item.SelectItem(itemIndex) itemPrice = item.GetISellItemPrice() if item.Is1GoldItem(): itemPrice = itemCount / itemPrice / 5 else: itemPrice = itemPrice * itemCount / 5 item.GetItemName(itemIndex) itemName = item.GetItemName() self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText( locale.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice)) self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem)) self.questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) self.questionDialog.Open() self.questionDialog.count = itemCount
def __SellItem(self, itemSlotPos): if not player.IsEquipmentSlot(itemSlotPos): self.sellingSlotNumber = itemSlotPos itemIndex = player.GetItemIndex(itemSlotPos) itemCount = player.GetItemCount(itemSlotPos) self.sellingSlotitemIndex = itemIndex self.sellingSlotitemCount = itemCount item.SelectItem(itemIndex) ## 안티 플레그 검사 빠져서 추가 ## 20140220 if item.IsAntiFlag(item.ANTIFLAG_SELL): popup = uiCommon.PopupDialog() popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM) popup.SetAcceptEvent(self.__OnClosePopupDialog) popup.Open() self.popup = popup return itemPrice = player.GetISellItemPrice(itemSlotPos) item.GetItemName(itemIndex) itemName = item.GetItemName() self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText( localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice)) self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem)) self.questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) self.questionDialog.Open() self.questionDialog.count = itemCount constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
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 __InventoryLocalSlotPosToGlobalSlotPos(self, local): if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or player.IsBeltInventorySlot(local): return local return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
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)