Created a main page.

This commit is contained in:
Greg Edwards 2014-05-05 02:11:53 -04:00
parent 9c6c7cc8b7
commit a6353bc2be
9 changed files with 177 additions and 18 deletions

View File

@ -5,4 +5,29 @@
<asp:Content ID="Content2" ContentPlaceHolderID="cpMain" runat="server">
<h1>What is Foundations GTS?</h1>
<p>Foundations GTS aims to re-create the same functionality of the original
<abbr title="Global Trading Station">GTS</abbr> service found in the games, Pokémon Diamond,
Pearl, Platinum, Heart Gold, Soul Silver, Black, White, Black 2, and White 2, in an open source
project.</p>
<p>The main reason I chose to write my own GTS is because of the
<a href="http://www.nintendo.com/whatsnew/detail/vyWpoM6CBIe6FjW8NIY7bvzOrgBURhzw">planned
shutdown of Nintendo Wi-fi Connection services</a> scheduled for May 20. To allow players to
continue trading, someone would need to make a replacement server, so I decided to help out.</p>
<h1>What is Pokémon Foundations?</h1>
<p>Pokémon Foundations is going to be a collection of utilities dealing with the logic, math,
and data related to the main series of Pokémon RPG videogames. Planned is a Pokédex, stat calculator,
damage calculator, and possibly more! (For now, its just a GTS.)</p>
<h1>How do I use this GTS?</h1>
<h2>Now until May 20th:</h2>
<p>Under Nintendo Wi-fi Connection Settings in your DS, change your primary DNS server to:</p>
<p class="code">191.236.98.208</p>
<p>If you use the Nintendo Wi-fi USB Connector, change the primary DNS on the computer you
plug it into.</p>
<h2>May 20th and onward:</h2>
<p>Stay tuned.</p>
</asp:Content>

View File

@ -6,8 +6,27 @@
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="cpHead" runat="server" />
<link rel="stylesheet" href="~/css/main.css" type="text/css" />
</head>
<body>
<div id="gtsHeader">
<div class="setWidth">
<h1>Foundations GTS</h1>
<p>Fan-operated GTS for Pokémon generations IV and V, by mm201</p>
<div class="stats">
<asp:Literal ID="litPokemon" runat="server" />
Pokémon available for offer.<br />
<asp:HyperLink ID="hlAllPokemon" NavigateUrl="~/AllPokemon.aspx" runat="server">Details</asp:HyperLink>
</div>
</div>
<div class="github-contain">
<a class="github" href="https://github.com/mm201/pkmnFoundations" target="_blank">Fork me on GitHub!</a>
</div>
</div>
<div id="gtsMain">
<div class="setWidth">
<asp:ContentPlaceHolder ID="cpMain" runat="server" />
</div>
</div>
</body>
</html>

View File

@ -11,7 +11,9 @@ namespace PkmnFoundations.GTS
{
protected void Page_Load(object sender, EventArgs e)
{
GtsSessionManager manager = GtsSessionManager.FromContext(Context);
int availTotal = manager.AvailablePokemon4 + manager.AvailablePokemon5;
litPokemon.Text = availTotal.ToString();
}
}
}

View File

