Ejemplo n.º 1
0
            /// <summary>Returns a representative string of the Trigger</summary>
            /// <remarks>Flightgroups are identified as <b>"FG:#"</b> for later substitution if required</remarks>
            /// <returns>Description of the trigger and targets if applicable</returns>
            public override string ToString()
            {
                string trig = "";

                if (Condition != 0 /*TRUE*/ && Condition != 10 /*FALSE*/)
                {
                    trig  = BaseStrings.SafeString(Strings.Amount, Amount);
                    trig += (trig.IndexOf(" of") >= 0 || trig.IndexOf(" in") >= 0) ? " " : " of ";
                    switch (VariableType)                     //TODO: should make an enum for this...
                    {
                    case 1:
                        trig += "FG:" + Variable;
                        break;

                    case 2:
                        trig += "Ship type " + BaseStrings.SafeString(Strings.CraftType, Variable + 1);
                        break;

                    case 3:
                        trig += "Ship class " + BaseStrings.SafeString(Strings.ShipClass, Variable);
                        break;

                    case 4:
                        trig += "Object type " + BaseStrings.SafeString(Strings.ObjectType, Variable);
                        break;

                    case 5:
                        trig += "IFF:" + Variable;
                        break;

                    case 6:
                        trig += "Ship orders " + BaseStrings.SafeString(Strings.Orders, Variable);
                        break;

                    case 7:
                        trig += "Craft When " + BaseStrings.SafeString(Strings.CraftWhen, Variable);
                        break;

                    case 8:
                        trig += "Global Group " + Variable;
                        break;

                    case 9:
                        trig += "Misc " + BaseStrings.SafeString(Strings.Misc, Variable);
                        break;

                    default:
                        trig += VariableType + " " + Variable;
                        break;
                    }
                    trig += " must ";
                }
                trig += BaseStrings.SafeString(Strings.Trigger, Condition);
                return(trig);
            }
Ejemplo n.º 2
0
            /// <summary>Returns a representative string of the Order</summary>
            /// <remarks>Flightgroups are identified as <b>"FG:#"</b>, Teams are identified as <b>"TM:#"</b> and Regions are <b>"REG:#"</b> for later substitution if required</remarks>
            /// <returns>Description of the order and targets if applicable, otherwise <b>"None"</b></returns>
            public override string ToString()
            {
                if (Command == 0)
                {
                    return("None");
                }
                string order = BaseStrings.SafeString(Strings.Orders, Command);

                if ((Command >= 7 && Command <= 18) || (Command >= 21 && Command <= 27) || Command == 31 || Command == 32 || Command == 37)                 //all orders where targets are important
                {
                    string s  = orderTargetString(Target1, Target1Type);
                    string s2 = orderTargetString(Target2, Target2Type);
                    if (s != "")
                    {
                        order += ", " + s;
                    }
                    if (s != "" && s2 != "")
                    {
                        if (T1AndOrT2)
                        {
                            order += " or " + s2;
                        }
                        else
                        {
                            order += " if " + s2;
                        }
                    }
                    s  = orderTargetString(Target3, Target3Type);
                    s2 = orderTargetString(Target4, Target4Type);
                    if (s != "")
                    {
                        order += ", " + s;
                    }
                    if (s != "" && s2 != "")
                    {
                        if (T3AndOrT4)
                        {
                            order += " or " + s2;
                        }
                        else
                        {
                            order += " if " + s2;
                        }
                    }
                }
                else if (Command == 50)                  // Hyper to Region
                {
                    order += " REG:" + Variable1;
                }
                return(order);
            }
