private void SetMedalLabels(string apanSteamId) { try { //Set medals labels tcMySqlCommand lcMySqlCommand = new tcMySqlCommand("SELECT bronze,silver,gold,platinum FROM kzs_medals WHERE player = (SELECT id FROM kzs_players WHERE auth = ?steamid);"); lcMySqlCommand.mcMySqlCommand.Parameters.Add("?steamid", apanSteamId); MySqlDataReader lcMySqlReader = lcMySqlCommand.mcMySqlCommand.ExecuteReader(); lcMySqlReader.Read(); Panel4.Controls.Add(new LiteralControl("<br>")); tcLabel lcHeading = new tcLabel(); lcHeading.Text = "Medals earned"; lcHeading.ForeColor = teColors.eeRedText; lcHeading.Font.Bold = true; Panel4.Controls.Add(lcHeading); Panel4.Controls.Add(new LiteralControl("<br>")); for (int lnMedalIndex = 0; lnMedalIndex < (int)teMedals.eeMax; lnMedalIndex++) { System.Web.UI.WebControls.Image lcImage = new System.Web.UI.WebControls.Image(); lcImage.ImageAlign = ImageAlign.TextTop; lcImage.Height = lcImage.Width = 16; lcImage.ToolTip = ((teMedals)lnMedalIndex).ToString().Substring(2); switch ((teMedals)lnMedalIndex) { case teMedals.eeBronze: lcImage.ImageUrl = "~/img/medals/bronze.png"; break; case teMedals.eeSilver: lcImage.ImageUrl = "~/img/medals/silver.png"; break; case teMedals.eeGold: lcImage.ImageUrl = "~/img/medals/gold.png"; break; case teMedals.eePlatinum: lcImage.ImageUrl = "~/img/medals/platinum.png"; break; } Label lcNumMedals = new Label(); lcNumMedals.Text = " " + lcMySqlReader.GetInt32(lnMedalIndex).ToString() + " "; lcNumMedals.Font.Size = 12; lcNumMedals.Font.Name = "Arial"; lcNumMedals.ForeColor = teColors.eeText; Panel4.Controls.Add(lcImage); Panel4.Controls.Add(lcNumMedals); } lcMySqlCommand.Close(); } catch (Exception e) { Debug.WriteLine("SetMedalLabels: " + e.Message); } }
private void SetAliases(string apanSteamId) { int lnCount = 0; tcLabel lcAliasesLabel = new tcLabel(); lcAliasesLabel.Text = "Aliases: "; tcMySqlCommand lcMySqlCommand = new tcMySqlCommand(@"SELECT name FROM kzs_names WHERE player = (SELECT id FROM kzs_players WHERE auth = ?auth LIMIT 1) ORDER BY count DESC LIMIT 5"); lcMySqlCommand.mcMySqlCommand.Parameters.Add("?auth", apanSteamId); MySqlDataReader lcReader = lcMySqlCommand.mcMySqlCommand.ExecuteReader(); while (lnCount < 5 && lcReader.HasRows && !lcReader.IsClosed && lcReader.Read()) { lcAliasesLabel.Text = lcAliasesLabel.Text + lcReader.GetString(0) + ", "; lnCount++; } lcAliasesLabel.Text = lcAliasesLabel.Text.Substring(0, lcAliasesLabel.Text.Length - 2); Panel4.Controls.Add(new LiteralControl("<br>")); Panel4.Controls.Add(lcAliasesLabel); lcReader.Close(); lcMySqlCommand.Close(); }
private void SetRewardLabels(string apanSteamId) { try { //Set medals labels tcMySqlCommand lcMySqlCommand = new tcMySqlCommand("SELECT timebomb,painkillers,soccerball,stats_readout,moonboots,strange_mojo,slowmo,burningfeet,cloak,fastmo,custom_title,psychic_anti_gravity,boots_of_height FROM kzs_medals WHERE player = (SELECT id FROM kzs_players WHERE auth = ?steamid);"); lcMySqlCommand.mcMySqlCommand.Parameters.Add("?steamid", apanSteamId); MySqlDataReader lcMySqlReader = lcMySqlCommand.mcMySqlCommand.ExecuteReader(); lcMySqlReader.Read(); Panel4.Controls.Add(new LiteralControl("<br><br>")); tcLabel lcHeading = new tcLabel(); lcHeading.Text = "Rewards purchased"; lcHeading.ForeColor = teColors.eeRedText; lcHeading.Font.Bold = true; Panel4.Controls.Add(lcHeading); Panel4.Controls.Add(new LiteralControl("<br><div style=\"line-height:56px;\"><table>")); for (int lnRewardIndex = 0; lnRewardIndex < (int)teRewards.eeMax; lnRewardIndex++) { System.Web.UI.WebControls.Image lcImage = new System.Web.UI.WebControls.Image(); lcImage.ImageAlign = ImageAlign.Middle; lcImage.Height = lcImage.Width = 48; lcImage.ToolTip = ((teRewards)lnRewardIndex).ToString().Substring(2); tcLabel lcRewardName = new tcLabel(); switch ((teRewards)lnRewardIndex) { case teRewards.eeTimeBomb: lcImage.ImageUrl = "~/img/rewards/timebomb.png"; lcRewardName.Text = "Timebomb"; break; case teRewards.eePainKillers: lcImage.ImageUrl = "~/img/rewards/painkillers.png"; lcRewardName.Text = "Painkillers"; break; case teRewards.eeSoccerBall: lcImage.ImageUrl = "~/img/rewards/soccerball.png"; lcRewardName.Text = "Soccer ball"; break; case teRewards.eeStatsReadout: lcImage.ImageUrl = "~/img/rewards/stats_readout.png"; lcRewardName.Text = "Stats readout"; break; case teRewards.eeMoonBoots: lcImage.ImageUrl = "~/img/rewards/moonboots.png"; lcRewardName.Text = "Moon boots"; break; case teRewards.eeStrangeMojo: lcImage.ImageUrl = "~/img/rewards/strange_mojo.png"; lcRewardName.Text = "Strange mojo"; break; case teRewards.eeSlowmo: lcImage.ImageUrl = "~/img/rewards/slomo.png"; lcRewardName.Text = "Slow-mo"; break; case teRewards.eeBurningFeet: lcImage.ImageUrl = "~/img/rewards/burningfeet.png"; lcRewardName.Text = "Burning feet"; break; case teRewards.eeCloak: lcImage.ImageUrl = "~/img/rewards/cloak.png"; lcRewardName.Text = "Cloak"; break; case teRewards.eeFastmo: lcImage.ImageUrl = "~/img/rewards/boots_of_speed.png"; lcRewardName.Text = "Boots of speed"; break; case teRewards.eeCustomTitle: lcImage.ImageUrl = "~/img/rewards/custom_message.png"; lcRewardName.Text = "Custom title"; break; case teRewards.eePsychicAntiGravity: lcImage.ImageUrl = "~/img/rewards/psychic_anti_gravity.png"; lcRewardName.Text = "Psychic anti-gravity"; break; case teRewards.eeBootsOfHeight: lcImage.ImageUrl = "~/img/rewards/boots_of_height.png"; lcRewardName.Text = "Boots of height"; break; } tcLabel lcNumRewards = new tcLabel(); lcNumRewards.Text = " " + lcMySqlReader.GetInt32(lnRewardIndex).ToString() + " "; if (lnRewardIndex % 2 == 0) { if (lnRewardIndex == 0) { Panel4.Controls.Add(new LiteralControl("<tr>")); } else { Panel4.Controls.Add(new LiteralControl("</tr>")); } } Panel4.Controls.Add(new LiteralControl("<td>")); Panel4.Controls.Add(lcImage); Panel4.Controls.Add(new LiteralControl("</td><td>")); Panel4.Controls.Add(lcRewardName); Panel4.Controls.Add(new LiteralControl("</td><td>")); Panel4.Controls.Add(lcNumRewards); Panel4.Controls.Add(new LiteralControl("</td>")); } Panel4.Controls.Add(new LiteralControl("</tr></table></div>")); lcMySqlCommand.Close(); } catch (Exception e) { Debug.WriteLine("SetRewardLabels: " + e.Message); } }
private void SetSteamCommunityInfo(string apanSteamId) { tcLabel lcHeading = new tcLabel(); lcHeading.Text = "Steam information"; lcHeading.ForeColor = teColors.eeRedText; lcHeading.Font.Bold = true; //Panel4.Controls.Add(new LiteralControl("<br>")); //Panel4.Controls.Add(lcHeading); Panel4.Controls.Add(new LiteralControl("<br>")); HyperLink lcLink = new HyperLink(); lcLink.ForeColor = teColors.eeLink; lcLink.Text = "Steam community profile"; lcLink.NavigateUrl = StaticMethods.GetSteamProfileLink(apanSteamId); //System.Web.UI.WebControls.Image lcImage = new System.Web.UI.WebControls.Image(); //lcImage.ImageUrl = StaticMethods.GetPlayerImageUrl(apanSteamId); //lcImage.Width = lcImage.Height = 96; //lcImage.ImageAlign = ImageAlign.Middle; //Panel4.Controls.Add(lcImage); //Panel4.Controls.Add(new LiteralControl(" ")); Panel4.Controls.Add(lcLink); }
private void SetMiscInfo(string apanSteamId) { tcMySqlCommand lcMySqlCommand = new tcMySqlCommand(@"SELECT DATE_FORMAT(date,'%Y-%m-%d') AS Date,IFNULL(country,0), IFNULL(full,'Unknown') AS CountryFull, IFNULL(cp,0) AS RecordsCp, IFNULL(nocheck,0) AS Records, IFNULL(totalwr,0) AS WrTotal, IFNULL(curwr,0) AS WrCurrent FROM (SELECT id,date,country FROM kzs_players WHERE auth = ?auth) AS P LEFT JOIN (SELECT code,full FROM kzs_countries) AS CNT ON CNT.code = P.country LEFT JOIN (SELECT player,COUNT(DISTINCT(course))AS nocheck FROM kzs_records GROUP BY player) AS R ON R.player = P.id LEFT JOIN (SELECT player,COUNT(DISTINCT(course)) AS cp FROM kzs_recordscp GROUP BY player) AS RCP ON RCP.player = P.id LEFT JOIN (SELECT player, COUNT(*) AS totalwr FROM kzs_wrs GROUP BY player) AS WRT ON WRT.player = P.id LEFT JOIN (SELECT player,COUNT(*) AS curwr FROM (SELECT * FROM (SELECT W.player,W.course,W.time,W.date,P.auth, C.invert FROM ((SELECT player, course, time, date FROM kzs_wrs) AS W LEFT JOIN(SELECT id,auth FROM kzs_players) AS P ON P.id = W.player LEFT JOIN (SELECT invert,id FROM kzs_courses) AS C ON C.id = W.course) ORDER BY course, date, CASE 1 WHEN C.invert THEN Time ELSE -Time END DESC) AS F GROUP BY course) AS FF WHERE auth = ?auth) AS WRCUR ON WRCUR.player = P.id"); lcMySqlCommand.mcMySqlCommand.Parameters.Add("?auth", apanSteamId); MySqlDataReader lcReader = lcMySqlCommand.mcMySqlCommand.ExecuteReader(); lcReader.Read(); string lpanStartDate = lcReader.GetString(0); string lpanCountryCode = lcReader.GetString(1); string lpanCountryFull = lcReader.GetString(2); int lnRecCp = lcReader.GetInt32(3); int lnRec = lcReader.GetInt32(4); int lnWrTotal = lcReader.GetInt32(5); int lnWrcur = lcReader.GetInt32(6); lcReader.Close(); lcMySqlCommand.Close(); tcLabel lcDate = new tcLabel(); tcLabel lcCountry = new tcLabel(); tcLabel lcRecords = new tcLabel(); tcLabel lcWr = new tcLabel(); tcLabel lcHeading = new tcLabel(); lcHeading.Text = "General information"; lcHeading.ForeColor = teColors.eeRedText; lcHeading.Font.Bold = true; Panel4.Controls.Add(lcHeading); Panel4.Controls.Add(new LiteralControl("<br>")); lcDate.Text = "Playing since " + lpanStartDate + " from "; Panel4.Controls.Add(lcDate); System.Web.UI.WebControls.Image lcImage = new System.Web.UI.WebControls.Image(); lcImage.ImageUrl = "~/img/flags/" + lpanCountryCode + ".gif"; Panel4.Controls.Add(lcImage); lcCountry.Text = " " + lpanCountryFull; Panel4.Controls.Add(lcCountry); Panel4.Controls.Add(new LiteralControl("<br>")); lcRecords.Text = "Nochecked " + lnRec + " courses, finished " + lnRecCp + " courses with checkpoints"; Panel4.Controls.Add(lcRecords); Panel4.Controls.Add(new LiteralControl("<br>")); lcWr.Text = "Held " + lnWrTotal + " total world records (" + lnWrcur + " current)"; Panel4.Controls.Add(lcWr); }
private void ProcessStatsPage(string apanSteamId) { tcLabel lcHeading = new tcLabel(); try { Panel4.HorizontalAlign = HorizontalAlign.Left; Panel4.BorderStyle = BorderStyle.Solid; Panel4.BorderColor = Color.Transparent; Panel4.BorderWidth = 32; //aliases, country, medals, maps finished Panel4.Controls.Add(new LiteralControl("<div align=\"center\" style=\"line-height:24px;\">")); SetMiscInfo(apanSteamId); SetAliases(apanSteamId); Panel4.Controls.Add(new LiteralControl("<div align=\"center\" style=\"line-height:24px;\">")); lcHeading.Text = "Medals earned"; SetMedalLabels(apanSteamId); SetRewardLabels(apanSteamId); SetSteamCommunityInfo(apanSteamId); Panel4.Controls.Add(new LiteralControl("</div></div>")); } catch(Exception e) { Debug.WriteLine("PlayerStats: " + e.Message); } }
private void ProcessTagPage(string apanSteamId) { int lnTags = 0; int lnTagsNinja = 0; int lnTagged = 0; int lnRoudWins = 0; int lnRoundsPlayed = 0; int lnMatchWins = 0; int lnTotalUntaggedTime = 0; int lnRoundMostUntagged = 0; int lnRoundLeastUntagged = 0; int lnRoundMostPowerups = 0; int lnRoundLeastPowerups = 0; float lrAvgRoundPowerup = 0f; float lrAvgRoundTag = 0f; float lrAvgRoundTagged = 0f; tcMySqlCommand lcMySqlCommand = new tcMySqlCommand(@"SELECT tags, ninja, tagged, round_wins, rounds_played, match_wins, total_untagged_time, round_most_untagged, round_least_untagged, round_most_powerup, round_least_powerup, avg_powerup_per_round, avg_tags_per_round, avg_tagged_per_round FROM (SELECT id FROM kzs_players WHERE auth = ?auth) AS P LEFT JOIN (SELECT * FROM kzs_tag) AS T ON P.id = T.player"); lcMySqlCommand.mcMySqlCommand.Parameters.Add("?auth", apanSteamId); MySqlDataReader lcMySqlReader = lcMySqlCommand.mcMySqlCommand.ExecuteReader(); lcMySqlReader.Read(); if (lcMySqlReader.HasRows) { lnTags = lcMySqlReader.GetInt32(0); lnTagsNinja = lcMySqlReader.GetInt32(1); lnTagged = lcMySqlReader.GetInt32(2); lnRoudWins = lcMySqlReader.GetInt32(3); lnRoundsPlayed = lcMySqlReader.GetInt32(4); lnMatchWins = lcMySqlReader.GetInt32(5); lnTotalUntaggedTime = lcMySqlReader.GetInt32(6); lnRoundMostUntagged = lcMySqlReader.GetInt32(7); lnRoundLeastUntagged = lcMySqlReader.GetInt32(8); lnRoundMostPowerups = lcMySqlReader.GetInt32(9); lnRoundLeastPowerups = lcMySqlReader.GetInt32(10); lrAvgRoundPowerup = lcMySqlReader.GetFloat(11); lrAvgRoundTag = lcMySqlReader.GetFloat(12); lrAvgRoundTagged = lcMySqlReader.GetFloat(13); } float lrWinPercentage = 0f; String lpanLeastPowerups = "~"; String lpanLeastUntagged = "~"; if (lnRoundsPlayed > 0) { lrWinPercentage = (lnRoudWins / (float)lnRoundsPlayed) * 100f; } if (lnRoundLeastUntagged < 9000) { lpanLeastUntagged = lnRoundLeastUntagged.ToString(); } if (lnRoundLeastPowerups < 9000) { lpanLeastPowerups = lnRoundLeastPowerups.ToString(); } tcLabel lcHeading = new tcLabel(); tcLabel lcText = new tcLabel(); lcHeading.ForeColor = teColors.eeRedText; lcHeading.Font.Bold = true; lcHeading.Text = "<br>General stats<br>"; lcText.Text = @"Tags: " + lnTags + " (" + lnTagsNinja + " Ninja)" + ", Tagged: " + lnTagged + "<br>Rounds played: " + lnRoundsPlayed + ", round wins: " + lnRoudWins + " (" + String.Format("{0:0.##}", lrWinPercentage) + "%)" + "<br>Match wins: " + lnMatchWins + "<br>Total untagged time: " + lnTotalUntaggedTime + "<br><br>"; Panel4.Controls.Add(lcHeading); Panel4.Controls.Add(lcText); tcLabel lcRoundHeading = new tcLabel(); tcLabel lcRoundText = new tcLabel(); lcRoundHeading.ForeColor = teColors.eeRedText; lcRoundHeading.Font.Bold = true; lcRoundHeading.Text = "Round records<br>"; lcRoundText.Text = @"Most untagged time: " + lnRoundMostUntagged + "<br>Least untagged time: " + lpanLeastUntagged + "<br>Most powerups: " + lnRoundMostPowerups + "<br>Fewest powerups: " + lpanLeastPowerups + "<br><br>"; Panel4.Controls.Add(lcRoundHeading); Panel4.Controls.Add(lcRoundText); tcLabel lcAvgHeading = new tcLabel(); tcLabel lcAvgText = new tcLabel(); lcAvgHeading.ForeColor = teColors.eeRedText; lcAvgHeading.Font.Bold = true; lcAvgHeading.Text = "Round averages<br>"; lcAvgText.Text = "Tags: " + String.Format("{0:0.##}", lrAvgRoundTag) + "<br>Tagged: " + String.Format("{0:0.##}", lrAvgRoundTagged) + "<br>Powerups: " + String.Format("{0:0.##}", lrAvgRoundPowerup); Panel4.Controls.Add(lcAvgHeading); Panel4.Controls.Add(lcAvgText); lcMySqlCommand.Close(); }
private void AddRewards() { int lnCount = 0; int lnTimebomb = 0; int lnPainkillers = 0; int lnSoccerball = 0; int lnStatsReadout = 0; int lnMoonboots = 0; int lnStrangeMojo = 0; int lnSlomo = 0; int lnBurningFeet = 0; int lnCloack = 0; int lnFastmo = 0; int lnTitle = 0; int lnAntiGrav = 0; int lnBootsOfHeight = 0; GetRewards(out lnTimebomb, out lnPainkillers, out lnSoccerball, out lnStatsReadout, out lnMoonboots, out lnStrangeMojo, out lnSlomo, out lnBurningFeet, out lnCloack, out lnFastmo, out lnTitle, out lnAntiGrav, out lnBootsOfHeight); AddPanelLabel("<br><br>Total rewards purchased", true); Panel4.Controls.Add(new LiteralControl("<hr>")); Panel4.Controls.Add(new LiteralControl("<div style=\"line-height:56px;\"><table align=\"center\">")); for (int lnRewardIndex = 0; lnRewardIndex < (int)teRewards.eeMax; lnRewardIndex++) { System.Web.UI.WebControls.Image lcImage = new System.Web.UI.WebControls.Image(); lcImage.ImageAlign = ImageAlign.Middle; lcImage.Height = lcImage.Width = 48; lcImage.ToolTip = ((teRewards)lnRewardIndex).ToString().Substring(2); tcLabel lcRewardName = new tcLabel(); switch ((teRewards)lnRewardIndex) { case teRewards.eeTimeBomb: lcImage.ImageUrl = "~/img/rewards/timebomb.png"; lcRewardName.Text = "Timebomb"; lnCount = lnTimebomb; break; case teRewards.eePainKillers: lcImage.ImageUrl = "~/img/rewards/painkillers.png"; lcRewardName.Text = "Painkillers"; lnCount = lnPainkillers; break; case teRewards.eeSoccerBall: lcImage.ImageUrl = "~/img/rewards/soccerball.png"; lcRewardName.Text = "Soccer ball"; lnCount = lnSoccerball; break; case teRewards.eeStatsReadout: lcImage.ImageUrl = "~/img/rewards/stats_readout.png"; lcRewardName.Text = "Stats readout"; lnCount = lnStatsReadout; break; case teRewards.eeMoonBoots: lcImage.ImageUrl = "~/img/rewards/moonboots.png"; lcRewardName.Text = "Moon boots"; lnCount = lnMoonboots; break; case teRewards.eeStrangeMojo: lcImage.ImageUrl = "~/img/rewards/strange_mojo.png"; lcRewardName.Text = "Strange mojo"; lnCount = lnStrangeMojo; break; case teRewards.eeSlowmo: lcImage.ImageUrl = "~/img/rewards/slomo.png"; lcRewardName.Text = "Slow-mo"; lnCount = lnSlomo; break; case teRewards.eeBurningFeet: lcImage.ImageUrl = "~/img/rewards/burningfeet.png"; lcRewardName.Text = "Burning feet"; lnCount = lnBurningFeet; break; case teRewards.eeCloak: lcImage.ImageUrl = "~/img/rewards/cloak.png"; lcRewardName.Text = "Cloak"; lnCount = lnCloack; break; case teRewards.eeFastmo: lcImage.ImageUrl = "~/img/rewards/boots_of_speed.png"; lcRewardName.Text = "Boots of speed"; lnCount = lnFastmo; break; case teRewards.eeCustomTitle: lcImage.ImageUrl = "~/img/rewards/custom_message.png"; lcRewardName.Text = "Custom title"; lnCount = lnTitle; break; case teRewards.eePsychicAntiGravity: lcImage.ImageUrl = "~/img/rewards/psychic_anti_gravity.png"; lcRewardName.Text = "Psychic anti-gravity"; lnCount = lnAntiGrav; break; case teRewards.eeBootsOfHeight: lcImage.ImageUrl = "~/img/rewards/boots_of_height.png"; lcRewardName.Text = "Boots of height"; lnCount = lnBootsOfHeight; break; } if (lnRewardIndex % 2 == 0) { if (lnRewardIndex == 0) { Panel4.Controls.Add(new LiteralControl("<tr>")); } else { Panel4.Controls.Add(new LiteralControl("</tr>")); } } Panel4.Controls.Add(new LiteralControl("<td>")); Panel4.Controls.Add(lcImage); Panel4.Controls.Add(new LiteralControl("</td><td>")); Panel4.Controls.Add(lcRewardName); Panel4.Controls.Add(new LiteralControl("</td><td>")); AddPanelLabel(" " + lnCount + " "); Panel4.Controls.Add(new LiteralControl("</td>")); } Panel4.Controls.Add(new LiteralControl("</tr></table></div>")); }