Ejemplo n.º 1
0
        /// <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'>&nbsp;</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>");
            }
        }
Ejemplo n.º 2
0
        /// <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);
            }
        }
Ejemplo n.º 3
0
 private void WriteItems(HtmlTextWriter writer)
 {
     foreach (SabotageFactory factory in Sabotage.Factories.Values)
     {
         Sabotage sabotage    = (Sabotage)factory.create(null);
         bool     canSabotage = sabotage.CanSabotage(Source, Source).Ok;
         writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
         writer.WriteLine("<td class='resource'>{0}</td>", CultureModule.getContent(sabotage.Key));
         writer.WriteLine("<td class='resourceCell'>{0}</td>", sabotage.Turns);
         writer.WriteLine("<td class='resourceCell'>{0}</td>", sabotage.Spies);
         writer.WriteLine("<td class='resourceCell'><a href='javascript:performSabotage(\"{1}\");'><img src='{0}' /></a></td>", OrionGlobals.YesNoImage(canSabotage), sabotage.Key);
         writer.WriteLine("</tr>");
     }
 }