Ejemplo n.º 3
0
            /// <summary>Returns a representative string of the Order</summary>
            /// <remarks>Flightgroups are identified as <b>"FG:#"</b> for later substitution if required</remarks>
            /// <returns>Description of the order and targets if applicable, otherwise <b>"None"</b></returns>
            public override string ToString()
            {
                if (Command == 0)
                {
                    return("None");
                }
                string order = BaseStrings.SafeString(Strings.Orders, Command);

                if ((Command >= 7 && Command <= 0x12) || (Command >= 0x15 && Command <= 0x1B) || Command == 0x1F || Command == 0x20 || Command == 0x25)                 //all orders where targets are important
                {
                    string s  = orderTargetString(Target1, Target1Type);
                    string s2 = orderTargetString(Target2, Target2Type);
                    if (s != "")
                    {
                        order += ", " + s;
                    }
                    if (s != "" && s2 != "")
                    {
                        if (T1AndOrT2)
                        {
                            order += " or " + s2;
                        }
                        else
                        {
                            order += " if " + s2;
                        }
                    }
                    s  = orderTargetString(Target3, Target3Type);
                    s2 = orderTargetString(Target4, Target4Type);
                    if (s != "")
                    {
                        order += ", " + s;
                    }
                    if (s != "" && s2 != "")
                    {
                        if (T3AndOrT4)
                        {
                            order += " or " + s2;
                        }
                        else
                        {
                            order += " if " + s2;
                        }
                    }
                }
                return(order);
            }
Ejemplo n.º 4
0
            static string orderTargetString(byte target, byte type)
            {
                string s = "";

                switch (type)
                {
                case 0:
                    break;

                case 1:
                    s += "FG:" + target;
                    break;

                case 2:
                    s += BaseStrings.SafeString(Strings.CraftType, target + 1) + "s";
                    break;

                case 3:
                    s += BaseStrings.SafeString(Strings.ShipClass, target);
                    break;

                case 4:
                    s += BaseStrings.SafeString(Strings.ObjectType, target);
                    break;

                case 5:
                    s += "IFF:" + target;
                    break;

                case 6:
                    s += "Craft with " + BaseStrings.SafeString(Strings.Orders, target) + " orders";
                    break;

                case 7:
                    s += "Craft when " + BaseStrings.SafeString(Strings.CraftWhen, target);
                    break;

                case 8:
                    s += "Global Group " + target;
                    break;

                default:
                    s += type + " " + target;
                    break;
                }
                return(s);
            }
