public void StartEnterCode(PokeTradeBot b) { if (!CreateAssets) { return; } try { var file = GetBlockFileName(b); if (CopyImageFile && File.Exists(TradeBlockFile)) { File.Copy(TradeBlockFile, file); } else { File.WriteAllBytes(file, BlackPixel); } } #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)); } }
private void GenerateBotConnection(PokeTradeBot b, PokeTradeDetail <PK8> detail) { var file = b.Connection.IP; var name = string.Format(TrainerTradeStart, detail.ID, detail.Trainer.TrainerName, (Species)detail.TradeData.Species); File.WriteAllText($"{file}.txt", name); }
private void GenerateBotConnection(PokeTradeBot b, PokeTradeDetail <PK8> detail) { var file = b.Config.ConnectionType == ConnectionType.WiFi ? b.Connection.IP : "USB" + b.Connection.UsbPortIndex; var name = string.Format(TrainerTradeStart, detail.ID, detail.Trainer.TrainerName, (Species)detail.TradeData.Species); File.WriteAllText($"{file}.txt", name); }
public void StartTrade(PokeTradeBot b, PokeTradeDetail <PK8> detail, PokeTradeHub <PK8> hub) { 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.Config.Counts); } 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)); } }
private static void GenerateBotSprite(PokeTradeBot b, PokeTradeDetail <PK8> detail) { var func = CreateSpriteFile; if (func == null) { return; } var file = b.Connection.IP; var pk = detail.TradeData; func.Invoke(pk, $"sprite_{file}.png"); }
private static void GenerateBotSprite(PokeTradeBot b, PokeTradeDetail <PK8> detail) { var func = CreateSpriteFile; if (func == null) { return; } var file = b.Config.ConnectionType == ConnectionType.WiFi ? b.Connection.IP : "USB" + b.Connection.UsbPortIndex; var pk = detail.TradeData; func.Invoke(pk, $"sprite_{file}.png"); }
public void IdleAssets(PokeTradeBot b) { if (!CreateAssets) { return; } try { var files = Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly); foreach (var file in files) { if (file.Contains(b.Config.ConnectionType == ConnectionType.WiFi ? b.Connection.IP : "USB" + b.Connection.UsbPortIndex)) { File.Delete(file); } } if (CreateWaitedTime) { File.WriteAllText("waited.txt", "00:00:00"); } if (CreateEstimatedTime) { File.WriteAllText("estimatedTime.txt", "Estimated time: 0 minutes"); File.WriteAllText("estimatedTimestamp.txt", ""); } if (CreateOnDeck) { File.WriteAllText("ondeck.txt", "Waiting..."); } if (CreateOnDeck2) { File.WriteAllText("ondeck2.txt", "Queue is empty!"); } if (CreateUserList) { File.WriteAllText("users.txt", "None"); } if (CreateUsersInQueue) { File.WriteAllText("queuecount.txt", "Users in Queue: 0"); } } #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)); } }
public void IdleAssets(PokeTradeBot b) { if (!CreateAssets) { return; } try { var files = Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly); foreach (var file in files) { if (file.Contains(b.Connection.IP)) { File.Delete(file); } } if (CreateWaitedTime) { File.WriteAllText("waited.txt", "00:00:00"); } if (CreateEstimatedTime) { File.WriteAllText("estimatedTime.txt", "Estimated time: 0 minutes"); File.WriteAllText("estimatedTimestamp.txt", ""); } if (CreateOnDeck) { File.WriteAllText("ondeck.txt", "Waiting..."); } if (CreateOnDeck2) { File.WriteAllText("ondeck2.txt", "Queue is empty!"); } if (CreateUserList) { File.WriteAllText("users.txt", "None"); } if (CreateUsersInQueue) { File.WriteAllText("queuecount.txt", "Users in Queue: 0"); } } catch (Exception e) { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
public void EndEnterCode(PokeTradeBot b) { try { var file = GetBlockFileName(b); if (File.Exists(file)) { File.Delete(file); } } catch (Exception e) { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
public void StartTrade(PokeTradeBot b, PokeTradeDetail <PK8> detail, PokeTradeHub <PK8> hub) { 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.Config.Counts); } if (CreateTradeStartSprite) { GenerateBotSprite(b, detail); } } catch (Exception e) { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
public void EndEnterCode(PokeTradeBot b) { try { var file = GetBlockFileName(b); if (File.Exists(file)) { File.Delete(file); } } #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)); } }
public void StartEnterCode(PokeTradeBot b) { try { var file = GetBlockFileName(b); if (CopyImageFile && File.Exists(TradeBlockFile)) { File.Copy(TradeBlockFile, file); } else { File.WriteAllBytes(file, BlackPixel); } } catch (Exception e) { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
public void CalculateAndNotify(T pkm, PokeTradeDetail <T> detail, SeedCheckSettings settings, PokeTradeBot bot) { const string msg = "Seed searching implementation not found. " + "Please let the person hosting the bot know that they need to provide the required Z3 files."; detail.SendNotification(bot, msg); }
public void CalculateAndNotify(T pkm, PokeTradeDetail <T> detail, SeedCheckSettings settings, PokeTradeBot bot) { var ec = pkm.EncryptionConstant; var pid = pkm.PID; var IVs = pkm.IVs.Length == 0 ? GetBlankIVTemplate() : PKX.ReorderSpeedLast((int[])pkm.IVs.Clone()); var name = SpeciesName.GetSpeciesName(pkm.Species, 2); var ot = pkm.OT_Name; var abilityNo = pkm.AbilityNumber; var ability = pkm.Ability; var gender = pkm.GetSaneGender(); var nature = pkm.Nature; if (settings.ShowAllZ3Results) { var matches = Z3Search.GetAllSeeds(ec, pid, IVs, name, ot, gender, abilityNo, ability, nature); foreach (var match in matches) { var lump = new PokeTradeSummary("Calculated Seed:", match); detail.SendNotification(bot, lump); } } else { var match = Z3Search.GetFirstSeed(ec, pid, IVs, name, ot, gender, abilityNo, ability, nature); var lump = new PokeTradeSummary("Calculated Seed:", match); detail.SendNotification(bot, lump); } }
private string GetBlockFileName(PokeTradeBot b) => string.Format(TradeBlockFormat, b.Connection.IP);
public void CalculateAndNotify(T pkm, PokeTradeDetail <T> detail, SeedCheckSettings settings, PokeTradeBot bot) { var ec = pkm.EncryptionConstant; var pid = pkm.PID; var IVs = pkm.IVs.Length == 0 ? GetBlankIVTemplate() : PKX.ReorderSpeedLast((int[])pkm.IVs.Clone()); if (settings.ShowAllZ3Results) { var matches = Z3Search.GetAllSeeds(ec, pid, IVs); foreach (var match in matches) { var lump = new PokeTradeSummary("Calculated Seed:", match); detail.SendNotification(bot, lump); } } else { var match = Z3Search.GetFirstSeed(ec, pid, IVs); var lump = new PokeTradeSummary("Calculated Seed:", match); detail.SendNotification(bot, lump); } }
private string GetBlockFileName(PokeTradeBot b) => string.Format(TradeBlockFormat, b.Config.ConnectionType == ConnectionType.WiFi ? b.Connection.IP : "USB" + b.Connection.UsbPortIndex);