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);
        }