private void BarrelInteraction_OnInteractionBegin(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
 {
     orig(self, activator);
     if (activator && activator.GetComponent <CharacterBody>())
     {
         var body      = activator.GetComponent <CharacterBody>();
         var itemCount = GetCount(body);
         if (itemCount > 0)
         {
             var actualRadius = radius + stackRadius * (itemCount - 1);
             new BlastAttack()
             {
                 attacker         = body.gameObject,
                 inflictor        = self.gameObject,
                 baseDamage       = body.damage * 1f,
                 damageColorIndex = DamageColorIndex.Item,
                 damageType       = DamageType.Stun1s,
                 losType          = BlastAttack.LoSType.None,
                 position         = self.gameObject.transform.position,
                 procCoefficient  = 0f,
                 radius           = actualRadius,
                 teamIndex        = body.teamComponent.teamIndex,
             }.Fire();
         }
     }
 }
Ejemplo n.º 2
0
        private static void ShareBarrelMoney(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig,
                                             BarrelInteraction self, Interactor activator)
        {
            orig(self, activator);

            if (!GeneralHooks.IsMultiplayer())
            {
                return;
            }

            #region Sharedmoney

            // Collect reward from barrel and put it into shared pool
            SharedMoneyValue += self.goldReward;

            if (!ShareSuite.MoneyScalarEnabled.Value ||
                !NetworkServer.active)
            {
                return;
            }

            AddToSharedMoneyValue(self.goldReward);

            #endregion
        }
Ejemplo n.º 3
0
        private void BarrelInteraction_OnInteractionBegin(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
        {
            orig(self, activator);
            var comp = self.gameObject.AddComponent <ShopTalker>();

            comp.StartConvo();
            comp.currentUser = activator;
        }
Ejemplo n.º 4
0
            private void DestroyBarrel(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
            {
                orig(self, activator);
                var component = self.gameObject.GetComponent <BarrelDestroyOnInteraction>();

                if (component)
                {
                    component.used = true;
                }
            }
Ejemplo n.º 5
0
        private static void BarrelInteraction_OnInteractionBegin(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
        {
            orig(self, activator);
            var comp = self.gameObject.GetComponent <EnforcerSelectSpecialComponent>();

            if (self.gameObject.GetComponent <EnforcerSelectSpecialComponent>())
            {
                SelectSpecialType(activator, comp.slotIndex);
            }
        }
 private void BarrelInteraction_OnInteractionBegin(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
 {
     orig(self, activator);
     if (activator && activator.GetComponent <CharacterBody>())
     {
         var body      = activator.GetComponent <CharacterBody>();
         var itemCount = GetCount(body);
         if (itemCount > 0)
         {
             body.AddTimedBuffAuthority(BuffsController.Anger.buffIndex, duration + stackDuration * (itemCount - 1));
         }
     }
 }
Ejemplo n.º 7
0
 private void BarrelInteraction_OnInteractionBegin(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
 {
     orig(self, activator);
     if (activator && activator.GetComponent <CharacterBody>())
     {
         var body      = activator.GetComponent <CharacterBody>();
         var itemCount = GetCount(body);
         if (itemCount > 0)
         {
             var actualRadius = radius + stackRadius * (itemCount - 1);
             Shared.Blanks.MasterBlankItem.FireBlank(body, self.gameObject.transform.position, actualRadius, 1f, actualRadius, false, true, true);
         }
     }
 }
Ejemplo n.º 8
0
 private void Barrel_Opened(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
 {
     orig(self, activator);
     barrelsOpened++;
     UpdateTextArea(StageStatsTextAreaName);
 }
Ejemplo n.º 9
0
        private void BarrelInteraction_OnInteractionBegin(On.RoR2.BarrelInteraction.orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
        {
            if (!NetworkServer.active)
            {
                orig(self, activator);
                return;
            }

            if (IsOnVIPSelectionStage)
            {
                if (self.Networkopened)
                {
                    orig(self, activator);
                    return;
                }

                foreach (var barrel in spawnedBarrels)
                {
                    BarrelInteraction interaction = barrel.GetComponent <BarrelInteraction>();
                    if (self != interaction)
                    {
                        interaction.Networkopened = true;
                    }
                }

                AllyDetails details = self.GetComponent <AllyDetails>();
                if (details && details.ally)
                {
                    CharacterMaster summonCharacterMaster = activator.GetComponent <CharacterBody>().master;
                    CharacterMaster allyCharacterMaster   = details.ally.GetComponent <CharacterMaster>();

                    AllyMaster allyMaster = allyCharacterMaster.gameObject.AddComponent <AllyMaster>();
                    allyMaster.NameToken = "VIP";

                    GiveHelpingHand(allyCharacterMaster);
                    ApplyNormalAI(
                        details.ally.GetComponent <BaseAI>(),
                        summonCharacterMaster.GetBodyObject());

                    allies.Add(allyCharacterMaster);
                    allySquad.AddMember(allyCharacterMaster);

                    Chat.SendBroadcastChat(new Chat.SimpleChatMessage()
                    {
                        baseToken = $"<color=#{ColorUtility.ToHtmlStringRGB(Color.green)}>Protect the VIP:</color> " +
                                    $"<color=#{ColorUtility.ToHtmlStringRGB(Color.gray)}>Protect the ally at all costs.</color> " +
                                    $"<color=#{ColorUtility.ToHtmlStringRGB(Color.red)}>If it dies, you die.</color>"
                    });
                }
                else if (details && !details.ally)
                {
                    Chat.SendBroadcastChat(new Chat.SimpleChatMessage()
                    {
                        baseToken = $"<color=#{ColorUtility.ToHtmlStringRGB(Color.green)}>Protect the VIP:</color> " +
                                    $"<color=#{ColorUtility.ToHtmlStringRGB(Color.gray)}>Starting run with no ally.</color>"
                    });
                }
                else
                {
                    Debug.LogError("No details attached to barrel :( Starting normal run...");
                }

                GoToNextLevel();

                Debug.Log("Unhooking from RoR2.BarrelInteraction.OnInteractionBegin");
                On.RoR2.BarrelInteraction.OnInteractionBegin -= BarrelInteraction_OnInteractionBegin;
            }

            orig(self, activator);
        }