Пример #1
0
        /// <summary>Obtém um User dado o seu id</summary>
        public override User getUser(int id)
        {
            SqlConnection conn = new SqlConnection(OrionGlobals.getConnectionString("connectionString"));
            SqlCommand    cmd  = new SqlCommand("OrionsBelt_UsersGetUserById", conn);

            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandTimeout = 0;

            cmd.Parameters.Add("@id", id);

            try {
                conn.Open();

                reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    User user = new User();

                    user.Nick       = (string)reader["user_nick"];
                    user.UserId     = (int)reader["user_id"];
                    user.RulerId    = (int)reader["user_ruler_id"];
                    user.EloRanking = (int)reader["user_rank"];

                    user.RegistDate = (DateTime)getField("user_registDate");
                    user.LastLogin  = (DateTime)getField("user_lastLogin");

                    user.Skin      = (int)reader["user_skin"];
                    user.Lang      = (string)reader["user_lang"];
                    user.ImagesDir = (string)reader["user_imagesDir"];

                    user.Website = (string)reader["user_website"];
                    user.Avatar  = (string)reader["user_avatar"];

                    user.Msn    = (string)reader["user_msn"];
                    user.Icq    = (string)reader["user_icq"];
                    user.Jabber = (string)reader["user_jabber"];
                    user.Aim    = (string)reader["user_aim"];
                    user.Yahoo  = (string)reader["user_yahoo"];

                    return(user);
                }
                else
                {
                    return(null);
                }
            } catch (Exception e) {
                throw new AlnitakException("Erro ao executar o procedimento 'OrionsBelt_UsersGetUserById' @ SqlServerUserutility::getUser : " + e.Message, e);
            } finally {
                conn.Close();
            }
        }
