Пример #1
0
        public static int[] InitializeTargetIVs(PokeTradeHub <PK8> hub)
        {
            int[] targetIVs = { -1, -1, -1, -1, -1, -1 };

            /* Populate targetIVs array.  Bot matches 0 and 31 IVs.
             * Any other nonzero IV is treated as a minimum accepted value.
             * If they put "x", this is a wild card so we can leave -1. */
            string[] splitIVs = hub.Config.StopConditions.TargetIVs.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            // Only accept up to 6 values in case people can't count.
            for (int i = 0; i < 6 && i < splitIVs.Length; i++)
            {
                var str = splitIVs[i];
                if (int.TryParse(str, out var val))
                {
                    targetIVs[i] = val;
                }
            }
            return(targetIVs);
        }
Пример #2
0
        public EncounterBot(PokeBotConfig cfg, PokeTradeHub <PK8> Hub) : base(cfg)
        {
            hub           = Hub;
            Counts        = Hub.Counts;
            DumpSetting   = Hub.Config.Folder;
            DesiredNature = Hub.Config.Encounter.DesiredNature;

            /* Populate DesiredIVs array.  Bot matches 0 and 31 IVs.
             * Any other nonzero IV is treated as a minimum accepted value.
             * If they put "x", this is a wild card so we can leave -1. */
            string[] splitIVs = Hub.Config.Encounter.DesiredIVs.Split(new [] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            // Only accept up to 6 values in case people can't count.
            for (int i = 0; i < 6 && i < splitIVs.Length; i++)
            {
                if (splitIVs[i] == "x" || splitIVs[i] == "X")
                {
                    continue;
                }
                DesiredIVs[i] = Convert.ToInt32(splitIVs[i]);
            }
        }
Пример #3
0
 public RaidBot(PokeBotConfig cfg, PokeTradeHub <PK8> hub) : base(cfg)
 {
     Hub      = hub;
     Settings = hub.Config.Raid;
     Counts   = hub.Counts;
 }
Пример #4
0
 public PokeTradeBot(PokeTradeHub <PK8> hub, PokeBotConfig cfg) : base(cfg)
 {
     Hub             = hub;
     DumpSetting     = hub.Config.Folder;
     GiveawaySetting = hub.Config.Giveaway;
 }
Пример #5
0
 public BotEnvironmentImpl(PokeTradeHub <PK8> hub) : base(hub)
 {
 }
Пример #6
0
 protected PokeBotRunner(PokeTradeHub <T> hub, BotFactory <T> factory)
 {
     Hub     = hub;
     Factory = factory;
 }
Пример #7
0
 public RaidBot(PokeBotState cfg, PokeTradeHub <PK8> hub) : base(cfg)
 {
     Hub      = hub;
     Settings = hub.Config.Raid;
 }
Пример #8
0
 public EncounterBotReset(PokeBotState cfg, PokeTradeHub <PK8> hub) : base(cfg, hub)
 {
 }
Пример #9
0
 public BoolBot(PokeBotState cfg, PokeTradeHub <PK8> hub) : base(cfg, hub)
 {
     Settings = Hub.Config.Bool;
 }
Пример #10
0
 protected PokeBotRunner(PokeTradeHub <PK8> hub) => Hub    = hub;
Пример #11
0
 public DenBot(PokeBotState cfg, PokeTradeHub <PK8> hub, RaidBot raid) : base(cfg)
 {
     Hub      = hub;
     Settings = hub.Config.Den;
     Raid     = raid;
 }
Пример #12
0
 public TradeQueueManager(PokeTradeHub <T> hub)
 {
     Hub  = hub;
     Info = new TradeQueueInfo <T>(hub);
 }
Пример #13
0
 public OverworldBot(PokeBotState cfg, PokeTradeHub <PK8> hub) : base(cfg)
 {
     Hub    = hub;
     Counts = Hub.Counts;
 }
Пример #14
0
        private void GenerateCompletedTrades <T>(PokeTradeHub <T> hub) where T : PKM, new()
        {
            var msg = string.Format(CompletedTradesFormat, hub.Config.Trade.CompletedTrades);

            File.WriteAllText("completed.txt", msg);
        }
Пример #15
0
        public void StartTrade <T>(PokeRoutineExecutorBase b, PokeTradeDetail <T> detail, PokeTradeHub <T> hub) where T : PKM, new()
        {
            if (!CreateAssets)
            {
                return;
            }

            try
            {
                if (CreateTradeStart)
                {
                    GenerateBotConnection(b, detail);
                }
                if (CreateWaitedTime)
                {
                    GenerateWaitedTime(detail.Time);
                }
                if (CreateEstimatedTime)
                {
                    GenerateEstimatedTime(hub);
                }
                if (CreateUsersInQueue)
                {
                    GenerateUsersInQueue(hub.Queues.Info.Count);
                }
                if (CreateOnDeck)
                {
                    GenerateOnDeck(hub);
                }
                if (CreateOnDeck2)
                {
                    GenerateOnDeck2(hub);
                }
                if (CreateUserList)
                {
                    GenerateUserList(hub);
                }
                if (CreateCompletedTrades)
                {
                    GenerateCompletedTrades(hub);
                }
                if (CreateTradeStartSprite)
                {
                    GenerateBotSprite(b, detail);
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                LogUtil.LogError(e.Message, nameof(StreamSettings));
            }
        }
Пример #16
0
 protected PokeBotRunner(PokeTradeHubConfig config, BotFactory <T> factory)
 {
     Factory = factory;
     Hub     = new PokeTradeHub <T>(config);
 }
Пример #17
0
 public PokeBotRunnerImpl(PokeTradeHub <PK8> hub) : base(hub)
 {
 }
Пример #18
0
 private async Task <byte[]> DenData(PokeTradeHub <PK8> hub, CancellationToken token) => await Connection.ReadBytesAsync(DenUtil.GetDenOffset(hub), 0x18, token).ConfigureAwait(false);
Пример #19
0
 public TradeExtensions(PokeTradeHub <PK8> hub)
 {
     Hub = hub;
 }
Пример #20
0
 public PokeTradeBot(PokeTradeHub <PK8> hub, PokeBotConfig cfg) : base(cfg) => Hub = hub;
Пример #21
0
 public override PokeRoutineExecutorBase CreateBot(PokeTradeHub <PB8> Hub, PokeBotState cfg) => cfg.NextRoutineType switch
 {
Пример #22
0
 public static void InitializeTargetIVs(PokeTradeHub <PK8> hub, out int[] min, out int[] max)
 {
     min = ReadTargetIVs(hub.Config.StopConditions, true);
     max = ReadTargetIVs(hub.Config.StopConditions, false);
     return;
 }
Пример #23
0
 public TradeQueueManager(PokeTradeHub <T> hub)
 {
     Hub       = hub;
     Info      = new TradeQueueInfo <T>(hub);
     AllQueues = new[] { Seed, Dump, Clone, Trade, };
 }
Пример #24
0
 public PokeBotRunnerImpl(PokeTradeHub <T> hub, BotFactory <T> fac) : base(hub, fac)
 {
 }
Пример #25
0
 public TradeQueueInfo(PokeTradeHub <T> hub) => Hub = hub;
Пример #26
0
 public EggBot(PokeTradeHub <PK8> hub, PokeBotConfig cfg) : base(cfg)
 {
     Counts      = hub.Counts;
     DumpSetting = hub.Config;
 }
Пример #27
0
 public QueueMonitor(PokeTradeHub <PK8> hub) => Hub = hub;
Пример #28
0
 protected BotEnvironment(PokeTradeHub <PK8> hub) => Hub    = hub;
Пример #29
0
 public PokeTradeBot(PokeTradeHub <PK8> hub, PokeBotConfig cfg) : base(cfg)
 {
     Hub         = hub;
     DumpSetting = hub.Config;
 }
Пример #30
0
 public PokeTradeBot(PokeTradeHub <PK8> hub, PokeBotState cfg) : base(cfg)
 {
     Hub         = hub;
     DumpSetting = hub.Config.Folder;
 }