示例#1
0
 private void HandleAbortedTrade(PokeTradeDetail <PB8> detail, PokeRoutineType type, uint priority, PokeTradeResult result)
 {
     detail.IsProcessing = false;
     if (result.ShouldAttemptRetry() && detail.Type != PokeTradeType.Random && !detail.IsRetry)
     {
         detail.IsRetry = true;
         Hub.Queues.Enqueue(type, detail, Math.Min(priority, PokeTradePriorities.Tier2));
         detail.SendNotification(this, "Oops! Something happened. I'll requeue you for another attempt.");
     }
     else
     {
         detail.SendNotification(this, $"Oops! Something happened. Canceling the trade: {result}.");
         detail.TradeCanceled(this, result);
     }
 }
示例#2
0
        public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
        {
            OnFinish?.Invoke(routine);
            var line = $"@{info.Trainer.TrainerName}: Trade canceled, {msg}";

            LogUtil.LogText(line);
            SendMessage(line, Settings.TradeCanceledDestination);
        }
示例#3
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
 {
     LogUtil.LogInfo($"Canceling trade with {info.Trainer.TrainerName}, because {msg}.", routine.Connection.Name);
     OnFinish?.Invoke(routine);
 }
示例#4
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
 {
     OnFinish?.Invoke(routine);
     Context.User.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false);
 }
示例#5
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
 {
     Client.SendMessage(Channel, $"Trade canceled: {msg}");
     OnFinish?.Invoke(routine);
 }
示例#6
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeResult msg) => Notifier.TradeCanceled(routine, this, msg);
示例#7
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
 {
     OnFinish?.Invoke(routine);
     Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false);
     if (info.Type == PokeTradeType.TradeCord)
     {
         TradeExtensions.TradeStatusUpdate(Trader.Id.ToString(), true);
     }
 }
示例#8
0
 public static bool AttemptRetry(this PokeTradeResult t) => t != PokeTradeResult.Success && t >= PokeTradeResult.Aborted;
示例#9
0
 public static bool ShouldAttemptRetry(this PokeTradeResult t) => t >= PokeTradeResult.RoutineCancel;
示例#10
0
        public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
        {
            OnFinish?.Invoke(routine);
            if (info.Type == PokeTradeType.TradeCord)
            {
                var user = Context.User.Id.ToString();
                var path = TradeExtensions.TradeCordPath.FirstOrDefault(x => x.Contains(user));
                TradeExtensions.TradeCordPath.Remove(path);
            }

            Context.User.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false);
        }
示例#11
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
 {
     OnFinish?.Invoke(routine);
     Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false);
     if (msg == PokeTradeResult.NoTrainerFound)
     {
         CommandSentChannel.SendMessageAsync($"{Trader.Mention} - Something happened with your trade: {msg}. This has been reported.");
     }
 }
示例#12
0
        public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
        {
            OnFinish?.Invoke(routine);
            Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false);

            var hub   = new PokeTradeHub <PK8>(new PokeTradeHubConfig());
            var qInfo = new TradeQueueInfo <PK8>(hub);

            if (qInfo.Count != 0)
            {
                string gameText = $"{SysCordInstance.Settings.BotGameStatus.Replace("{0}", $"Completed Trade #{info.ID}")}";
                Context.Client.SetGameAsync(gameText).ConfigureAwait(false);
            }
            else
            {
                string gameText = $"{SysCordInstance.Settings.BotGameStatus.Replace("{0}", $"Queue is Empty")}";
                Context.Client.SetGameAsync(gameText).ConfigureAwait(false);
            }
        }
示例#13
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
 {
     OnFinish?.Invoke(routine);
     NotifyServerOfState(WebTradeState.Canceled);
 }
示例#14
0
        public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
        {
            if (Hub.Config.Trade.EggRaffle && info.TradeData.IsEgg)
            {
                System.IO.StreamReader reader = new System.IO.StreamReader("EggRngBlacklist.txt");
                var content = reader.ReadToEnd();
                reader.Close();

                var id    = System.Text.RegularExpressions.Regex.Match(Context.User.Mention, @"\D*(\d*)", System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value;
                var parse = System.Text.RegularExpressions.Regex.Match(content, @"(" + id + @") - (\S*\ \S*\ \w*)", System.Text.RegularExpressions.RegexOptions.Multiline);
                if (content.Contains(id))
                {
                    content = content.Replace(parse.Groups[0].Value, $"{id} - 1/11/2000 12:00:00 AM").TrimEnd();
                    System.IO.StreamWriter writer = new System.IO.StreamWriter("EggRngBlacklist.txt");
                    writer.WriteLine(content);
                    writer.Close();
                    OnFinish?.Invoke(routine);
                    Context.User.SendMessageAsync($"Trade canceled: {msg}. EggRaffle cooldown was reset.").ConfigureAwait(false);
                }
            }
            else
            {
                OnFinish?.Invoke(routine);
                Context.User.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false);
            }
        }
示例#15
0
        public void TradeCanceled(PokeRoutineExecutor <T> routine, PokeTradeDetail <T> info, PokeTradeResult msg)
        {
            if (info.Type == PokeTradeType.TradeCord)
            {
                TradeCordHelper <T> .HandleTradedCatches(Trader.Id, false);
            }

            OnFinish?.Invoke(routine);
            Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false);
        }