예제 #1
0
파일: LeechApp.cs 프로젝트: vlshl/leech
        public LeechApp(ILeechConfig config, IBotManager botManager, IBotsConfiguration botsConfig, ITickDispatcher tickDisp, IDataStorage dataStorage,
                        IInstrumTable insTable, IStopOrderTable stopOrderTable, IOrderTable orderTable, ITradeTable tradeTable,
                        IHoldingTable holdingTable, ICashTable positionTable, AccountTable accountTable, IInsStoreData insStoreData, ILogger logger)
        {
            _config         = config;
            _scheduler      = new Scheduler(logger);
            _botsConfig     = botsConfig;
            _tickDispatcher = tickDisp;
            _botManager     = botManager;
            _dataStorage    = dataStorage;
            _accountTable   = accountTable;
            _instrumTable   = insTable;
            _orderTable     = orderTable;
            _tradeTable     = tradeTable;
            _stopOrderTable = stopOrderTable;
            _holdingTable   = holdingTable;
            _cashTable      = positionTable;
            _insStoreData   = insStoreData;
            _logger         = logger;
            _dataProtect    = IoC.Resolve <DataProtect>();
            _lpClientApp    = new LpClientApp(_dataProtect, _instrumTable, _accountTable, _stopOrderTable, _orderTable,
                                              _tradeTable, _cashTable, _holdingTable, _tickDispatcher, _logger);

            _allTradesData = new AllTradesData(_instrumTable, _insStoreData, _logger);
            _alorTrade     = new AlorTradeWrapper(_instrumTable, _stopOrderTable, _orderTable, _tradeTable,
                                                  _holdingTable, _cashTable, _accountTable,
                                                  _tickDispatcher, _config, _logger);
        }
예제 #2
0
        public void botSetState(string bot, string State)
        {
            //this is a test case of being able to get access to a property
            //of the actual rexbot itself through the botAPI
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                RexBot rxbot;
                rxbot = (RexBot)manager.GetBot(UUID.Parse(bot));
                //follow up with this
                switch (State.ToLower())
                {
                case "walking":
                    rxbot.State = RexBot.RexBotState.Walking;
                    break;

                case "idle":
                    rxbot.State = RexBot.RexBotState.Idle;
                    break;

                case "flying":
                    rxbot.State = RexBot.RexBotState.Flying;
                    break;

                default:
                    rxbot.State = RexBot.RexBotState.Unknown;
                    break;
                }
            }
        }
예제 #3
0
        public void llPursue(LSL_String target, LSL_List options)
        {
            IBotManager botManager = World.RequestModuleInterface <IBotManager>();

            if (botManager != null)
            {
                float   fuzz       = 2;
                Vector3 offset     = Vector3.Zero;
                bool    requireLOS = false;
                // 20131224 not used                bool intercept;  = false; //Not implemented
                for (int i = 0; i < options.Length; i += 2)
                {
                    LSL_Integer opt = options.GetLSLIntegerItem(i);
                    if (opt == ScriptBaseClass.PURSUIT_FUZZ_FACTOR)
                    {
                        fuzz = (float)options.GetLSLFloatItem(i + 1).value;
                    }
                    if (opt == ScriptBaseClass.PURSUIT_OFFSET)
                    {
                        offset = options.GetVector3Item(i + 1).ToVector3();
                    }
                    if (opt == ScriptBaseClass.REQUIRE_LINE_OF_SIGHT)
                    {
                        requireLOS = options.GetLSLIntegerItem(i + 1) == 1;
                    }
                    // 20131224 not used                    if (opt == ScriptBaseClass.PURSUIT_INTERCEPT)
                    // 20131224 not used                        intercept = options.GetLSLIntegerItem(i + 1) == 1;
                }
                botManager.FollowAvatar(m_host.ParentEntity.UUID, target.m_string, fuzz, fuzz, requireLOS, offset,
                                        m_host.ParentEntity.OwnerID);
            }
        }
