// Ophalen van alle spelers public static List <Player> GetPlayers() { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Players.ToList()); } }
// Ophalen van specifiek item. public static Item GetItem(int itemId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Items.Where(x => x.Id == itemId) .SingleOrDefault()); } }
// Ophalen van alle items die verkocht worden. public static List <Item> GetItems() { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Items.Where(x => x.BuyPrice != null) .ToList()); } }
// Ophalen van de speler zijn specifieke pokedex. public static List <PlayerPokedex> GetPlayerPokedexEntries(int playerId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.PlayerPokedexes.Include(x => x.Pokedex).Where(x => x.PlayerId == playerId) .ToList()); } }
// speler ophalen aan de hand van de Id public static Player GetPlayer(int playerid) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Players .Where(x => x.Id == playerid) .SingleOrDefault()); } }
// Ophalen van 1 specifieke aanval public static Attack GetAttack(int attackId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Attacks .Include(x => x.Type) .Where(x => x.Id == attackId).SingleOrDefault()); } }
//ophalen areas public static List <Area> GetAreas() { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Areas .OrderBy(x => x.Id) .ToList()); } }
// Opalen van de pokedex informatien van een specifieke pokemon. public static Pokedex GetPokedexEntry(int pokemonId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Pokedexes. Include(x => x.PlayerPokedexes). Where(x => x.PokedexEntry == pokemonId) .SingleOrDefault()); } }
// Ophalen van de speler zijn pokemons. public static List <PlayerPokemon> GetPokemons(int playerPokemonId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.PlayerPokemons .Include(x => x.Pokemon) .Include(z => z.Pokemon.Pokedex.Type) .Where(z => z.Id == playerPokemonId).ToList()); } }
//Ophalen van alle trainers in een bepaalde area public static List <Npc> GetTrainers(int areaId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Npcs .Where(x => x.Type.ToLower() == "trainer" || x.Type.ToLower() == "gym leader") .Where(x => x.AreaId == areaId) .ToList()); } }
// Ophalen van de speler zijn party pokemons. public static List <PlayerPokemon> GetPlayerPokemons(int playerid) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.PlayerPokemons.Where(y => y.PlayerId == playerid) .Where(x => x.InParty != false) .Include(x => x.Pokemon.Pokedex) .ToList()); } }
//Ophalen gekozen pokemon voor battle public static PlayerPokemon GetPlayerPokemon(int playerPokemonId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.PlayerPokemons .Include(z => z.Pokemon.OwnedPokemonAttacks) .Include(x => x.Pokemon.Pokedex.Type) .Where(z => z.Id == playerPokemonId).SingleOrDefault()); } }
// Ophalen van alle pokemons die in een bepaald gebied gevonden kunnen worden. public static List <Found> GetFoundPokemonViaAreaId(int areaId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Founds .Include(x => x.Pokedex.Type) .Where(x => x.AreaId == areaId) .ToList()); } }
//ophalen pokemon, stats en aanvallen public static List <TrainerPokemon> GetTrainerPokemonInformation(int trainerId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.TrainerPokemons .Include(x => x.Pokemon.Pokedex.Type) .Include(x => x.Pokemon.OwnedPokemonAttacks.Select(y => y.Attack.Type)) .Where(x => x.NpcId == trainerId) .ToList()); } }
//Ophalen van alle aanvallen die een specifieke pokemon kan gebruiken maar momenteel niet gebruikt wordt. public static List <OwnedPokemonAttack> GetKnownAttacksEqualsFalse(int pokemonId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.OwnedPokemonAttacks.Include(z => z.Attack) .Include(x => x.Attack.Type) .Where(y => y.PokemonId == pokemonId) .Where(z => z.KnownAttack == false) .ToList()); } }
// Alle aanvalleen die de pokemon kan leren ophalen. public static List <PokemonAttack> GetAvailableAttacks(int pokemonId, int currentLevel) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.PokemonAttacks.Include(z => z.Attack) .Include(x => x.Attack.Type) .Where(y => y.RequiredLevel <= currentLevel) .Where(z => z.PokedexId == pokemonId) .ToList()); } }
// Ophalen specifiek player item public static PlayerItem GetPlayerItem(int itemId, int playerId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.PlayerItems .Include(y => y.Item) .Where(x => x.ItemId == itemId) .Where(x => x.PlayerId == playerId) .SingleOrDefault()); } }
// Ophalen van de Area id's waar een bepaalde pokemon kan voorkomen. public static List <Found> GetPlayerPokedexEntriesAreas(int pokedexId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.Founds .Include(x => x.Pokedex) .Include(x => x.Area) .Where(x => x.PokedexId == pokedexId) .ToList()); } }
// Ophalen van de speler zijn badges uit de database. public static List <PlayerItem> GetPlayerBadges(int playerid) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.PlayerItems.Include(x => x.Item) .Where(y => y.PlayerId == playerid) .Where(z => z.Item.Type == "Badge") .OrderBy(x => x.Id) .ToList()); } }
// Ophalen van de gym leader zijn/haar badge. public static NpcItem GetGymLeaderBadge(int gymleaderId) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { return(projectPokemonEntities.NpcItems .Include(x => x.Item) .Where(x => x.Item.Type.ToLower() == "badge") .Where(x => x.NpcId == gymleaderId) .SingleOrDefault()); } }
// Updaten van playerpokedex public static int UpdatePlayerPokedex(PlayerPokedex playerPokedexEntry) { try { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { projectPokemonEntities.Entry(playerPokedexEntry).State = EntityState.Modified; return(projectPokemonEntities.SaveChanges()); } } catch (Exception ex) { FileOperations.FoutLoggen(ex); return(0); } }
// Updaten welke aanvallen de pokemon momenteel kent. public static int UpdateKnownAttacks(OwnedPokemonAttack knownAttack) { try { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { projectPokemonEntities.Entry(knownAttack).State = EntityState.Modified; return(projectPokemonEntities.SaveChanges()); } } catch (Exception ex) { FileOperations.FoutLoggen(ex); return(0); } }
public static int DeletePlayer(Player player) { try { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { projectPokemonEntities.Entry(player).State = EntityState.Deleted; return(projectPokemonEntities.SaveChanges()); } } catch (Exception ex) { FileOperations.FoutLoggen(ex); return(0); } }
//Nieuwe pokemon toevoegen aan de playerpokedex public static int AddNewPokemonPlayerPokedex(PlayerPokedex entry) { try { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { projectPokemonEntities.PlayerPokedexes.Add(entry); return(projectPokemonEntities.SaveChanges()); } } catch (Exception ex) { FileOperations.FoutLoggen(ex); return(0); } }
// OwnedPokemonAttacks toevoegen public static int AddCaughtPokemonAttacks(OwnedPokemonAttack ownedPokemonAttack) { try { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { projectPokemonEntities.OwnedPokemonAttacks.Add(ownedPokemonAttack); return(projectPokemonEntities.SaveChanges()); } } catch (Exception ex) { FileOperations.FoutLoggen(ex); return(0); } }
// player items toevoegen public static int AddPlayerItem(PlayerItem playerItem) { try { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { projectPokemonEntities.PlayerItems.Add(playerItem); return(projectPokemonEntities.SaveChanges()); } } catch (Exception ex) { FileOperations.FoutLoggen(ex); return(0); } }
// Pokemon object toevoegen public static int AddPokemon(Pokemon pokemon) { try { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { projectPokemonEntities.Pokemons.Add(pokemon); projectPokemonEntities.SaveChanges(); int id = pokemon.Id; return(id); } } catch (Exception ex) { FileOperations.FoutLoggen(ex); return(0); } }
// Ophalen van de speler zijn items uit de database. public static List <PlayerItem> GetPlayerItems(int playerid, bool sell) { using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities()) { if (sell == false) { // alle Items van een speler tonen behalve zijn Badges. return(projectPokemonEntities.PlayerItems.Include(x => x.Item) .Where(y => y.PlayerId == playerid) .Where(z => z.Item.Type != "Badge") .ToList()); } else { // alle items van een speler tonen die verkocht kunnen worden. return(projectPokemonEntities.PlayerItems.Include(x => x.Item) .Where(y => y.PlayerId == playerid) .Where(z => z.Item.SellPrice != null) .ToList()); } } }