Filter out your own pokemon from search results

This commit is contained in:
Greg Edwards 2014-04-28 02:44:49 -04:00
parent 334e63466e
commit 007c15b78b
3 changed files with 5 additions and 4 deletions

View File

@ -325,7 +325,7 @@ namespace PokeFoundations.GTS
if (data.Length > 11) country = data[11];
if (resultsCount > 7) resultsCount = 7; // stop DDOS
GtsDatagram4[] datagrams = DataAbstract.Instance.GtsSearch4(species, gender, minLevel, maxLevel, country, resultsCount);
GtsDatagram4[] datagrams = DataAbstract.Instance.GtsSearch4(pid, species, gender, minLevel, maxLevel, country, resultsCount);
foreach (GtsDatagram4 datagram in datagrams)
{
context.Response.OutputStream.Write(datagram.Save(), 0, 292);

View File

@ -38,7 +38,7 @@ namespace PokeFoundations.Data
public abstract bool GtsTradePokemon4(int pidSrc, int pidDest);
public abstract bool GtsTradePokemon4(GtsDatagram4 upload, GtsDatagram4 result);
public abstract GtsDatagram4[] GtsSearch4(ushort species, Genders gender, byte minLevel, byte maxLevel, byte country, int count);
public abstract GtsDatagram4[] GtsSearch4(int pid, ushort species, Genders gender, byte minLevel, byte maxLevel, byte country, int count);
#endregion
}

View File

@ -203,12 +203,13 @@ namespace PokeFoundations.Data
}
}
public override GtsDatagram4[] GtsSearch4(ushort species, Genders gender, byte minLevel, byte maxLevel, byte country, int count)
public override GtsDatagram4[] GtsSearch4(int pid, ushort species, Genders gender, byte minLevel, byte maxLevel, byte country, int count)
{
using (MySqlConnection db = CreateConnection())
{
List<MySqlParameter> _params = new List<MySqlParameter>();
String where = "WHERE Species = @species";
String where = "WHERE pid != @pid AND Species = @species";
_params.Add(new MySqlParameter("@pid", pid));
_params.Add(new MySqlParameter("@species", species));
if (gender != Genders.Either)