예제 #4
0
        public void botSetMap(string keyOfBot, LSL_List positions, LSL_List movementType, LSL_Integer flags)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetMap", m_host, "bot", m_itemID))
            {
                return;
            }
            List <Vector3> PositionsMap = new List <Vector3>();

            for (int i = 0; i < positions.Length; i++)
            {
                LSL_Vector pos = positions.GetVector3Item(i);
                PositionsMap.Add(new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
            }
            List <TravelMode> TravelMap = new List <TravelMode>();

            for (int i = 0; i < movementType.Length; i++)
            {
                LSL_Integer travel = movementType.GetLSLIntegerItem(i);
                TravelMap.Add((TravelMode)travel.value);
            }

            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.SetBotMap(UUID.Parse(keyOfBot), PositionsMap, TravelMap, flags.value, m_host.OwnerID);
            }
        }
예제 #5
0
        public Game()
        {
            GameBuilder builder = new GameBuilder();

            Cg = builder.CustomGameBuilder();

            Phases = builder.PhaseManagerBuilder();
            _loop  = builder.LoopBuilder(Phases);

            Chat = builder.ChatBuilder(Cg.Chat);

            //ISlotContentHistory slotContentHistory = builder.SlotContentHistoryBuilder();


            BotsModifiedFlag modifiedFlag = new BotsModifiedFlag();

            Slots = builder.SlotBuilder(Cg.AI, FilledSlotsFunc, modifiedFlag);

            Bots = builder.BotBuilder(Cg.AI, Slots, modifiedFlag);
            //Players = new PlayerManager(this);

            //Match = new MatchManager(this);


            //Logger = new MatchLogger(this);

            //Maps = new MapChooser(this, Map.A_HorizonLunarColony); //todolater get this from the user. Also need to load preset


            //Joins = new JoinManager(this);

            //Loop.AddPhaselessLoop(IncrementTime, 1);
        }
예제 #6
0
 public App(ILogger logger, IConfiguration configuration, IBotManager manager, ILiteDatabase database)
 {
     _logger   = logger;
     _config   = configuration;
     _manager  = manager;
     _database = database;
 }
예제 #7
0
 /// <summary>
 /// Initializes an instance of middleware
 /// </summary>
 /// <param name="next">Instance of request delegate</param>
 /// <param name="botManager">Bot manager for the bot</param>
 /// <param name="logger">Logger for this middleware</param>
 public TelegramGameScoreMiddleware(RequestDelegate next,
                                    IBotManager <TBot> botManager,
                                    ILogger <TelegramGameScoreMiddleware <TBot> > logger)
 {
     _next       = next;
     _logger     = logger;
     _botManager = (IInternalBotManager <TBot>)botManager;
 }
 /// <summary>
 /// Initializes an instance of middleware
 /// </summary>
 /// <param name="next">Instance of request delegate</param>
 /// <param name="botManager">Bot manager for the bot</param>
 /// <param name="logger">Logger for this middleware</param>
 public TelegramBotMiddleware(RequestDelegate next,
                              IBotManager <TBot> botManager,
                              ILogger <TelegramBotMiddleware <TBot> > logger)
 {
     _next       = next;
     _botManager = botManager;
     _logger     = logger;
 }
예제 #9
0
파일: BotNotifier.cs 프로젝트: Olya73/Chat
 public BotNotifier(IMapper mapper,
                    IBotManager botManager,
                    IServiceScopeFactory serviceScopeFactory)
 {
     _mapper              = mapper;
     _botManager          = botManager;
     _serviceScopeFactory = serviceScopeFactory;
 }
예제 #10
0
        public void llDeleteCharacter()
        {
            IBotManager botManager = World.RequestModuleInterface <IBotManager>();

            if (botManager != null)
            {
                botManager.RemoveCharacter(m_host.ParentEntity.UUID);
            }
        }
예제 #11
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botSendChatMessage(string bot, string message, int sayType)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager> ();

            if (manager != null)
            {
                manager.SendChatMessage(UUID.Parse(bot), message, sayType);
            }
        }
