Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reptarsrage committed Aug 31, 2016
1 parent b2cb28c commit 8d87cd4
Show file tree
Hide file tree
Showing 61 changed files with 10,477 additions and 0 deletions.
1,467 changes: 1,467 additions & 0 deletions PokeGeneratorInstaller/PokeGeneratorInstaller.vdproj

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions PokemonGenerator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGenerator", "PokemonGenerator\PokemonGenerator.csproj", "{DFF429CD-326E-4558-8319-E00B430DF65A}"
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "PokeGeneratorInstaller", "PokeGeneratorInstaller\PokeGeneratorInstaller.vdproj", "{A4025CFD-8ADC-4219-B70D-EAC530E97805}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGeneratorGUI", "PokemonGeneratorGUI\PokemonGeneratorGUI.csproj", "{17F3B4DB-C29D-42B7-9278-4A638C0688F2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{871427A5-3544-491D-A3F2-E0A707EA754E}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DFF429CD-326E-4558-8319-E00B430DF65A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DFF429CD-326E-4558-8319-E00B430DF65A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFF429CD-326E-4558-8319-E00B430DF65A}.Debug|x64.ActiveCfg = Debug|x64
{DFF429CD-326E-4558-8319-E00B430DF65A}.Debug|x64.Build.0 = Debug|x64
{DFF429CD-326E-4558-8319-E00B430DF65A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFF429CD-326E-4558-8319-E00B430DF65A}.Release|Any CPU.Build.0 = Release|Any CPU
{DFF429CD-326E-4558-8319-E00B430DF65A}.Release|x64.ActiveCfg = Release|x64
{DFF429CD-326E-4558-8319-E00B430DF65A}.Release|x64.Build.0 = Release|x64
{DFF429CD-326E-4558-8319-E00B430DF65A}.Release|x64.Deploy.0 = Release|x64
{A4025CFD-8ADC-4219-B70D-EAC530E97805}.Debug|Any CPU.ActiveCfg = Debug
{A4025CFD-8ADC-4219-B70D-EAC530E97805}.Debug|x64.ActiveCfg = Debug
{A4025CFD-8ADC-4219-B70D-EAC530E97805}.Release|Any CPU.ActiveCfg = Release
{A4025CFD-8ADC-4219-B70D-EAC530E97805}.Release|Any CPU.Build.0 = Release
{A4025CFD-8ADC-4219-B70D-EAC530E97805}.Release|x64.ActiveCfg = Release
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Debug|x64.ActiveCfg = Debug|Any CPU
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Debug|x64.Build.0 = Debug|Any CPU
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Release|Any CPU.Build.0 = Release|Any CPU
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Release|x64.ActiveCfg = Release|Any CPU
{17F3B4DB-C29D-42B7-9278-4A638C0688F2}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
40 changes: 40 additions & 0 deletions PokemonGenerator/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<!--<add name="ThePokeBaseEntities" connectionString="metadata=res://*/ThePokeBase.csdl|res://*/ThePokeBase.ssdl|res://*/ThePokeBase.msl;provider=System.Data.SqlServerCe.4.0;provider connection string=&quot;Data Source=D:\Documents\Visual Studio\Projects\PokemonGenerator\PokemonGenerator\ThePokeBase.sdf&quot;" providerName="System.Data.EntityClient" />-->
<add name="ThePokeBase" connectionString="Data Source=|DataDirectory|\ThePokeBase.sdf" providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
93 changes: 93 additions & 0 deletions PokemonGenerator/DAL/PokeBseDAL.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/// <summary>
/// Author: Justin Robb
/// Date: 8/30/2016
///
/// Description:
/// Generates a team of six Gen II pokemon for use in Pokemon Gold or Silver.
/// Built in order to supply Pokemon Stadium 2 with a better selection of Pokemon.
///
/// </summary>