Пример #2
0
        private void WriteFleetInformation(HtmlTextWriter writer, Chronos.Core.Fleet fleet)
        {
            string state       = info.getContent("fleet_state");
            string information = string.Empty;

            if (fleet.IsMoving)
            {
                state += info.getContent("fleet_inMovement");
                string arrival = string.Format(info.getContent("fleet_turnsToGo"), fleet.HoursToArrive);
                information = string.Format("<b>{0}:</b> {1}<br/>{2}", info.getContent("fleet_coordinate"), fleet.DestinyCoordinate.ToString(), arrival);
            }
            else
            {
                if (fleet.IsInBattle)
                {
                    state      += info.getContent("fleet_inBattle");
                    information = info.getContent("fleet_battleCoordinate") + fleet.Coordinate.ToString();
                }
                else
                {
                    if (fleet.IsMoveable)
                    {
                        state += info.getContent("fleet_stopped");
                        if (fleet.Owner is Planet)
                        {
                            Planet p    = ((Planet)fleet.Owner);
                            string link = OrionGlobals.getSectionBaseUrl("Fleet") + "?id=" + p.Id;
                            information = string.Format("{0}<a href='{1}'>{2}</a>", info.getContent("fleet_location"), link, p.Name);
                        }
                        else
                        {
                            information = info.getContent("fleet_location") + fleet.Coordinate.ToString();
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            writer.WriteLine(@"
				<tr>
					<td class='borderTop' colspan='3' style='padding: 5px 0px 5px 0px;'>
						{0}<br/>
						{1}
					</td>
				</tr>"                , state, information
                             );
        }
Пример #3
0
 /// <summary>Escreve o nome de um planeta</summary>
 protected void WritePlanet(Planet planet, HtmlTextWriter writer, string targetSection)
 {
     writer.WriteLine("<td class='resourceManagement'><a href='{0}default.aspx?id={1}' title='{3}'>{2}</a>",
                      OrionGlobals.getSectionUrl(targetSection),
                      planet.Id,
                      planet.Name,
                      planet.ToString()
                      );
     if (planet.IsInBattle)
     {
         writer.WriteLine("<img src='{0}'/>", OrionGlobals.getCommonImagePath("messages/Battle.gif"));
     }
     writer.WriteLine("</td>");
 }
Пример #4
0
        /// <summary>Envia notcias</summary>
        protected override void Render(HtmlTextWriter writer)
        {
            try {
                OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.FleetManagement, CultureModule.getContent("section_ships"));

                User  user  = (User)Context.User;
                Ruler ruler = Universe.instance.getRuler(user.RulerId);

                WriteShips(ruler, writer, new string[] { "light", "medium" });
                WriteShips(ruler, writer, new string[] { "heavy", "animal", "special" });
            } catch (Exception ex) {
                writer.WriteLine("<!-- {0} -->", ex.ToString());
            }
        }
Пример #5
0
        /// <summary>Pinta o controlo</summary>
        protected override void OnPreRender(EventArgs args)
        {
            Chronos.Core.Planet planet = getPlanet();

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, string.Format("{1} - {0}", info.getContent("section_planet"), planet.Name));

            if (planet == null)
            {
                writeErrorResponse();
                return;
            }

            writePlanet(planet);
        }
Пример #6
0
        /// <summary>Obtm as notcias existentes</summary>
        public NewsList GetNews()
        {
            string culture = OrionGlobals.getCulture();
            object obj     = HttpContext.Current.Cache["NewsList" + culture];

            if (obj == null)
            {
                NewsList list = GetNewsFromDBByLang(culture);
                HttpContext.Current.Cache["NewsList" + culture] = list;
                return(list);
            }

            return((NewsList)obj);
        }
Пример #7
0
        /// <summary>Evento de click no buto</summary>
        protected void onLoginClick(object src, ImageClickEventArgs args)
        {
            //verificar se as string n esto vazias
            if (userMail.Text == string.Empty)
            {
                Information.AddError(info.getContent("provide-mail"));
                return;
            }

            if (!Regex.IsMatch(userMail.Text, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"))
            {
                Information.AddError(info.getContent("bad-mail-format"));
                return;
            }

            if (password.Text == string.Empty)
            {
                Information.AddError(info.getContent("provide-password"));
                return;
            }

            if ((userMail.Text.IndexOf(" ")) == 0 || (password.Text.IndexOf(" ")) == 0)
            {
                Information.AddError(info.getContent("login-error"));
                return;
            }

            bool user = UserUtility.bd.checkUser(userMail.Text, password.Text);

            if (!user)
            {
                Information.AddError(info.getContent("login-error"));
                return;
            }
            login.Visible  = false;
            logout.Visible = true;
            FormsAuthentication.SetAuthCookie(userMail.Text, autoLogin.Checked);
            string redirectUrl = FormsAuthentication.GetRedirectUrl(userMail.Text, autoLogin.Checked).ToLower();

            HttpContext context = HttpContext.Current;

            if (context.Request.QueryString["ReturnUrl"] != null)
            {
                context.Response.Redirect(redirectUrl);
            }
            else
            {
                context.Response.Redirect(OrionGlobals.resolveBase("default.aspx"));
            }
        }
Пример #8
0
        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>");
        }
Пример #9
0
        /// <summary>Escreve este controlo em html</summary>
        protected override void Render(HtmlTextWriter writer)
        {
            EnableViewState = false;

            Universe      universe = Universe.instance;
            ILanguageInfo info     = CultureModule.getLanguage();

            ChronosStats stats = (ChronosStats)Page.Application["ChronosStats"];

            writer.WriteLine("<div class='stats-box'>");
            writer.WriteLine("<div align='center'><b>" + info.getContent("stats_title") + "</b></div>");
            writer.WriteLine(info.getContent("stats_alliances") + "<b>: " + (universe.allianceCount - 1) + "</b><br />");
            writer.WriteLine(info.getContent("stats_rulers") + ": <b>" + universe.rulerCount + "</b><br />");

            int maxP = Coordinate.MaximumGalaxies * Coordinate.MaximumSystems * Coordinate.MaximumSectors * Coordinate.MaximumPlanets;

            writer.WriteLine(info.getContent("stats_planets") + ": <b>" + universe.planetCount + "/" + maxP + "</b><br />");


            writer.WriteLine(info.getContent("stats_nextCoordinate") + ": <b>" + universe.CurrentCoordinate + "</b><br />");
            writer.WriteLine("<div>--</div>");
            writer.WriteLine(info.getContent("stats_timeFromLastReboot") + ": <b>" + stats.StartTime + "</b><br />");
            writer.WriteLine("Dress Up: <b>" + stats.DressUp + "</b><br />");
            writer.WriteLine(info.getContent("stats_lastTurnTime") + ": <b>" + stats.LastTurnTime + "</b><br />");
            writer.WriteLine(info.getContent("stats_turnSinceReboot") + ": <b>" + stats.TurnCount + "</b><br />");
            writer.WriteLine(info.getContent("stats_totalTurns") + ": <b>" + universe.TurnCount + "</b><br />");
            writer.WriteLine(info.getContent("stats_turnTime") + ": <b>" + universe.TurnTime + "</b><br />");
            writer.WriteLine(info.getContent("stats_lastTurn") + ": <b>" + stats.LastTurn.ToLongTimeString() + "</b><br />");
            writer.WriteLine(info.getContent("stats_nextTurn") + ": <b>" + stats.LastTurn.AddMilliseconds(universe.TurnTime).ToLongTimeString() + "</b><br />");
            if (Universe.instance.Persistence is UniverseSerializer)
            {
                writer.WriteLine("Stream Size: <b>" + (((UniverseSerializer)Universe.instance.Persistence).StreamSize / 1024) + " Kb</b><br />");
            }
            writer.WriteLine("<div>--</div>");
            writer.WriteLine(info.getContent("stats_persistence") + ": <b>" + Chronos.Persistence.UniverseSerializer.Instance.GetType().Name + "</b><br />");
            writer.WriteLine("<div>--</div>");
            writer.WriteLine("<b>Alnitak: </b><br/>{0}<p/>", OrionGlobals.AlnitakInfo.Replace(";", "<br/>"));
            writer.WriteLine("<b>Chronos: </b><br/>{0}", Chronos.Utils.Platform.ChronosInfo.Replace(";", "<br/>"));
            writer.WriteLine("</div>");

            registerScripts();

            writer.WriteLine("<p />");
            writeCacheInfo(writer, info);
            writer.WriteLine("<p />");
            writeApplicationInfo(writer, info);

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_admin"));
        }
Пример #10
0
        /// <summary>Pinta o controlo</summary>
        protected override void OnLoad(EventArgs e)
        {
            if (planets != null)
            {
                ruler = getRuler();

                planets.ItemDataBound += new RepeaterItemEventHandler(planets_ItemDataBound);
                planets.DataSource     = ruler.Planets;
                planets.DataBind();
            }

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, info.getContent("section_planets"));

            base.OnLoad(e);
        }
Пример #11
0
        /// <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;
            }
        }
