Exemplo n.º 1
0
        private void GlobalEventManager_OnTeamLevelUp(On.RoR2.GlobalEventManager.orig_OnTeamLevelUp orig, TeamIndex teamIndex)
        {
            ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(teamIndex);

            for (int i = 0; i < teamMembers.Count; i++)
            {
                TeamComponent teamComponent = teamMembers[i];
                if (teamComponent)
                {
                    CharacterBody characterBody = teamComponent.GetComponent <CharacterBody>();
                    if (characterBody)
                    {
                        CharacterMaster master = characterBody.master;
                        if (master)
                        {
                            int nokiaItemCount = master.inventory.GetItemCount(Nokia.itemIndex);
                            //int ancientItemCount = master.inventory.GetItemCount(BrokenScepter.itemIndex);

                            if (nokiaItemCount > 0 && NetworkServer.active && Util.CheckRoll(50, master))
                            {
                                NokiaCall(characterBody.transform, nokiaItemCount);
                            }
                        }
                    }
                }
            }
            orig(teamIndex);
        }