コード例 #1
0
        private void Run_Update(On.RoR2.Run.orig_Update orig, RoR2.Run self)
        {
            orig.Invoke(self);

            //Wait till all players loaded
            //Dont know if there is a better option for this
            if (RoR2.Run.instance.time < 5)
            {
                return;
            }

            //Compare this user with the host user
            bool isHost = LocalUserManager.GetFirstLocalUser().cachedMasterController == PlayerCharacterMasterController.instances[0];

            //If Not host unhook the update function and quit this function
            if (!isHost)
            {
                On.RoR2.Run.Update -= Run_Update;
                return;
            }

            //If Host send a Reset, so everything is setup correctly
            ExampleCommandClientCustom.Invoke(x =>
            {
                x.Write("Reset");
                //Send this to every client so its host dependend
                x.Write(config.Everything_Avaiable);
            });

            //Hook host specific stuff
            On.EntityStates.Barrel.Opening.OnEnter         += Opening_OnEnter;
            On.RoR2.PurchaseInteraction.OnInteractionBegin += PurchaseInteraction_OnInteractionBegin;
            //Unhook the Update function
            On.RoR2.Run.Update -= Run_Update;
        }
コード例 #2
0
            static public void AddChestChoices(RoR2.Run self)
            {
                float smallChestTotal  = 0;
                float mediumChestTotal = 0;

                if (self.availableTier1DropList.Count > 0)
                {
                    smallChestTotal += smallChestTier1;
                }
                if (self.availableTier2DropList.Count > 0)
                {
                    smallChestTotal  += smallChestTier2;
                    mediumChestTotal += mediumChestTier2;
                }
                if (self.availableTier3DropList.Count > 0)
                {
                    smallChestTotal  += smallChestTier3;
                    mediumChestTotal += mediumChestTier3;
                }

                if (self.availableTier1DropList.Count > 0)
                {
                    self.smallChestDropTierSelector.AddChoice(self.availableTier1DropList, smallChestTier1 / smallChestTotal);
                }
                if (self.availableTier2DropList.Count > 0)
                {
                    self.smallChestDropTierSelector.AddChoice(self.availableTier2DropList, smallChestTier2 / smallChestTotal);
                    self.mediumChestDropTierSelector.AddChoice(self.availableTier2DropList, mediumChestTier2 / mediumChestTotal);
                }
                if (self.availableTier3DropList.Count > 0)
                {
                    self.smallChestDropTierSelector.AddChoice(self.availableTier3DropList, smallChestTier3 / smallChestTotal);
                    self.mediumChestDropTierSelector.AddChoice(self.availableTier3DropList, mediumChestTier3 / mediumChestTotal);
                }
            }
コード例 #3
0
ファイル: DiluvianPlugin.cs プロジェクト: Kapyyy/R2Mods
        private void Run_onRunDestroyGlobal(RoR2.Run obj)
        {
            if (HooksApplied)
            {
                //Remove all of our hooks on run end and restore elite tables to their original value.
                IL.RoR2.HealthComponent.TakeDamage     -= UnluckyBears;
                IL.RoR2.HealthComponent.TakeDamage     -= ChangeOSP;
                IL.RoR2.CharacterBody.RecalculateStats -= AdjustRegen;
                //RoR2.TeleporterInteraction.onTeleporterChargedGlobal += NoSafetyAfterFinishCharging;
                //IL.RoR2.TeleporterInteraction.StateFixedUpdate -= NoSafetyAfterFinishCharging;
                RoR2.TeleporterInteraction.onTeleporterFinishGlobal -= MakeSureBonusDirectorDiesOnStageFinish;
                if (!ESOenabled)
                {
                    for (int i = 0; i < CombatDirectorTierDefs.Length; i++)
                    {
                        EliteDef tierDef = CombatDirectorTierDefs[i];
                        tierDef.costMultiplier = vanillaEliteMultipliers[i];
                    }
                }
                On.RoR2.ShrineBloodBehavior.FixedUpdate -= BloodShrinePriceRandom;

                //Restore vanilla text.
                DefaultLanguage.ForEachTry((pair) =>
                {
                    R2API.AssetPlus.Languages.AddToken(pair.Key, pair.Value, reload: false);
                });
                R2API.AssetPlus.Languages.ReloadLanguage();
                HooksApplied = false;
            }
        }