Пример #12
0
        /// <summary>
        /// carrega todas as informações sobre o Ruler, introduz as informações no repeater
        /// e carrega os contrôlos
        /// </summary>
        protected override void OnInit(EventArgs e)
        {
            ruler = getRuler();

            string name = Page.Request.Form["fleetToRemove"];

            if (name != null && name != string.Empty)
            {
                remove(name);
            }

            //regista o codigo de script para esconder/mostrar a fleet
            OrionGlobals.registerShowHideScript(Page);
            base.OnInit(e);
        }
Пример #13
0
        /// <summary>Escreve este controlo em html</summary>
        protected override void Render(HtmlTextWriter writer)
        {
            string url = OrionGlobals.getConfigurationValue("alnitak", "url");

            writer.WriteLine("<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:trackback=\"http://madskills.com/public/xml/rss/module/trackback/\" xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\" xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\">");
            writer.WriteLine("\t<channel>");
            writer.WriteLine("\t<title>Orion's Belt</title>");
            writer.WriteLine("\t<link>{0}</link>", url);
            writer.WriteLine("\t<description>Orion's Belt :: Notícias</description>");
            writer.WriteLine("\t<dc:language>pt-PT</dc:language>");
            writer.WriteLine("\t<generator>Alnitak.RssFeed</generator>");
            writer.WriteLine("\t</channel>");
            writeEntries(writer, url);
            writer.WriteLine("</rss>");
        }
