private void OnWeaponFired(BaseProjectile projectile, BasePlayer player) { if (!HasInfiniteAmmo(player)) { return; } projectile.GetItem().condition = projectile.GetItem().info.condition.max; if (projectile.primaryMagazine.contents > 0) { return; } projectile.primaryMagazine.contents = projectile.primaryMagazine.capacity; projectile.SendNetworkUpdateImmediate(); }
object OnReloadWeapon(BasePlayer player, BaseProjectile projectile) { #if DEBUG Puts("OnReloadWeapon called!"); #endif Item item = projectile.GetItem(); Dictionary <string, object> weaponStats = null; if (weaponContainer.ContainsKey(item.info.shortname)) { #if DEBUG Puts("OnReloadWeapon: Adding weapon "); #endif weaponStats = weaponContainer[item.info.shortname] as Dictionary <string, object>; } if (!(bool)weaponStats["settingactive"]) { #if DEBUG Puts($"OnReloadWeapon: Weapon type {item.info.shortname} inactive."); #endif return(null); } if (hasRight(player, "maxammo") || hasRight(player, "all")) { #if DEBUG Puts($"OnReloadWeapon: Weapon type {item.info.shortname} active - giving maxammo."); #endif projectile.primaryMagazine.capacity = (int)weaponStats["maxammo"]; projectile.SendNetworkUpdate(); } return(null); }
private void OnWeaponFired(BaseProjectile projectile, BasePlayer player) { if (!permission.UserHasPermission(player.userID.ToString(), "infinite.ammo")) { return; } if (!HasInfiniteAmmo(player)) { return; } projectile.GetItem().condition = projectile.GetItem().info.condition.max; if (projectile.primaryMagazine.contents > 0) { return; } projectile.primaryMagazine.contents = projectile.primaryMagazine.capacity; projectile.SendNetworkUpdateImmediate(); }
private void DisableTaserBehaviour(BaseProjectile aBaseProjectile) { Item theItem = aBaseProjectile.GetItem(); if (theItem != null) { theItem.name = null; } aBaseProjectile.canUnloadAmmo = true; aBaseProjectile.primaryMagazine.contents = 0; aBaseProjectile.primaryMagazine.capacity = 16; TaserController theController = aBaseProjectile.GetComponent <TaserController>(); if (theController) { UnityEngine.Object.Destroy(theController); } aBaseProjectile.SendNetworkUpdateImmediate(); }
private void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles) { /* TODO : * - Remove retarded cone of fire/bloom * - Put back the old crazy recoil of Ak, f**k noobs */ var item = projectile.GetItem(); Debug($"SHOOT : {projectile.GetAimCone()} {projectile.aimCone} {projectile.aimSway}"); var shotgunsNerfed = new int[2, 2] { { -1009492144, 30 }, // Shotgun Pump { 191795897, 30 } // Double Barrel }; //Debug("Shooting with : " + item.info.shortname + " (" + item.info.itemid + ")"); for (var x = 0; x < shotgunsNerfed.Length / 2; x++) { if (shotgunsNerfed[x, 0] != item.info.itemid) { continue; } Chance = shotgunsNerfed[x, 1]; Random = UnityEngine.Random.Range(0, 100); //Debug("Shotgun fail : " + Random + " of " + Chance); if (Chance <= Random) { return; } item.LoseCondition(10f); break; } if (item.info.itemid != 2077983581) { return; } OnPipeShotgunUse(player, item); }
private void EnableTaserBehaviour(BaseProjectile aBaseProjectile) { Item theItem = aBaseProjectile.GetItem(); if (theItem != null) { theItem.name = GetText(I18N_TASER, theItem.GetOwnerPlayer()?.UserIDString); } aBaseProjectile.canUnloadAmmo = false; aBaseProjectile.primaryMagazine.contents = 1; aBaseProjectile.primaryMagazine.capacity = 0; TaserController theController = aBaseProjectile.GetComponent <TaserController>(); if (theController) { UnityEngine.Object.Destroy(theController); } aBaseProjectile.gameObject.AddComponent <TaserController>().Config = config; aBaseProjectile.SendNetworkUpdateImmediate(); }
private object OnWeaponReload(BaseProjectile projectile, BasePlayer player) { if (configData.Debug) { Puts("OnReloadWeapon called!"); } Item item = projectile.GetItem(); WeaponStats weaponStats = new WeaponStats(); if (configData.Weapons.ContainsKey(item.info.shortname)) { if (configData.Debug) { Puts("OnReloadWeapon: Adding weapon "); } weaponStats = configData.Weapons[item.info.shortname]; } if (!weaponStats.settingactive) { if (configData.Debug) { Puts($"OnReloadWeapon: Weapon type {item.info.shortname} inactive."); } return(null); } double maxammo = HasExtender(projectile) ? Math.Ceiling(weaponStats.maxammo * 1.25) : weaponStats.maxammo; if (HasRight(player, "maxammo") || HasRight(player, "all")) { if (configData.Debug) { Puts($"OnReloadWeapon: Weapon type {item.info.shortname} active - giving maxammo."); } projectile.primaryMagazine.capacity = (int)maxammo; projectile.SendNetworkUpdate(); } return(null); }
private void OnWeaponFired(BaseProjectile projectile, BasePlayer player) { projectile.GetItem().condition = projectile.GetItem().info.condition.max; projectile.SendNetworkUpdateImmediate(); }
void UnlimitedAmmo(BaseProjectile projectile, BasePlayer player) { projectile.GetItem().condition = projectile.GetItem().info.condition.max; projectile.primaryMagazine.contents = projectile.primaryMagazine.capacity; projectile.SendNetworkUpdateImmediate(); }
private bool IsAmmoBlocked(BasePlayer owner, BaseProjectile proj) { Debug($"IsAmmoBlocked called on player \"{owner.displayName}\" for weapon \"{proj.GetItem()?.info.displayName.english ?? "Unknown"}\""); List <Item> currentAmmo = owner.inventory.FindItemIDs(proj.primaryMagazine.ammoType.itemid).ToList(); Item newAmmo = null; Debug($"CurrentAmmo count = {currentAmmo.Count}"); if (currentAmmo.Count == 0) { List <Item> newAmmoList = new List <Item>(); owner.inventory.FindAmmo(newAmmoList, proj.primaryMagazine.definition.ammoTypes); Debug( $"CurrentAmmo count equals 0. NewAmmoList count = {newAmmoList.Count}\nTrying to get the first item."); if (newAmmoList.Count == 0) { return(false); } try { newAmmo = newAmmoList[0]; Debug($"Successfully got item {newAmmo.info.displayName.english}"); } catch (Exception e) { PrintError($"Error in attempt to get the item from NewAmmoList. {e.GetType()}:\n{e.Message}"); return(false); } } else { Debug($"CurrentAmmo count doesn't equals 0. Getting NewAmmo out of it."); try { newAmmo = currentAmmo[0]; Debug($"Successfully got item {newAmmo.info.displayName.english}"); } catch (Exception e) { PrintError($"Error in attempt to get the item from the CurrentAmmo list. {e.GetType()}:\n{e.Message}"); return(false); } } return(config.BlockedAmmo.Contains(newAmmo.info.displayName.english) || config.BlockedAmmo.Contains(newAmmo.info.shortname)); }
private void OnWeaponFired(BaseProjectile projectile, BasePlayer player) { projectile.GetItem().condition = projectile.GetItem().info.condition.max; projectile.SendNetworkUpdateImmediate(); }