private void InitConfig() { ModIsEnabled = Config.Bind( "Settings", "ModEnabled", true, "Toggles whether or not the mod is enabled. If turned off while in-game, it will unhook " + "everything and reset the game to it's default behaviors." ); ModIsEnabled.SettingChanged += ReloadHooks; MoneyIsShared = Config.Bind( "Settings", "MoneyShared", true, "Toggles money sharing between teammates. Every player gains money together and spends it " + "from one central pool of money." ); WhiteItemsShared = Config.Bind( "Settings", "WhiteItemsShared", true, "Toggles item sharing for common (white color) items." ); GreenItemsShared = Config.Bind( "Settings", "GreenItemsShared", true, "Toggles item sharing for rare (green color) items." ); RedItemsShared = Config.Bind( "Settings", "RedItemsShared", true, "Toggles item sharing for legendary (red color) items." ); EquipmentShared = Config.Bind( "Settings", "EquipmentShared", false, "Toggles item sharing for equipment." ); LunarItemsShared = Config.Bind( "Settings", "LunarItemsShared", false, "Toggles item sharing for Lunar (blue color) items." ); BossItemsShared = Config.Bind( "Settings", "BossItemsShared", true, "Toggles item sharing for boss (yellow color) items." ); VoidItemsShared = Config.Bind( "Settings", "VoidItemsShared", false, "Toggles item sharing for void (purple/corrupted) items." ); RichMessagesEnabled = Config.Bind( "Settings", "RichMessagesEnabled", true, "Toggles detailed item pickup messages with information on who picked the item up and" + " who all received the item." ); DropBlacklistedEquipmentOnShare = Config.Bind( "Balance", "DropBlacklistedEquipmentOnShare", false, "Changes the way shared equipment handles blacklisted equipment. If true," + " blacklisted equipment will be dropped on the ground once a new equipment is shared" + ". If false, blacklisted equipment is left untouched when new equipment is shared." ); RandomizeSharedPickups = Config.Bind( "Balance", "RandomizeSharedPickups", false, "When enabled each player (except the player who picked up the item) will get a randomized item of the same rarity." ); LunarItemsRandomized = Config.Bind( "Balance", "LunarItemsRandomized", true, "Toggles randomizing Lunar items in RandomizeSharedPickups mode." ); BossItemsRandomized = Config.Bind( "Balance", "BossItemsRandomized", false, "Toggles randomizing Boss items in RandomizeSharedPickups mode." ); VoidItemsRandomized = Config.Bind( "Balance", "VoidItemsRandomized", false, "Toggles randomizing Void items in RandomizeSharedPickups mode." ); PrinterCauldronFixEnabled = Config.Bind( "Balance", "PrinterCauldronFix", true, "Toggles 3D printer and Cauldron item dupe fix by giving the item directly instead of" + " dropping it on the ground." ); DeadPlayersGetItems = Config.Bind( "Balance", "DeadPlayersGetItems", false, "Toggles whether or not dead players should get copies of picked up items." ); OverridePlayerScalingEnabled = Config.Bind( "Balance", "OverridePlayerScaling", true, "Toggles override of the scalar of interactables (chests, shrines, etc) that spawn in the world to your configured credit." ); InteractablesCredit = Config.Bind( "Balance", "InteractablesCredit", 1d, "If player scaling via this mod is enabled, the amount of players the game should think are playing in terms of chest spawns." ); InteractablesOffset = Config.Bind( "Balance", "InteractablesOffset", 0, "If player scaling via this mod is enabled, the offset from base scaling for interactables credit (e.g. 100 would add 100 interactables credit (not 100 interactables), can also be negative)." ); OverrideBossLootScalingEnabled = Config.Bind( "Balance", "OverrideBossLootScaling", true, "Toggles override of the scalar of boss loot drops to your configured balance." ); BossLootCredit = Config.Bind( "Balance", "BossLootCredit", 1, "Specifies the amount of boss items dropped when the boss drop override is true." ); OverrideVoidFieldLootScalingEnabled = Config.Bind( "Balance", "OverrideVoidLootScaling", true, "Toggles override of the scalar of Void Field loot drops to your configured balance." ); OverrideSimulacrumLootScalingEnabled = Config.Bind( "Balance", "OverrideSimulacrumLootScaling", true, "Toggles override of the scalar of Simulacrum loot drops to your configured balance." ); OverrideMultiplayerCheck = Config.Bind( "Debug", "OverrideMultiplayerCheck", false, "Forces ShareSuite to think that the game is running in a multiplayer instance." ); LastMessageSent = Config.Bind( "Debug", "LastMessageSent", "none", "Keeps track of the last mod version that sent you a message. Prevents spam, don't touch." ); VoidFieldLootCredit = Config.Bind( "Balance", "VoidFieldLootCredit", 1, "Specifies the amount of items dropped from completed Void Fields when the Void Field scaling override is true." ); SimulacrumLootCredit = Config.Bind( "Balance", "SimulacrumLootCredit", 1, "Specifies the amount of items dropped after each Simulacrum round when the Simulacrum scaling override is true." ); SacrificeFixEnabled = Config.Bind( "Balance", "SacrificeFixEnabled", true, "Toggles the reduction in sacrifice loot drops to be balanced with shared items enabled." ); MoneyScalarEnabled = Config.Bind( "Settings", "MoneyScalarEnabled", false, "Toggles the money scalar, set MoneyScalar to an amount to fine-tune the amount of gold " + "you recieve." ); MoneyScalar = Config.Bind( "Settings", "MoneyScalar", 1D, "Modifies player count used in calculations of gold earned when money sharing is on." ); ItemBlacklist = Config.Bind( "Settings", "ItemBlacklist", "BeetleGland,TreasureCache,TitanGoldDuringTP,TPHealingNova,ArtifactKey,FreeChest,RoboBallBuddy", "Items (by internal name) that you do not want to share, comma separated. Please find the item \"Code Names\" at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names" ); ItemBlacklist.SettingChanged += (o, e) => Blacklist.Recalculate(); EquipmentBlacklist = Config.Bind( "Settings", "EquipmentBlacklist", "", "Equipment (by internal name) that you do not want to share, comma separated. Please find the \"Code Names\"s at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names" ); EquipmentBlacklist.SettingChanged += (o, e) => Blacklist.Recalculate(); }
private static void OnGrantItem(On.RoR2.GenericPickupController.orig_AttemptGrant orig, GenericPickupController self, CharacterBody body) { var item = PickupCatalog.GetPickupDef(self.pickupIndex); var itemDef = ItemCatalog.GetItemDef(item.itemIndex); var randomizedPlayerDict = new Dictionary <CharacterMaster, PickupDef>(); // If the player is dead, they might not have a body. The game uses inventory.GetComponent, avoiding the issue entirely. var master = body?.master ?? body.inventory?.GetComponent <CharacterMaster>(); if (( //ShareSuite.RandomizeSharedPickups.Value || !Blacklist.HasItem(item.itemIndex)) && NetworkServer.active && IsValidItemPickup(self.pickupIndex) && GeneralHooks.IsMultiplayer()) { if (ShareSuite.RandomizeSharedPickups.Value) { randomizedPlayerDict.Add(master, item); } foreach (var player in PlayerCharacterMasterController.instances.Select(p => p.master)) { // Ensure character is not original player that picked up item if (body != null && player.inventory == body.inventory) { continue; } // Do not reward dead players if not required if (!ShareSuite.DeadPlayersGetItems.Value && player.IsDeadAndOutOfLivesServer()) { continue; } if (ShareSuite.RandomizeSharedPickups.Value) { var pickupIndex = GetRandomItemOfTier(itemDef.tier, item.pickupIndex); if (pickupIndex == null) { // Could not find any not blacklisted item in that tier. You get nothing! Good day, sir! continue; } var giveItem = PickupCatalog.GetPickupDef(pickupIndex.Value); player.inventory.GiveItem(giveItem.itemIndex); // Alternative: Only show pickup text for yourself // var givePickupDef = PickupCatalog.GetPickupDef(givePickupIndex); // Chat.AddPickupMessage(body, givePickupDef.nameToken, givePickupDef.baseColor, 1); // Legacy -- old normal pickup message handler //SendPickupMessage(player, giveItem); randomizedPlayerDict.Add(player, giveItem); } // Otherwise give everyone the same item else { player.inventory.GiveItem(item.itemIndex); } } if (ShareSuite.RandomizeSharedPickups.Value) { orig(self, body); ChatHandler.SendRichRandomizedPickupMessage(master, item, randomizedPlayerDict); return; } } orig(self, body); ChatHandler.SendRichPickupMessage(master, item); }
private static PickupIndex?GetRandomItemOfTier(ItemTier tier, PickupIndex orDefault) { switch (tier) { case ItemTier.Tier1: return(PickRandomOf(Blacklist.AvailableTier1DropList)); case ItemTier.Tier2: return(PickRandomOf(Blacklist.AvailableTier2DropList)); case ItemTier.Tier3: return(PickRandomOf(Blacklist.AvailableTier3DropList)); case ItemTier.Lunar: if (ShareSuite.LunarItemsRandomized.Value) { return(PickRandomOf(Blacklist.AvailableLunarDropList)); } break; case ItemTier.Boss: if (ShareSuite.BossItemsRandomized.Value) { return(PickRandomOf(Blacklist.AvailableBossDropList)); } break; case ItemTier.VoidBoss: if (ShareSuite.VoidItemsRandomized.Value) { return(PickRandomOf(Blacklist.AvailableVoidDropList)); } break; case ItemTier.VoidTier1: if (ShareSuite.VoidItemsRandomized.Value) { return(PickRandomOf(Blacklist.AvailableVoidDropList)); } break; case ItemTier.VoidTier2: if (ShareSuite.VoidItemsRandomized.Value) { return(PickRandomOf(Blacklist.AvailableVoidDropList)); } break; case ItemTier.VoidTier3: if (ShareSuite.VoidItemsRandomized.Value) { return(PickRandomOf(Blacklist.AvailableVoidDropList)); } break; } var pickupDef = PickupCatalog.GetPickupDef(orDefault); if (Blacklist.HasItem(pickupDef.itemIndex)) { return(null); } return(orDefault); }
private void InitConfig() { ModIsEnabled = Config.Bind( "Settings", "ModEnabled", true, "Toggles whether or not the mod is enabled. If turned off while in-game, it will unhook " + "everything and reset the game to it's default behaviors." ); ModIsEnabled.SettingChanged += ReloadHooks; MoneyIsShared = Config.Bind( "Settings", "MoneyShared", true, "Toggles money sharing between teammates. Every player gains money together and spends it " + "from one central pool of money." ); WhiteItemsShared = Config.Bind( "Settings", "WhiteItemsShared", true, "Toggles item sharing for common (white color) items." ); GreenItemsShared = Config.Bind( "Settings", "GreenItemsShared", true, "Toggles item sharing for rare (green color) items." ); RedItemsShared = Config.Bind( "Settings", "RedItemsShared", true, "Toggles item sharing for legendary (red color) items." ); EquipmentShared = Config.Bind( "Settings", "EquipmentShared", false, "Toggles item sharing for equipment." ); LunarItemsShared = Config.Bind( "Settings", "LunarItemsShared", false, "Toggles item sharing for Lunar (blue color) items." ); BossItemsShared = Config.Bind( "Settings", "BossItemsShared", true, "Toggles item sharing for boss (yellow color) items." ); RichMessagesEnabled = Config.Bind( "Settings", "RichMessagesEnabled", true, "Toggles detailed item pickup messages with information on who picked the item up and" + " who all received the item." ); DropBlacklistedEquipmentOnShare = Config.Bind( "Balance", "DropBlacklistedEquipmentOnShare", false, "Changes the way shared equipment handles blacklisted equipment. If true," + " blacklisted equipment will be dropped on the ground once a new equipment is shared" + ". If false, blacklisted equipment is left untouched when new equipment is shared." ); RandomizeSharedPickups = Config.Bind( "Balance", "RandomizeSharedPickups", false, "When enabled each player (except the player who picked up the item) will get a randomized item of the same rarity." ); LunarItemsRandomized = Config.Bind( "Balance", "LunarItemsRandomized", true, "Toggles randomizing Lunar items in RandomizeSharedPickups mode." ); BossItemsRandomized = Config.Bind( "Balance", "BossItemsRandomized", false, "Toggles randomizing Boss items in RandomizeSharedPickups mode." ); PrinterCauldronFixEnabled = Config.Bind( "Balance", "PrinterCauldronFix", true, "Toggles 3D printer and Cauldron item dupe fix by giving the item directly instead of" + " dropping it on the ground." ); DeadPlayersGetItems = Config.Bind( "Balance", "DeadPlayersGetItems", false, "Toggles whether or not dead players should get copies of picked up items." ); OverridePlayerScalingEnabled = Config.Bind( "Balance", "OverridePlayerScaling", true, "Toggles override of the scalar of interactables (chests, shrines, etc) that spawn in the world to your configured credit." ); InteractablesCredit = Config.Bind( "Balance", "InteractablesCredit", 1d, "If player scaling via this mod is enabled, the amount of players the game should think are playing in terms of chest spawns." ); OverrideBossLootScalingEnabled = Config.Bind( "Balance", "OverrideBossLootScaling", true, "Toggles override of the scalar of boss loot drops to your configured balance." ); BossLootCredit = Config.Bind( "Balance", "BossLootCredit", 1, "Specifies the amount of boss items dropped when the boss drop override is true." ); OverrideVoidFieldLootScalingEnabled = Config.Bind( "Balance", "OverrideVoidLootScaling", true, "Toggles override of the scalar of Void Field loot drops to your configured balance." ); VoidFieldLootCredit = Config.Bind( "Balance", "VoidFieldLootCredit", 1, "Specifies the amount of Void Fields items dropped when the Void Field scaling override is true." ); SacrificeFixEnabled = Config.Bind( "Balance", "SacrificeFixEnabled", true, "Toggles the reduction in sacrifice loot drops to be balanced with shared items enabled." ); MoneyScalarEnabled = Config.Bind( "Settings", "MoneyScalarEnabled", false, "Toggles the money scalar, set MoneyScalar to an amount to fine-tune the amount of gold " + "you recieve." ); MoneyScalar = Config.Bind( "Settings", "MoneyScalar", 1D, "Modifies player count used in calculations of gold earned when money sharing is on." ); ItemBlacklist = Config.Bind( "Settings", "ItemBlacklist", "53,60,82,86", "Items (by index) that you do not want to share, comma separated. Please find the item indices at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names" ); ItemBlacklist.SettingChanged += (o, e) => Blacklist.Recalculate(); EquipmentBlacklist = Config.Bind( "Settings", "EquipmentBlacklist", "", "Equipment (by index) that you do not want to share, comma separated. Please find the indices at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names" ); EquipmentBlacklist.SettingChanged += (o, e) => Blacklist.Recalculate(); }