コード例 #4
0
ファイル: DiluvianPlugin.cs プロジェクト: Kapyyy/R2Mods
        private void Run_onRunStartGlobal(RoR2.Run run)
        {
            //Only do stuff when Diluvian is selected.
            if (run.selectedDifficulty == DiluvianIndex && HooksApplied == false)
            {
                ChatMessage.SendColored("A storm is brewing...", DiluvianColor);
                //Make our hooks.
                HooksApplied = true;
                IL.RoR2.HealthComponent.TakeDamage     += UnluckyBears;
                IL.RoR2.HealthComponent.TakeDamage     += ChangeOSP;
                IL.RoR2.CharacterBody.RecalculateStats += AdjustRegen;
                RoR2.TeleporterInteraction.onTeleporterFinishGlobal += MakeSureBonusDirectorDiesOnStageFinish;
                //
                if (!ESOenabled)
                {
                    for (int i = 0; i < CombatDirectorTierDefs.Length; i++)
                    {
                        EliteDef tierDef = CombatDirectorTierDefs[i];
                        vanillaEliteMultipliers[i] = tierDef.costMultiplier;
                        tierDef.costMultiplier    *= EliteModifier;
                    }
                }
                On.RoR2.ShrineBloodBehavior.FixedUpdate += BloodShrinePriceRandom;

                //All of these replace strings.
                ReplaceInteractibles();
                ReplaceItems();
                ReplaceObjectives();
                ReplacePause();
                ReplaceStats();
                //Forcefully update the language.
                R2API.AssetPlus.Languages.ReloadLanguage();
            }
        }
コード例 #5
0
 void BuildDropTable(On.RoR2.Run.orig_BuildDropTable orig, RoR2.Run run)
 {
     Data.RefreshInfo();
     if (Data.modEnabled)
     {
         DataShop.SetScrapStarting();
         Data.SaveConfigProfile();
     }
     orig(run);
 }
コード例 #6
0
            public void ClearAllLists(RoR2.Run self)
            {
                for (int choiceIndex = 0; choiceIndex < self.smallChestDropTierSelector.Count; choiceIndex++)
                {
                    if (self.smallChestDropTierSelector.GetChoice(choiceIndex).value.Count > 0)
                    {
                        ItemTier itemTier = RoR2.ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(self.smallChestDropTierSelector.GetChoice(choiceIndex).value[0]).itemIndex).tier;
                        if (itemTier == ItemTier.Tier1)
                        {
                            smallChestTier1 = self.smallChestDropTierSelector.GetChoice(choiceIndex).weight;
                        }
                        else if (itemTier == ItemTier.Tier2)
                        {
                            smallChestTier2 = self.smallChestDropTierSelector.GetChoice(choiceIndex).weight;
                        }
                        else if (itemTier == ItemTier.Tier3)
                        {
                            smallChestTier3 = self.smallChestDropTierSelector.GetChoice(choiceIndex).weight;
                        }
                    }
                }
                for (int choiceIndex = 0; choiceIndex < self.mediumChestDropTierSelector.Count; choiceIndex++)
                {
                    if (self.mediumChestDropTierSelector.GetChoice(choiceIndex).value.Count > 0)
                    {
                        ItemTier itemTier = RoR2.ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(self.mediumChestDropTierSelector.GetChoice(choiceIndex).value[0]).itemIndex).tier;
                        if (itemTier == ItemTier.Tier2)
                        {
                            mediumChestTier2 = self.mediumChestDropTierSelector.GetChoice(choiceIndex).weight;
                        }
                        else if (itemTier == ItemTier.Tier3)
                        {
                            mediumChestTier3 = self.mediumChestDropTierSelector.GetChoice(choiceIndex).weight;
                        }
                    }
                }

                DuplicateDropList(self.availableTier1DropList, tier1DropListOriginal);
                DuplicateDropList(self.availableTier2DropList, tier2DropListOriginal);
                DuplicateDropList(self.availableTier3DropList, tier3DropListOriginal);
                DuplicateDropList(self.availableEquipmentDropList, equipmentDropListOriginal);

                self.availableItems.Clear();
                self.availableEquipment.Clear();
                self.availableTier1DropList.Clear();
                self.availableTier2DropList.Clear();
                self.availableTier3DropList.Clear();
                self.availableBossDropList.Clear();
                self.availableLunarDropList.Clear();
                self.availableEquipmentDropList.Clear();

                self.smallChestDropTierSelector.Clear();
                self.mediumChestDropTierSelector.Clear();
                self.largeChestDropTierSelector.Clear();
            }
コード例 #7
0
 private static void Run_FixedUpdate(On.RoR2.Run.orig_FixedUpdate orig, RoR2.Run self)
 {
     orig(self);
     runningTimer    += Time.deltaTime;
     timeSinceUpdate += Time.deltaTime;
     if (timeSinceUpdate >= 5f)
     {
         timeSinceUpdate = 0f;
         Chat.AddMessage("It's been " + runningTimer.ToString("F4") + " seconds.");
     }
 }
コード例 #8
0
        private void Run_Awake(On.RoR2.Run.orig_Awake orig, RoR2.Run self)
        {
            orig.Invoke(self);

            RoR2.Chat.AddMessage("<color=blue>Command Artifact Loaded</color>");

            //Unhook non host related stuff
            //Had issues when everyone hooked them ...
            On.EntityStates.Barrel.Opening.OnEnter         -= Opening_OnEnter;
            On.RoR2.PurchaseInteraction.OnInteractionBegin -= PurchaseInteraction_OnInteractionBegin;
            //Makes sure the Update Function is hooked at the start!
            On.RoR2.Run.Update += Run_Update;
        }
