Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions PoGo.PokeMobBot.CLI/ConsoleEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ public void HandleEvent(SnipeScanEvent evt, ISession session)
$"{evt.Bounds.Latitude},{evt.Bounds.Longitude}"));
}

public void HandleEvent(PokemonEncounterEvent evt, ISession session)
{
Logger.Write(
$"{evt.WildPokemon.PokemonId.ToString().PadRight(16, ' ')} | " +
$"Lvl: {Logic.PoGoUtils.PokemonInfo.GetLevel(evt.WildPokemon),2:#0} | " +
$"CP: {evt.WildPokemon.Cp,4:###0}/{Logic.PoGoUtils.PokemonInfo.CalculateMaxCp(evt.WildPokemon),4:###0} | " +
$"IV: {Logic.PoGoUtils.PokemonInfo.CalculatePokemonPerfection(evt.WildPokemon),6:##0.00}% | " +
$"[{evt.WildPokemon.IndividualAttack,2:#0}/{evt.WildPokemon.IndividualDefense,2:#0}/{evt.WildPokemon.IndividualStamina,2:#0}] | " +
$"Location: {evt.MapPokemon.Latitude},{evt.MapPokemon.Longitude}",
LogLevel.Caught, ConsoleColor.Green);
}

public void HandleEvent(DisplayHighestsPokemonEvent evt, ISession session)
{
string strHeader;
Expand Down
14 changes: 14 additions & 0 deletions PoGo.PokeMobBot.Logic/Event/PokemonEncounterEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#region using directives

using POGOProtos.Enums;

#endregion

namespace PoGo.PokeMobBot.Logic.Event
{
public class PokemonEncounterEvent : IEvent
{
public POGOProtos.Data.PokemonData WildPokemon { get; set; }
public POGOProtos.Map.Pokemon.MapPokemon MapPokemon { get; set; }
}
}
1 change: 1 addition & 0 deletions PoGo.PokeMobBot.Logic/PoGo.PokeMobBot.Logic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<Compile Include="DataDumper\Dumper.cs" />
<Compile Include="Common\Translations.cs" />
<Compile Include="Event\DebugEvent.cs" />
<Compile Include="Event\PokemonEncounterEvent.cs" />
<Compile Include="Event\PokemonSettingsEvent.cs" />
<Compile Include="Event\UseLuckyEggMinPokemonEvent.cs" />
<Compile Include="Event\DisplayHighestsPokemonEvent.cs" />
Expand Down
20 changes: 20 additions & 0 deletions PoGo.PokeMobBot.Logic/Tasks/CatchPokemonTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ public static async Task Execute(ISession session, dynamic encounter, MapPokemon
throw new ArgumentException("Parameter pokemon must be set, if encounter is of type EncounterResponse",
"pokemon");

if (encounter is EncounterResponse)
{
session.EventDispatcher.Send(new PokemonEncounterEvent
{
WildPokemon = encounter.WildPokemon?.PokemonData,
MapPokemon = pokemon
});

DataDumper.Dumper.Dump(session,
$"[{DateTime.Now.ToString("HH:mm:ss")}] | " +
$"{encounter.WildPokemon?.PokemonData?.PokemonId.ToString().PadRight(16, ' ')} | " +
$"Lvl: {PokemonInfo.GetLevel(encounter.WildPokemon?.PokemonData),2:#0} | " +
$"CP: {encounter.WildPokemon?.PokemonData?.Cp,4:###0}/{PokemonInfo.CalculateMaxCp(encounter.WildPokemon?.PokemonData),4:###0} | " +
$"IV: {PokemonInfo.CalculatePokemonPerfection(encounter.WildPokemon?.PokemonData),6:##0.00}% | " +
$"[{encounter.WildPokemon?.PokemonData?.IndividualAttack,2:#0}/{encounter.WildPokemon?.PokemonData?.IndividualDefense,2:#0}/{encounter.WildPokemon?.PokemonData?.IndividualStamina,2:#0}] | " +
$"Location: {pokemon.Latitude},{pokemon.Longitude} | " +
$"EncounterId: {pokemon.EncounterId}",
"encounters");
}

CatchPokemonResponse caughtPokemonResponse;
var attemptCounter = 1;
do
Expand Down