Ejemplo n.º 5
0
            /// <summary>Returns a representative string of the Trigger</summary>
            /// <remarks>Flightgroups are identified as <b>"FG:#"</b>, IFFs are <b>"IFF:#" and </b> Teams are <b>"TM:#"</b> for later substitution if required</remarks>
            /// <returns>Description of the trigger and targets if applicable</returns>
            public override string ToString()
            {
                string trig = "";

                if (Condition != 0 /*TRUE*/ && Condition != 10 /*FALSE*/ && VariableType != 14 /*Delay*/)
                {
                    if (Condition == 0x31 /*Prox*/ || Condition == 0x32 /*NOT Prox*/)
                    {
                        trig = "Any of ";
                    }
                    else
                    {
                        if (Amount > Strings.Amount.Length)
                        {
                            Amount = 0;                                                         //can occur switching away from high-distance prox triggers
                        }
                        trig  = BaseStrings.SafeString(Strings.Amount, Amount);
                        trig += (trig.IndexOf(" of") >= 0 || trig.IndexOf(" in") >= 0) ? " " : " of ";
                    }
                    switch (VariableType)
                    {
                    case 1:
                        trig += "FG:" + Variable;
                        break;

                    case 2:
                        trig += "Ship type " + BaseStrings.SafeString(Strings.CraftType, Variable);
                        break;

                    case 3:
                        trig += "Ship class " + BaseStrings.SafeString(Strings.ShipClass, Variable);
                        break;

                    case 4:
                        trig += "Object type " + BaseStrings.SafeString(Strings.ObjectType, Variable);
                        break;

                    case 5:
                        trig += "IFF:" + Variable;
                        break;

                    case 6:
                        trig += "Ship orders " + BaseStrings.SafeString(Strings.Orders, Variable);
                        break;

                    case 7:
                        trig += "Craft When " + BaseStrings.SafeString(Strings.CraftWhen, Variable);
                        break;

                    case 8:
                        trig += "GG:" + Variable;
                        break;

                    case 9:
                        trig += "Rating " + BaseStrings.SafeString(Strings.Rating, Variable);
                        break;

                    case 10:
                        trig += "Craft with status: " + BaseStrings.SafeString(Strings.Status, Variable);
                        break;

                    case 11:
                        trig += "All craft";
                        break;

                    case 12:
                        trig += "TM:" + Variable;
                        break;

                    case 13:
                        trig += "Player #" + Variable;
                        break;

                    //case 14: omitted, special case after the switch
                    case 15:
                        trig += "all except FG:" + Variable;
                        break;

                    case 16:
                        trig += "all except " + BaseStrings.SafeString(Strings.CraftType, Variable) + "s";
                        break;

                    case 17:
                        trig += "all except " + BaseStrings.SafeString(Strings.ShipClass, Variable);
                        break;

                    case 18:
                        trig += "all except " + BaseStrings.SafeString(Strings.ObjectType, Variable);
                        break;

                    case 19:
                        trig += "all except IFF:" + Variable;
                        break;

                    case 20:
                        trig += "all except GG:" + Variable;
                        break;

                    case 21:
                        trig += "all except TM:" + Variable;
                        break;

                    case 22:
                        trig += "all except Player #" + Variable;
                        break;

                    case 23:
                        trig += "Global Unit " + Variable;
                        break;

                    case 24:
                        trig += "all except Global Unit " + Variable;
                        break;

                    case 25:
                        trig += "Global Cargo " + Variable;
                        break;

                    case 26:
                        trig += "all except Global Cargo " + Variable;
                        break;

                    case 27:
                        trig += "Message #" + (Variable + 1);                                  //[JB] One-based for display purposes.
                        break;

                    default:
                        trig += VariableType + " " + Variable;
                        break;
                    }
                    trig += " must ";
                }
                if (VariableType == 14)
                {
                    trig = "After " + string.Format("{0}:{1:00}", Variable * 5 / 60, Variable * 5 % 60) + " delay";
                }
                else if (Condition == 0x31 || Condition == 0x32)
                {
                    trig += (Condition == 0x32 ? "NOT " : "") + "be within ";
                    double dist;
                    if (Amount == 0)
                    {
                        dist = 0.05;
                    }
                    else if (Amount <= 10)
                    {
                        dist = 0.1 * Amount;
                    }
                    else
                    {
                        dist = Amount * 0.5 - 4;
                    }
                    trig += dist + " km of FG2:" + Parameter1;
                }
                else
                {
                    trig += BaseStrings.SafeString(Strings.Trigger, Condition);
                }
                if (trig.Contains("Region"))
                {
                    trig += " " + Parameter1;
                }
                return(trig);
            }
