def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
if item.IsRefineScroll(srcItemVNum):
return True
elif item.IsMetin(srcItemVNum):
return True
elif item.IsDetachScroll(srcItemVNum):
return True
elif item.IsKey(srcItemVNum):
return True
elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
return True
elif constInfo.ENABLE_SELF_STACK_SCROLLS and srcItemVNum in (71052,71051,71084,71085,70024):
return True
else:
if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
return True
return False
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 constInfo.ENABLE_SELF_STACK_SCROLLS and player.GetItemIndex(dstSlotPos) == srcItemVNum:
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 srcItemVNum in (71084, 71085, 70024):
dstVnum = player.GetItemIndex(dstSlotPos)
if not self.__IsWeaponOrArmor(dstVnum):
return False
attr_count = self.__GetAttrCount(dstSlotPos)
if srcItemVNum == 71085:
return attr_count < 5
if srcItemVNum == 71084:
return attr_count > 0
if srcItemVNum == 70024:
return attr_count == 4
elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
return True
elif constInfo.ENABLE_SELF_STACK_SCROLLS and srcItemVNum in (71052,71051,71084,71085,70024):
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)
item.SelectItem(dstItemVNum)
if item.ITEM_TYPE_BELT == item.GetItemType():
return True
elif app.ENABLE_USE_COSTUME_ATTR and "USE_CHANGE_COSTUME_ATTR" == useType:
if self.__CanChangeCostumeAttrList(dstSlotPos):
return True
elif app.ENABLE_USE_COSTUME_ATTR and "USE_RESET_COSTUME_ATTR" == useType:
if self.__CanResetCostumeAttr(dstSlotPos):
return True
return False
def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
if srcItemSlotPos == dstItemSlotPos:
return
if app.ENABLE_SOULBIND_SYSTEM and item.IsSealScroll(srcItemVID):
self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
elif item.IsRefineScroll(srcItemVID):
if constInfo.ENABLE_SELF_STACK_SCROLLS and player.GetItemIndex(srcItemSlotPos) == player.GetItemIndex(dstItemSlotPos):
self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos,0)
else:
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)
elif constInfo.ENABLE_SELF_STACK_SCROLLS and srcItemVID in (71052,71051,71084,71085,70024):
self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
else:
if player.IsEquipmentSlot(dstItemSlotPos):
if item.IsEquipmentVID(srcItemVID):
self.__UseItem(srcItemSlotPos)
else:
self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
def __get_attr_limit(self):
try:
return player.ATTRIBUTE_SLOT_MAX_NUM
except:
return 7
def __GetAttrCount(self, dstSlotPos):
limit = self.__get_attr_limit()
cnt = 0
for i in xrange(limit):
if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
cnt += 1
return cnt
def __IsWeaponOrArmor(self, vnum):
if vnum == 0:
return False
item.SelectItem(vnum)
t = item.GetItemType()
return t == item.ITEM_TYPE_WEAPON or t == item.ITEM_TYPE_ARMOR