@ -21,6 +21,24 @@ namespace PkmnFoundations.GTS {
/// </remarks>
protected global::System.Web.UI.WebControls.ContentPlaceHolder cpHead;
/// <summary>
/// litPokemon control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litPokemon;
/// <summary>
/// hlAllPokemon control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink hlAllPokemon;
/// <summary>
/// cpMain control.
/// </summary>

72
gts/css/main.css Normal file
View File

@ -0,0 +1,72 @@
body
{
font-family: Arial,sans-serif;
margin: 0; padding: 0;
}
#gtsHeader
{
background-color: #ff8063;
color: white;
font-family: Arial,sans-serif;
padding: 4px 0;
height: 120px;
}
#gtsHeader .stats
{
background-color: #ffac9f;
border-radius: 9px;
padding: 4px;
position: absolute;
top: 8px;
right: 160px;
width: 200px;
font-size: 12px;
}
#gtsHeader a
{
color: white;
}
#gtsMain
{
padding: 4px 0;
}
.setWidth
{
width: 720px;
margin: 0 auto;
}
.github-contain
{
position: absolute;
overflow: hidden;
top: 0; right: 0;
width: 160px; height: 160px;
}
.github
{
width: 300px;
height: 20px;
color: white;
background-color: black;
position: absolute;
top: 60px;
right: -80px;
text-align: center;
display: block;
margin: 0; padding: 0;
text-decoration: none;
transform: rotate(45deg);
}
.code
{
font-family: Consolas,'Andale Mono',monospace
}

View File

@ -55,8 +55,7 @@
<Reference Include="System.Web.ApplicationServices" />
</ItemGroup>
<ItemGroup>
<Content Include="BoxUploadDecode.aspx" />
<Content Include="DatabaseTest.aspx" />
<Content Include="css\main.css" />
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
<Content Include="Web.config" />
@ -68,23 +67,9 @@
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="BoxUploadDecode.aspx.cs">
<DependentUpon>BoxUploadDecode.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="BoxUploadDecode.aspx.designer.cs">
<DependentUpon>BoxUploadDecode.aspx</DependentUpon>
</Compile>
<Compile Include="syachi2ds.ashx.cs">
<DependentUpon>syachi2ds.ashx</DependentUpon>
</Compile>
<Compile Include="DatabaseTest.aspx.cs">
<DependentUpon>DatabaseTest.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="DatabaseTest.aspx.designer.cs">
<DependentUpon>DatabaseTest.aspx</DependentUpon>
</Compile>
<Compile Include="pokemondpds.ashx.cs">
<DependentUpon>pokemondpds.ashx</DependentUpon>
</Compile>
@ -114,7 +99,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="css\" />
<Folder Include="images\sm-s\" />
<Folder Include="images\sm\" />
</ItemGroup>

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PkmnFoundations.Data;
namespace PkmnFoundations.GTS
{
@ -18,6 +19,7 @@ namespace PkmnFoundations.GTS
{
Sessions4 = new Dictionary<String, GtsSession4>();
Sessions5 = new Dictionary<String, GtsSession5>();
RefreshStats();
}
public void PruneSessions()
@ -141,5 +143,23 @@ namespace PkmnFoundations.GTS
return result;
}
public void RefreshStats()
{
AvailablePokemon4 = DataAbstract.Instance.GtsAvailablePokemon4();
AvailablePokemon5 = DataAbstract.Instance.GtsAvailablePokemon5();
}
public int AvailablePokemon4
{
get;
private set;
}
public int AvailablePokemon5
{
get;
private set;
}
}
}

View File

@ -39,6 +39,7 @@ namespace PkmnFoundations.Data
public abstract bool GtsTradePokemon4(GtsRecord4 upload, GtsRecord4 result);
public abstract GtsRecord4[] GtsSearch4(int pid, ushort species, Genders gender, byte minLevel, byte maxLevel, byte country, int count);
public abstract int GtsAvailablePokemon4();
public abstract GtsRecord5 GtsDataForUser5(int pid);
@ -50,6 +51,7 @@ namespace PkmnFoundations.Data
public abstract bool GtsTradePokemon5(GtsRecord5 upload, GtsRecord5 result);
public abstract GtsRecord5[] GtsSearch5(int pid, ushort species, Genders gender, byte minLevel, byte maxLevel, byte country, int count);
public abstract int GtsAvailablePokemon5();
#endregion
}

View File

@ -334,6 +334,15 @@ namespace PkmnFoundations.Data
return result;
}
public override int GtsAvailablePokemon4()
{
using (MySqlConnection db = CreateConnection())
{
db.Open();
return (int)(long)db.ExecuteScalar("SELECT Count(*) FROM GtsPokemon4 WHERE IsExchanged = 0");
}
}
#endregion
#region GTS 5
@ -654,6 +663,14 @@ namespace PkmnFoundations.Data
return result;
}
public override int GtsAvailablePokemon5()
{
using (MySqlConnection db = CreateConnection())
{
db.Open();
return (int)(long)db.ExecuteScalar("SELECT Count(*) FROM GtsPokemon5 WHERE IsExchanged = 0");
}
}
#endregion
}
}