Exemplo n.º 1
0
    def OnClickOpenChest(self):
        if self.invItemPos == -1:
            return

        itemCount = player.GetItemCount(self.invItemPos)

        #	if player.GetItemTypeBySlot(self.invItemPos) == item.ITEM_TYPE_GACHA:
        #		itemCount = player.GetItemMetinSocket(player.INVENTORY, self.invItemPos, 0)

        if itemCount >= self.openAmount:
            for i in xrange(self.openAmount):
                if itemCount == 1:
                    net.SendItemUsePacket(self.invItemPos)
                    self.OnPressEscapeKey()
                    break

                net.SendItemUsePacket(self.invItemPos)
                itemCount = itemCount - 1
        else:
            for i in xrange(itemCount):
                if itemCount == 1:
                    net.SendItemUsePacket(self.invItemPos)
                    self.OnPressEscapeKey()
                    break

                net.SendItemUsePacket(self.invItemPos)
                itemCount = itemCount - 1
Exemplo n.º 2
0
	def __SendUseItemPacket(self, slotPos):
		# 개인상점 열고 있는 동안 아이템 사용 방지
		if uiPrivateShopBuilder.IsBuildingPrivateShop():
			chat.AppendChat(chat.CHAT_TYPE_INFO, locale.USE_ITEM_FAILURE_PRIVATE_SHOP)
			return

		net.SendItemUsePacket(slotPos)
Exemplo n.º 3
0
 def PlaceFireAndGrillFish(self):
     slot = OpenLib.GetItemByID(self.campFire)
     if slot != -1:
         net.SendItemUsePacket(slot)
         self.SetState(self.STATE_PLACE_FIRE)
         return
     chat.AppendChat(3, "[Fishing-bot] You need to buy a campfire first.")
Exemplo n.º 4
0
    def LevelUpRod(self):
        self.SetState(self.STATE_IMPROVING_ROD)
        self.stopFishing()
        if self.isMoving:
            return

        #Unequip weapon if it is a rod
        val = OpenLib.isItemTypeOnSlot(item.ITEM_TYPE_ROD, player.EQUIPMENT,
                                       item.EQUIPMENT_WEAPON)
        if val:
            chat.AppendChat(
                3, "[Fishing-Bot] Removing fishing rod from main weapon")
            net.SendItemUsePacket(player.EQUIPMENT, item.EQUIPMENT_WEAPON)
            return

        slot = OpenLib.GetItemByType(item.ITEM_TYPE_ROD)

        #Check if rod is already in inventory
        if slot == -1:
            chat.AppendChat(3, "[Fishing-Bot] Rod is not in inventory")
            return

        chat.AppendChat(3, "[Fishing-Bot] Request to shop sent")
        NPCInteraction.RequestGiveItemNPCAwayRestorePosition(
            [slot],
            NPCInteraction.GetFishermanUpgrade(),
            callback=_PositionRestoreCallback,
            pos=self.startPosition)
        self.isMoving = True
Exemplo n.º 5
0
def UseAnyItemByID(id_list):
    """
	Use the first item found that matches any of the id specified.

	Args:
		id_list ([list]): List of item ids.

	Returns:
		[int]: Returns 1 if the item was used or -1 otherwise.
	"""
    for i in range(0, MAX_INVENTORY_SIZE):
        if player.GetItemIndex(i) in id_list:
            net.SendItemUsePacket(i)
            return 1
    return -1
	def __Accept(self):
		if (-1, -1) == self.dstItemPos:
			net.SendItemUsePacket(*srcItemPos)
		else:
			self.__SendMoveItemPacket(*(self.srcItemPos + self.dstItemPos + (0,)))
		self.dlgQuestion.Close()
Exemplo n.º 7
0
    def CheckInv(self):
        fishIds = self.catches.keys()
        useBait = False
        dropFish = False
        wormSlot = -1
        pastSlot = -1

        #Check bait and fish killing
        for i in range(0, OpenLib.MAX_INVENTORY_SIZE):
            id = player.GetItemIndex(i)
            if self.wormID == id:
                wormSlot = i
            if self.pasteID == id:
                pastSlot = i
            if dropFish == False and id in self.hairIDs and self.hairBtn.isOn:
                dropFish = True
                net.SendItemDropPacketNew(i, 200)
                continue

            if id in self.liveFish:
                isAliveFish = True
            else:
                isAliveFish = False
            if id in self.deadFish:
                id -= 30
                isDeadFish = True
            else:
                isDeadFish = False

            if id in self.friedFish:
                id -= 60
                isFryFish = True
            else:
                isFryFish = False

            if id in fishIds:
                fishOptions = self.catches[id]

                if useBait == False and 'buttonBait' in fishOptions.keys(
                ) and fishOptions[
                        'buttonBait'].isOn and not isDeadFish and not isFryFish:
                    net.SendItemUsePacket(i)
                    useBait = True
                    continue
                if 'buttonOpen' in fishOptions.keys() and fishOptions[
                        'buttonOpen'].isOn and not isDeadFish and not isFryFish:
                    net.SendItemUsePacket(i)
                    continue
                if dropFish == False and 'buttonDrop' in fishOptions.keys(
                ) and fishOptions['buttonDrop'].isOn:
                    dropFish = True
                    net.SendItemDropPacketNew(i, player.GetItemCount(i))
                    continue

        #Check if inventory is full
        if OpenLib.isInventoryFull():
            self.GoToShop()
            return False

        #Check if rod is available
        val = OpenLib.isItemTypeOnSlot(item.ITEM_TYPE_ROD, player.EQUIPMENT,
                                       item.EQUIPMENT_WEAPON)
        if val == 0:
            slot = OpenLib.GetItemByType(item.ITEM_TYPE_ROD)
            if slot == -1:
                chat.AppendChat(
                    3, "[Fishing-Bot] No rod available, you need a rod first")
                self.exitFishing()
                return False
            else:
                net.SendItemUsePacket(slot)
                return False
        #Check if rod is ready to level up
        if self.rodBtn.isOn and self.isRodAbleToLevelUp():
            self.state = self.STATE_IMPROVING_ROD
            return False

        #Check for next bait to use
        if useBait == False:
            if wormSlot != -1:
                net.SendItemUsePacket(wormSlot)
                return True
            elif pastSlot != -1:
                net.SendItemUsePacket(pastSlot)
                return True
            else:
                if self.buyWormsBtn.isOn:
                    self.GoToShop()
                    return False
                else:
                    self.exitFishing()
                    chat.AppendChat(3, "[Fishing-Bot] No Worms left.")
                    return False

        return True