Ejemplo n.º 1
0
 def CheckChangeLocation(self):
     currLevel = player.GetStatus(player.LEVEL)
     resultLoc = 0
     for loc in self.locations:
         if loc.level > currLevel:
             continue
         if resultLoc == 0:
             resultLoc = loc
             continue
         if loc.level > resultLoc.level:
             resultLoc = loc
     if resultLoc != 0 and (
             int(resultLoc.locationX) != int(self.startPosition[0])
             or int(resultLoc.locationY) != int(self.startPosition[1])
             or background.GetCurrentMapName() != resultLoc.map):
         chat.AppendChat(
             3, "Going to " + str(resultLoc.map) + " X:" +
             str(resultLoc.locationX) + " Y:" + str(resultLoc.locationY))
         self.SetStateWait()
         Movement.GoToPositionAvoidingObjects(
             resultLoc.locationX,
             resultLoc.locationY,
             callback=self._PositionArriveCallback,
             mapName=resultLoc.map)
         self.startPosition = (resultLoc.locationX, resultLoc.locationY)
         return True
     return False
Ejemplo n.º 2
0
 def TeleportToDest(self, aimx, aimy):
     global TeleportHackMode, timerrBlock
     val, timerrBlock = OpenLib.timeSleep(
         timerrBlock, 2)  #Avoid multiple calls on same keypress
     if val == False:
         return
     if TeleportHackMode == "Walk":
         chat.AppendChat(3, str(aimx) + " " + str(aimy))
         Movement.GoToPositionAvoidingObjects(aimx, aimy)
     else:
         Movement.TeleportToPosition(aimx, aimy)
Ejemplo n.º 3
0
    def Frame(self):
        if self.levelState == self.STATE_LEVELING:
            if self.allowLocChanger and self.CheckChangeLocation():
                return
            monster = self.GetNextMonster()
            if monster != 0:
                OpenLib.AttackTarget(monster)
            elif self.goToCenter:
                Movement.GoToPositionAvoidingObjects(self.startPosition[0],
                                                     self.startPosition[1])

        elif self.levelState == self.STATE_WAIT:
            return
Ejemplo n.º 4
0
    def OnUpdate(self):
        val, self.lastTime = OpenLib.timeSleep(self.lastTime, 0.1)
        if (val and self.enableButton.isOn and OpenLib.IsInGamePhase()):
            if self.state == self.STATE_WAITING:
                valWaitState, self.lastTimeWaitState = OpenLib.timeSleep(
                    self.lastTimeWaitState,
                    self.WaitDelaySlider.GetSliderPos() * 10)
                if valWaitState:
                    if self.CheckInv() == False:
                        return
                    net_packet.SendStartFishing(2)
                    chat.AppendChat(
                        3, "[Fishing-Bot] Using bait, and start fishing")
                    self.SetState(self.STATE_FISHING)
                    self.lastTimeFishState = OpenLib.GetTime()
                    self.isRodDown = True
                    self.isMoving = False

            if self.state == self.STATE_FISHING:
                valFishState, self.lastTimeFishState = OpenLib.timeSleep(
                    self.lastTimeFishState,
                    self.StartStopDelaySlider.GetSliderPos() * 10)
                if valFishState:
                    chat.AppendChat(3, "[Fishing-Bot] Pulling Rod")
                    net_packet.SendStopFishing(
                        net_packet.SUCCESS_FISHING,
                        self.ServerDelaySlider.GetSliderPos() * 10)
                    self.lastTimeWaitState = OpenLib.GetTime()
                    self.SetState(self.STATE_WAITING)
                    self.isRodDown = False

            if self.state == self.STATE_GOING_TO_SHOP:
                #The callback will take care of leaving the state
                pass

            if self.state == self.STATE_IMPROVING_ROD:
                val, self.lastTimeImprove = OpenLib.timeSleep(
                    self.lastTimeImprove, 0.5)
                if not val:
                    return

                self.LevelUpRod()

        if self.state == self.STATE_PLACE_FIRE:
            val, self.lastTimeFire = OpenLib.timeSleep(self.lastTimeFire, 0.2)
            if not val:
                return
            for vid in net_packet.InstancesList:
                chr.SelectInstance(vid)
                race = chr.GetRace()
                if race == self.campFireRace:
                    self.GrillFishes(vid)
                    if self.enableButton.isOn:
                        Movement.GoToPositionAvoidingObjects(
                            self.startPosition[0],
                            self.startPosition[1],
                            callback=_PositionRestoreCallback,
                            maxDist=250)
                        self.SetState(self.STATE_GOING_TO_SHOP)
                    else:
                        self.SetState(self.STATE_WAITING)
Ejemplo n.º 5
0
 def GoToPosition(self, callback=None):
     return Movement.GoToPositionAvoidingObjects(self.position[0],
                                                 self.position[1],
                                                 mapName=self.mapName,
                                                 callback=callback)
Ejemplo n.º 6
0
def _ReturnToPositionCallBack():
    #global originalFunctionCallback
    chat.AppendChat(3, "Going Back")
    Movement.GoToPositionAvoidingObjects(originalPosition[0],
                                         originalPosition[1],
                                         callback=originalFunctionCallback)