public ShareSuite() { InitWrap(); On.RoR2.Console.Awake += (orig, self) => { FrogtownInterface.Init(Config); orig(self); }; CommandHelper.AddToConsoleWhenReady(); #region Hook registration // Register all the hooks GeneralHooks.OverrideBossScaling(); GeneralHooks.OnPlaceTeleporter(); GeneralHooks.OnTpInteraction(); ItemSharingHooks.OnGrantItem(); ItemSharingHooks.OnShopPurchase(); ItemSharingHooks.OnPurchaseDrop(); MoneySharingHooks.SharedMoneyValue = 0; MoneySharingHooks.ModifyGoldReward(); MoneySharingHooks.BrittleCrownHook(); MoneySharingHooks.SplitTpMoney(); EquipmentSharingHooks.OnGrantEquipment(); #endregion }
public static void SendRichPickupMessage(CharacterMaster player, PickupDef pickupDef) { var body = player.hasBody ? player.GetBody() : null; if (!GeneralHooks.IsMultiplayer() || body == null || !ShareSuite.RichMessagesEnabled.Value) { if (ShareSuite.RichMessagesEnabled.Value) { SendPickupMessage(player, pickupDef.pickupIndex); } return; } var pickupColor = pickupDef.baseColor; var pickupName = Language.GetString(pickupDef.nameToken); var playerColor = GetPlayerColor(player.playerCharacterMasterController); var itemCount = player.inventory.GetItemCount(pickupDef.itemIndex); if (pickupDef.coinValue > 0) { var coinMessage = $"<color=#{playerColor}>{body.GetUserName()}</color> <color=#{GrayColor}>picked up</color> " + $"<color=#{ColorUtility.ToHtmlStringRGB(pickupColor)}>" + $"{pickupName ?? "???"} ({pickupDef.coinValue})</color> <color=#{GrayColor}>for themselves.</color>"; Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = coinMessage }); return; } if (Blacklist.HasItem(pickupDef.itemIndex) || !ItemSharingHooks.IsValidItemPickup(pickupDef.pickupIndex)) { var singlePickupMessage = $"<color=#{playerColor}>{body.GetUserName()}</color> <color=#{GrayColor}>picked up</color> " + $"<color=#{ColorUtility.ToHtmlStringRGB(pickupColor)}>" + $"{pickupName ?? "???"} ({itemCount})</color> <color=#{GrayColor}>for themselves. </color>" + $"<color=#{NotSharingColor}>(Item Set to NOT be Shared)</color>"; Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = singlePickupMessage }); return; } var pickupMessage = $"<color=#{playerColor}>{body.GetUserName()}</color> <color=#{GrayColor}>picked up</color> " + $"<color=#{ColorUtility.ToHtmlStringRGB(pickupColor)}>" + $"{pickupName ?? "???"} ({itemCount})</color> <color=#{GrayColor}>for themselves</color>" + $"{ItemPickupFormatter(body)}<color=#{GrayColor}>.</color>"; Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = pickupMessage }); }
private void ReloadHooks(object _ = null, System.EventArgs __ = null) { if (previouslyEnabled && !ModIsEnabled.Value) { GeneralHooks.UnHook(); MoneySharingHooks.UnHook(); ItemSharingHooks.UnHook(); EquipmentSharingHooks.UnHook(); previouslyEnabled = false; } if (!previouslyEnabled && ModIsEnabled.Value) { previouslyEnabled = true; GeneralHooks.Hook(); MoneySharingHooks.Hook(); ItemSharingHooks.Hook(); EquipmentSharingHooks.Hook(); } }
private void ReloadHooks(object _ = null, EventArgs __ = null) { if (_previouslyEnabled && !ModIsEnabled.Value) { GeneralHooks.UnHook(); MoneySharingHooks.UnHook(); ItemSharingHooks.UnHook(); EquipmentSharingHooks.UnHook(); ChatHandler.UnHook(); _previouslyEnabled = false; } if (!_previouslyEnabled && ModIsEnabled.Value) { _previouslyEnabled = true; GeneralHooks.Hook(); MoneySharingHooks.Hook(); ItemSharingHooks.Hook(); EquipmentSharingHooks.Hook(); ChatHandler.Hook(); } }