def ShowToolTip(self, slot): item.SelectItem(self.itemSlotsList[slot]) self.itemtooltip.ClearToolTip() self.itemtooltip.AddItemData(self.itemSlotsList[slot], [0, 0, 0, 0, 0, 0]) time = 0 if item.GetItemType() == 16: if item.GetValue(0) > 0: time = item.GetValue(0) if item.GetItemType() == 28: (limittype, limitvalue) = item.GetLimit(0) time = int(limitvalue / 60) if item.GetItemType() == 18: (limittype, limitvalue) = item.GetLimit(0) if limittype == 7 and limitvalue > 0: time = int(limitvalue / 60) if time > 0: time = int(time / 60) time_str = "Stunden" if time >= 48: time = int(time / 24) time_str = "Tage" self.itemtooltip.AppendSpace(5) self.itemtooltip.AppendTextLine( "[ Laufzeit ]", self.itemtooltip.SPECIAL_TITLE_COLOR) self.itemtooltip.AppendTextLine( str(time) + " " + str(time_str), self.itemtooltip.NORMAL_COLOR) #currencyNames = ["Yang","AP's","DP's"] currencyType = self.itemCurrencyType[slot] currencyCount = self.itemCurrencyCount[slot] if currencyCount > self.currencyPlayerCount: self.CurrencyTextLine.SetFontColor(0.9, 0.4745, 0.4627) else: self.CurrencyTextLine.SetFontColor(0.5411, 0.7254, 0.5568) self.itemtooltip.AppendSpace(5) self.itemtooltip.AppendTextLine("[ Kaufpreis ]", self.itemtooltip.SPECIAL_TITLE_COLOR) self.itemtooltip.AppendTextLine( constInfo.NumberToPointString(currencyCount) + " " + self.currencyNames[currencyType], self.itemtooltip.NORMAL_COLOR) self.itemtooltip.ShowToolTip()
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 SelectEmptySlot(self, slotIndex): ## 마우스에 아이템이 붙어 있어야 함 if not mouseModule.mouseController.isAttached(): return attachedSlotType = mouseModule.mouseController.GetAttachedType() attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemVnum = player.GetItemIndex(attachedSlotPos) item.SelectItem(attachedItemVnum) itemType = item.GetItemType() if player.SLOT_TYPE_INVENTORY != attachedSlotType: return if attachedSlotPos >= player.ITEM_SLOT_COUNT: return if itemType != item.ITEM_TYPE_SKILLBOOK: return for index, key in self.SkillBookList.items(): if attachedSlotPos == key[1]: return mouseModule.mouseController.DeattachObject() self.SkillBookList[slotIndex] = (attachedSlotType, attachedSlotPos, 1) self.Slot.SetItemSlot(slotIndex, attachedItemVnum) self.Slot.RefreshSlot()
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 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 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
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
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
def OnShowItemTooltip(self, vnum): item.SelectItem(vnum) if item.GetItemType() == item.ITEM_TYPE_METIN: self.itemTooltip.isStone = True self.itemTooltip.isBook = False self.itemTooltip.isBook2 = False self.itemTooltip.SetItemToolTip(self.lastStoneVnum) else: self.itemTooltip.isStone = False self.itemTooltip.isBook = True self.itemTooltip.isBook2 = True self.itemTooltip.SetItemToolTip(vnum)
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
def AppendItem(self, listBox, vnums, count, rarity = 0): if type(vnums) == int: vnum = vnums else: vnum = vnums[0] item.SelectItem(vnum) itemName = item.GetItemName() if type(vnums) != int and len(vnums) > 1: vnums = sorted(vnums) realName = itemName[:itemName.find("+")] if item.GetItemType() == item.ITEM_TYPE_METIN: realName = localeInfo.TARGET_INFO_STONE_NAME itemName = realName + "+0 - +4" else: itemName = realName + "+" + str(vnums[0] % 10) + " - +" + str(vnums[len(vnums) - 1] % 10) vnum = vnums[len(vnums) - 1] myItem = self.ItemListBoxItem(listBox.GetWidth()) myItem.LoadImage(item.GetIconImageFileName()) if count <= 1: myItem.SetText(itemName) else: myItem.SetText("%dx %s" % (count, itemName)) if app.ENABLE_SEND_TARGET_INFO_EXTENDED: myItem.SetRarity(rarity) myItem.SAFE_SetOverInEvent(self.OnShowItemTooltip, vnum) myItem.SAFE_SetOverOutEvent(self.OnHideItemTooltip) listBox.AppendItem(myItem) if item.GetItemType() == item.ITEM_TYPE_METIN: self.stoneImg = myItem self.stoneVnum = vnums self.lastStoneVnum = self.STONE_LAST_VNUM + vnums[len(vnums) - 1] % 1000 / 100 * 100 return myItem.GetHeight()
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
def isRodAbleToLevelUp(self): idx = player.GetItemIndex(player.EQUIPMENT, item.EQUIPMENT_WEAPON) if (idx == 0): return False item.SelectItem(idx) currPoints = player.GetItemMetinSocket(player.EQUIPMENT, item.EQUIPMENT_WEAPON, 0) maxPoints = item.GetValue(2) if currPoints == maxPoints and item.GetItemType( ) == item.ITEM_TYPE_ROD: chat.AppendChat(3, "[Fishing-Bot] Rod is ready to be upgraded.") return True return False
def __CanCleanBrokenMetinStone(self, dstSlotPos): dstItemVNum = player.GetItemIndex(dstSlotPos) if dstItemVNum == 0: return FALSE item.SelectItem(dstItemVNum) if item.ITEM_TYPE_WEAPON != item.GetItemType(): return FALSE for i in xrange(player.METIN_SOCKET_MAX_NUM): if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE: return TRUE return FALSE
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()
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 GetItemByType(_id): """ Return the slot index of the first item with the specified type in the inventory. Args: _id ([int]): The type of the item. Returns: [int]: Returns the slot index that matches the type or returns -1 if it is not found. """ for i in range(0, MAX_INVENTORY_SIZE): curr_id = player.GetItemIndex(i) if curr_id == 0: continue item.SelectItem(curr_id) if item.GetItemType() == _id: return i return -1
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
def isItemTypeOnSlot(_type, invType=player.EQUIPMENT, slot=item.EQUIPMENT_WEAPON): """ Check if a specified item type exists in a specified slot. Args: _type ([int]): The item type. invType ([int], optional): The inventory type. Defaults to player.EQUIPMENT. slot ([type], optional): The slot number. Defaults to item.EQUIPMENT_WEAPON. Returns: [bool]: Returns True if item exist with the specified type or False otherwise. """ idx = player.GetItemIndex(invType, slot) if idx != 0: item.SelectItem(idx) if item.GetItemType() == _type: return True return False
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
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]
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 __IsDragonSoul(self, vnum): item.SelectItem(vnum) return item.GetItemType() == item.ITEM_TYPE_DS
def ShowToolTip(self, slot): index = self.slotLink[slot] itemInfo = self.shopContent[self.category]["category_content"][index] item.SelectItem(itemInfo["item_vnum"]) self.itemtooltip.ClearToolTip() self.itemtooltip.AddItemData(itemInfo["item_vnum"], [0, 0, 0, 0, 0, 0]) time = 0 if item.GetItemType() == 16: if item.GetValue(0) > 0: time = item.GetValue(0) if item.GetItemType() == 28: (limittype, limitvalue) = item.GetLimit(0) time = int(limitvalue / 60) if item.GetItemType() == 18: (limittype, limitvalue) = item.GetLimit(0) if limittype == 7 and limitvalue > 0: time = int(limitvalue / 60) if time > 0: time = int(time / 60) time_str = localeInfo.HOUR if time >= 48: time = int(time / 24) time_str = localeInfo.DAY self.itemtooltip.AppendSpace(5) self.itemtooltip.AppendTextLine( localeInfo.MULTISHOP_RUNTIME, self.itemtooltip.SPECIAL_TITLE_COLOR) self.itemtooltip.AppendTextLine( str(time) + " " + str(time_str), self.itemtooltip.NORMAL_COLOR) self.itemtooltip.AppendSpace(5) self.itemtooltip.AppendTextLine(localeInfo.MULTISHOP_BUY, self.itemtooltip.SPECIAL_TITLE_COLOR) if itemInfo["currency_type"] == self.CURRENCY_TYPE_GOLD: self.itemtooltip.AppendTextLine( constInfo.NumberToPointString(itemInfo["currency_count"]) + " " + localeInfo.MULTISHOP_CURRENCY_GOLD, self.itemtooltip.NORMAL_COLOR) elif itemInfo["currency_type"] == self.CURRENCY_TYPE_ACHIEVEMENT: self.itemtooltip.AppendTextLine( constInfo.NumberToPointString(itemInfo["currency_count"]) + " " + localeInfo.MULTISHOP_CURRENCY_ACHIEVEMENT, self.itemtooltip.NORMAL_COLOR) elif itemInfo["currency_type"] == self.CURRENCY_TYPE_DUNGEON: self.itemtooltip.AppendTextLine( constInfo.NumberToPointString(itemInfo["currency_count"]) + " " + localeInfo.MULTISHOP_CURRENCY_DUNGEON, self.itemtooltip.NORMAL_COLOR) elif itemInfo["currency_type"] == self.CURRENCY_TYPE_ITEMSHOP: self.itemtooltip.AppendTextLine( constInfo.NumberToPointString(itemInfo["currency_count"]) + " " + localeInfo.MULTISHOP_CURRENCY_COINS, self.itemtooltip.NORMAL_COLOR) elif itemInfo["currency_type"] == self.CURRENCY_TYPE_ITEM: item.SelectItem(itemInfo["currency_vnum"]) self.itemtooltip.AppendTextLine( constInfo.NumberToPointString(itemInfo["currency_count"]) + "x " + item.GetItemName()) self.itemtooltip.AppendSpace(5) self.itemtooltip.AppendTextLine( localeInfo.TOOLTIP_MULTISHOP_SHORTCUT_BUY_MORE, self.itemtooltip.NORMAL_COLOR) self.itemtooltip.ShowToolTip()
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)
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])