Пример #14
0
        /// <summary>
        /// Criar a tabela com as naves e o
        /// </summary>
        private void createTable()
        {
            itemsTable.Title         = info.getContent("fleet_moveFleet");
            itemsTable.TitleCssClass = "planetInfoZoneTitle";
            itemsTable.TableCssClass = "planetFrame";

            createTitle(itemsTable);

            bool hasResults = false;

            if (travel.IsTravelAvailable)
            {
                foreach (string fleet in getMoveableFleets())
                {
                    ItemsTableLine line = new ItemsTableLine();

                    ItemsTableText fleetName = new ItemsTableText(fleet, "resource");

                    ItemsTableText coord = new ItemsTableText(_ruler.getFleet(fleet).Coordinate.ToString(), "resource");

                    ItemsTableImageButton moveFleet = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("move.gif"), "move_" + _ruler.getFleet(fleet).Id.ToString());
                    moveFleet.Click += new ImageClickEventHandler(moveFleet_Click);

                    line.add(fleetName);
                    line.add(coord);
                    line.add(moveFleet);

                    itemsTable.addLine(line);

                    hasResults = true;
                }

                if (!hasResults)
                {
                    addLine(info.getContent("fleet_noFleetsToMove"), 3);
                    travel.Visible = false;
                }
                else
                {
                    addLine(info.getContent("fleet_help"), 3);
                }
            }
            else
            {
                travel.Visible = false;
                addLine(info.getContent("fleet_moveNotAvailable"), 3);
            }
        }
Пример #15
0
        private void planets_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Control             planetSkin = e.Item;
                Chronos.Core.Planet planet     = (Chronos.Core.Planet)e.Item.DataItem;

                Image img = (Image)planetSkin.FindControl("img");
                if (img != null)
                {
                    img.ImageUrl = string.Format("{0}planets/{1}.jpg", OrionGlobals.getCommonImagePath(""), planet.Info.Id);
                }

                HyperLink planetLink = (HyperLink)planetSkin.FindControl("planetLink");
                if (planetLink != null)
                {
                    //planetLink.NavigateUrl = OrionGlobals.resolveBase("ruler/planets/planet/default.aspx?id=" + planet.Id);
                    planetLink.NavigateUrl = OrionGlobals.getSectionUrl("planet") + "default.aspx?id=" + planet.Id;
                }

                HyperLink buildingsLink = (HyperLink)planetSkin.FindControl("buildingsLink");
                if (buildingsLink != null)
                {
                    buildingsLink.NavigateUrl = OrionGlobals.resolveBase("ruler/planets/planet/buildings.aspx?id=" + planet.Id);
                    buildingsLink.Text        = info.getContent("Building");
                }

                Label name = (Label)planetSkin.FindControl("name");
                if (name != null)
                {
                    name.Text = planet.Name;
                }

                Label coordinate = (Label)planetSkin.FindControl("coordinate");
                if (coordinate != null)
                {
                    coordinate.Text = planet.Coordinate.ToString();
                }

                Control resources = (Control)planetSkin.FindControl("resourcesPanel");
                if (resources != null)
                {
                    resources.Controls.Add(new ShowPlanetResources(planet));
                }

                fillResourceType("Building", planetSkin, planet);
            }
        }
Пример #16
0
        protected override void Render(HtmlTextWriter writer)
        {
            int r = RandomPicture;

            Page.RegisterHiddenField("imagesPath", OrionGlobals.getCommonImagePath("screenshots/"));
            writer.WriteLine("<table id='screenShotViewer' >");
            writer.WriteLine("<tr><td>");
            writer.WriteLine("<img id='currentPicture' src='{0}' />", OrionGlobals.getCommonImagePath("screenshots/" + r + ".png"));
            writer.WriteLine("</td></tr>");
            writer.WriteLine("<th>");
            writer.WriteLine("<span onClick='prevPicture()'> << </span>");
            writer.WriteLine("<span id='currentPictureNumber'>{1}</span>/<span id='maxPicture'>{0}</span>", Max, r);
            writer.WriteLine("<span onClick='nextPicture()'> >> </span>");
            writer.WriteLine("</th>");
            writer.WriteLine("</table>");
        }
Пример #17
0
 /// <summary>Retorna parâmetros internacionalizados</summary>
 private string[] getParams(string[] original)
 {
     string[] result = new string[original.Length];
     for (int i = 0; i < original.Length; ++i)
     {
         if (!OrionGlobals.isInt(original[i]))
         {
             result[i] = info.getContent(original[i]);
         }
         else
         {
             result[i] = original[i];
         }
     }
     return(result);
 }