namespace PokemonGenerator.DAL
{
//using Modals;
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Linq;
//using System.Reflection;

/// <summary>
/// Not Used Anymore. See <see cref="SQLManager"/>.
/// </summary>
class PokeBseDAL // : IDisposable
{
//private string connectionString;
//ThePokeBaseDataContext db;

//public PokeBseDAL()
//{
// Assembly ass = Assembly.GetExecutingAssembly();
// var dir = new FileInfo(ass.Location).Directory;
// var file = Path.Combine(dir.FullName, "ThePokeBase.mdf");
// connectionString = @"Data Source=JUSTINHOMEDESKT\SQLEXPRESS;Initial Catalog=ThePokeBase;Integrated Security=True";
// //"Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=\"" + file + "\";Integrated Security=True";
// // @"Data Source=JUSTINHOMEDESKT\SQLEXPRESS;Initial Catalog=ThePokeBase;Integrated Security=True";
// db = new ThePokeBaseDataContext(connectionString);
//}

//public void Dispose()
//{
// db.Dispose();
//}

//public List<int> GetPossiblePokemon(int level, Entropy entopy)
//{
// var list = new List<int>();

// if (entopy < Entropy.High)
// {
// var query = db.GetPokemonByLevelStrict(level);
// query.ToList().ForEach((s) => list.Add(s.id));
// }
// else
// {
// var query = from mon in db.vwEvolutions select mon;
// query.ToList().ForEach((s) => list.Add(s.id));
// }

// return list;
//}

//public List<vwTM> GetTMBank()
//{
// var query = db.vwTMs;

// return query.ToList();
//}

//public List<uspGetPokemonMoveSetResult> GetMovesForPokemon(int id, int level)
//{
// var query = db.uspGetPokemonMoveSet(id, level);

// return query.ToList();
//}


//public List<vwBaseStat> GetTeamBaseStats(PokeList list) {
// var iList = list.Species.ToList();
// var query = from mon in db.vwBaseStats
// where iList.Contains((byte)mon.id)
// select mon;
// return query.ToList();
//}

//internal List<string> GetWeaknesses(string v)
//{
// var list = new List<string>();
// var query = db.uspGetWeaknesses(v);
// query.ToList().ForEach((s) => list.Add(s.identifier));
// return list;
//}
}
}
123 changes: 123 additions & 0 deletions PokemonGenerator/DAL/SQLManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/// <summary>
/// Author: Justin Robb
/// Date: 8/30/2016
///
/// Description:
/// Generates a team of six Gen II pokemon for use in Pokemon Gold or Silver.
/// Built in order to supply Pokemon Stadium 2 with a better selection of Pokemon.
///
/// </summary>

