Esempio n. 1
0
        public SysCord(CrossBot bot)
        {
            Bot     = bot;
            _client = new DiscordSocketClient(new DiscordSocketConfig
            {
                // How much logging do you want to see?
                LogLevel = LogSeverity.Info,

                // If you or another service needs to do anything with messages
                // (eg. checking Reactions, checking the content of edited/deleted messages),
                // you must set the MessageCacheSize. You may adjust the number as needed.
                //MessageCacheSize = 50,
            });

            _commands = new CommandService(new CommandServiceConfig
            {
                // Again, log level:
                LogLevel = LogSeverity.Info,

                // This makes commands get run on the task thread pool instead on the websocket read thread.
                // This ensures long running logic can't block the websocket connection.
                DefaultRunMode = RunMode.Sync,

                // There's a few more properties you can set,
                // for example, case-insensitive commands.
                CaseSensitiveCommands = false,
            });

            // Subscribe the logging handler to both the client and the CommandService.
            _client.Log   += Log;
            _commands.Log += Log;

            // Setup your DI container.
            _services = ConfigureServices();
        }
        public static async Task <uint> GetCurrentPlayerOffset(this CrossBot bot, uint rootInventoryOffset, uint playerSize, CancellationToken token)
        {
            var names = await FetchPlayerNames(bot.Connection, rootInventoryOffset, playerSize, token).ConfigureAwait(false);

            LogUtil.LogInfo($"Found the following players on your island: {string.Join(", ", names)}", bot.Config.IP);
            return(rootInventoryOffset + (playerSize * ((uint)names.Length - 1)));
        }
Esempio n. 3
0
 public VisitorListHelper(CrossBot bot)
 {
     BotRunner       = bot;
     Connection      = BotRunner.SwitchConnection;
     Config          = BotRunner.Config;
     LastVisitorDiff = new VisitorDifference(Visitors);
 }
 public void OrderCancelled(CrossBot routine, string msg, bool faulted)
 {
     OnFinish?.Invoke(routine);
     Trader.SendMessageAsync($"Oops! Something has happened with your order: {msg}");
     if (!faulted)
     {
         CommandSentChannel.SendMessageAsync($"{Trader.Mention} - Your order has been cancelled: {msg}");
     }
 }
Esempio n. 5
0
        public VillagerHelper(CrossBot bot, VillagerHouse[] houses, Villager2[] shells)
        {
            Bot        = bot;
            Connection = Bot.Connection;

            VillagerHouses = new List <VillagerHouse>(houses);
            VillagerShells = new List <Villager2>(shells);
            updateVillagerList();
        }
Esempio n. 6
0
        public VillagerHelper(CrossBot bot, VillagerHouse2[] houses, Villager2[] shells)
        {
            Bot        = bot;
            Connection = Bot.Connection;

            VillagerHouses = new List <VillagerHouse2>(houses);
            VillagerShells = new List <Villager2>(shells);

            OriginalVillagers = new string[VillagerShells.Count];
            for (int i = 0; i < VillagerShells.Count; ++i)
            {
                OriginalVillagers[i] = shells[i].InternalName;
            }

            UpdateVillagerList();
        }
Esempio n. 7
0
        public static async Task <VillagerHelper> GenerateHelper(CrossBot bot, CancellationToken token)
        {
            LogUtil.LogInfo("Fetching villager data, please wait...", bot.Config.IP);
            // houses
            var housesData = await bot.Connection.ReadBytesAsync((uint)OffsetHelper.VillagerHouseAddress, ExpectedHouseSize, token).ConfigureAwait(false);

            var houses = new VillagerHouse[10];

            for (int i = 0; i < 10; ++i)
            {
                houses[i] = new VillagerHouse(housesData.Skip(i * VillagerHouse.SIZE).Take(VillagerHouse.SIZE).ToArray());
            }

            // villager shells
            var villagers = await GetVillagerShells(bot.Connection, true, token).ConfigureAwait(false);

            LogUtil.LogInfo("Villager data loaded...", bot.Config.IP);
            return(new VillagerHelper(bot, houses, villagers));
        }
 public void OrderReady(CrossBot routine, string msg, string dodo)
 {
     Trader.SendMessageAsync($"I'm waiting for you {Trader.Username}! {msg}. Your Dodo code is **{dodo}**");
 }
 public void OrderInitializing(CrossBot routine, string msg)
 {
     Trader.SendMessageAsync($"Your order is starting, please **ensure your inventory is __empty__**, then go talk to Orville and stay on the Dodo code entry screen. I will send you the Dodo code shortly. {msg}");
 }
Esempio n. 10
0
 public void OrderReady(CrossBot routine, string msg)
 {
     Trader.SendMessageAsync($"I'm waiting for you {Trader.Username}! {msg}");
 }
Esempio n. 11
0
 public void SendNotification(CrossBot routine, string msg)
 {
 }
Esempio n. 12
0
 public void OrderReady(CrossBot routine, string msg)
 {
 }
Esempio n. 13
0
 public void OrderFinished(CrossBot routine, string msg)
 {
 }
Esempio n. 14
0
 public void OrderCancelled(CrossBot routine, string msg, bool faulted)
 {
 }
 public DodoPositionHelper(CrossBot bot)
 {
     BotRunner  = bot;
     Connection = BotRunner.Connection;
     Config     = BotRunner.Config;
 }
 public void OrderFinished(CrossBot routine, string msg)
 {
     OnFinish?.Invoke(routine);
     Trader.SendMessageAsync($"Your order is complete, Thanks for your order! {msg}");
 }
 public void SendNotification(CrossBot routine, string msg)
 {
     Trader.SendMessageAsync(msg);
 }
Esempio n. 18
0
 public void OrderInitializing(CrossBot routine, string msg)
 {
 }