public string Info(Station station, SolarSystem from, string postfix) { string result = Info(station); if (finder != null && station != null && from != null) { int jumpsSecure = finder.map.DistanceBetween(from, station.System, true); int jumpsShortest = finder.map.DistanceBetween(from, station.System, false); SecurityStatus.Level security = finder.map.RouteSecurity(from, station.System); if (security == SecurityStatus.Level.LowSecShortcut) { result += " <FONT COLOR=\"#00ff33\">(" + jumpsSecure + " " + Pluralize("jump", "jumps", jumpsSecure) + ")</FONT>"; result += "/<FONT COLOR=\"#ff0033\">(" + jumpsShortest + " " + Pluralize("jump", "jumps", jumpsShortest) + ")</FONT>" + postfix; } else if (security == SecurityStatus.Level.HighSec) { result += " <FONT COLOR=\"#00ff33\">(" + jumpsSecure + " " + Pluralize("jump", "jumps", jumpsSecure) + ")</FONT>" + postfix;; } else { result += " <FONT COLOR=\"#ff0033\">(" + jumpsShortest + " " + Pluralize("jump", "jumps", jumpsShortest) + ")</FONT>" + postfix; } } return(result); }
public SingleTrip(Map map, Station source, Station destination) { this.map = map; this.source = source; this.destination = destination; jumpsSecure = map.DistanceBetween(source.System, destination.System, true); jumpsShortest = map.DistanceBetween(source.System, destination.System, false); if ((jumpsSecure == jumpsShortest) && (jumpsSecure != int.MaxValue)) { security = SecurityStatus.Level.HighSec; } else if ((jumpsSecure > jumpsShortest) && (jumpsSecure != int.MaxValue)) { security = SecurityStatus.Level.LowSecShortcut; } else if ((jumpsSecure == int.MaxValue) && (jumpsShortest != int.MaxValue)) { security = SecurityStatus.Level.LowSecOnly; } else { security = SecurityStatus.Level.Isolated; } }
public SingleTripDisplayItem(Map map, SingleTrip data, Parameters parameters) { Text = data.TypeName; profit = (int)data.Profit; int profitPercentage = (profit * 100) / (int)parameters.Isk; SolarSystem startingSystem = map.GetSystem(parameters.StartingSystem); if (startingSystem == null) { profitPerWarp = (int)data.ProfitPerWarp(true); } else { data.StartingSystem = startingSystem; profitPerWarp = (int)data.ProfitPerWarpFromStartingSystem(true); } int jumpsFromStart = map.DistanceBetween(startingSystem, data.Source.System, true); int jumps = data.Jumps(true); string source = data.Source.Name; string destination = data.Destination.Name; SecurityStatus.Level security = data.Security; LimitingFactor limitedBy = data.LimitedBy; SubItems.Add(profitPerWarp.ToString()); SubItems.Add(profitPercentage + "%"); SubItems.Add(security.ToString()); SubItems.Add(jumpsFromStart.ToString()); SubItems.Add(jumps.ToString()); SubItems.Add(source); SubItems.Add(destination); SubItems.Add(limitedBy.ToString()); }
public SecurityStatus.Level RouteSecurity(SolarSystem source, SolarSystem destination) { SecurityStatus.Level securityFromStartingSystem = SecurityStatus.Level.Isolated; int jumpsFromStartSecure = DistanceBetween(source, destination, true); int jumpsFromStartShortest = DistanceBetween(source, destination, false); if (jumpsFromStartSecure == jumpsFromStartShortest) { securityFromStartingSystem = SecurityStatus.Level.HighSec; } else if ((jumpsFromStartSecure > jumpsFromStartShortest) && (jumpsFromStartSecure != int.MaxValue)) { securityFromStartingSystem = SecurityStatus.Level.LowSecShortcut; } else if ((jumpsFromStartSecure == int.MaxValue) && (jumpsFromStartShortest != int.MaxValue)) { securityFromStartingSystem = SecurityStatus.Level.LowSecOnly; } return(securityFromStartingSystem); }
public string Info(SingleTrip route, SecurityStatus.Level startingTrip) { SecurityStatus.Level security = SecurityStatus.Min(startingTrip, route.Security); string output; string TradeSec = string.Empty; // todo: this differently int CurPercent = Convert.ToInt32(FormatPercent(route.ProfitMargin).Replace("%", "")); int GreyPercent = 100 - CurPercent; // ^--------------------^ float taxrate = 0.01f - (Convert.ToInt32(input["accounting"]) * 0.001f); switch (security) { case SecurityStatus.Level.LowSecOnly: TradeSec = "<b><font color='#FF0000' size='$fontsz_small' face='$fontname'>Routes through lowsec only!</font></b>"; break; case SecurityStatus.Level.LowSecShortcut: TradeSec = "<font color='#FF0000' size='$fontsz_small' face='$fontname'>Route has lowsec shortcut.</font>"; break; case SecurityStatus.Level.HighSec: TradeSec = "<font color='#00FF00' size='$fontsz_small' face='$fontname'>Routes through highsec only.</font>"; break; case SecurityStatus.Level.Isolated: TradeSec = "</b><font color='#00FF00' size='$fontsz_small' face='$fontname'>Routes within system!</font></b>"; break; } // Bug here :/ if (route.Profit - Variables.Total_Sales * taxrate <= 0) { return(""); } /*{ * if (Constants.IsBetaVersion) * { * return "Strange, a trade that would result in a loss was passed here. Don't report this."; * } * else * { */ // return ""; // } //} output = ReadFromResource("Web_Server.TradePage.html"); // Replace $Identifiers .. output = output.Replace("$TO", Info(route.Destination, route.Source.System)); output = output.Replace("$FROM", Info(route.Source, systemName)); output = output.Replace("$HISK", FormatIsk(route.ProfitPerWarp(true))); output = output.Replace("$LISK", FormatIsk(route.ProfitPerWarp(false))); output = output.Replace("$CURPERCENT", String.Format("{0}", CurPercent)); output = output.Replace("$ENDPERCENT", String.Format("{0}", GreyPercent)); output = output.Replace("$TRADESEC", TradeSec); output = output.Replace("$LISTP", route.ListPurchases()); output = output.Replace("$LISTS", route.ListSales()); output = output.Replace("$CNEED", String.Format("{0:0.##}m3", route.Volume)); output = output.Replace("$RNEED", String.Format("{0:0.##} ISK", route.Cost)); output = output.Replace("$TAXTOTAL", String.Format("{0:0.##} ({1:0.##}%)", Variables.Total_Sales * taxrate, taxrate * 100)); output = output.Replace("$PROFIT", FormatIsk(route.Profit - (Variables.Total_Sales * taxrate)) + " (" + FormatPercent(route.ProfitMargin) + ")"); output = ReplaceVariables(output, null, null, null); return(output); }
public SingleTrip(Map map, Station source, Station destination) { this.map = map; this.source = source; this.destination = destination; jumpsSecure = map.DistanceBetween(source.System, destination.System, true); jumpsShortest = map.DistanceBetween(source.System, destination.System, false); if ((jumpsSecure == jumpsShortest) && (jumpsSecure != int.MaxValue)) { security = SecurityStatus.Level.HighSec; } else if ((jumpsSecure > jumpsShortest) && (jumpsSecure != int.MaxValue)) { security = SecurityStatus.Level.LowSecShortcut; } else if ((jumpsSecure == int.MaxValue) && (jumpsShortest != int.MaxValue)) { security = SecurityStatus.Level.LowSecOnly; } else { security = SecurityStatus.Level.Isolated; } }