Пример #18
0
        /// <summary>Mostra o menu que indica todas as categorias possíveis</summary>
        private void showMainMenu(HtmlTextWriter writer)
        {
            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, CultureModule.getContent("section_docs"));

            writer.WriteLine("<ul>");
            foreach (string allowed in AllowedCategories)
            {
                writer.WriteLine("<li><a href='{0}?category={1}'>",
                                 OrionGlobals.getSectionBaseUrl("docs"),
                                 allowed
                                 );
                writer.WriteLine(info.getContent(allowed));
                writer.WriteLine("</a> ({0})</li>", getHash(allowed).Count);
            }
            writer.WriteLine("</ul>");
        }
Пример #19
0
        /// <summary>Envia notcias</summary>
        protected override void Render(HtmlTextWriter writer)
        {
            try {
                OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, CultureModule.getContent("section_resources"));

                User  user  = (User)Context.User;
                Ruler ruler = Universe.instance.getRuler(user.RulerId);

                WriteResources(ruler, writer);
                WriteModifiers(ruler, writer);
                WriteRareResources(ruler, writer);
                WriteGeneral(ruler, writer);
            } catch (Exception ex) {
                writer.WriteLine("<!-- {0} -->", ex.ToString());
            }
        }
Пример #20
0
        /// <summary>Mostra o controlo</summary>
        protected override void Render(HtmlTextWriter writer)
        {
#if WIKI
        #if DEBUG
            Check(GetFederation(), "Federation");
        #endif
            if (WikiSearch != null)
            {
                WriteSearchResults(writer);
                return;
            }

            string currentTopic = "Orionsbelt.Orionsbelt";

            OrionTopic obj = (OrionTopic)Context.Items["WikiTopic"];
            if (obj != null)
            {
                currentTopic = obj.ToString();
            }

            if (obj != null && !obj.Exists)
            {
                writer.WriteLine("Lamentamos, mas o tpico {0} ainda no foi adicionado.", obj.ToString());
                ExceptionLog.log("WikiTopic", string.Format("Access detected to WikiTopic '{0}' that does not exist.", obj.ToString()));
                return;
            }

            FlexWiki.AbsoluteTopicName topic = new FlexWiki.AbsoluteTopicName(currentTopic);

            string display = GetDisplay(topic);
            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, string.Format("{0} - {1}", CultureModule.getContent("help"), display));

            FlexWiki.Federation fed = GetFederation();

            string formattedBody = fed.GetTopicFormattedContent(topic, false);
            writer.WriteLine("<div id='TopicTip'></div>");
            writer.WriteLine("<div id='wiki'>");
            WriteLocation(writer, topic, display);
            CheckPreviewImage(writer, topic);
            writer.WriteLine("<h1>{0}</h1>", display);
            writer.WriteLine(formattedBody);
            writer.WriteLine("</div>");
#else
            writer.WriteLine("<p>This <b>orionsbelt</b> version was compiled without Wiki support!</p>");
            writer.WriteLine("<p>If this is an online version... then... er... maybe we forgot the wiki, please warn us!</p>");
#endif
        }
Пример #21
0
        /// <summary>Verifica se houve eventos</summary>
        private void checkEvents(ResourceInfo resource)
        {
            if (Page.IsPostBack)
            {
                string queueStatus = Page.Request.Form["queueStatus"];
                //string action = Page.Request.Form["queueAction"];
                string idx = Page.Request.Form["queueParam"];

                if (idx == null || idx == "")
                {
                    return;
                }

                if (!OrionGlobals.isInt(idx))
                {
                    errorMessage = "InvalidQueueRequest";
                    Log.log(idx + " is not integer");
                    return;
                }

                int index = int.Parse(idx);

                string state = (resource.Current != null).ToString() + ";" + resource.QueueCount;
                if (queueStatus != state)
                {
                    errorMessage = "InvalidQueueState";
                    Log.log("Invalid state: " + state + " should be: " + queueStatus);
                    return;
                }

                if (index < -1 || index >= resource.QueueCount)
                {
                    errorMessage = "InvalidQueueRequest";
                    Log.log("Invalid index: " + index);
                    return;
                }

                if (index == -1)
                {
                    resource.cancel();
                }
                else
                {
                    resource.dequeue(index);
                }
            }
        }
Пример #22
0
        /// <summary>Retorna o Ruler da sessão</summary>
        protected Ruler getRuler()
        {
            User user = Page.User as User;

            if (user == null)
            {
                OrionGlobals.forceLogin();
                return(null);
            }

            Chronos.Core.Ruler ruler = Universe.instance.getRuler(user.RulerId);
            if (ruler == null)
            {
                throw new AlnitakException("Ruler não existe @ PlanetControl::getRuler");
            }
            return(ruler);
        }
