Esempio n. 1
0
 // Ophalen van alle spelers
 public static List <Player> GetPlayers()
 {
     using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities())
     {
         return(projectPokemonEntities.Players.ToList());
     }
 }
Esempio n. 2
0
 // 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());
     }
 }
Esempio n. 3
0
 // 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());
     }
 }
Esempio n. 4
0
 // 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());
     }
 }
Esempio n. 5
0
 // 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());
     }
 }
Esempio n. 6
0
 // 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());
     }
 }
Esempio n. 7
0
 //ophalen areas
 public static List <Area> GetAreas()
 {
     using (Project_Pokemon_Entities projectPokemonEntities = new Project_Pokemon_Entities())
     {
         return(projectPokemonEntities.Areas
                .OrderBy(x => x.Id)
                .ToList());
     }
 }
Esempio n. 8
0
 // 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());
     }
 }
Esempio n. 9
0
 // 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());
     }
 }
Esempio n. 10
0
 //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());
     }
 }
Esempio n. 11
0
 // 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());
     }
 }
Esempio n. 12
0
 //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());
     }
 }
Esempio n. 13
0
 // 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());
     }
 }
Esempio n. 14
0
 //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());
     }
 }
Esempio n. 15
0
 //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());
     }
 }
Esempio n. 16
0
 // 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());
     }
 }
Esempio n. 17
0
 // 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());
     }
 }
Esempio n. 18
0
 // 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());
     }
 }
Esempio n. 19
0
 // 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());
     }
 }
Esempio n. 20
0
 // 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());
     }
 }
Esempio n. 21
0
 // 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);
     }
 }
Esempio n. 22
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);
     }
 }
Esempio n. 23
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);
     }
 }
Esempio n. 24
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);
     }
 }
Esempio n. 25
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);
     }
 }
Esempio n. 26
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);
     }
 }
Esempio n. 27
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);
     }
 }
Esempio n. 28
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());
         }
     }
 }