namespace PokemonGenerator.DAL
{
using Modals;
using System.Collections.Generic;
using System.Linq;
using Serialization;

/// <summary>
/// Accesses the database to return information about pokemon.
/// <para/>
/// Data base is a modified version of of the project found here: https://github.com/veekun/pokedex
/// </summary>
class SQLManager
{
#region Stored Procedure Constants
const string uspGetPossiblePokemon = @"SELECT DISTINCT D.* FROM [tbl_vwEvolutions] D WHERE D.Id NOT IN ( SELECT DISTINCT B.[Id] FROM [tbl_vwEvolutions] A INNER JOIN [tbl_vwEvolutions] B ON A.evolvedFromPrevID = B.Id WHERE COALESCE(A.minimum_level, 0) <= @p0 AND B.Id IS NOT NULL UNION SELECT DISTINCT C.[Id] FROM [tbl_vwEvolutions] A INNER JOIN [tbl_vwEvolutions] B ON A.evolvedFromPrevID = B.Id INNER JOIN [tbl_vwEvolutions] C ON B.evolvedFromPrevID = C.Id WHERE COALESCE(A.minimum_level, 0) <= @p0 AND C.Id IS NOT NULL ) AND COALESCE(D.minimum_level, 0) < @p0";

const string uspGetPokemonMoveSet = @"SELECT level, moveId, moveName, identifier AS Type, power, pp, damageType, effect, method AS learnType FROM tbl_vwPokemonMoves INNER JOIN tbl_vwGenIIMoves moves ON moves.[moveId] = move_id WHERE pokemon_id = @p0 AND (level <= @p1 OR level IS NULL) ORDER BY level, moveId";

const string uspGetWeaknesses = @"SELECT dt.identifier FROM [type_efficacy] te LEFT JOIN [types] as dt ON dt.[id] =te.damage_type_id LEFT JOIN [types] as dtb ON dtb.[id] = te.target_type_id WHERE @p0 LIKE '%' + dtb.identifier + '%' and damage_factor > 100";
#endregion

#region Public Methods

/// <summary>
/// Gets a list of all pokemon at the given level, eliminating pokemon that would have already evolved at this level, as well as pokemon that haven't evelolved at this level.
/// </summary>
public List<int> GetPossiblePokemon(int level, Entropy entopy)
{
var list = new List<int>();
using (var ctx = new ThePokeBase())
{
//Get student name of string type
var results = ctx.tbl_vwEvolutions.SqlQuery(uspGetPossiblePokemon, level).ToList();
results.ForEach(s => list.Add(s.id));
}
return list;
}

/// <summary>
/// Gets a list of all moves available to the pokemon at the given level, eliminating moves that would only be avaialable at later levels.
/// </summary>
public List<uspGetPokemonMoveSetResult> GetMovesForPokemon(int id, int level)
{
using (var ctx = new ThePokeBase())
{
//Get student name of string type
var results = ctx.Database.SqlQuery<uspGetPokemonMoveSetResult>(uspGetPokemonMoveSet, id, level).ToList();


var ret = results.ToList();
return ret;
}
}

/// <summary>
/// Gets the base stats for the team of pokemon.
/// </summary>
public List<tbl_vwBaseStats> GetTeamBaseStats(PokeList list)
{
using (var ctx = new ThePokeBase())
{
var iList = list.Species.ToList();
var query = from mon in ctx.tbl_vwBaseStats
where iList.Contains((byte)mon.id)
select mon;
return query.ToList();
}
}

/// <summary>
/// Gets a random move. Completely random, but with a min and max power.
/// </summary>
public List<uspGetPokemonMoveSetResult> getRandomMoves(int minPower, int maxPower)
{
using (var ctx = new ThePokeBase())
{
//Get student name of string type
var results = ctx.Database.SqlQuery<uspGetPokemonMoveSetResult>("SELECT level, moveId, moveName, identifier AS Type, power, pp, damageType, effect FROM tbl_vwPokemonMoves INNER JOIN tbl_vwGenIIMoves moves ON moves.[moveId] = move_id WHERE [power] >= @p0 AND [power] <= @p1 ORDER BY level, moveId", minPower, maxPower);

return results.ToList();
}
}

/// <summary>
/// Gets the types that are strong against the given type.
/// </summary>
public List<string> GetWeaknesses(string v)
{
using (var ctx = new ThePokeBase())
{
//Get student name of string type
var results = ctx.Database.SqlQuery<string>(uspGetWeaknesses, v).ToList();
return results.ToList();
}
}

/// <summary>
/// Gets all TMs.
/// </summary>
internal List<int> getTMs()
{
using (var ctx = new ThePokeBase())
{
//Get student name of string type
var results = from tm in ctx.tbl_vwTMs
select tm.move_id;
return results.ToList();
}
}
#endregion
}
}
58 changes: 58 additions & 0 deletions PokemonGenerator/DAL/Serialization/tbl_vwBaseStats.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
namespace PokemonGenerator.DAL.Serialization
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;

public partial class tbl_vwBaseStats
{
[Key]
[Column(Order = 0)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int id { get; set; }

[Key]
[Column(Order = 1)]
[StringLength(79)]
public string identifier { get; set; }

[Key]
[Column(Order = 2)]
public string Types { get; set; }

[Key]
[Column(Order = 3)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int hp { get; set; }

[Key]
[Column(Order = 4)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int attack { get; set; }

[Key]
[Column(Order = 5)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int defense { get; set; }

[Key]
[Column(Order = 6)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int spAttack { get; set; }

[Key]
[Column(Order = 7)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int spDefense { get; set; }

[Key]
[Column(Order = 8)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int speed { get; set; }

[StringLength(79)]
public string growthRate { get; set; }
}
}
27 changes: 27 additions & 0 deletions PokemonGenerator/DAL/Serialization/tbl_vwEvolutions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace PokemonGenerator.DAL.Serialization
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;

public partial class tbl_vwEvolutions
{
[Key]
[Column(Order = 0)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int id { get; set; }

[Key]
[Column(Order = 1)]
[StringLength(79)]
public string identifier { get; set; }

public int? evolvedFromPrevID { get; set; }

public int? evolution_trigger_id { get; set; }

public int? minimum_level { get; set; }
}
}

0 comments on commit 8d87cd4

Please sign in to comment.