Пример #23
0
        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");
        }
Пример #24
0
        private void WikiWriteByScore(StreamWriter writer, ArrayList rulers)
        {
            writer.WriteLine("!!!Total PlanetScore/Number of Planets");

            writer.Write("||{!^}*#*");
            writer.Write("||{!^}*Ruler*");
            writer.Write("||{!^}*Planets*");
            writer.WriteLine("||{!^}*Average*||");

            for (int i = 0; i < NumberOfRulers; ++i)
            {
                Ruler ruler = (Ruler)rulers[i];
                writer.Write("||{0}", i + 1);
                writer.Write("||{0}", ruler.Name);
                writer.Write("||{0}", ruler.Planets.Length);
                writer.WriteLine("||{0}||", OrionGlobals.format((int)Math.Round(ScoreComparer.Count(ruler))));
            }
        }
Пример #25
0
        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>");
        }
Пример #26
0
 /// <summary>Mostra informação de roles</summary>
 private void showUserRole(HtmlTextWriter writer, User user)
 {
     if (OrionGlobals.isAdmin(user))
     {
         writer.WriteLine("<div class='nav'>{0}</div>", string.Format(info.getContent("user_admin"), OrionGlobals.getLink(user)));
         return;
     }
     if (OrionGlobals.isBetaTester(user))
     {
         writer.WriteLine("<div class='nav'>{0}</div>", string.Format(info.getContent("user_betatester"), OrionGlobals.getLink(user)));
         return;
     }
     if (OrionGlobals.isArtist(user))
     {
         writer.WriteLine("<div class='nav'>{0}</div>", string.Format(info.getContent("user_artist"), OrionGlobals.getLink(user)));
         return;
     }
 }
Пример #27
0
        private void WikiWriteByPopulation(StreamWriter writer, ArrayList planets)
        {
            writer.WriteLine("!!Top by Labor");

            writer.Write("||{{!^}}*{0}*", "#");
            writer.Write("||{{!^}}*{0}*", "Planet");
            writer.Write("||{{!^}}*{0}*", "Ruler");
            writer.WriteLine("||{{!^}}*{0}*||", CultureModule.getContent("labor"));

            for (int i = 0; i < NumberOfPlanets; ++i)
            {
                Planet planet = (Planet)planets[i];
                writer.Write("||{0}", i + 1);
                writer.Write("||{0}", planet);
                writer.Write("||{0}", ((Ruler)planet.Owner).Name);
                writer.WriteLine("||{0}||", OrionGlobals.format(planet.Population));
            }
        }
Пример #28
0
        private void WikiWriteByCulture(StreamWriter writer, ArrayList planets)
        {
            writer.WriteLine("!!!Top by Culture");

            writer.Write("||{!^}*#*");
            writer.Write("||{!^}*Planet*");
            writer.Write("||{!^}*Ruler*");
            writer.WriteLine("||{{!^}}*{0}*||", CultureModule.getContent("culture"));

            for (int i = 0; i < NumberOfPlanets; ++i)
            {
                Planet planet = (Planet)planets[i];
                writer.Write("||{0}", i + 1);
                writer.Write("||{0}", planet);
                writer.Write("||{0}", ((Ruler)planet.Owner).Name);
                writer.WriteLine("||{0}||", OrionGlobals.format(planet.Culture));
            }
        }
Пример #29
0
        private void WikiWriteByScore(StreamWriter writer, ArrayList planets)
        {
            writer.WriteLine("!!!Top by Score");

            writer.Write("||{!^}*#*");
            writer.Write("||{!^}*Planet*");
            writer.Write("||{!^}*Ruler*");
            writer.WriteLine("||{!^}*Score*||");

            for (int i = 0; i < NumberOfPlanets; ++i)
            {
                Planet planet = (Planet)planets[i];
                writer.Write("||{0}", i + 1);
                writer.Write("||{0}", planet);
                writer.Write("||{0}", ((Ruler)planet.Owner).Name);
                writer.WriteLine("||{0}||", OrionGlobals.format(planet.Score));
            }
        }
Пример #30
0
        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}&ordm;</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>");
        }