Ejemplo n.º 1
0
 /// <summary>
 /// Serialises the component
 /// </summary>
 /// <returns>JSON object as string</returns>
 public override string ToJSON()
 {
     /*{
      * "Plasma" : {
      *  "Name" : name,
      *  "Types" : types,
      *  "Power" : power,
      *  "Space" : space,
      *  "Special" : special,
      *  "Origin" : origin,
      *  "Page" : page,
      *  "SP" : sp,
      *  "Quality" : quality,
      *  "Speed" : speed,
      *  "Man" : man,
      *  "Comp" : comp,
      *  "Mod" : mod,
      *  "Cond" : condition}
      *}
      */
     return(@"{""Plasma"":{""Name"":""" + base.Name.Escape() + @""",""Types"":" + (byte)HullTypes + @",""Power"":" + RawPower + @",""Space"":"
            + RawSpace + @",""Special"":""" + RawSpecial.Escape() + @""",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber + @",""SP"":"
            + RawSP + @",""Quality"":" + (byte)Quality + @",""Speed"":" + Speed + @",""Man"":" + Manoeuvrability + @",""Comp"":"
            + (byte)ComponentOrigin + @",""Mod"":" + (Modified ? 1 : 0) + @",""Cond"":" + Condition + @"}}");
 }
Ejemplo n.º 2
0
 public override string ToJSON()
 {
     /*{
      * "NovaCannon" : {
      *  "Name" : name,
      *  "Hulls" : hulls,
      *  "Power" : power,
      *  "Space" : space,
      *  "SP" : sp,
      *  "Damage" : damage,
      *  "Range" : range,
      *  "Origin" : origin,
      *  "Page" : page,
      *  "Special" : special,
      *  "Quality" : quality,
      *  "WeapQual" : wq,
      *  "Comp" : comp,
      *  "Cond" : Condition,
      *  "Ammo" : ammo}
      *}
      */
     return(@"{""NovaCannon"":{""Name"":""" + Name.Escape() + @""",""Hulls"":" + (byte)HullTypes + @",""Power"":" + RawPower + @",""Space"":" + RawSpace + @",""SP"":" + RawSP
            + @",""Damage"":""" + RawDamage.ToString().Escape() + @""",""Range"":" + RawRange + @",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber
            + @",""Special"":""" + RawSpecial.Escape() + @""",""Quality"":" + (byte)Quality + @",""WeapQual"":" + (byte)WeaponQuality + @",""Comp"":" + (byte)ComponentOrigin
            + @",""Cond"":" + Condition + @",""Ammo"":" + Ammo + @"}}");
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Serialises the Augur Array
 /// </summary>
 /// <returns>JSON object as string</returns>
 public override string ToJSON()
 {
     /*
      * {
      * "Augur" : {
      *  "Name" : name,
      *  "Power" : power,
      *  "Origin" : origin,
      *  "Page" : page,
      *  "Det" : det,
      *  "Special" : special,
      *  "Quality" : quality,
      *  "SP" : sp,
      *  "Man": man,
      *  "BS" : bs,
      *  "Comp" : comp,
      *  "Mining" : mining,
      *  "Creed" : creed,
      *  "Military" : military,
      *  "Trade" : trade,
      *  "Criminal" : criminal,
      *  "Explore" : explore,
      *  "Cond" : condition}
      * }
      * */
     return(@"{""Augur"":{""Name"":""" + Name.Escape() + @""",""Power"":" + RawPower + @",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber
            + @",""Det"":" + DetectionRating + @",""Special"":""" + RawSpecial.Escape() + @""",""Quality"":" + (byte)Quality + @",""SP"":" + RawSP
            + @",""Man"":" + Manoeuvrability + @",""BS"":" + BSModifier + @",""Comp"":" + (byte)ComponentOrigin
            + @",""Mining"":" + MiningObjective + @",""Creed"":" + CreedObjective + @",""Military"":" + MilitaryObjective
            + @",""Trade"":" + TradeObjective + @",""Criminal"":" + CriminalObjective + @",""Explore"":" + ExplorationObjective + @",""Cond"":" + Condition + @"}}");
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Serialises the Life sustainer
 /// </summary>
 /// <returns>JSON object as string</returns>
 public override string ToJSON()
 {
     /*{
      * "Sustainer" : {
      *  "Name" : name,
      *  "Types" : types,
      *  "Power" : power,
      *  "Space" : space,
      *  "Morale" : morale,
      *  "Origin" : origin,
      *  "Page" : page,
      *  "Special" : special,
      *  "Quality" : quality,
      *  "SP" : sp,
      *  "MoraleLoss" : loss,
      *  "CrewLoss" : loss,
      *  "Comp" : comp,
      *  "Cond" : condition}
      *}
      */
     return(@"{""Sustainer"":{""Name"":""" + Name.Escape() + @""",""Types"":" + (byte)HullTypes + @",""Power"":" + RawPower + @",""Space"":"
            + RawSpace + @",""Morale"":" + Morale + @",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber + @",""Special"":"""
            + RawSpecial.Escape() + @""",""Quality"":" + (byte)Quality + @",""SP"":" + RawSP + @",""MoraleLoss"":" + MoraleLoss
            + @",""CrewLoss"":" + CrewLoss + @",""Comp"":" + (byte)ComponentOrigin + @",""Cond"":" + Condition + @"}}");
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Serialises the component
 /// </summary>
 /// <returns>JSON object as string</returns>
 public override string ToJSON()
 {
     /*{
      * "Weapon": {
      *  "Name" : name,
      *  "WeapType" : type,
      *  "Types" : types,
      *  "Slots" : slots,
      *  "Power" : power,
      *  "Space" : space,
      *  "SP" : sp,
      *  "Str" : str,
      *  "Damage" : damage,
      *  "Crit" : crit,
      *  "Range" : range,
      *  "Origin" : origin,
      *  "Page" :  page,
      *  "Quality" : quality,
      *  "WeapQual" : wq,
      *  "Special" : special,
      *  "Turbo" : turbo,
      *  "Comp" : comp,
      *  "Cond" : Condition}
      *}
      */
     return(@"{""Weapon"":{""Name"":""" + Name.Escape() + @""",""WeapType"":" + (byte)Type + @",""Types"":" + (byte)HullTypes
            + @",""Slots"":" + (byte)Slots + @",""Power"":" + RawPower + @",""Space"":" + RawSpace + @",""SP"":" + RawSP + @",""Str"":"
            + RawStrength + @",""Damage"":""" + RawDamage.ToString().Escape() + @""",""Crit"":" + RawCrit + @",""Range"":" + RawRange
            + @",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber + @",""Quality"":" + (byte)Quality
            + @",""Special"":""" + RawSpecial.Escape() + @""",""Turbo"":" + (byte)TurboWeapon + @",""Comp"":" + (byte)ComponentOrigin + @",""Cond"":" + Condition + @"}}");
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Serialises the Torpedo Tubes
        /// </summary>
        /// <returns>JSON object as string</returns>
        public override string ToJSON()
        {
            /*{
             * "Torpedo" : {
             *  "Name" : name,
             *  "Types" : types,
             *  "Power" : power,
             *  "Space" : space,
             *  "SP" : sp,
             *  "Size" : size,
             *  "Origin" : origin,
             *  "Page" : page,
             *  "Quality" : quality,
             *  "WeapQual" : wq,
             *  "Special" : special,
             *  "Comp" : comp,
             *  "Ammo" : [Torpedoes],
             *  "Tubes" : [Tubes],
             *  "Cond" : condition}
             *}
             */
            StringBuilder output = new StringBuilder(
                @"{""Torpedo"":{""Name"":""" + Name.Escape() + @""",""Types"":" + (byte)HullTypes
                + @",""Power"":" + RawPower + @",""Space"":" + RawSpace + @",""SP"":" + RawSP + @",""Size"":" + Capacity + @",""Origin"":"
                + (byte)Origin + @",""Page"":" + PageNumber + @",""Quality"":" + (byte)Quality + @",""WeapQual"":"
                + (byte)WeaponQuality + @",""Special"":""" + RawSpecial.Escape() + @""",""Comp"":" + (byte)ComponentOrigin
                + @",""Ammo"":[");

            if (Ammo != null)
            {
                for (int i = 0; i < Ammo.Count; i++)
                {
                    output.Append(Ammo[i].ToJSON());
                    if (i < Ammo.Count - 1)
                    {
                        output.Append(",");
                    }
                }
            }
            output.Append(@"],""Tubes"":[");
            if (Tubes != null)
            {
                for (int i = 0; i < Tubes.Length; i++)
                {
                    output.Append((Tubes[i] == null ? "null" : Tubes[i].ToJSON()));
                    if (i < Tubes.Length - 1)
                    {
                        output.Append(",");
                    }
                }
            }
            output.Append(@"],""Cond"":" + Condition + @"}}");
            return(output.ToString());
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Serialises the Gellar Field
 /// </summary>
 /// <returns>JSON object as string</returns>
 public override string ToJSON()
 {
     /*
      * {
      *  "Gellar" : {
      *   "Name" : name,
      *   "Types" : types,
      *   "Power" : power,
      *   "Special" : special,
      *   "Origin" : origin,
      *   "Page" : page,
      *   "SP" : sp,
      *   "Nav" : nav,
      *   "Quality" : quality,
      *   "Comp" : comp,
      *   "Cond" : condition}
      * }
      * */
     return(@"{""Gellar"":{""Name"":""" + Name.Escape() + @""",""Types"":" + (byte)HullTypes + @",""Power"":" + RawPower + @",""Special"":"""
            + RawSpecial.Escape() + @""",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber + @",""SP"":" + RawSP + @",""Nav"":" + NavigateWarp
            + @",""Quality"":" + (byte)Quality + @",""Comp"":" + (byte)ComponentOrigin + @",""Cond"":" + Condition + @"}}");
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Serialises the Supplemental Component
 /// </summary>
 /// <returns>JSON object as string</returns>
 public override string ToJSON()
 {
     /*{
      * "Supplemental" : {
      *  "Name" : name,
      *  "Types" : types,
      *  "Power" : power.
      *  "Space" : space,
      *  "SP" : sp,
      *  "Origin" : origin,
      *  "Page" : page,
      *  "Ram" : ram,
      *  "Special" : special,
      *  "Quality" : quality,
      *  "Speed" : speed,
      *  "Man" : man,
      *  "Int" : int,
      *  "Armour" : armour,
      *  "Turrets" : turrets,
      *  "Morale" : morale,
      *  "Crew" : crew,
      *  "Prow" : prow,
      *  "Rating" : rating,
      *  "Mining" : mining,
      *  "Creed" : creed,
      *  "Military" : military,
      *  "Trade" : trade,
      *  "Criminal" : criminal,
      *  "Explore" : explore,
      *  "Gen" : gen,
      *  "Det" : det,
      *  "Aux" : {Weapon : {...}},
      *  "Macro" : damage,
      *  "BS" : bs,
      *  "Nav" : nav,
      *  "CrewLoss" : crewLoss,
      *  "MoraleLoss" : moraleLoss,
      *  "Comp" : comp,
      *  "Replace" : replace,
      *  "Max" : max,
      *  "Cond" : condition}
      *}
      */
     return(@"{""Supplemental"":{""Name"":""" + Name.Escape() + @""",""Types"":" + (byte)HullTypes + @",""Power"":" + RawPower
            + @",""Space"":" + RawSpace + @",""SP"":" + RawSP + @",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber
            + @",""Ram"":""" + RamDamage.ToString().Escape() + @""",""Special"":""" + RawSpecial.Escape() + @""",""Quality"":"
            + (byte)Quality + @",""Speed"":" + Speed + @",""Man"":" + Manoeuvrability + @",""Int"":" + HullIntegrity
            + @",""Armour"":" + Armour + @",""Turrets"":" + TurretRating + @",""Morale"":" + Morale + @",""Crew"":"
            + CrewPopulation + @",""Prow"":" + ProwArmour + @",""Rating"":" + CrewRating + @",""Mining"":"
            + MiningObjective + @",""Creed"":" + CreedObjective + @",""Military"":" + MilitaryObjective
            + @",""Trade"":" + TradeObjective + @",""Criminal"":" + CriminalObjective + @",""Explore"":"
            + ExplorationObjective + @",""Gen"":" + (PowerGenerated ? 1 : 0) + @",""Det"":" + DetectionRating
            + @",""Aux"":" + AuxiliaryWeapon.JSON() + @",""Macro"":"
            + MacrobatteryModifier + @",""BS"":" + BSModifier + @",""Nav"":" + NavigateWarp + @",""CrewLoss"":"
            + CrewLoss + @",""MoraleLoss"":" + MoraleLoss + @",""Comp"":" + (byte)ComponentOrigin + @",""Replace"":""" + Replace.Escape() + @""",""Max"":" + Max + @",""Cond"":" + Condition + @"}}");
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Serialises the Bridge
 /// </summary>
 /// <returns>JSON object as string</returns>
 public override string ToJSON()
 {
     /*{
      * "Bridge" : {
      *  "Name" : name,
      *  "Types" : types,
      *  "Power" : power,
      *  "Space" : space,
      *  "Origin" : origin,
      *  "Page" : page,
      *  "Special" : special,
      *  "SP" : sp,
      *  "Quality" : quality,
      *  "Man" : man,
      *  "BS" : bs,
      *  "Command" : command,
      *  "Repair" : repair,
      *  "Pilot" : pilot,
      *  "Nav" : nav,
      *  "Comp" : comp,
      *  "Mining" : mining,
      *  "Creed" : creed,
      *  "Military" : military,
      *  "Trade" : trade,
      *  "Criminal" : criminal,
      *  "Explore" : explore,
      *  "Cond" : condition}
      *}*/
     return(@"{""Bridge"":{""Name"":""" + Name.Escape() + @""",""Types"":" + (byte)HullTypes + @",""Power"":" + RawPower + @",""Space"":" + RawSpace
            + @",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber + @",""Special"":""" + RawSpecial.Escape() + @""",""SP"":" + RawSP
            + @",""Quality"":" + (byte)Quality + @",""Man"":" + Manoeuvrability + @",""BS"":" + BSModifier + @",""Command"":" + Command
            + @",""Repair"":" + Repair + @",""Pilot"":" + Pilot + @",""Nav"":" + NavigateWarp + @",""Comp"":" + (byte)ComponentOrigin
            + @",""Mining"":" + MiningObjective + @",""Creed"":" + CreedObjective + @",""Military"":" + MilitaryObjective
            + @",""Trade"":" + TradeObjective + @",""Criminal"":" + CriminalObjective + @",""Explore"":" + ExplorationObjective + @",""Cond"":" + Condition + @"}}");
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Serialises the component
        /// </summary>
        /// <returns>JSON object as string</returns>
        public override string ToJSON()
        {
            /*
             * {
             *  "Hull" : {
             *   "Name" : name,
             *   "Speed" : speed,
             *   "Man" : man,
             *   "Det" : det,
             *   "Int" : hullint,
             *   "Armour" : armour,
             *   "Space" : space,
             *   "SP" : sp,
             *   "Types" : types,
             *   "Special" : special,
             *   "Origin" : origin,
             *   "Page" : page,
             *   "Turrets" : turrets,
             *   "Prow" : prow,
             *   "Dorsal" : dorsal,
             *   "Side" : side,
             *   "Keel" : keel,
             *   "Aft" : aft,
             *   "Frontal" : {Weapon : {...}}
             *   "Broadside" : {Weapon : {...}}
             *   "Comps" : [{Supplemental : {...}},{Supplemental : {...}}...]
             *   "Command" : command,
             *   "Max" : maxspeed,
             *   "Power" : power,
             *   "History" : History,
             *   "BS" : bs,
             *   "Locked" : locked,
             *   "Nav" : nav,
             *   "Shields" : shields }
             * }
             */
            StringBuilder output = new StringBuilder(@"{""Hull"":{""Name"":""" + Name.Escape() + @""",""Speed"":" + Speed);

            output.Append(@",""Man"":" + Manoeuvrability + @",""Det"":" + DetectionRating + @",""Int"":" + HullIntegrity);
            output.Append(@",""Armour"":" + Armour + @",""Space"":" + RawSpace + @",""SP"":" + RawSP + @",""Types"":" + (byte)HullTypes);
            output.Append(@",""Special"":""" + RawSpecial.Escape() + @""",""Origin"":" + (byte)Origin + @",""Page"":" + PageNumber);
            output.Append(@",""Turrets"":" + TurretRating + @",""Prow"":" + ProwSlots + @",""Dorsal"":" + DorsalSlots);
            output.Append(@",""Side"":" + SideSlots + @",""Keel"":" + KeelSlots + @",""Aft"":" + AftSlots);
            output.Append(@",""Frontal"":" + DefaultProw.JSON());
            output.Append(@",""Broadside"":" + DefaultBroadside.JSON());
            output.Append(@",""Comps"":[");
            if (DefaultComponents != null)
            {
                for (int i = 0; i < DefaultComponents.Length; i++)
                {
                    output.Append(DefaultComponents[i].ToJSON());
                    if (i < DefaultComponents.Length - 1)
                    {
                        output.Append(@",");
                    }
                }
            }
            output.Append(@"],""Command"":" + Command + @",""Max"":" + MaxSpeed + @",""Power"":" + Power + @",""History"":" + (byte)History
                          + @",""BS"":" + BSModifier + @",""Locked"":" + (ArmourLocked ? 1 : 0) + @",""Nav"":" + NavigateWarp + @",""Shields"":" + (byte)VoidShields + @"}}");
            return(output.ToString());
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Serialises the Landing Bay
        /// </summary>
        /// <returns>JSON object as string</returns>
        public override string ToJSON()
        {
            /*{
             * "Landing" : {
             *  "Name" : name,
             *  "Types" : types,
             *  "Slots" : slots,
             *  "Power" : power,
             *  "Space" : space,
             *  "SP" : sp,
             *  "Str" : str,
             *  "Origin" : origin,
             *  "Page" : page,
             *  "Quality" : quality,
             *  "WeapQual" : wq,
             *  "Special" : special,
             *  "Comp" : comp,
             *  "Squadrons": [squadrons],
             *  "Cond" : Conditions}
             *}
             */
            StringBuilder output = new StringBuilder(@"{""Landing"":{""Name"":""" + Name.Escape() + @""",""Types"":" + (byte)HullTypes + @",""Slots"":" + (byte)Slots
                                                     + @",""Power"":" + RawPower + @",""Space"":" + RawSpace + @",""SP"":" + RawSP + @",""Str"":" + Strength + @",""Origin"":"
                                                     + (byte)Origin + @",""Page"":" + PageNumber + @",""Quality"":" + (byte)Quality + @",""WeapQual"":"
                                                     + (byte)WeaponQuality + @",""Special"":""" + RawSpecial.Escape() + @""",""Comp"":" + (byte)ComponentOrigin + @",""Squadrons"":[");

            if (Squadrons != null)
            {
                for (int i = 0; i < Squadrons.Count; i++)
                {
                    output.Append(Squadrons[i].ToJSON());
                    if (i < Squadrons.Count - 1)
                    {
                        output.Append(",");
                    }
                }
            }
            output.Append(@"],""Cond"":" + Condition + @"}}");
            return(output.ToString());
        }