public void SetChecked(Weapon.WeaponId weaponId, bool isChecked) { if (toggleButtons.ContainsKey(weaponId)) { toggleButtons[weaponId].IsChecked = isChecked; } }
public bool?IsChecked(Weapon.WeaponId weaponId) { if (toggleButtons.ContainsKey(weaponId)) { return(toggleButtons[weaponId].IsChecked); } return(null); }
private void RandomWeaponEquip() { RandomWeaponSettings rws = Settings.RandomWeaponSettings; if (!rws.IsEnabled) { return; } List <Weapon.WeaponId> weapons = rws.WeaponSelector.GetEnabledWeapons(); if (weapons.Count == 0) { return; } if (DateTime.Now.Subtract(rws.NextRandomWeaponTimeStamp).TotalMilliseconds > 0) { Weapon.WeaponId nextWeapon = weapons[StaticRandom.Random.Next(weapons.Count)]; foreach (Player player in Players.Where(p => p.IsAlive)) { if (player.IsBot && rws.IsSkipBots) { continue; } if (!rws.IsSameWeaponForAll) { nextWeapon = weapons[StaticRandom.Random.Next(weapons.Count)]; } if (rws.IsDropPreviousWeapon || player.Weapon.GetActiveWeaponId() == WeaponId.None) { player.EquipWeapon(nextWeapon); } } rws.NextRandomWeaponTimeStamp = DateTime.Now.AddSeconds(StaticRandom.Random.Next( Math.Min(rws.MinimalTimeInS, rws.MaximalTimeInS), Math.Max(rws.MinimalTimeInS, rws.MaximalTimeInS) )); } }