Ejemplo n.º 1
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
Ejemplo n.º 2
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