Ejemplo n.º 6
0
            static string orderTargetString(byte target, byte type)
            {
                string s = "";

                switch (type)
                {
                case 0:
                    break;

                case 1:
                    s = "FG:" + target;
                    break;

                case 2:
                    s = BaseStrings.SafeString(Strings.CraftType, target) + "s";
                    break;

                case 3:
                    s = BaseStrings.SafeString(Strings.ShipClass, target);
                    break;

                case 4:
                    s = BaseStrings.SafeString(Strings.ObjectType, target);
                    break;

                case 5:
                    s = BaseStrings.SafeString(Strings.IFF, target) + "s";
                    break;

                case 6:
                    s = "Craft with " + BaseStrings.SafeString(Strings.Orders, target) + " orders";
                    break;

                case 7:
                    s = "Craft when " + BaseStrings.SafeString(Strings.CraftWhen, target);
                    break;

                case 8:
                    s = "GG:" + target;
                    break;

                case 9:
                    s = "Rating " + BaseStrings.SafeString(Strings.Rating, target);
                    break;

                case 10:
                    s = "Craft with status: " + BaseStrings.SafeString(Strings.Status, target);
                    break;

                case 11:
                    s = "All";
                    break;

                case 12:
                    s = "TM:" + target;
                    break;

                case 13:
                    s = "Player #" + target;
                    break;

                case 14:
                    s = "before time " + string.Format("{0}:{1:00}", target * 5 / 60, target * 5 % 60);
                    break;

                case 15:
                    s = "Not FG:" + target;
                    break;

                case 16:
                    s = "Not ship type " + BaseStrings.SafeString(Strings.CraftType, target);
                    break;

                case 17:
                    s = "Not ship class " + BaseStrings.SafeString(Strings.ShipClass, target);
                    break;

                case 18:
                    s = "Not object type " + BaseStrings.SafeString(Strings.ObjectType, target);
                    break;

                case 19:
                    s = "Not IFF " + BaseStrings.SafeString(Strings.IFF, target);
                    break;

                case 20:
                    s = "Not GG:" + target;
                    break;

                case 21:
                    s = "All Teams except TM:" + target;
                    break;

                case 22:
                    s = "Not player #" + target;
                    break;

                case 23:
                    s = "Global Unit " + target;
                    break;

                case 24:
                    s = "Not Global Unit " + target;
                    break;

                case 25:
                    s = "Global Cargo " + target;
                    break;

                case 26:
                    s = "Not Global Cargo " + target;
                    break;

                case 27:
                    s = "Message #" + (target + 1);      //[JB] Now one-based for consistency with other message displays
                    break;

                default:
                    s = type + " " + target;
                    break;
                }
                return(s);
            }
Ejemplo n.º 7
0
            static string orderTargetString(byte target, byte type)
            {
                string s = "";

                switch (type)
                {
                case 0:
                    break;

                case 1:
                    s += "FG:" + target;
                    break;

                case 2:
                    s += BaseStrings.SafeString(Strings.CraftType, target + 1) + "s";
                    break;

                case 3:
                    s += BaseStrings.SafeString(Strings.ShipClass, target);
                    break;

                case 4:
                    s += BaseStrings.SafeString(Strings.ObjectType, target);
                    break;

                case 5:
                    s += BaseStrings.SafeString(Strings.IFF, target) + "s";
                    break;

                case 6:
                    s += "Craft with " + BaseStrings.SafeString(Strings.Orders, target) + " starting orders";
                    break;

                case 7:
                    s += "Craft when " + BaseStrings.SafeString(Strings.CraftWhen, target);
                    break;

                case 8:
                    s += "Global Group " + target;
                    break;

                case 9:
                    s += "Craft with " + BaseStrings.SafeString(Strings.Rating, target) + " adjusted skill";
                    break;

                case 0xA:
                    s += "Craft with primary status: " + BaseStrings.SafeString(Strings.Status, target);
                    break;

                case 0xB:
                    s += "All craft";
                    break;

                case 0xC:
                    s += "TM:" + target;
                    break;

                case 0xD:
                    s += "Player #" + (target + 1);
                    break;

                case 0xE:
                    s += "Before elapsed time " + string.Format("{0}:{1:00}", target * 5 / 60, target * 5 % 60);
                    break;

                case 0xF:
                    s += "Not FG:" + target;
                    break;

                case 0x10:
                    s += "Not ship type " + BaseStrings.SafeString(Strings.CraftType, target + 1) + "s";
                    break;

                case 0x11:
                    s += "Not ship class " + BaseStrings.SafeString(Strings.ShipClass, target);
                    break;

                case 0x12:
                    s += "Not object type " + BaseStrings.SafeString(Strings.ObjectType, target);
                    break;

                case 0x13:
                    s += "Not IFF " + BaseStrings.SafeString(Strings.IFF, target);
                    break;

                case 0x14:
                    s += "Not GG " + target;
                    break;

                case 0x15:
                    s += "All teams except TM:" + target;
                    break;

                case 0x16:
                    s += "Not player #" + (target + 1);
                    break;

                case 0x17:
                    s += "Global Unit " + target;
                    break;

                case 0x18:
                    s += "Not global unit " + target;
                    break;

                default:
                    s += type + " " + target;
                    break;
                }
                return(s);
            }
