Exemplo n.º 1
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);
        }
Exemplo n.º 2
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;
        }