protected void RefreshWeaponStatus() { if (!this.m_Player.CurrentWeaponWielded.Get() && this.m_RefreshWeaponStatusIterations < 50) { this.m_RefreshWeaponStatusIterations++; vp_Timer.In(0.1f, new vp_Timer.Callback(this.RefreshWeaponStatus), null); return; } this.m_RefreshWeaponStatusIterations = 0; string text = this.m_Player.CurrentWeaponName.Get(); if (string.IsNullOrEmpty(text)) { return; } this.m_CurrentWeaponStatus = this.GetWeaponStatus(text); }
protected virtual bool OnAttempt_AddAmmo(object arg) { object[] array = (object[])arg; string name = (string)array[0]; int num = (array.Length != 2) ? -1 : ((int)array[1]); vp_SimpleInventory.InventoryWeaponStatus weaponStatus = this.GetWeaponStatus(name); if (weaponStatus == null) { return(false); } if (num == -1) { weaponStatus.LoadedAmmo = weaponStatus.MaxAmmo; } else { weaponStatus.LoadedAmmo = Mathf.Min(num, weaponStatus.MaxAmmo); } return(true); }