コード例 #9
0
        private void RunStart(RoR2.Run run)
        {
            // Init Item Event
            CharacterMaster clientMaster = PlayerCharacterMasterController.instances[0].master;

            clientMaster.inventory.onInventoryChanged += () =>
            {
                int numDriftItems = clientMaster.inventory.GetItemCount(driftItemDef.itemIndex);
                int deltaItems    = numDriftItems - clientNumDriftItems;

                clientMaster.playerCharacterMasterController.networkUser.GetCurrentBody().sprintingSpeedMultiplier += (deltaItems * .1f);
            };
        }
コード例 #10
0
        private void OnRunStart(On.RoR2.Run.orig_Start orig, RoR2.Run self)
        {
            orig(self);
            // Must reset all values since class is not re-awoken/instantiated

            DamageDealt = RoR2.Stats.StatDef.Find("totalDamageDealt");

            currentAvgDPS = 0;

            lastTotalDamage = 0;

            LastNCombatDPS = new LinkedList <ulong>();

            Player = LocalUserManager.GetFirstLocalUser();

            InvokeRepeating("RollingStats", 1f, 1f);
        }
コード例 #11
0
 private void Run_onStageStart(On.RoR2.Run.orig_BeginStage o, RoR2.Run s)
 {
     o(s);
 }
コード例 #12
0
        private void Run_OnDestroy(On.RoR2.Run.orig_OnDestroy orig, RoR2.Run self)
        {
            orig(self);

            deathTimerPanel = null;
        }
コード例 #13
0
            public void GenerateItems(RoR2.Run self)
            {
                availableTier1DropList.Clear();
                availableTier2DropList.Clear();
                availableTier3DropList.Clear();
                availableBossDropList.Clear();
                availableLunarDropList.Clear();
                availableEquipmentDropList.Clear();

                foreach (ItemIndex itemIndex in RoR2.ItemCatalog.tier1ItemList)
                {
                    if (!Catalogue.scrapItems.ContainsValue(itemIndex))
                    {
                        if (ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(itemIndex)))
                        {
                            availableTier1DropList.Add(PickupCatalog.FindPickupIndex(itemIndex));
                            self.availableItems.Add(itemIndex);
                        }
                    }
                }
                foreach (ItemIndex itemIndex in RoR2.ItemCatalog.tier2ItemList)
                {
                    if (!Catalogue.scrapItems.ContainsValue(itemIndex))
                    {
                        if (ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(itemIndex)))
                        {
                            availableTier2DropList.Add(PickupCatalog.FindPickupIndex(itemIndex));
                            self.availableItems.Add(itemIndex);
                        }
                    }
                }
                foreach (ItemIndex itemIndex in RoR2.ItemCatalog.tier3ItemList)
                {
                    if (!Catalogue.scrapItems.ContainsValue(itemIndex))
                    {
                        if (ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(itemIndex)))
                        {
                            availableTier3DropList.Add(PickupCatalog.FindPickupIndex(itemIndex));
                            self.availableItems.Add(itemIndex);
                        }
                    }
                }
                foreach (ItemIndex itemIndex in Catalogue.bossItems)
                {
                    if (!Catalogue.scrapItems.ContainsValue(itemIndex))
                    {
                        if (ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(itemIndex)))
                        {
                            availableBossDropList.Add(PickupCatalog.FindPickupIndex(itemIndex));
                            self.availableItems.Add(itemIndex);
                        }
                    }
                }
                foreach (ItemIndex itemIndex in RoR2.ItemCatalog.lunarItemList)
                {
                    if (ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(itemIndex)))
                    {
                        availableLunarDropList.Add(PickupCatalog.FindPickupIndex(itemIndex));
                        self.availableItems.Add(itemIndex);
                    }
                }
                foreach (EquipmentIndex equipmentIndex in RoR2.EquipmentCatalog.equipmentList)
                {
                    if (!Catalogue.lunarEquipment.Contains(equipmentIndex) && !Catalogue.eliteEquipment.Contains(equipmentIndex) && ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(equipmentIndex)))
                    {
                        availableEquipmentDropList.Add(PickupCatalog.FindPickupIndex(equipmentIndex));
                        self.availableEquipment.Add(equipmentIndex);
                    }
                }
                foreach (EquipmentIndex equipmentIndex in Catalogue.lunarEquipment)
                {
                    if (ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(equipmentIndex)))
                    {
                        availableLunarDropList.Add(PickupCatalog.FindPickupIndex(equipmentIndex));
                        self.availableEquipment.Add(equipmentIndex);
                    }
                }
                foreach (EquipmentIndex equipmentIndex in Catalogue.eliteEquipment)
                {
                    if (ItemDropAPIFixes.playerItems.Contains(PickupCatalog.FindPickupIndex(equipmentIndex)))
                    {
                        //availableEquipmentDropList.Add(PickupCatalog.FindPickupIndex(equipmentIndex));
                    }
                }
            }
コード例 #14
0
        private void OnRunEnd(On.RoR2.Run.orig_OnDestroy orig, RoR2.Run self)
        {
            CancelInvoke("RollingStats");

            orig(self);
        }
コード例 #15
0
ファイル: StatsDisplay.cs プロジェクト: ethall/BetterUI
 internal void runStartGlobal(RoR2.Run self)
 {
     highestMultikill = 0;
 }