Skip to content

Commit

Permalink
Add Pokemon Form & Costume filtering for Pokemon & Raid alarms (#58)
Browse files Browse the repository at this point in the history
* Add filtering by forms for Pokemon alerts

* Add Pokemon costume alarm filtering

* Add raid boss form filtering for alarms

* Add raid alarm filtering by costume
  • Loading branch information
versx authored Jan 11, 2021
1 parent 506b66a commit 33ea28c
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 92 deletions.
132 changes: 68 additions & 64 deletions examples/filters/default.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,68 @@
{
"pokemon":
{
"enabled": true, // Filter is enabled
"pokemon": [280,337,374], // List of Pokemon for the filter or empty for all
"min_iv": 0, // Minimum IV of Pokemon to send
"max_iv": 100, // Maximum IV of Pokemon to send
"min_cp": 0, // Minimum CP of Pokemon
"max_cp": 999999, // Maximum CP of Pokemon
"gender": "m", // Only send male (m,f,*)
"size": "Big", // Tiny, Small, Normal, Large, Big
"great_league": true, // Great League
"ultra_league": true, // Ultra League
"min_rank": 1, // Minimum rank of #1 PVP stats
"max_rank": 5, // Maximum rank of #5 PVP stats
"type": "Include", // Include or Exclude the `pokemon` list
"is_event": false, // Only send Pokemon checked with event accounts (GoFest, etc)
"ignoreMissing": true // Ignore Pokemon missing stats
},
"eggs":
{
"enabled": true, // Filter is enabled
"min_lvl": 1, // Minimum egg level to send
"max_lvl": 6, // Maximum egg level to send
"onlyEx": false, // Only send ex-eligible raids.
"team": "All", // All, Valor, Mystic, Instinct, Neutral
},
"raids":
{
"enabled": true, // Filter is enabled
"pokemon": [], // Raid bosses to include or none for all.
"min_lvl": 1, // Minimum raid level to send
"max_lvl": 6, // Maximum raid level to send
"type": "Include", // Include or Exclude the `pokemon` list
"onlyEx": false, // Only send ex-eligible raids.
"team": "All", // All, Valor, Mystic, Instinct, Nuetral
"ignoreMissing": true // Ignore raids missing stats
},
"quests":
{
"enabled": true, // Filter is enabled
"rewards": ["spinda", "nincada"], // Quest reward string (Chansey, stardust, candy, etc.)
"isShiny": false, // Only shiny encounter quests.
"type": "Include" // Include or Exclude the `rewards` list
},
"pokestops":
{
"enabled": true, // Filter is enabled
"lured": false, // Only send lured pokestops
"lure_types": ["Normal", "Glacial", "Mossy", "Magnetic"], // All lure types
"invasions": false // Only send Team Rocket invasion pokestops
},
"gyms":
{
"enabled": true, // Filter is enabled
"underAttack": true, // Only gyms that are under attack
"team": "All" // Team change to notify about (i.e. Neutral/Mystic/Valor/Instinct/All)
},
"weather":
{
"enabled": true, // Filter is enabled
"types": ["Clear", "Rainy", "PartlyCloudy", "Overcast", "Windy", "Snow", "Fog"] // Only send weather types that are in the list
}
}
{
"pokemon":
{
"enabled": true, // Filter is enabled
"pokemon": [280,337,374], // List of Pokemon for the filter or empty for all
"forms": ["Alola","Galarian"], // List of forms for the filter or empty for all
"costumes": ["Detective","Holiday"], // List of costumes for the filter or empty for all
"min_iv": 0, // Minimum IV of Pokemon to send
"max_iv": 100, // Maximum IV of Pokemon to send
"min_cp": 0, // Minimum CP of Pokemon
"max_cp": 999999, // Maximum CP of Pokemon
"gender": "m", // Only send male (m,f,*)
"size": "Big", // Tiny, Small, Normal, Large, Big
"great_league": true, // Great League
"ultra_league": true, // Ultra League
"min_rank": 1, // Minimum rank of #1 PVP stats
"max_rank": 5, // Maximum rank of #5 PVP stats
"type": "Include", // Include or Exclude the `pokemon` list
"is_event": false, // Only send Pokemon checked with event accounts (GoFest, etc)
"ignoreMissing": true // Ignore Pokemon missing stats
},
"eggs":
{
"enabled": true, // Filter is enabled
"min_lvl": 1, // Minimum egg level to send
"max_lvl": 6, // Maximum egg level to send
"onlyEx": false, // Only send ex-eligible raids.
"team": "All", // All, Valor, Mystic, Instinct, Neutral
},
"raids":
{
"enabled": true, // Filter is enabled
"pokemon": [], // Raid bosses to include or none for all.
"costumes": ["Detective","Holiday"], //List of costumes for the filter or empty for all
"forms": ["Alola","Galarian"], //List of forms for the filter or empty for all
"min_lvl": 1, // Minimum raid level to send
"max_lvl": 6, // Maximum raid level to send
"type": "Include", // Include or Exclude the `pokemon` list
"onlyEx": false, // Only send ex-eligible raids.
"team": "All", // All, Valor, Mystic, Instinct, Nuetral
"ignoreMissing": true // Ignore raids missing stats
},
"quests":
{
"enabled": true, // Filter is enabled
"rewards": ["spinda", "nincada"], // Quest reward string (Chansey, stardust, candy, etc.)
"isShiny": false, // Only shiny encounter quests.
"type": "Include" // Include or Exclude the `rewards` list
},
"pokestops":
{
"enabled": true, // Filter is enabled
"lured": false, // Only send lured pokestops
"lure_types": ["Normal", "Glacial", "Mossy", "Magnetic"], // All lure types
"invasions": false // Only send Team Rocket invasion pokestops
},
"gyms":
{
"enabled": true, // Filter is enabled
"underAttack": true, // Only gyms that are under attack
"team": "All" // Team change to notify about (i.e. Neutral/Mystic/Valor/Instinct/All)
},
"weather":
{
"enabled": true, // Filter is enabled
"types": ["Clear", "Rainy", "PartlyCloudy", "Overcast", "Windy", "Snow", "Fog"] // Only send weather types that are in the list
}
}
49 changes: 32 additions & 17 deletions src/Alarms/Filters/Models/FilterPokemonObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,106 +13,118 @@
public class FilterPokemonObject
{
/// <summary>
/// Enable pokemon filter
/// Gets or sets a value determining whether to enable the pokemon filter
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }

/// <summary>
/// List of pokemon pokedex IDs to filter against
/// Gets or sets the list of pokemon pokedex IDs to filter against
/// </summary>
//TODO: Allow pokemon names and ids for pokemon filter.
[JsonProperty("pokemon")]
public List<int> Pokemon { get; set; }

/// <summary>
/// Minimum IV value to report
/// Gets or sets the list of pokemon Form strings to filter against
/// </summary>
[JsonProperty("forms")]
public List<string> Forms { get; set; }

/// <summary>
/// Gets or sets the list of Pokemon costume strings to filter against
/// </summary>
[JsonProperty("costumes")]
public List<string> Costumes { get; set; }

/// <summary>
/// Gets or sets the minimum IV value to report
/// </summary>
[JsonProperty("min_iv")]
public uint MinimumIV { get; set; }

/// <summary>
/// Maximum IV value to report
/// Gets or sets the maximum IV value to report
/// </summary>
[JsonProperty("max_iv")]
public uint MaximumIV { get; set; }

/// <summary>
/// Minimum CP value to report
/// Gets or sets the minimum CP value to report
/// </summary>
[JsonProperty("min_cp")]
public uint MinimumCP { get; set; }

/// <summary>
/// Maximum CP value to report
/// Gets or sets the maximum CP value to report
/// </summary>
[JsonProperty("max_cp")]
public uint MaximumCP { get; set; }

/// <summary>
/// Minimum level value to report
/// Gets or sets the minimum level value to report
/// </summary>
[JsonProperty("min_lvl")]
public uint MinimumLevel { get; set; }

/// <summary>
/// Maximum level value to report
/// Gets or sets the maximum level value to report
/// </summary>
[JsonProperty("max_lvl")]
public uint MaximumLevel { get; set; }

/// <summary>
/// Pokemon gender to filter by
/// Gets or sets the Pokemon gender to filter by
/// </summary>
[JsonProperty("gender")]
public char Gender { get; set; }

/// <summary>
/// Pokemon size to filter by
/// Gets or sets the Pokemon size to filter by
/// </summary>
[JsonProperty("size")]
public PokemonSize? Size { get; set; }

/// <summary>
/// Only great league PvP eligible Pokemon
/// Gets or sets a value determining to filter only great league PvP eligible Pokemon
/// </summary>
[JsonProperty("great_league")]
public bool IsPvpGreatLeague { get; set; }

/// <summary>
/// Only ultra league PvP eligible Pokemon
/// Gets or sets a value determining to filter only ultra league PvP eligible Pokemon
/// </summary>
[JsonProperty("ultra_league")]
public bool IsPvpUltraLeague { get; set; }

/// <summary>
/// Minimum PvP rank to report
/// Gets or sets the minimum PvP rank to report
/// </summary>
[JsonProperty("min_rank")]
public uint MinimumRank { get; set; }

/// <summary>
/// Maximum PvP rank to report
/// Gets or sets the maximum PvP rank to report
/// </summary>
[JsonProperty("max_rank")]
public uint MaximumRank { get; set; }

//TODO: Filter by move?

/// <summary>
/// Pokemon filter type
/// Gets or sets the Pokemon filter type
/// </summary>
[JsonProperty("type")]
public FilterType FilterType { get; set; }

/// <summary>
/// Event Pokemon flag indicating it was checked with an event account
/// Gets or sets a value determining whether a Pokemon was checked with an event account
/// </summary>
[JsonProperty("is_event")]
public bool IsEvent { get; set; }

/// <summary>
/// Ignore Pokemon missing stats
/// Gets or sets a value determining whether to ignore Pokemon missing stats
/// </summary>
[JsonProperty("ignoreMissing")]
public bool IgnoreMissing { get; set; }
Expand All @@ -122,6 +134,9 @@ public class FilterPokemonObject
/// </summary>
public FilterPokemonObject()
{
Pokemon = new List<int>();
Forms = new List<string>();
Costumes = new List<string>();
MinimumIV = 0;
MaximumIV = 100;
MinimumCP = 0;
Expand Down
31 changes: 23 additions & 8 deletions src/Alarms/Filters/Models/FilterRaidObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,62 @@
public class FilterRaidObject
{
/// <summary>
/// Enable raid boss filter
/// Gets or sets a value determining whether to enable the raid boss filter
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }

/// <summary>
/// Minimum raid level
/// Gets or sets the minimum raid level
/// </summary>
[JsonProperty("min_lvl")]
public uint MinimumLevel { get; set; }

/// <summary>
/// Maximum raid level
/// Gets or sets the maximum raid level
/// </summary>
[JsonProperty("max_lvl")]
public uint MaximumLevel { get; set; }

/// <summary>
/// Raid boss pokedex ID list to filter against
/// Gets or sets the Raid boss pokedex ID list to filter against
/// </summary>
//TODO: Allow pokemon names and ids for raid filter.
[JsonProperty("pokemon")]
public List<int> Pokemon { get; set; }

/// <summary>
/// Raid boss filter type
/// Gets or sets the list of Raid Boss Pokemon Form strings to filter against
/// </summary>
[JsonProperty("forms")]
public List<string> Forms { get; set; }

/// <summary>
/// Gets or sets the list of Raid Boss Pokemon costume strings to filter against
/// </summary>
[JsonProperty("costumes")]
public List<string> Costumes { get; set; }

/// <summary>
/// Gets or sets the Raid boss filter type
/// </summary>
[JsonProperty("type")]
public FilterType FilterType { get; set; }

/// <summary>
/// Only report ex-eligible raids
/// Gets or sets a value determining whether to only report ex-eligible raids
/// </summary>
[JsonProperty("onlyEx")]
public bool OnlyEx { get; set; }

/// <summary>
/// Gym team control filter
/// Gets or sets the Gym team control filter
/// </summary>
[JsonProperty("team")]
public PokemonTeam Team { get; set; }

/// <summary>
/// Ignore raids missing stats
/// Gets or sets a value determining whether to ignore raids missing stats
/// </summary>
[JsonProperty("ignoreMissing")]
public bool IgnoreMissing { get; set; }
Expand All @@ -66,6 +78,9 @@ public class FilterRaidObject
/// </summary>
public FilterRaidObject()
{
Pokemon = new List<int>();
Forms = new List<string>();
Costumes = new List<string>();
MinimumLevel = 1;
MaximumLevel = 5;
Team = PokemonTeam.All;
Expand Down
1 change: 0 additions & 1 deletion src/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
using DSharpPlus.CommandsNext;
using DSharpPlus.Interactivity;

// TODO: Subscriptions, Pokemon, Raid, Quest, Invasion, Gym, Weather alarm statistics by day. date/pokemonId/count
// TODO: List all subscriptions with info command
// TODO: Multiple discord bot tokens per server
// TODO: Check nests again
Expand Down
4 changes: 2 additions & 2 deletions src/Localization/Translator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ public string GetPokemonName(int pokeId)
return Translate($"poke_{pokeId}");
}

public string GetFormName(int formId)
public string GetFormName(int formId, bool includeNormal = false)
{
if (formId == 0)
return null;

var form = Translate("form_" + formId);
// TODO: Localize
if (string.Compare(form, "Normal", true) == 0)
if (!includeNormal && string.Compare(form, "Normal", true) == 0)
return string.Empty;
return form;
}
Expand Down
Loading

0 comments on commit 33ea28c

Please sign in to comment.