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))); }
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}"); } }
public VillagerHelper(CrossBot bot, VillagerHouse[] houses, Villager2[] shells) { Bot = bot; Connection = Bot.Connection; VillagerHouses = new List <VillagerHouse>(houses); VillagerShells = new List <Villager2>(shells); updateVillagerList(); }
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(); }
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}"); }
public void OrderReady(CrossBot routine, string msg) { Trader.SendMessageAsync($"I'm waiting for you {Trader.Username}! {msg}"); }
public void SendNotification(CrossBot routine, string msg) { }
public void OrderReady(CrossBot routine, string msg) { }
public void OrderFinished(CrossBot routine, string msg) { }
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); }
public void OrderInitializing(CrossBot routine, string msg) { }