public static void AllWeaponsMaxAmmo(Reach.CampaignSave saveData) { foreach (Reach.GameObject obj in saveData.Objects) { Reach.WeaponObject weapon = obj as Reach.WeaponObject; if (weapon != null) { weapon.Ammo = 32767; weapon.ClipAmmo = 32767; } } }
/// <summary> /// Initializes a combo box with a specific weapon /// </summary> /// <param name="typeBox">The combo box to initialize</param> /// <param name="weapon">The weapon to select in the combo box</param> private void LoadWeapon(ComboBox typeBox, Reach.WeaponObject weapon) { if (weapon != null) { int index = _weaponIndices[weapon]; ChangeWeapon(typeBox, 0, index); typeBox.SelectedIndex = index; } else { ChangeWeapon(typeBox, 0, 0); typeBox.SelectedIndex = 0; } _selectedWeapons[typeBox] = typeBox.SelectedItem as ComboBoxItem; }
/// <summary> /// Returns a UIElement/Util.IAmmoDisplay that can be used to accurately display the weapon's ammo. /// </summary> /// <param name="saveData">The save data to read from</param> /// <param name="weapon">The weapon object to display</param> /// <param name="name">The name of the weapon</param> /// <returns>A UIElement/Util.IAmmoDisplay corresponding to the weapon</returns> public static UIElement GetAmmoDisplay(Reach.CampaignSave saveData, Reach.WeaponObject weapon, string name) { name = name.ToLower(); UIElement display; if (name.Contains("plasma") || name.Contains("energy") || name.Contains("laser") || name.Contains("focus")) { display = new plasmaAmmoDisplay(weapon); } else if (name.Contains("target") || name.Contains("locator")) { display = new targetLocatorDisplay(saveData); } else { display = new regularAmmoDisplay(weapon); } return(display); }