private void WriteRegistered(HtmlTextWriter writer, Tournament tour) { writer.WriteLine("<h2>{0}</h2>", CultureModule.getContent("tournament_registered")); writer.WriteLine("<ul class='registered'>"); int bags = Championship.GetNumberOfGroups(tour.Registered.Count); int count = -1; int currBag = 1; writer.WriteLine("<li class='title'>{0} {1}</li>", CultureModule.getContent("tournament_bag"), currBag++, bags); foreach (Ruler ruler in tour.Registered) { if (++count == bags) { count = 0; writer.WriteLine("<li class='title'>{0} {1}</li>", CultureModule.getContent("tournament_bag"), currBag++, bags); } writer.Write("<li>{0}", OrionGlobals.getLink(ruler)); if (Page.User.IsInRole("admin")) { writer.Write("<a href='{0}&remove={1}'><img src='{2}' /></a>", Page.Request.RawUrl, ruler.ForeignId, OrionGlobals.getCommonImagePath("remove.gif")); } writer.WriteLine("</li>"); } writer.WriteLine("</ul>"); }
private void WriteByRatio(StreamWriter writer, ArrayList rulers, string resource) { writer.WriteLine("<h2>Top Rulers by {0}</h2>", CultureModule.getContent(resource)); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>Planets</td>"); writer.WriteLine("<th>Avg</td>"); writer.WriteLine("<th>{0}</td>", "Per Turn"); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfRulers; ++i) { Ruler ruler = (Ruler)rulers[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink(ruler)); writer.WriteLine("<td>{0}</td>", ruler.Planets.Length); int ratio = RatioComparer.Count(ruler, resource); writer.WriteLine("<td>+{0}</td>", OrionGlobals.format(ratio / ruler.Planets.Length)); writer.WriteLine("<td>+{0}</td>", OrionGlobals.format(ratio)); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
private void WriteByScore(StreamWriter writer, ArrayList planets) { writer.WriteLine("<h2>Top {0}</h2>", CultureModule.getContent("score")); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("planet")); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("score")); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfPlanets; ++i) { Planet planet = (Planet)planets[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", planet); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink((Ruler)planet.Owner)); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(planet.Score)); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
private void WriteByRatio(StreamWriter writer, ArrayList planets, string resource) { writer.WriteLine("<h2>Top {0}</h2>", CultureModule.getContent(resource)); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("planet")); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>{0}</td>", "Per Turn"); writer.WriteLine("<th>{0}</td>", "Ratio"); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfPlanets; ++i) { Planet planet = (Planet)planets[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", planet); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink((Ruler)planet.Owner)); writer.WriteLine("<td>+{0}</td>", OrionGlobals.format(planet.getPerTurn("Intrinsic", resource))); writer.WriteLine("<td>%{0}</td>", planet.ModifiersRatio[resource]); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
private void WriteBySize(StreamWriter writer, ArrayList planets) { writer.WriteLine("<h2>Top {0}</h2>", "Size"); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("planet")); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>{0}</td>", "Ground"); writer.WriteLine("<th>{0}</td>", "Water"); writer.WriteLine("<th>{0}</td>", "Orbit"); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfPlanets; ++i) { Planet planet = (Planet)planets[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", planet); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink((Ruler)planet.Owner)); writer.WriteLine("<td>{0}</td>", planet.Info.GroundSpace); writer.WriteLine("<td>{0}</td>", planet.Info.WaterSpace); writer.WriteLine("<td>{0}</td>", planet.Info.OrbitSpace); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
private void WriteGroup(HtmlTextWriter writer, Group group, bool link) { if (link) { writer.WriteLine("<div class='planetInfoZoneTitle'><b>Group {0}</b> <a href='{1}&group={0}'><img src='{2}' /></a></div>", group.Id, Page.Request.RawUrl, OrionGlobals.getCommonImagePath("Filter.gif")); } else { writer.WriteLine("<div class='planetInfoZoneTitle'><b>Group {0}</b></div>", group.Id); } writer.WriteLine("<table class='planetFrame' width='100%'>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resourceTitle'>#</td>"); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("section_ruler")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("batalhas")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("tournament_group_results")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("score")); writer.WriteLine("</tr>"); int pos = 0; foreach (Classification classif in group.Registered) { writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); writer.WriteLine("<td class='resourceCell'>{0} º</td>", ++pos); writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(classif.Player)); writer.WriteLine("<td class='resourceCell'>{0}</td>", classif.Games); writer.WriteLine("<td class='resourceCell'><span class='green'>{0}</span>/<span class='orange'>{1}</span>/<span class='red'>{2}</span></td>", classif.Wins, classif.Draws, classif.Defeats); writer.WriteLine("<td class='resourceCell'>{0}</td>", classif.Points); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
private void WriteByScore(StreamWriter writer, ArrayList rulers) { writer.WriteLine("<h2>Total Planet{0}/Number of Planets</h2>", CultureModule.getContent("score")); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>Planets</td>"); writer.WriteLine("<th>{0}</td>", "Average"); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfRulers; ++i) { Ruler ruler = (Ruler)rulers[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink(ruler)); writer.WriteLine("<td>{0}</td>", ruler.Planets.Length); writer.WriteLine("<td>{0}</td>", OrionGlobals.format((int)Math.Round(ScoreComparer.Count(ruler)))); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
private void WriteByFleet(StreamWriter writer, ArrayList planets) { writer.WriteLine("<h2>Top {0}</h2>", CultureModule.getContent("section_fleet")); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("planet")); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>L</td>"); writer.WriteLine("<th>M</td>"); writer.WriteLine("<th>H</td>"); writer.WriteLine("<th>A</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("section_fleet")); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfPlanets; ++i) { Planet planet = (Planet)planets[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", planet); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink((Ruler)planet.Owner)); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(planet, "light"))); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(planet, "medium"))); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(planet, "heavy"))); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(planet, "animal"))); writer.WriteLine("<td>{0}</td>", OrionGlobals.format((FleetComparer.Count(planet.getDefenseFleet())))); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
/// <summary>Pinta o controlo</summary> protected override void Render(HtmlTextWriter writer) { if (Page.User.IsInRole("admin")) { if (Page.Request.Form["purge"] == null) { IList list = UserUtility.bd.getInactiveUsers(); //Console.ReadLine(); writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>Purge Users</b></div>"); writer.WriteLine("<input type='submit' value='Purge {0} Inactive Users' name='purge' />", list.Count); writer.WriteLine("<ul>"); foreach (User user in list) { Ruler ruler = Universe.instance.getRuler(user.RulerId); writer.WriteLine("<li>{0} - Planetas: {1}</li>", OrionGlobals.getLink(user), ruler.Planets.Length); } writer.WriteLine("</ul>"); writer.WriteLine("</div>"); } else { writer.WriteLine("<div>Done!</div>"); } } else { writer.WriteLine("There is no spoon!"); } }
private void WriteByCulture(StreamWriter writer, ArrayList rulers) { writer.WriteLine("<h2>Top Rulers by {0}</h2>", CultureModule.getContent("culture")); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>Planets</td>"); writer.WriteLine("<th>Avg</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("culture")); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfRulers; ++i) { Ruler ruler = (Ruler)rulers[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink(ruler)); writer.WriteLine("<td>{0}</td>", ruler.Planets.Length); int count = ruler.getResourceCount("Intrinsic", "culture"); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count / ruler.Planets.Length)); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count)); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
private void WriteByPopulation(StreamWriter writer, ArrayList rulers) { writer.WriteLine("<h2>Top Rulers by {0}</h2>", CultureModule.getContent("labor")); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>Planets</td>"); writer.WriteLine("<th>Avg</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("labor")); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfRulers; ++i) { Ruler ruler = (Ruler)rulers[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink(ruler)); writer.WriteLine("<td>{0}</td>", ruler.Planets.Length); int count = PopulationComparer.Count(ruler); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count / ruler.Planets.Length)); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count)); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { UserWatcher queue = (UserWatcher)Page.Application["AlnitakOnlineUsers"]; if (queue == null || !queue.HasRegisteredUsers) { writer.WriteLine("?"); return; } int i = queue.List.Count; IDictionaryEnumerator it = queue.List.GetEnumerator(); while (it.MoveNext()) { writer.Write(OrionGlobals.getLink((User)it.Value)); /*if(ShowDate) { * writer.Write(ParseDate((DateTime) it.Key)); * }*/ if (--i != 0) { writer.WriteLine(Separator); } } }
private void WriteBySize(StreamWriter writer, ArrayList rulers) { writer.WriteLine("<h2>Top Rulers by Total {0}</h2>", "Size"); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>Planets</td>"); writer.WriteLine("<th>Avg</td>"); writer.WriteLine("<th>{0}</td>", "Space"); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfRulers; ++i) { Ruler ruler = (Ruler)rulers[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink(ruler)); writer.WriteLine("<td>{0}</td>", ruler.Planets.Length); int count = SizeComparer.Count(ruler); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count / ruler.Planets.Length)); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count)); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
protected void RenderWannabe(HtmlTextWriter writer) { User watching = Page.User as User; if (watching.AllianceId != Current.Id) { return; } writer.WriteLine("<h2>{0} {1}</h2>", Current.Wannabe.Count, CultureModule.getContent("alliance_wannabes")); if (Current.Wannabe.Count == 0) { writer.WriteLine("<p>{0}</p>", CultureModule.getContent("noneAvailable")); return; } writer.WriteLine("<table class='planetFrame'>"); writer.WriteLine("<tr class='resourceTitle'>"); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_ruler")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_topranks")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("score")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_toprulers")); if (watching.AllianceRank >= AllianceMember.Role.ViceAdmiral) { writer.WriteLine("<th class='resourceTitle'></th>"); writer.WriteLine("<th class='resourceTitle'></th>"); } writer.WriteLine("</tr>"); foreach (User user in Current.Wannabe) { writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(user)); writer.WriteLine("<td class='resourceCell'>{0}</td>", user.EloRanking); if (user.RulerId > 0) { Ruler ruler = Universe.instance.getRuler(user.RulerId); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Score); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Rank); } else { writer.WriteLine("<td class='resourceCell'>-</td>"); writer.WriteLine("<td class='resourceCell'>-</td>"); } if (watching.AllianceRank >= AllianceMember.Role.ViceAdmiral) { writer.WriteLine("<td class='resourceCell'><a href='javascript:aproove({0})'><img src='{1}' /></a></td>", user.UserId, OrionGlobals.getCommonImagePath("ok.gif")); writer.WriteLine("<td class='resourceCell'><a href='javascript:reject({0})'><img src='{1}' /></a></td>", user.UserId, OrionGlobals.getCommonImagePath("remove.gif")); } writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
protected void RenderMembers(HtmlTextWriter writer) { User watching = Page.User as User; bool member = false; bool canAdmin = false; if (watching != null) { member = watching.AllianceId == Current.Id; canAdmin = member && watching.AllianceRank >= AllianceMember.Role.Admiral; writer.WriteLine("<!-- member:{0} watching.AllianceId:{1} Current.Id:{2}-->", member, watching.AllianceId, Current.Id); writer.WriteLine("<!-- canAdmin:{0} rank:{1} -->", canAdmin, watching.AllianceRank); } writer.WriteLine("<h2>{0} {1}</h2>", Current.Members.Count, CultureModule.getContent("alliance_members")); writer.WriteLine("<table class='planetFrame'>"); writer.WriteLine("<tr class='resourceTitle'>"); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_ruler")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("alliance_role")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_topranks")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("score")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_toprulers")); if (canAdmin) { writer.WriteLine("<th class='resourceTitle'></th>"); } writer.WriteLine("</tr>"); foreach (User user in Current.Members) { writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(user)); writer.WriteLine("<td class='resourceCell'>{0}</td>", user.AllianceRank); writer.WriteLine("<td class='resourceCell'>{0}</td>", user.EloRanking); if (user.RulerId > 0) { Ruler ruler = Universe.instance.getRuler(user.RulerId); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Score); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Rank); } else { writer.WriteLine("<td class='resourceCell'>-</td>"); writer.WriteLine("<td class='resourceCell'>-</td>"); } if (canAdmin) { writer.WriteLine("<td class='resourceCell'>{0}</td>", GetSelect(user)); } writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { User user = (User)Page.Application["LatestRuler"]; if (null == user) { writer.WriteLine("?"); return; } writer.WriteLine(OrionGlobals.getLink(user)); }
/// <summary>Gera o cdigo dos relatrios de scan</summary> private void GenerateScanReport(StringWriter writer, Scan[] scans) { Ruler ruler = getRuler(); writer.Write("<tr class='resourceTitle'>"); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("turn_current")); if (ShowSourcePlanet) { writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("section_planet")); } writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_target")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("section_ruler")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_success")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_cloaked")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_report")); writer.Write("</tr>"); foreach (Scan scan in scans) { writer.Write("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); writer.Write("<td class='resourceCell'>{0}</td>", scan.Turn); if (ShowSourcePlanet) { writer.Write("<td class='resourceCell'><a href='{0}default.aspx?id={2}'>{1}</a></td>", OrionGlobals.getSectionUrl("scan"), ruler.getPlanet(scan.SourcePlanetId).Name, scan.SourcePlanetId); } writer.Write("<td class='resourceCell'>{0}</td>", scan.Target.ToString()); if (scan.TargetPlanetOwner >= 0) { writer.Write("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(Universe.instance.getRuler(scan.TargetPlanetOwner))); } else { writer.Write("<td class='resourceCell'>{0}</td>", info.getContent("scan_inhabited")); } writer.Write("<td class='resourceCell'><img src='{0}' /></td>", OrionGlobals.YesNoImage(scan.Success)); writer.Write("<td class='resourceCell'><img src='{0}' /></td>", OrionGlobals.YesNoImage(!scan.Intercepted)); if (!scan.Success) { writer.Write("<td class='resourceCell'> </td>"); } else { writer.Write("<td class='resourceCell'><a href='scanreport.aspx?id={0}&scan={2}'><img src='{1}' /></a></td>", scan.SourcePlanetId, OrionGlobals.getCommonImagePath("Filter.gif"), scan.Id ); } writer.Write("</tr>"); } }
private void WriteMatches(HtmlTextWriter writer, ICollection matches) { writer.WriteLine("<table class='planetFrame' width='100%'>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("tournament_matches")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("section_ruler")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("score")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("score")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("section_ruler")); writer.WriteLine("</tr>"); foreach (Match match in matches) { writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); if (match.Result == BattleResult.None) { writer.WriteLine("<td class='resourceCell'><a href='{1}ruler/battle/battle.aspx?id={2}&rulerid={3}'><img src='{0}' /></a></td>", OrionGlobals.getCommonImagePath("Filter.gif"), OrionGlobals.AppPath, match.BattleId, match.NumberOne.Id); } else { writer.WriteLine("<td class='resourceCell'>-</td>"); } writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(match.NumberOne)); string css = "resourceCostCellSucceeded"; if (match.Result != BattleResult.NumberOneVictory) { css = "resourceCostCellFailed"; } writer.WriteLine("<td class='{1}'>{0}</td>", match.NumberOnePoints, css); css = "resourceCostCellSucceeded"; if (match.Result != BattleResult.NumberTwoVictory) { css = "resourceCostCellFailed"; } writer.WriteLine("<td class='{1}'>{0}</td>", match.NumberTwoPoints, css); writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(match.NumberTwo)); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
/// <summary>Indica o receptor</summary> private void SetTo() { string toId = Request.QueryString["id"]; if (toId == null || !OrionGlobals.isInt(toId)) { to.Controls.Add(new LiteralControl("Webmaster")); } else { User user = GetUser(int.Parse(toId)); to.Controls.Add(new LiteralControl(OrionGlobals.getLink(user))); ViewState["Mail-To"] = user; } }
protected override void OnLoad(EventArgs args) { base.OnLoad(args); if (Page.IsPostBack) { return; } if (Page.User is User) { User user = (User)Page.User; rank1.Text = user.EloRanking.ToString(); userRank.Text = OrionGlobals.getLink(user) + ": " + user.EloRanking.ToString(); } resultDDL.Items.Add("NumberOneVictory"); resultDDL.Items.Add("NumberTwoVictory"); resultDDL.Items.Add("Draw"); }
private void WriteRoaster(HtmlTextWriter writer, Championship champ) { writer.WriteLine("<h2>Playoffs Preview</h2>"); ArrayList list = champ.GetWinners(); writer.WriteLine("<ul id='PlayoffsPreview'>"); for (int i = 0; i < list.Count; i += 2) { Ruler one = (Ruler)list[i]; Ruler two = (Ruler)list[i + 1]; writer.WriteLine("<li>{0} <span class='green'>vs</span> {1}</li>", OrionGlobals.getLink(one), OrionGlobals.getLink(two) ); } writer.WriteLine("</ul>"); }
private void RenderRanks(HtmlTextWriter writer, User[] users) { writer.WriteLine("<table class='planetFrame'>"); writer.WriteLine("<tr class='resourceTitle'>"); writer.WriteLine("<td class='resourceTitle'>#</td>"); writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("stats_rulers")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("battle_rank")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("batalhas")); writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("score")); writer.WriteLine("</tr>"); for (int i = 0; i < users.Length; ++i) { if (users[i] == null) { continue; } writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); writer.WriteLine("<td class='resourceCell'>{0}º</td>", i + 1); bool rulerViewing = false; // mostrar o nome do ruler writer.WriteLine("<td class='resource'>"); if (rulerViewing) { writer.WriteLine("<u><b>{0}</b></u>", OrionGlobals.getLink(users[i])); } else { writer.WriteLine(OrionGlobals.getLink(users[i])); } writer.WriteLine("</td>"); writer.WriteLine("<td class='resourceCell'>{0}</td>", users[i].EloRankDescription.ToString()); writer.WriteLine("<td class='resourceCell'><span class='green'>{0}</span> / <span class='red'>{1}</span></td>", users[i].Wins, users[i].Losses); writer.WriteLine("<td class='resourceCell'>{0}</td>", users[i].EloRanking); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
/// <summary>Indica os vencedores de um prémio</summary> private void writeWinners(HtmlTextWriter writer, PrizeManager prizes) { if (prizes.Gold != null) { writer.WriteLine(OrionGlobals.getLink(prizes.Gold.Ruler)); } if (prizes.Silver != null) { writer.WriteLine("<br/>{0}", OrionGlobals.getLink(prizes.Silver.Ruler)); } if (prizes.Bronze != null) { writer.WriteLine("<br/>{0}", OrionGlobals.getLink(prizes.Bronze.Ruler)); } if (prizes.Last != null) { writer.WriteLine("<br/>{0}", OrionGlobals.getLink(prizes.Last.Ruler)); } }
protected void WriteAlliances(HtmlTextWriter writer, ArrayList all) { int max = 50; if (all.Count < max) { max = all.Count; } writer.WriteLine("<table class='planetFrame'>"); writer.WriteLine("<tr class='resourceTitle'>"); writer.WriteLine("<th class='resourceTitle'>#</th>"); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_alliance")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("alliance_tag")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("alliance_members")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("planetas")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("spaceTitle")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("section_topranks")); writer.WriteLine("<th class='resourceTitle'>{0}</th>", CultureModule.getContent("score")); writer.WriteLine("</tr>"); for (int i = 0; i < max; ++i) { AllianceInfo info = (AllianceInfo)all[i]; if (!info.HasMembers) { continue; } writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); writer.WriteLine("<td class='resourceCell'>{0}</td>", i + 1); writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(info)); writer.WriteLine("<td class='resourceCell'>{0}</td>", info.Tag); writer.WriteLine("<td class='resourceCell'>{0}</td>", info.Members.Count); writer.WriteLine("<td class='resourceCell'>{0}</td>", info.TotalPlanets); writer.WriteLine("<td class='resourceCell'>{0}</td>", info.TotalSpace); writer.WriteLine("<td class='resourceCell'><b title='Avg: {1}'>{0}</b> ({2})</td>", info.Ranking, info.AverageRanking, info.RankingBattles); writer.WriteLine("<td class='resourceCell'><b title='{1}'>{0}</b> (<span class='green'>{2}</span>/<span class='red'>{3}</span>)</td>", info.Score, info.AverageScore, info.TotalRoundWins, info.TotalRoundDefeats); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
/// <summary>Indica o emissor</summary> private void SetFrom() { User user = Context.User as User; if (user == null) { fromBlank.Visible = true; from.Visible = false; } else { fromBlank.Visible = false; from.Visible = true; } if (from.Visible) { from.Text = OrionGlobals.getLink(user); } }
private void WriteByFleet(StreamWriter writer, ArrayList rulers) { writer.WriteLine("<h2>Top Rulers by {0}</h2>", CultureModule.getContent("section_fleet")); writer.WriteLine("<table>"); writer.WriteLine("<tr>"); writer.WriteLine("<th>#</td>"); writer.WriteLine("<th>Ruler</td>"); writer.WriteLine("<th>L</td>"); writer.WriteLine("<th>M</td>"); writer.WriteLine("<th>H</td>"); writer.WriteLine("<th>A</td>"); writer.WriteLine("<th>Planets</td>"); writer.WriteLine("<th>{0}</td>", CultureModule.getContent("section_fleet")); writer.WriteLine("<th>Average</td>"); writer.WriteLine("</tr>"); for (int i = 0; i < NumberOfRulers; ++i) { Ruler ruler = (Ruler)rulers[i]; writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", i + 1); writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink(ruler)); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(ruler, "light"))); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(ruler, "medium"))); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(ruler, "heavy"))); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(FleetComparer.Count(ruler, "animal"))); writer.WriteLine("<td>{0}</td>", ruler.Planets.Length); int count = FleetComparer.Count(ruler); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count)); writer.WriteLine("<td>{0}</td>", OrionGlobals.format(count / ruler.Planets.Length)); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
/// <summary>Pinta o controlo</summary> protected override void Render(HtmlTextWriter writer) { OrionGlobals.RegisterRequest(MessageType.Generic, string.Format("{1} {0}", info.getContent("section_home"), ruler.Name)); writer.WriteLine("<div class='planetInfoZoneTitle'><b>" + Title + "</b></div>"); writer.WriteLine("<table class='planetFrame' style='margin-bottom: 0px; border-bottom:none;'>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("name")); writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(ruler)); writer.WriteLine("</tr>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("stats_alliances")); string allianceText = null; if (ruler.AllianceId == 0) { allianceText = "<i>" + info.getContent("no_alliance") + "</i>"; } else { AllianceInfo allianceInfo = AllianceUtility.Persistance.Get(ruler.AllianceId); if (allianceInfo != null) { allianceText = OrionGlobals.getLink(allianceInfo); } else { allianceText = "<i>" + info.getContent("no_alliance") + "</i>"; } } writer.WriteLine("<td class='resourceCell'>{0}</td>", allianceText); writer.WriteLine("</tr>"); writer.WriteLine("</table>"); writer.WriteLine("<table class='planetFrame' style='margin-top: 0px;'>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("planetas")); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Planets.Length); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("maxPlanets")); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.getResourceCount("maxPlanets")); writer.WriteLine("</tr>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("victories")); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Victories); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("defeats")); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Defeats); writer.WriteLine("</tr>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("culture")); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.getResourceCount("culture")); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("score")); writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.getResourceCount("score")); writer.WriteLine("</tr>"); writer.WriteLine("<tr>"); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("battle_rank")); writer.WriteLine("<td class='resourceCell'>{0}</td>", info.getContent(ruler.Ranking)); writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("battle_rank")); writer.WriteLine("<td class='resourceCell'><b>{0}</b>º</td>", (ruler.Rank == -1?"~":ruler.Rank.ToString())); writer.WriteLine("</tr>"); writer.WriteLine("</table>"); }
/// <summary>Prepara o controlo</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); try { Ruler scanner = getRuler(); Scan scan = ScanUtility.Persistence.GetScan(ScanId); if (scan == null) { throw new Exception("No scan with id '" + ScanId + "' found"); } if (!scan.Success) { throw new Exception("Trying to access an unsucceceful scan"); } Planet source = scanner.getPlanet(scan.SourcePlanetId); if (source == null) { throw new Exception("Ruler '" + scanner.Id + "' don't own planet '" + scan.SourcePlanetId + ""); } Planet planet = scan.TargetPlanet; OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Scan, string.Format("{0} - {1}", info.getContent("section_scanreport"), planet.Coordinate)); scanWiki.NavigateUrl = Wiki.GetUrl("Scan"); scanWiki.Text = info.getContent("Wiki_Scan"); scanWiki.CssClass = "docs"; img.ImageUrl = OrionGlobals.getCommonImagePath("planets/" + planet.Info.Id + ".jpg"); img.EnableViewState = false; if (scan.TargetPlanetOwner != -1) { name.Text = planet.Name; ruler.Text = OrionGlobals.getLink(Universe.instance.getRuler(scan.TargetPlanetOwner)); } else { name.Text = "?"; ruler.Text = info.getContent("scan_inhabited"); } coordinate.Text = planet.Coordinate.ToString(); diameter.Text = planet.Info.Diameter.ToString(); mass.Text = planet.Info.Mass.ToString(); temperature.Text = planet.Info.Temperature; escape.Text = planet.Info.EscapeVelocity.ToString(); terrain.Text = info.getContent(planet.Info.Terrain.Description); cultureValue.Text = scan.Culture.ToString(); travelTime.Text = Chronos.Core.Fleet.TravelTime(source.Coordinate, scan.Target).ToString(); inBattle.ImageUrl = OrionGlobals.YesNoImage(scan.InBattle); if (scan.ScanLevel == 1) { return; } level2.Visible = true; fillPanel(mineral, "mineral", planet.Info.MPRatio); fillPanel(food, "food", planet.Info.FoodRatio); fillPanel(gold, "gold", planet.Info.GoldRatio); fillPanel(energy, "energy", planet.Info.EnergyRatio); fillPanel(groundSpace, "groundSpace", planet.Info.GroundSpace); fillPanel(waterSpace, "waterSpace", planet.Info.WaterSpace); fillPanel(orbitSpace, "orbitSpace", planet.Info.OrbitSpace); if (scan.ScanLevel == 2) { return; } level3.Visible = true; fleetNumber.Text = scan.NumberOfFleets.ToString(); shipsNumber.Text = scan.TotalShips.ToString(); hasStarPort.ImageUrl = OrionGlobals.YesNoImage(scan.HasStarPort); hasCommsSatellite.ImageUrl = OrionGlobals.YesNoImage(scan.HasCommsSatellite); hasGate.ImageUrl = OrionGlobals.YesNoImage(scan.HasGate); hasStarGate.ImageUrl = OrionGlobals.YesNoImage(scan.HasStarGate); hasHospital.ImageUrl = OrionGlobals.YesNoImage(scan.HasHospital); hasLandReclamation.ImageUrl = OrionGlobals.YesNoImage(scan.HasLandReclamation); hasMineralExtractor.ImageUrl = OrionGlobals.YesNoImage(scan.HasMineralExtractor); hasSpa.ImageUrl = OrionGlobals.YesNoImage(scan.HasSpa); hasStockMarkets.ImageUrl = OrionGlobals.YesNoImage(scan.HasStockMarkets); hasWaterReclamation.ImageUrl = OrionGlobals.YesNoImage(scan.HasWaterReclamation); hasIonCannon.ImageUrl = OrionGlobals.YesNoImage(scan.HasIonCannon); hasTurret.ImageUrl = OrionGlobals.YesNoImage(scan.HasTurret); } catch (Exception ex) { Visible = false; Chronos.Utils.Log.log(ex); ExceptionLog.log(ex); } }
private void CreateFleets() { Hashtable universeFleets = _ruler.UniverseFleets; _itemsTable.Title = info.getContent("battle_fleetsReadyToBattle"); _itemsTable.TitleCssClass = "planetInfoZoneTitle"; _itemsTable.TableCssClass = "planetFrame"; createTitle(_itemsTable); bool isOneReady = false; if (universeFleets != null && universeFleets.Count > 0) { IDictionaryEnumerator iter = universeFleets.GetEnumerator(); while (iter.MoveNext()) { Chronos.Core.Fleet f = (Chronos.Core.Fleet)iter.Value; Planet p = Universe.instance.getPlanet(f.Coordinate); if (f.GoodForBattle) { ItemsTableLine line = new ItemsTableLine(); ItemsTableText fleet = new ItemsTableText(f.Name, "resource"); ItemsTableText coord = new ItemsTableText(f.Coordinate.ToString(), "resource"); ItemsTableText rulerName; if (p.Owner != null) { rulerName = new ItemsTableText(OrionGlobals.getLink((Ruler)p.Owner), "resource"); } else { rulerName = new ItemsTableText(info.getContent("conquerplanet_none"), "resource"); } ItemsTableItem action; if (p.IsInBattle) { action = new ItemsTableText(info.getContent("battle_isInBattle"), "resource"); } else { if (p.HasImmunity) { action = new ItemsTableText(string.Format(info.getContent("BattleImmunity"), p.Immunity), "resource"); } else { if (p.Owner != null && Ruler.IsSameAlliance((Ruler)p.Owner, (Ruler)f.Owner)) { action = new ItemsTableText(info.getContent("battle_sameAlliance"), "resource"); } else { if (!p.HasProtection) { action = new ItemsTableText(info.getContent("planet_not_protected"), "resource"); } else { action = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("ok.gif"), fleet.ID); ((ItemsTableImageButton)action).Click += new ImageClickEventHandler(submit_Click); } } } } line.add(fleet); line.add(coord); line.add(rulerName); line.add(action); _itemsTable.addLine(line); isOneReady = true; } } } if (!isOneReady) { insertNoFleets(); } }
/// <summary>Traduz um Ruler para texto localizado</summary> public string translate(Ruler ruler) { return(OrionGlobals.getLink(ruler)); }