Exemplo n.º 1
0
        public override string Compile()
        {
            string        output    = "";
            WeaponInfo    oldWeapon = null;
            WeaponInfo    newWeapon = null;
            BuildableInfo entity    = null;


            if (ApplicationType == ApplicationTypes.ApplyToEntity)
            {
                if (this.Parent.Parent is BuildableInfo)
                {
                    entity = ((BuildableInfo)Parent.Parent);
                }
            }
            else
            {
                entity = DataDumper.Units[Target] as BuildableInfo;
            }
            try
            {
                if (entity != null)
                {
                    WeaponHardPointInfo whpInfo = entity.WeaponHardPoints[HardPoint] as WeaponHardPointInfo;
                    oldWeapon = (WeaponInfo)whpInfo.Weapons[whpInfo.UpgradeValue];
                    whpInfo.UpgradeValue++;
                    newWeapon = (WeaponInfo)whpInfo.Weapons[whpInfo.UpgradeValue];
                    if (!oldWeapon.IsDummyWeapon())
                    {
                        if (ApplicationType == ApplicationTypes.ApplyToEntityType)
                        {
                            output += "Upgrades " + entity.Name + "'s " + Translation.Translate(oldWeapon.Name) + " to " + Translation.Translate(newWeapon.Name);
                        }
                        else if (ApplicationType == ApplicationTypes.ApplyToEntity)
                        {
                            output += "Upgrades " + Translation.Translate(oldWeapon.Name) + " to " + Translation.Translate(newWeapon.Name);
                        }
                    }
                    else
                    {
                        output += "Equips " + entity.Name + " with " + Translation.Translate(newWeapon.Name);
                    }
                }
            }
            catch {  }
            return(output);
        }
Exemplo n.º 2
0
        public static WeaponInfo GetWeapon(BuildableInfo info, int hardpoint, int index)
        {
            WeaponHardPointInfo whp = null;

            whp = info.WeaponHardPoints[hardpoint] as WeaponHardPointInfo;
            if (whp == null)
            {
                return(null);
            }
            foreach (WeaponInfo wpInfo in whp.Weapons)
            {
                if (wpInfo.WeaponIndex == index)
                {
                    return(wpInfo);
                }
            }
            return(null);
        }
Exemplo n.º 3
0
        public override string Compile()
        {
            string output = "";

            if (this.Parent.Parent is BuildableInfo)
            {
                BuildableInfo Bld = Parent.Parent as BuildableInfo;
                if (Bld.ArmorType > ArmorTypes.unknown && Bld.ArmorType < ArmorTypes.tp_building_high)
                {
                    if (ApplicationType == ApplicationTypes.ApplyToEntityType)
                    {
                        output = "Changes the armor of the " + Bld.Name + "to the secondary armor type";
                    }
                    else if (ApplicationType == ApplicationTypes.ApplyToEntity)
                    {
                        output = "Changes the armor to the secondary armor type";
                    }
                }
            }

            return(output);
        }
Exemplo n.º 4
0
        public virtual int CompareTo(object o)
        {
            if (!(o is BuildableInfo))
            {
                return(-1);
            }
            try
            {
                BuildableInfo toCompare = o as BuildableInfo;

                if (Race.CompareTo(toCompare.Race) < 0)
                {
                    return(-1);
                }
                if (Race.CompareTo(toCompare.Race) > 0)
                {
                    return(1);
                }
                return(Name.CompareTo(toCompare.Name));
            }
            catch {  };
            return(-1);
        }