// Token: 0x0600235E RID: 9054 RVA: 0x0009AAB4 File Offset: 0x00098CB4
 protected override void Awake()
 {
     base.Awake();
     this.rectTransform = (RectTransform)base.transform;
     this.itemStacks    = ItemCatalog.RequestItemStackArray();
     this.itemOrder     = ItemCatalog.RequestItemOrderBuffer();
 }
        private void Awake()
        {
            if (_instance != null && _instance != this)
            {
                Destroy(gameObject);
            }
            else
            {
                _instance = this;
            }

            lobbyRule.AddChoice(0, "None", "Enemies aggregate no items", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1ItemDark));
            lobbyRule.AddChoice(1, "White", "Enemies aggregate white items every level", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1ItemDark));
            lobbyRule.AddChoice(2, "Green", "Enemies also aggregate green items, every 3 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier2Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier2ItemDark));
            lobbyRule.AddChoice(3, "Red", "Enemies also aggregate red items, every 5 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3ItemDark));
            lobbyRule.AddChoice(4, "Lunar", "Enemies also aggregate lunar items, every 8 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem), ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItemDark));
            lobbyRule.AddChoice(5, "Boss", "Enemies also aggregate boss items, every 10 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.BossItem), ColorCatalog.GetColor(ColorCatalog.ColorIndex.BossItemDark));

            lobbyRule.MakeValueDefault(0);

            lobbyCategory.PushRule <int>(lobbyRule);

            On.RoR2.UI.HUD.Awake += (orig, self) =>
            {
                orig(self);


                itemInventoryDisplay = Instantiate(self.itemInventoryDisplay, self.transform);
                itemInventoryDisplay.SetFieldValue <int[]>("itemStacks", ItemCatalog.RequestItemStackArray());
                itemInventoryDisplay.SetFieldValue <ItemIndex[]>("itemOrder", ItemCatalog.RequestItemOrderBuffer());

                if (!inventory)
                {
                    inventory = itemInventoryDisplay.gameObject.AddComponent <Inventory>();
                }

                itemInventoryDisplay.SetSubscribedInventory(inventory);
            };

            RoR2.Run.onRunStartGlobal += (RoR2.Run run) =>
            {
                if (NetworkServer.active && lobbyRule.Value != null)
                {
                    levelWave = 1;

                    Debug.Log(lobbyRule.Value);


                    if (lobbyRule.Value == 1)
                    {
                        Debug.Log("Added white");

                        On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave;
                        On.RoR2.CharacterMaster.OnBodyStart      += CopyItemsMaster;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp;
                    }
                    if (lobbyRule.Value == 2)
                    {
                        Debug.Log("Added green");

                        On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave;
                        On.RoR2.CharacterMaster.OnBodyStart      += CopyItemsMaster;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp;
                    }
                    if (lobbyRule.Value == 3)
                    {
                        Debug.Log("Added red");


                        On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave;
                        On.RoR2.CharacterMaster.OnBodyStart      += CopyItemsMaster;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += RedOnLevelUp;
                    }
                    if (lobbyRule.Value == 4)
                    {
                        Debug.Log("Added lunar");



                        On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave;
                        On.RoR2.CharacterMaster.OnBodyStart      += CopyItemsMaster;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += RedOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += LunarOnLevelUp;
                    }
                    if (lobbyRule.Value == 5)
                    {
                        Debug.Log("Added boss");
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave;
                        On.RoR2.CharacterMaster.OnBodyStart      += CopyItemsMaster;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += RedOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += LunarOnLevelUp;
                        On.RoR2.GlobalEventManager.OnTeamLevelUp += BossOnLevelUp;
                    }
                }
            };

            RoR2.Run.onRunDestroyGlobal += (RoR2.Run run) =>
            {
                if (NetworkServer.active && lobbyRule.Value != null)
                {
                    levelWave = 1;

                    if (lobbyRule.Value <= 0)
                    {
                        On.RoR2.GlobalEventManager.OnTeamLevelUp -= UpdateLevelWave;
                        On.RoR2.CharacterMaster.OnBodyStart      -= CopyItemsMaster;
                    }
                    if (lobbyRule.Value <= 1)
                    {
                        On.RoR2.GlobalEventManager.OnTeamLevelUp -= WhiteOnLevelUp;
                    }
                    if (lobbyRule.Value <= 2)
                    {
                        On.RoR2.GlobalEventManager.OnTeamLevelUp -= GreenOnLevelUp;
                    }
                    if (lobbyRule.Value <= 3)
                    {
                        On.RoR2.GlobalEventManager.OnTeamLevelUp -= RedOnLevelUp;
                    }
                    if (lobbyRule.Value <= 4)
                    {
                        On.RoR2.GlobalEventManager.OnTeamLevelUp -= LunarOnLevelUp;
                    }
                    if (lobbyRule.Value <= 5)
                    {
                        On.RoR2.GlobalEventManager.OnTeamLevelUp -= BossOnLevelUp;
                    }
                }
            };
        }