예제 #12
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botSetPathMap(string bot, string pathMap, int x, int y, int cornerstoneX, int cornerstoneY)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager> ();

            if (manager != null)
            {
                manager.ReadMap(UUID.Parse(bot), pathMap, x, y, cornerstoneX, cornerstoneY);
            }
        }
예제 #13
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botRemoveBot(string bot)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager> ();

            if (manager != null)
            {
                manager.RemoveAvatar(UUID.Parse(bot), m_host.ParentEntity.Scene);
            }
        }
예제 #14
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botStopFollowAvatar(string bot, string avatarName)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager> ();

            if (manager != null)
            {
                manager.StopFollowAvatar(UUID.Parse(bot), avatarName);
            }
        }
예제 #15
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botStart(string bot)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.EnableAutoMove(UUID.Parse(bot));
            }
        }
예제 #16
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botResume(string bot)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.UnpauseAutoMove(UUID.Parse(bot));
            }
        }
예제 #17
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botSetShouldFly(string keyOfBot, int ShouldFly)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager> ();

            if (manager != null)
            {
                manager.SetBotShouldFly(UUID.Parse(keyOfBot), ShouldFly == 1);
            }
        }
예제 #18
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public string botCreateBot(string FirstName, string LastName, string appearanceToClone)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                return(manager.CreateAvatar(FirstName, LastName, m_host.ParentEntity.Scene, UUID.Parse(appearanceToClone)).ToString());
            }
            return("");
        }
예제 #19
0
파일: Bot_API.cs 프로젝트: kow/Aurora-Sim
        public void botFindPath(string bot, LSL_Vector startPos, LSL_Vector endPos)
        {
            IBotManager manager = World.RequestModuleInterface <IBotManager> ();

            if (manager != null)
            {
                manager.FindPath(UUID.Parse(bot), new Vector3((float)startPos.x, (float)startPos.y, (float)startPos.z),
                                 new Vector3((float)endPos.x, (float)endPos.y, (float)endPos.z));
            }
        }
예제 #20
0
        public void llCreateCharacter(LSL_List options)
        {
            IBotManager botManager = World.RequestModuleInterface <IBotManager>();

            if (botManager != null)
            {
                botManager.CreateCharacter(m_host.ParentEntity.UUID, World);
                llUpdateCharacter(options);
            }
        }
        /// <summary>
        /// Removes and disables webhooks for bot
        /// </summary>
        /// <typeparam name="TBot">Type of bot</typeparam>
        /// <param name="app">Instance of IApplicationBuilder</param>
        /// <param name="ensureWebhookDisabled">If true, a request is immediately made to delete webhook</param>
        /// <returns>Instance of IApplicationBuilder</returns>
        public static IApplicationBuilder UseTelegramBotLongPolling <TBot>(this IApplicationBuilder app, bool ensureWebhookDisabled = true)
            where TBot : BotBase <TBot>
        {
            IBotManager <TBot> botManager = FindBotManager <TBot>(app);

            if (ensureWebhookDisabled)
            {
                botManager.SetWebhookStateAsync(false).Wait();
            }

            return(app);
        }
예제 #22
0
        public string botSpawnAttackBot(string FirstName, string LastName, string appearanceToClone, string AvatarToFollowName)
        {
            UUID        botUUID;
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                botUUID = manager.SpawnAttackBot(FirstName, LastName, m_host.ParentEntity.Scene, UUID.Parse(appearanceToClone), AvatarToFollowName);
                return(botUUID.ToString());
            }
            return("");
        }
        /// <summary>
        /// Add Telegram bot webhook handling functionality to the pipeline
        /// </summary>
        /// <typeparam name="TBot">Type of bot</typeparam>
        /// <param name="app">Instance of IApplicationBuilder</param>
        /// <param name="ensureWebhookEnabled">Whether to set the webhook immediately by making a request to Telegram bot API</param>
        /// <returns>Instance of IApplicationBuilder</returns>
        public static IApplicationBuilder UseTelegramBotWebhook <TBot>(this IApplicationBuilder app, bool ensureWebhookEnabled = true)
            where TBot : BotBase <TBot>
        {
            IBotManager <TBot> botManager = FindBotManager <TBot>(app);

            if (ensureWebhookEnabled)
            {
                botManager.SetWebhookStateAsync(true).Wait();
            }

            return(app.UseMiddleware <TelegramBotMiddleware <TBot> >());
        }
