Beispiel #1
0
	def go_to_bank(self):
		path_to_bank = data.BankPath
		self.debug(f"Go to Bank (path: {path_to_bank})")
		instructions = tools.read_file(tools.get_full_path(path_to_bank))
		if instructions:
			self.interpret(instructions, ignore_start_from_step=True)
		else:
			self.pause()
			self.log('Error: Could not interpret to go to bank path')
Beispiel #2
0
 def load_group_list(self):
     logger.info('load group list')
     group_list_file = "grouplist/%s" % self.qq
     group_list = read_file(group_list_file)
     for group in group_list:
         ginfo = group.split('\t', 1)
         gid = ginfo[0]
         gname = ginfo[1] if len(ginfo) >= 2 else "Unknown"
         self.groups[gid] = Group(gid, gname)
     return 0
Beispiel #3
0
 def go_to_store(self, store_path):
     self.debug('Go to store (path: %s)' % store_path)
     if store_path in data.BankPath:
         instructions = data.BankPath[store_path]
     else:
         instructions = tools.read_file(tools.get_full_path(store_path))
     if instructions:
         self.interpret(instructions, ignore_start_from_step=True)
     else:
         self.pause()
         self.debug('Could not interpret store path')
         self.log('Bot is maybe full pod', LogType.Error)
Beispiel #4
0
	def on_load_path_button_clicked(self, button):
		dialog = OpenFileDialog('Load Path', self, ('Bot Path', '*.path'))
		dialog.set_current_folder(tools.get_full_path('paths'))
		response = dialog.run()

		if response == Gtk.ResponseType.OK:
			# read file
			path = tools.read_file(dialog.get_filename())
			# append to path listbox
			for line in path.splitlines():
				self.path_listbox.append_text(line)

		dialog.destroy()
Beispiel #5
0
    def run(self):
        self.start_timer()
        self.debug('Bot thread started', DebugLevel.Low)

        # connect to account
        account_connected = False
        if self.account_id is not None:
            self.debug('Connect to account (account_id: %s)' % self.account_id)
            self.connect(self.account_id)
            account_connected = True
            # check for pause
            self.pause_event.wait()

        # get instructions & interpret them
        if not self.suspend:
            self.debug('Bot path: %s, repeat: %d' %
                       (self.parent.bot_path, self.repeat_path))
            if self.parent.bot_path:
                instructions = tools.read_file(self.parent.bot_path)
                repeat_count = 0
                while repeat_count < self.repeat_path:
                    # check for pause or suspend
                    self.pause_event.wait()
                    if self.suspend: break
                    # start interpretation
                    self.interpret(instructions)
                    repeat_count += 1

                # tell user that we have complete the path
                if not self.suspend:
                    self.log('Bot path completed', LogType.Success)

        if not self.suspend:
            # disconnect account
            if account_connected and self.disconnect_after:
                self.debug('Disconnect account')
                self.disconnect(self.exit_game)
            # reset bot window buttons
            self.reset()

        self.debug(
            'Bot thread ended, elapsed time: ' + self.get_elapsed_time(),
            DebugLevel.Low)