mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-09-10 11:15:14 -05:00
Hide gen6 pokemon from GTS search.
This commit is contained in:
@@ -258,5 +258,26 @@ namespace PkmnFoundations.Pokedex
|
||||
{
|
||||
return m_location_values_generations[generation];
|
||||
}
|
||||
|
||||
public static int SpeciesAtGeneration(Generations generation)
|
||||
{
|
||||
switch (generation)
|
||||
{
|
||||
case Generations.Generation1:
|
||||
return 151;
|
||||
case Generations.Generation2:
|
||||
return 251;
|
||||
case Generations.Generation3:
|
||||
return 386;
|
||||
case Generations.Generation4:
|
||||
return 493;
|
||||
case Generations.Generation5:
|
||||
return 649;
|
||||
case Generations.Generation6:
|
||||
return 721;
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using PkmnFoundations.Structures;
|
||||
|
||||
namespace PkmnFoundations.Web.controls
|
||||
{
|
||||
@@ -27,5 +28,19 @@ namespace PkmnFoundations.Web.controls
|
||||
theLookup.Value = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private Generations m_max_generation;
|
||||
public Generations MaxGeneration
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_max_generation;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_max_generation = value;
|
||||
theLookup.SourceUrl = "~/controls/PokemonSource.ashx?limit=" + Pokedex.Pokedex.SpeciesAtGeneration(value).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,12 +20,18 @@ namespace PkmnFoundations.Web.controls
|
||||
query = query.ToLowerInvariant();
|
||||
int natDex = 0;
|
||||
Int32.TryParse(query, out natDex);
|
||||
int limit = 0;
|
||||
if (context.Request.QueryString["limit"] != null)
|
||||
{
|
||||
limit = Convert.ToInt32(context.Request.QueryString["limit"]);
|
||||
if (natDex > limit) return null;
|
||||
}
|
||||
|
||||
Func<KeyValuePair<int, Species>, bool> filter;
|
||||
if (natDex > 0)
|
||||
filter = pair => pair.Key == natDex;
|
||||
else
|
||||
filter = pair => pair.Value.Name[iso].ToLowerInvariant().Contains(query);
|
||||
filter = pair => pair.Key <= limit && pair.Value.Name[iso].ToLowerInvariant().Contains(query);
|
||||
|
||||
IEnumerable<Species> data;
|
||||
data = pokedex.Species.Where(filter).OrderBy(pair => pair.Key).Take(rows).Select(pair => pair.Value);
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
<tr class="pfFormPair">
|
||||
<th class="pfFormKey">Species</th>
|
||||
<td class="pfFormValue">
|
||||
<pf:PokemonPicker ID="ppSpecies" runat="server" />
|
||||
<%-- todo: limit pokemon to gen4 when gen4 is checked --%>
|
||||
<pf:PokemonPicker ID="ppSpecies" MaxGeneration="Generation5" runat="server" />
|
||||
</td>
|
||||
|
||||
<th class="pfFormKey" rowspan="3">Version</th>
|
||||
|
||||
Reference in New Issue
Block a user