예제 #24
0
        public void botAddTag(string bot, string tag)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botAddTag", m_host, "bot", m_itemID))
            {
                return;
            }
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.AddTagToBot(UUID.Parse(bot), tag, m_host.OwnerID);
            }
        }
예제 #25
0
        public void botSendIM(string bot, string user, string message)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSendIM", m_host, "bot", m_itemID))
            {
                return;
            }
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.SendIM(UUID.Parse(bot), UUID.Parse(user), message, m_host.OwnerID);
            }
        }
예제 #26
0
        public void botSendChatMessage(string bot, string message, int channel, int sayType)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSendChatMessage", m_host, "bot", m_itemID))
            {
                return;
            }
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.SendChatMessage(UUID.Parse(bot), message, sayType, channel, m_host.OwnerID);
            }
        }
예제 #27
0
        public void botStopFollowAvatar(string bot)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botStopFollowAvatar", m_host, "bot", m_itemID))
            {
                return;
            }
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.StopFollowAvatar(UUID.Parse(bot), m_host.OwnerID);
            }
        }
예제 #28
0
        public void botSetShouldFly(string keyOfBot, int ShouldFly)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetShouldFly", m_host, "bot", m_itemID))
            {
                return;
            }
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.SetBotShouldFly(UUID.Parse(keyOfBot), ShouldFly == 1, m_host.OwnerID);
            }
        }
예제 #29
0
        public void botRemoveBotsWithTag(string tag)
        {
            if (
                !ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botRemoveBotsWithTag", m_host, "bot", m_itemID))
            {
                return;
            }
            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.RemoveBots(tag, m_host.OwnerID);
            }
        }
예제 #30
0
        public void botSetSpeed(LSL_Key bot, LSL_Float SpeedModifier)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetSpeed", m_host, "OSSL", m_itemID))
            {
                return;
            }

            IBotManager manager = World.RequestModuleInterface <IBotManager>();

            if (manager != null)
            {
                manager.SetSpeed(UUID.Parse(bot), m_host.OwnerID, (float)SpeedModifier);
            }
        }
예제 #31
0
 public StartCommand(IDatabaseService db, IBotManager bot)
 {
     _db = db;
     _bot = bot;
 }
예제 #32
0
 public UnknownCommand(IBotManager bot)
 {
     _bot = bot;
 }
예제 #33
0
 public AllowUserCommand(IBotManager bot, Lazy<IDatabaseService> db)
 {
     _bot = bot;
     _db = db;
 }
예제 #34
0
 public ListCommand(IBotManager bot, IDatabaseService db, ICommandHelper commandHelper)
 {
     _bot = bot;
     _db = db;
     _commandHelper = commandHelper;
 }
예제 #35
0
 public CustomUserCommand(IDatabaseService databaseService, IBotManager botManager)
 {
     _db = databaseService;
     _bot = botManager;
 }
예제 #36
0
 public AddCommand(IBotManager bot, IDatabaseService db)
 {
     _bot = bot;
     _db = db;
 }
예제 #37
0
 public AdminCommand(IBotManager bot)
 {
     _bot = bot;
 }
예제 #38
0
 public SettingsCommand(IBotManager bot)
 {
     _bot = bot;
 }
예제 #39
0
 public HelpCommand(ICommandHelper commandHelper, IBotManager bot)
 {
     _commandHelper = commandHelper;
     _bot = bot;
 }
예제 #40
0
 public AliasCommand(IDatabaseService databaseService, IBotManager botManager, ICommandHelper commandHelper)
 {
     _db = databaseService;
     _bot = botManager;
     _commandHelper = commandHelper;
 }