Ejemplo n.º 8
0
            /// <summary>Returns a representative string of the Trigger</summary>
            /// <remarks>Flightgroups are identified as <b>"FG:#"</b>, IFFs are <b>"IFF:#" and </b> Teams are <b>"TM:#"</b> for later substitution if required</remarks>
            /// <returns>Description of the trigger and targets if applicable</returns>
            public override string ToString()
            {
                string trig = "";

                if (Condition != 0 /*TRUE*/ && Condition != 10 /*FALSE*/)
                {
                    trig  = BaseStrings.SafeString(Strings.Amount, Amount);
                    trig += (trig.IndexOf(" of") >= 0 || trig.IndexOf(" in") >= 0) ? " " : " of ";
                    switch (VariableType)
                    {
                    case 1:
                        trig += "FG:" + Variable;
                        break;

                    case 2:
                        trig += "Ship type " + BaseStrings.SafeString(Strings.CraftType, Variable + 1);
                        break;

                    case 3:
                        trig += "Ship class " + BaseStrings.SafeString(Strings.ShipClass, Variable);
                        break;

                    case 4:
                        trig += "Object type " + BaseStrings.SafeString(Strings.ObjectType, Variable);
                        break;

                    case 5:
                        trig += "IFF:" + Variable;
                        break;

                    case 6:
                        trig += "Craft with " + BaseStrings.SafeString(Strings.Orders, Variable) + " starting orders";
                        break;

                    case 7:
                        trig += "Craft when " + BaseStrings.SafeString(Strings.CraftWhen, Variable);
                        break;

                    case 8:
                        trig += "Global Group " + Variable;
                        break;

                    case 9:
                        trig += "Craft with " + BaseStrings.SafeString(Strings.Rating, Variable) + " adjusted skill";
                        break;

                    case 0xA:
                        trig += "Craft with primary status: " + BaseStrings.SafeString(Strings.Status, Variable);
                        break;

                    case 0xB:
                        trig += "All craft";
                        break;

                    case 0xC:
                        trig += "TM:" + Variable;
                        break;

                    case 0xD:
                        trig += "(Player #" + Variable + ")";
                        break;

                    case 0xE:
                        trig += "(Before elapsed time " + string.Format("{0}:{1:00}", Variable * 5 / 60, Variable * 5 % 60) + ")";
                        break;

                    case 0xF:
                        trig += "All except FG:" + Variable;
                        break;

                    case 0x10:
                        trig += "All except " + BaseStrings.SafeString(Strings.CraftType, Variable + 1) + "s";
                        break;

                    case 0x11:
                        trig += "All except " + BaseStrings.SafeString(Strings.ShipClass, Variable);
                        break;

                    case 0x12:
                        trig += "All except " + BaseStrings.SafeString(Strings.ObjectType, Variable);
                        break;

                    case 0x13:
                        trig += "All except IFF:" + Variable;
                        break;

                    case 0x14:
                        trig += "All except GG " + Variable;
                        break;

                    case 0x15:
                        trig += "All except TM:" + Variable;
                        break;

                    case 0x16:
                        trig += "(All except Player #" + (Variable + 1) + ")";
                        break;

                    case 0x17:
                        trig += "Global Unit " + Variable;
                        break;

                    case 0x18:
                        trig += "All except Global Unit " + Variable;
                        break;

                    default:
                        trig += VariableType + " " + Variable;
                        break;
                    }
                    trig += " must ";
                }
                trig += BaseStrings.SafeString(Strings.Trigger, Condition);
                return(trig);
            }