示例#1
0
        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 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());
        }
示例#3
0
        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);
        }
示例#4
0
 public static int CompareByProfitPerWarpShortest(SingleTrip a, SingleTrip b)
 {
     return b.ProfitPerWarp(false).CompareTo(a.ProfitPerWarp(false)); // highest profit per warp comes first
 }
示例#5
0
 public static int CompareByProfitPerWarpSecure(SingleTrip a, SingleTrip b)
 {
     return b.ProfitPerWarp(true).CompareTo(a.ProfitPerWarp(true)); // highest profit per warp comes first
 }
示例#6
0
        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;
        }
示例#7
0
 public static int CompareByProfitPerWarpShortest(SingleTrip a, SingleTrip b)
 {
     return(b.ProfitPerWarp(false).CompareTo(a.ProfitPerWarp(false))); // highest profit per warp comes first
 }
示例#8
0
 public float ProfitPerWarpFromStartingSystemSecure(bool secure)
 {
     return(there.ProfitPerWarpFromStartingSystem(secure) + backAgain.ProfitPerWarp(secure));
 }