def __init__(self, console_path=CNSL_PLUGIN_PATH, find_cnsl=True, emitter_path=EMIT_PLUGIN_PATH, find_emitters=True, poll_interval=5, emit_interval=60): """Iterate over available PWS console plugins. Once a plugin is found that returns a connection object from its discover method, create an instance of the discovered console. """ #TODO Load config file self.poll_interval = poll_interval self.emit_interval = emit_interval self._obs = None self.db = Database() self.console = None self._console_path = console_path self.emitters = [] self._emitter_path = emitter_path if find_cnsl: self.find_console() if find_emitters: self.find_emitters()
import os from flask import Flask, Response, request from flask_cors import CORS from threading import Thread from mongo import Database from player import Player, get_status from settings import DB, DB_NAME, PROD_DB from algo import explore, traverse_player_to_target app = Flask(__name__) CORS(app) p = Player(get_status()) db = Database(DB, DB_NAME) db_id = db.get_id() atlas_db = Database(PROD_DB, DB_NAME) atlas_id = atlas_db.get_id() # MANUAL COMMANDS. ONLY RUN ONE AT A TIME # print(p.dash('w', '7', '327,256,243,178,90,86,80')) # print(f"{p.move('w')}") # print(f"{p.wise_explore('s', 22)}") # print(p.sell_item('nice jacket')) # print(p.examine_item('amazing treasure')) # print(p.examine_player('shiny treasure')) # print(f"{p.take_item('shiny treasure')}") # print(f"{p.drop_item('small treasure')}") # print(p.pray()) # print(p.fly('s'))