Ejemplo n.º 1
0
        public static HashSet <string> getWeaponAvaibleAmmoForMode(Weapon weapon, string modeId)
        {
            HashSet <string>   result       = new HashSet <string>();
            CustomAmmoCategory ammoCategory = CustomAmmoCategories.find(weapon.AmmoCategory.ToString());
            ExtWeaponDef       extWeapon    = CustomAmmoCategories.getExtWeaponDef(weapon.defId);

            if (extWeapon.AmmoCategory.BaseCategory == weapon.AmmoCategory)
            {
                ammoCategory = extWeapon.AmmoCategory;
            }
            if (extWeapon.Modes.Count < 1)
            {
                CustomAmmoCategoriesLog.Log.LogWrite("WARNING! " + weapon.defId + " has no modes. Even base mode. This means something is very very wrong\n", true);
                return(result);
            }
            if (extWeapon.Modes.ContainsKey(modeId) == false)
            {
                CustomAmmoCategoriesLog.Log.LogWrite("WARNING! " + weapon.defId + " has no mode " + modeId + ".\n", true);
                return(result);
            }
            WeaponMode weaponMode = extWeapon.Modes[modeId];

            if (weaponMode.AmmoCategory.Index != ammoCategory.Index)
            {
                ammoCategory = weaponMode.AmmoCategory;
            }
            ;
            if (ammoCategory.Index == CustomAmmoCategories.NotSetCustomAmmoCategoty.Index)
            {
                result.Add(""); return(result);
            }
            ;
            foreach (AmmunitionBox box in weapon.ammoBoxes)
            {
                if (box.IsFunctional == false)
                {
                    continue;
                }
                if (box.CurrentAmmo <= 0)
                {
                    continue;
                }
                CustomAmmoCategory boxAmmoCategory = CustomAmmoCategories.getAmmoAmmoCategory(box.ammoDef);
                if (boxAmmoCategory.Index == ammoCategory.Index)
                {
                    if (result.Contains(box.ammoDef.Description.Id) == false)
                    {
                        result.Add(box.ammoDef.Description.Id);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static bool isWeaponCanUseAmmo(WeaponDef weaponDef, AmmunitionDef ammoDef)
        {
            ExtAmmunitionDef   extAmmo      = CustomAmmoCategories.findExtAmmo(ammoDef.Description.Id);
            CustomAmmoCategory ammoCategory = extAmmo.AmmoCategory;

            if (ammoCategory.BaseCategory == AmmoCategory.NotSet)
            {
                ammoCategory = CustomAmmoCategories.find(ammoDef.Category.ToString());
            }
            ;
            if (ammoCategory.BaseCategory == AmmoCategory.NotSet)
            {
                return(false);
            }
            ;
            ExtWeaponDef extWeapon = CustomAmmoCategories.getExtWeaponDef(weaponDef.Description.Id);

            if (extWeapon.AmmoCategory.BaseCategory != AmmoCategory.NotSet)
            {
                if (extWeapon.AmmoCategory.Index == ammoCategory.Index)
                {
                    return(true);
                }
                ;
            }
            else
            if (weaponDef.AmmoCategory != AmmoCategory.NotSet)
            {
                CustomAmmoCategory weaponAmmoCategory = CustomAmmoCategories.find(weaponDef.AmmoCategory.ToString());
                if ((weaponAmmoCategory.BaseCategory != AmmoCategory.NotSet) && (weaponAmmoCategory.Index == ammoCategory.Index))
                {
                    return(true);
                }
            }
            foreach (var mode in extWeapon.Modes)
            {
                if (mode.Value.AmmoCategory == null)
                {
                    continue;
                }
                ;
                if ((mode.Value.AmmoCategory.BaseCategory != AmmoCategory.NotSet) && (mode.Value.AmmoCategory.Index == ammoCategory.Index))
                {
                    return(true);
                }
                ;
            }
            return(false);
        }
Ejemplo n.º 3
0
 public ExtWeaponDef()
 {
     StreakEffect       = false;
     HitGenerator       = HitGeneratorType.NotSet;
     DirectFireModifier = 0;
     FlatJammingChance  = 0;
     GunneryJammingBase = 0;
     GunneryJammingMult = 0;
     baseModeId         = WeaponMode.NONE_MODE_NAME;
     DisableClustering  = TripleBoolean.True;
     NotUseInMelee      = TripleBoolean.NotSet;
     DamageOnJamming    = TripleBoolean.NotSet;
     AmmoCategory       = new CustomAmmoCategory();
     Modes = new Dictionary <string, WeaponMode>();
 }
Ejemplo n.º 4
0
 public WeaponMode()
 {
     Id                       = WeaponMode.NONE_MODE_NAME;
     UIName                   = WeaponMode.BASE_MODE_NAME;
     AccuracyModifier         = 0;
     DirectFireModifier       = 0;
     DamagePerShot            = 0;
     HeatDamagePerShot        = 0;
     HeatGenerated            = 0;
     ProjectilesPerShot       = 0;
     ShotsWhenFired           = 0;
     CriticalChanceMultiplier = 0;
     MinRange                 = 0;
     MaxRange                 = 0;
     LongRange                = 0;
     MaxRange                 = 0;
     ShortRange               = 0;
     MediumRange              = 0;
     AIBattleValue            = 100;
     RefireModifier           = 0;
     Instability              = 0;
     AttackRecoil             = 0;
     EvasivePipsIgnored       = 0;
     FlatJammingChance        = 0;
     DistantVariance          = 0;
     DamageVariance           = 0;
     Cooldown                 = 0;
     AIHitChanceCap           = 0;
     ForbiddenRange           = 0;
     GunneryJammingBase       = 0;
     GunneryJammingMult       = 0;
     AlwaysIndirectVisuals    = TripleBoolean.NotSet;
     DamageMultiplier         = 1.0f;
     DamageOnJamming          = TripleBoolean.NotSet;
     DistantVarianceReversed  = TripleBoolean.NotSet;
     IndirectFireCapable      = TripleBoolean.NotSet;
     AOECapable               = TripleBoolean.NotSet;
     WeaponEffectID           = "";
     HitGenerator             = HitGeneratorType.NotSet;
     isBaseMode               = false;
     statusEffects            = new List <EffectData>();
     AmmoCategory             = null;
 }
Ejemplo n.º 5
0
 public ExtAmmunitionDef()
 {
     AccuracyModifier         = 0;
     DirectFireModifier       = 0;
     DamagePerShot            = 0;
     HeatDamagePerShot        = 0;
     ProjectilesPerShot       = 0;
     ShotsWhenFired           = 0;
     CriticalChanceMultiplier = 0;
     DamageMultiplier         = 1.0f;
     MinRange                = 0;
     MaxRange                = 0;
     LongRange               = 0;
     MaxRange                = 0;
     ShortRange              = 0;
     MediumRange             = 0;
     AIBattleValue           = 100;
     RefireModifier          = 0;
     Instability             = 0;
     AttackRecoil            = 0;
     EvasivePipsIgnored      = 0;
     FlatJammingChance       = 0;
     DistantVariance         = 0;
     DistantVarianceReversed = TripleBoolean.NotSet;
     DamageVariance          = 0;
     ForbiddenRange          = 0;
     GunneryJammingBase      = 0;
     GunneryJammingMult      = 0;
     IndirectFireCapable     = TripleBoolean.NotSet;
     AlwaysIndirectVisuals   = TripleBoolean.NotSet;
     AOECapable              = TripleBoolean.NotSet;
     WeaponEffectID          = "";
     HitGenerator            = HitGeneratorType.NotSet;
     statusEffects           = new EffectData[0] {
     };
     AmmoCategory            = new CustomAmmoCategory();
 }
Ejemplo n.º 6
0
        public static bool Prefix(WeaponDef __instance, ref string json)
        {
            CustomAmmoCategoriesLog.Log.LogWrite("WeaponDef fromJSON ");
            JObject defTemp = JObject.Parse(json);

            CustomAmmoCategoriesLog.Log.LogWrite(defTemp["Description"]["Id"] + "\n");
            CustomAmmoCategory custCat = CustomAmmoCategories.find((string)defTemp["AmmoCategory"]);
            //CustomAmmoCategories.RegisterWeapon((string)defTemp["Description"]["Id"], custCat);
            ExtWeaponDef extDef = new ExtWeaponDef();

            extDef.AmmoCategory = custCat;
            if (defTemp["Streak"] != null)
            {
                extDef.StreakEffect = (bool)defTemp["Streak"];
                defTemp.Remove("Streak");
            }
            if (defTemp["HitGenerator"] != null)
            {
                try {
                    extDef.HitGenerator = (HitGeneratorType)Enum.Parse(typeof(HitGeneratorType), (string)defTemp["HitGenerator"], true);
                } catch (Exception e) {
                    extDef.HitGenerator = HitGeneratorType.NotSet;
                }
                defTemp.Remove("HitGenerator");
            }
            if (defTemp["FlatJammingChance"] != null)
            {
                extDef.FlatJammingChance = (float)defTemp["FlatJammingChance"];
                defTemp.Remove("FlatJammingChance");
            }
            if (defTemp["GunneryJammingBase"] != null)
            {
                extDef.GunneryJammingBase = (float)defTemp["GunneryJammingBase"];
                defTemp.Remove("GunneryJammingBase");
            }
            if (defTemp["GunneryJammingMult"] != null)
            {
                extDef.GunneryJammingMult = (float)defTemp["GunneryJammingMult"];
                defTemp.Remove("GunneryJammingMult");
            }
            if (defTemp["DirectFireModifier"] != null)
            {
                extDef.DirectFireModifier = (float)defTemp["DirectFireModifier"];
                defTemp.Remove("DirectFireModifier");
            }
            if (defTemp["DisableClustering"] != null)
            {
                extDef.DisableClustering = ((bool)defTemp["DisableClustering"] == true) ? TripleBoolean.True : TripleBoolean.False;
                defTemp.Remove("DisableClustering");
            }
            if (defTemp["NotUseInMelee"] != null)
            {
                extDef.NotUseInMelee = ((bool)defTemp["NotUseInMelee"] == true) ? TripleBoolean.True : TripleBoolean.False;
                defTemp.Remove("NotUseInMelee");
            }
            if (defTemp["DamageOnJamming"] != null)
            {
                extDef.DamageOnJamming = ((bool)defTemp["DamageOnJamming"] == true) ? TripleBoolean.True : TripleBoolean.False;
                defTemp.Remove("DamageOnJamming");
            }
            if (defTemp["Modes"] != null)
            {
                if (defTemp["Modes"].Type == JTokenType.Array)
                {
                    extDef.Modes.Clear();
                    JToken jWeaponModes = defTemp["Modes"];
                    foreach (JObject jWeaponMode in jWeaponModes)
                    {
                        string ModeJSON = jWeaponMode.ToString();
                        if (string.IsNullOrEmpty(ModeJSON))
                        {
                            continue;
                        }
                        ;
                        WeaponMode mode = new WeaponMode();
                        mode.fromJSON(ModeJSON);
                        if (mode.AmmoCategory == null)
                        {
                            mode.AmmoCategory = extDef.AmmoCategory;
                        }
                        //mode.AmmoCategory = extDef.AmmoCategory;
                        CustomAmmoCategoriesLog.Log.LogWrite(" adding mode '" + mode.Id + "'\n");
                        extDef.Modes.Add(mode.Id, mode);
                        if (mode.isBaseMode == true)
                        {
                            extDef.baseModeId = mode.Id;
                        }
                    }
                }
                defTemp.Remove("Modes");
            }
            if (extDef.baseModeId == WeaponMode.NONE_MODE_NAME)
            {
                WeaponMode mode = new WeaponMode();
                mode.Id           = WeaponMode.BASE_MODE_NAME;
                mode.AmmoCategory = extDef.AmmoCategory;
                extDef.baseModeId = mode.Id;
                extDef.Modes.Add(mode.Id, mode);
            }
            CustomAmmoCategories.registerExtWeaponDef((string)defTemp["Description"]["Id"], extDef);
            defTemp["AmmoCategory"] = custCat.BaseCategory.ToString();
            //CustomAmmoCategoriesLog.Log.LogWrite("\n--------------ORIG----------------\n" + json + "\n----------------------------------\n");
            //CustomAmmoCategoriesLog.Log.LogWrite("\n--------------MOD----------------\n" + defTemp.ToString() + "\n----------------------------------\n");
            json = defTemp.ToString();
            return(true);
        }
Ejemplo n.º 7
0
        public static bool Prefix(AmmunitionDef __instance, ref string json)
        {
            CustomAmmoCategoriesLog.Log.LogWrite("AmmunitionDef fromJSON ");
            JObject defTemp = JObject.Parse(json);

            CustomAmmoCategoriesLog.Log.LogWrite(defTemp["Description"]["Id"] + "\n");
            CustomAmmoCategory custCat = CustomAmmoCategories.find((string)defTemp["Category"]);

            //CustomAmmoCategories.RegisterAmmunition((string)defTemp["Description"]["Id"], custCat);
            defTemp["Category"] = custCat.BaseCategory.ToString();
            ExtAmmunitionDef extAmmoDef = new ExtAmmunitionDef();

            extAmmoDef.AmmoCategory = custCat;
            if (defTemp["AccuracyModifier"] != null)
            {
                extAmmoDef.AccuracyModifier = (float)defTemp["AccuracyModifier"];
                defTemp.Remove("AccuracyModifier");
            }
            if (defTemp["DamagePerShot"] != null)
            {
                extAmmoDef.DamagePerShot = (float)defTemp["DamagePerShot"];
                defTemp.Remove("DamagePerShot");
            }
            if (defTemp["HeatDamagePerShot"] != null)
            {
                extAmmoDef.HeatDamagePerShot = (float)defTemp["HeatDamagePerShot"];
                defTemp.Remove("HeatDamagePerShot");
            }
            if (defTemp["ProjectilesPerShot"] != null)
            {
                extAmmoDef.ProjectilesPerShot = (int)defTemp["ProjectilesPerShot"];
                defTemp.Remove("ProjectilesPerShot");
            }
            if (defTemp["ShotsWhenFired"] != null)
            {
                extAmmoDef.ShotsWhenFired = (int)defTemp["ShotsWhenFired"];
                defTemp.Remove("ShotsWhenFired");
            }
            if (defTemp["CriticalChanceMultiplier"] != null)
            {
                extAmmoDef.CriticalChanceMultiplier = (float)defTemp["CriticalChanceMultiplier"];
                defTemp.Remove("CriticalChanceMultiplier");
            }
            if (defTemp["AIBattleValue"] != null)
            {
                extAmmoDef.AIBattleValue = (int)defTemp["AIBattleValue"];
                defTemp.Remove("AIBattleValue");
            }
            if (defTemp["MinRange"] != null)
            {
                extAmmoDef.MinRange = (float)defTemp["MinRange"];
                defTemp.Remove("MinRange");
            }
            if (defTemp["MaxRange"] != null)
            {
                extAmmoDef.MaxRange = (float)defTemp["MaxRange"];
                defTemp.Remove("MaxRange");
            }
            if (defTemp["ShortRange"] != null)
            {
                extAmmoDef.ShortRange = (float)defTemp["ShortRange"];
                defTemp.Remove("ShortRange");
            }
            if (defTemp["MediumRange"] != null)
            {
                extAmmoDef.MediumRange = (float)defTemp["MediumRange"];
                defTemp.Remove("MediumRange");
            }
            if (defTemp["LongRange"] != null)
            {
                extAmmoDef.LongRange = (float)defTemp["LongRange"];
                defTemp.Remove("LongRange");
            }
            if (defTemp["ForbiddenRange"] != null)
            {
                extAmmoDef.ForbiddenRange = (float)defTemp["ForbiddenRange"];
                defTemp.Remove("ForbiddenRange");
            }
            if (defTemp["RefireModifier"] != null)
            {
                extAmmoDef.RefireModifier = (int)defTemp["RefireModifier"];
                defTemp.Remove("RefireModifier");
            }
            if (defTemp["Instability"] != null)
            {
                extAmmoDef.Instability = (float)defTemp["Instability"];
                defTemp.Remove("Instability");
            }
            if (defTemp["AttackRecoil"] != null)
            {
                extAmmoDef.AttackRecoil = (int)defTemp["AttackRecoil"];
                defTemp.Remove("AttackRecoil");
            }
            if (defTemp["WeaponEffectID"] != null)
            {
                extAmmoDef.WeaponEffectID = (string)defTemp["WeaponEffectID"];
                defTemp.Remove("WeaponEffectID");
            }
            if (defTemp["EvasivePipsIgnored"] != null)
            {
                extAmmoDef.EvasivePipsIgnored = (float)defTemp["EvasivePipsIgnored"];
                defTemp.Remove("EvasivePipsIgnored");
            }
            if (defTemp["FlatJammingChance"] != null)
            {
                extAmmoDef.FlatJammingChance = (float)defTemp["FlatJammingChance"];
                defTemp.Remove("FlatJammingChance");
            }
            if (defTemp["GunneryJammingBase"] != null)
            {
                extAmmoDef.GunneryJammingBase = (float)defTemp["GunneryJammingBase"];
                defTemp.Remove("GunneryJammingBase");
            }
            if (defTemp["GunneryJammingMult"] != null)
            {
                extAmmoDef.GunneryJammingMult = (float)defTemp["GunneryJammingMult"];
                defTemp.Remove("GunneryJammingMult");
            }
            if (defTemp["IndirectFireCapable"] != null)
            {
                extAmmoDef.IndirectFireCapable = ((bool)defTemp["IndirectFireCapable"] == true) ? TripleBoolean.True : TripleBoolean.False;
                defTemp.Remove("IndirectFireCapable");
            }
            if (defTemp["DirectFireModifier"] != null)
            {
                extAmmoDef.DirectFireModifier = (float)defTemp["DirectFireModifier"];
                defTemp.Remove("DirectFireModifier");
            }
            if (defTemp["AOECapable"] != null)
            {
                extAmmoDef.AOECapable = ((bool)defTemp["AOECapable"] == true) ? TripleBoolean.True : TripleBoolean.False;
                defTemp.Remove("AOECapable");
            }
            if (defTemp["DistantVariance"] != null)
            {
                extAmmoDef.DistantVariance = (float)defTemp["DistantVariance"];
                defTemp.Remove("DistantVariance");
            }
            if (defTemp["AlwaysIndirectVisuals"] != null)
            {
                extAmmoDef.AlwaysIndirectVisuals = ((bool)defTemp["AlwaysIndirectVisuals"] == true) ? TripleBoolean.True : TripleBoolean.False;
                defTemp.Remove("AlwaysIndirectVisuals");
            }
            if (defTemp["DamageMultiplier"] != null)
            {
                extAmmoDef.DamageMultiplier = (float)defTemp["DamageMultiplier"];
                defTemp.Remove("DamageMultiplier");
            }
            if (defTemp["DistantVarianceReversed"] != null)
            {
                extAmmoDef.DistantVarianceReversed = ((bool)defTemp["DistantVarianceReversed"] == true) ? TripleBoolean.True : TripleBoolean.False;
                defTemp.Remove("DistantVarianceReversed");
            }
            if (defTemp["DamageVariance"] != null)
            {
                extAmmoDef.DamageVariance = (float)defTemp["DamageVariance"];
                defTemp.Remove("DamageVariance");
            }
            if (defTemp["HitGenerator"] != null)
            {
                try {
                    extAmmoDef.HitGenerator = (HitGeneratorType)Enum.Parse(typeof(HitGeneratorType), (string)defTemp["HitGenerator"], true);
                } catch (Exception e) {
                    extAmmoDef.HitGenerator = HitGeneratorType.NotSet;
                }
                defTemp.Remove("HitGenerator");
            }
            if (defTemp["statusEffects"] != null)
            {
                if (defTemp["statusEffects"].Type == JTokenType.Array)
                {
                    List <EffectData> tmpList       = new List <EffectData>();
                    JToken            statusEffects = defTemp["statusEffects"];
                    foreach (JObject statusEffect in statusEffects)
                    {
                        EffectData effect = new EffectData();
                        JSONSerializationUtility.FromJSON <EffectData>(effect, statusEffect.ToString());
                        tmpList.Add(effect);
                    }
                    extAmmoDef.statusEffects = tmpList.ToArray();
                }
                //extAmmoDef.statusEffects = JsonConvert.DeserializeObject<EffectData[]>(defTemp["statusEffects"].ToString());
                //JSONSerializationUtility.FromJSON<EffectData[]>(extAmmoDef.statusEffects, defTemp["statusEffects"].ToString());
                //CustomAmmoCategoriesLog.Log.LogWrite(JsonConvert.SerializeObject(extAmmoDef.statusEffects)+"\n");
                defTemp.Remove("statusEffects");
            }
            CustomAmmoCategories.RegisterExtAmmoDef((string)defTemp["Description"]["Id"], extAmmoDef);
            json = defTemp.ToString();
            return(true);
        }
Ejemplo n.º 8
0
        public void fromJSON(string json)
        {
            JObject jWeaponMode = JObject.Parse(json);

            if (jWeaponMode["Id"] != null)
            {
                this.Id = (string)jWeaponMode["Id"];
            }
            if (jWeaponMode["UIName"] != null)
            {
                this.UIName = (string)jWeaponMode["UIName"];
            }
            if (jWeaponMode["AccuracyModifier"] != null)
            {
                this.AccuracyModifier = (float)jWeaponMode["AccuracyModifier"];
            }
            if (jWeaponMode["DamagePerShot"] != null)
            {
                this.DamagePerShot = (float)jWeaponMode["DamagePerShot"];
            }
            if (jWeaponMode["HeatDamagePerShot"] != null)
            {
                this.HeatDamagePerShot = (float)jWeaponMode["HeatDamagePerShot"];
            }
            if (jWeaponMode["HeatGenerated"] != null)
            {
                this.HeatGenerated = (int)jWeaponMode["HeatGenerated"];
            }
            if (jWeaponMode["ProjectilesPerShot"] != null)
            {
                this.ProjectilesPerShot = (int)jWeaponMode["ProjectilesPerShot"];
            }
            if (jWeaponMode["ShotsWhenFired"] != null)
            {
                this.ShotsWhenFired = (int)jWeaponMode["ShotsWhenFired"];
            }
            if (jWeaponMode["CriticalChanceMultiplier"] != null)
            {
                this.CriticalChanceMultiplier = (float)jWeaponMode["CriticalChanceMultiplier"];
            }
            if (jWeaponMode["AIBattleValue"] != null)
            {
                this.AIBattleValue = (int)jWeaponMode["AIBattleValue"];
            }
            if (jWeaponMode["MinRange"] != null)
            {
                this.MinRange = (float)jWeaponMode["MinRange"];
            }
            if (jWeaponMode["MaxRange"] != null)
            {
                this.MaxRange = (float)jWeaponMode["MaxRange"];
            }
            if (jWeaponMode["ShortRange"] != null)
            {
                this.ShortRange = (float)jWeaponMode["ShortRange"];
            }
            if (jWeaponMode["ForbiddenRange"] != null)
            {
                this.ForbiddenRange = (float)jWeaponMode["ForbiddenRange"];
            }
            if (jWeaponMode["MediumRange"] != null)
            {
                this.MediumRange = (float)jWeaponMode["MediumRange"];
            }
            if (jWeaponMode["LongRange"] != null)
            {
                this.LongRange = (float)jWeaponMode["LongRange"];
            }
            if (jWeaponMode["RefireModifier"] != null)
            {
                this.RefireModifier = (int)jWeaponMode["RefireModifier"];
            }
            if (jWeaponMode["isBaseMode"] != null)
            {
                this.isBaseMode = (bool)jWeaponMode["isBaseMode"];
            }
            if (jWeaponMode["Instability"] != null)
            {
                this.Instability = (float)jWeaponMode["Instability"];
            }
            if (jWeaponMode["AttackRecoil"] != null)
            {
                this.AttackRecoil = (int)jWeaponMode["AttackRecoil"];
            }
            if (jWeaponMode["WeaponEffectID"] != null)
            {
                this.WeaponEffectID = (string)jWeaponMode["WeaponEffectID"];
            }
            if (jWeaponMode["EvasivePipsIgnored"] != null)
            {
                this.EvasivePipsIgnored = (float)jWeaponMode["EvasivePipsIgnored"];
            }
            if (jWeaponMode["IndirectFireCapable"] != null)
            {
                this.IndirectFireCapable = ((bool)jWeaponMode["IndirectFireCapable"] == true) ? TripleBoolean.True : TripleBoolean.False;
            }
            if (jWeaponMode["DirectFireModifier"] != null)
            {
                this.DirectFireModifier = (float)jWeaponMode["DirectFireModifier"];
            }
            if (jWeaponMode["DistantVariance"] != null)
            {
                this.DistantVariance = (float)jWeaponMode["DistantVariance"];
            }
            if (jWeaponMode["DamageMultiplier"] != null)
            {
                this.DamageMultiplier = (float)jWeaponMode["DamageMultiplier"];
            }
            if (jWeaponMode["DistantVarianceReversed"] != null)
            {
                this.DistantVarianceReversed = ((bool)jWeaponMode["DistantVarianceReversed"] == true) ? TripleBoolean.True : TripleBoolean.False;
            }
            if (jWeaponMode["DamageVariance"] != null)
            {
                this.DamageVariance = (float)jWeaponMode["DamageVariance"];
            }
            if (jWeaponMode["FlatJammingChance"] != null)
            {
                this.FlatJammingChance = (float)jWeaponMode["FlatJammingChance"];
            }
            if (jWeaponMode["GunneryJammingBase"] != null)
            {
                this.GunneryJammingBase = (float)jWeaponMode["GunneryJammingBase"];
            }
            if (jWeaponMode["GunneryJammingMult"] != null)
            {
                this.GunneryJammingMult = (float)jWeaponMode["GunneryJammingMult"];
            }
            if (jWeaponMode["AIHitChanceCap"] != null)
            {
                this.AIHitChanceCap = (float)jWeaponMode["AIHitChanceCap"];
            }
            if (jWeaponMode["Cooldown"] != null)
            {
                this.Cooldown = (int)jWeaponMode["Cooldown"];
            }
            if (jWeaponMode["AmmoCategory"] != null)
            {
                this.AmmoCategory = CustomAmmoCategories.find((string)jWeaponMode["AmmoCategory"]);
            }
            if (jWeaponMode["DamageOnJamming"] != null)
            {
                this.DamageOnJamming = ((bool)jWeaponMode["DamageOnJamming"] == true) ? TripleBoolean.True : TripleBoolean.False;
            }
            if (jWeaponMode["AOECapable"] != null)
            {
                this.AOECapable = ((bool)jWeaponMode["AOECapable"] == true) ? TripleBoolean.True : TripleBoolean.False;;
            }
            if (jWeaponMode["AlwaysIndirectVisuals"] != null)
            {
                this.AlwaysIndirectVisuals = ((bool)jWeaponMode["AlwaysIndirectVisuals"] == true) ? TripleBoolean.True : TripleBoolean.False;
            }
            if (jWeaponMode["HitGenerator"] != null)
            {
                try {
                    this.HitGenerator = (HitGeneratorType)Enum.Parse(typeof(HitGeneratorType), (string)jWeaponMode["HitGenerator"], true);
                } catch (Exception e) {
                    this.HitGenerator = HitGeneratorType.NotSet;
                }
                jWeaponMode.Remove("HitGenerator");
            }
            if (jWeaponMode["statusEffects"] != null)
            {
                if (jWeaponMode["statusEffects"].Type == JTokenType.Array)
                {
                    this.statusEffects.Clear();
                    JToken statusEffects = jWeaponMode["statusEffects"];
                    foreach (JObject statusEffect in statusEffects)
                    {
                        EffectData effect = new EffectData();
                        JSONSerializationUtility.FromJSON <EffectData>(effect, statusEffect.ToString());
                        this.statusEffects.Add(effect);
                    }
                }
            }
        }