Exemple #1
0
            // Token: 0x060023A6 RID: 9126 RVA: 0x0009B8F8 File Offset: 0x00099AF8
            private Row(LoadoutPanelController owner, int bodyIndex, string titleToken)
            {
                this.owner                          = owner;
                this.userProfile                    = owner.currentDisplayData.userProfile;
                this.rowPanelTransform              = (RectTransform)UnityEngine.Object.Instantiate <GameObject>(LoadoutPanelController.rowPrefab, owner.rowContainer).transform;
                this.buttonContainerTransform       = (RectTransform)this.rowPanelTransform.Find("ButtonContainer");
                this.choiceHighlightRect            = (RectTransform)this.rowPanelTransform.Find("ChoiceHighlightRect");
                UserProfile.onLoadoutChangedGlobal += this.OnLoadoutChangedGlobal;
                SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(BodyCatalog.GetBodyPrefab(bodyIndex));

                if (survivorDef != null)
                {
                    this.primaryColor = survivorDef.primaryColor;
                }
                float num;
                float s;
                float v;

                Color.RGBToHSV(this.primaryColor, out num, out s, out v);
                num += 0.5f;
                if (num > 1f)
                {
                    num -= 1f;
                }
                this.complementaryColor = Color.HSVToRGB(num, s, v);
                RectTransform rectTransform = (RectTransform)this.rowPanelTransform.Find("SlotLabel");

                rectTransform.GetComponent <LanguageTextMeshController>().token = titleToken;
                rectTransform.GetComponent <HGTextMeshProUGUI>().color          = this.primaryColor;
                this.choiceHighlightRect.GetComponent <Image>().color           = this.complementaryColor;
            }
Exemple #2
0
        private bool OnCharCommand(string userName, string[] pieces)
        {
            if (pieces.Length >= 2)
            {
                int prefabIndex = -1;
                if (!Int32.TryParse(pieces[1], out prefabIndex))
                {
                    prefabIndex = BodyCatalog.FindBodyIndexCaseInsensitive(pieces[1]);
                }
                if (prefabIndex != -1)
                {
                    GameObject prefab = BodyCatalog.GetBodyPrefab(prefabIndex);

                    if (prefab != null)
                    {
                        if (FrogtownShared.ChangePrefab(userName, prefab))
                        {
                            FrogtownShared.SendChat(userName + " morphed into " + prefab.name);
                        }
                        else
                        {
                            FrogtownShared.SendChat(userName + " couldn't morph into " + prefab.name);
                        }
                    }
                    else
                    {
                        FrogtownShared.SendChat("Prefab not found");
                    }
                }
            }

            return(true);
        }
Exemple #3
0
        private static System.Xml.Linq.XElement BodyLoadout_ToXml(On.RoR2.Loadout.BodyLoadoutManager.BodyLoadout.orig_ToXml orig, System.Object self, String elementName)
        {
            var bodyIndex          = self.GetFieldValue <int>("bodyIndex");
            var bodySkinController = BodyCatalog.GetBodyPrefab(bodyIndex).GetComponent <ModelLocator>().modelTransform.GetComponent <ModelSkinController>();
            var skinPreference     = self.GetFieldValue <uint>("skinPreference");

            if (addedSkins.Contains(bodySkinController.skins[skinPreference]))
            {
                self.SetFieldValue <uint>("skinPreference", 0u);
            }
            var skillPreferences    = self.GetFieldValue <uint[]>("skillPreferences");
            var allBodyInfosObj     = typeof(Loadout.BodyLoadoutManager).GetFieldValue <object>("allBodyInfos");
            var allBodyInfos        = ((Array)allBodyInfosObj).Cast <object>().ToArray();
            var currentInfo         = allBodyInfos[bodyIndex];
            var prefabSkillSlotsObj = currentInfo.GetFieldValue <object>("prefabSkillSlots");
            var prefabSkillSlots    = ((Array)prefabSkillSlotsObj).Cast <object>().ToArray();
            var skillFamilyIndices  = currentInfo.GetFieldValue <int[]>("skillFamilyIndices");

            for (int i = 0; i < prefabSkillSlots.Length; i++)
            {
                var         skillFamilyIndex = skillFamilyIndices[i];
                SkillFamily family           = SkillCatalog.GetSkillFamily(skillFamilyIndex);
                SkillDef    def = family.variants[skillPreferences[i]].skillDef;
                if (addedSkills.Contains(def))
                {
                    skillPreferences[i] = 0u;
                }
            }
            return(orig(self, elementName));
        }
Exemple #4
0
        /// <summary>
        /// Attempts to look up a name in the BodyCatalog, then find the SkillFamily instance used for one of its slots (by slot enum type). Returns null on failure.
        /// </summary>
        /// <param name="bodyName">The body name to search for. Case sensitive.</param>
        /// <param name="slot">The skillslot name to search for.</param>
        /// <returns>The resultant SkillFamily if lookup was successful, null otherwise.</returns>
        public static SkillFamily FindSkillFamilyFromBody(string bodyName, SkillSlot slot)
        {
            var targetBodyIndex = BodyCatalog.FindBodyIndex(bodyName);

            if (targetBodyIndex == BodyIndex.None)
            {
                AncientScepterMain._logger.LogError($"FindSkillFamilyFromBody: Couldn't find body with name {bodyName}");
                return(null);
            }
            var allSlots = BodyCatalog.GetBodyPrefabSkillSlots(targetBodyIndex);
            var skLoc    = BodyCatalog.GetBodyPrefab(targetBodyIndex).GetComponentInChildren <SkillLocator>();

            if (!skLoc)
            {
                AncientScepterMain._logger.LogError($"FindSkillFamilyFromBody: Body with name {bodyName} has no SkillLocator");
                return(null);
            }
            foreach (var skillInstance in BodyCatalog.GetBodyPrefabSkillSlots(targetBodyIndex))
            {
                var targetSlot = skLoc.FindSkillSlot(skillInstance);
                if (targetSlot == slot)
                {
                    return(skillInstance.skillFamily);
                }
            }
            AncientScepterMain._logger.LogError($"FindSkillFamilyFromBody: Body with name {bodyName} has no skill in slot {slot}");
            return(null);
        }
Exemple #5
0
        private static void AddSurvivorAction(List <SurvivorDef> survivorDefinitions)
        {
            // Set this to true so no more survivors can be added to the list while this is happening, or afterwards
            survivorsAlreadyAdded = true;

            // Get the count of the new survivors added, and the number of vanilla survivors
            var newSurvivorCount       = SurvivorDefinitions.Count;
            var exisitingSurvivorCount = SurvivorCatalog.idealSurvivorOrder.Length;

            // Increase the size of the order array to accomodate the added survivors
            Array.Resize(ref SurvivorCatalog.idealSurvivorOrder, exisitingSurvivorCount + newSurvivorCount);

            // Increase the max survivor count to ensure there is enough space on the char select bar
            SurvivorCatalog.survivorMaxCount += newSurvivorCount;


            foreach (var survivor in SurvivorDefinitions)
            {
                //Check if the current survivor has been registered in bodycatalog. Log if it has not, but still add the survivor
                if (BodyCatalog.FindBodyIndex(survivor.bodyPrefab) == -1 || BodyCatalog.GetBodyPrefab(BodyCatalog.FindBodyIndex(survivor.bodyPrefab)) != survivor.bodyPrefab)
                {
                    R2API.Logger.LogWarning($"Survivor: {survivor.displayNameToken} is not properly registered in {nameof(BodyCatalog)}");
                }

                R2API.Logger.LogInfo($"Survivor: {survivor.displayNameToken} added");

                survivorDefinitions.Add(survivor);

                // Add that new survivor to the order array so the game knows where to put it in character select
                SurvivorCatalog.idealSurvivorOrder[exisitingSurvivorCount++] = (SurvivorIndex)exisitingSurvivorCount;
            }
        }
Exemple #6
0
        private void RegisterSephiroth()
        {
            // gather our prefabs
            var sephPrefab        = Resources.Load <GameObject>("prefabs/characterbodies/commandobody").InstantiateClone("SephBody");
            var commandoPrefab    = Resources.Load <GameObject>("prefabs/characterbodies/commandobody");
            var sephDisplayPrefab = Resources.Load <GameObject>("prefabs/characterdisplays/commandodisplay").InstantiateClone("SephDisplay", false);

            // swap the models
            RegisterModelSwap(sephPrefab, sephDisplayPrefab);

            // Register sephs Skills
            RegisterSkills(sephPrefab);

            // register in body catalog
            var sephBody = sephPrefab.GetComponentInChildren <CharacterBody>();

            BodyCatalog.getAdditionalEntries += (list) => list.Add(sephPrefab);
            sephBody.baseNameToken            = "Sephiroth";

            // Register sephs stats
            RegisterStats(sephBody);

            // character needs pod?
            if (sephBody.preferredPodPrefab == null)
            {
                sephBody.preferredPodPrefab = commandoPrefab.GetComponentInChildren <CharacterBody>().preferredPodPrefab;
            }

            // register sephs genericcharactermain
            var stateMachine = sephBody.GetComponent <EntityStateMachine>();

            stateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(EntityStates.Sephiroth.Sephiroth));

            // register icon
            sephBody.portraitIcon = Assets.SephIcon.texture;

            // register survivor info
            SurvivorDef item = new SurvivorDef
            {
                name             = "SEPHIROTH_BODY",
                bodyPrefab       = sephPrefab,
                descriptionToken = "Kingdom Hearts, is light...",
                displayPrefab    = sephDisplayPrefab,
                primaryColor     = new Color(0.0f, 0.0f, 0.0f),
                unlockableName   = "Sephiroth",
                survivorIndex    = SurvivorIndex.Count + 1
            };

            SurvivorAPI.AddSurvivor(item);
            On.RoR2.BodyCatalog.Init += orig =>
            {
                orig();
                var bodyIndex = BodyCatalog.FindBodyIndex("SephBody");
                BodyCatalog.GetBodyPrefab(bodyIndex).GetComponent <CharacterBody>().baseNameToken = "Sephiroth";
            };
        }
Exemple #7
0
        private static Boolean IsSkinValid(Loadout.BodyLoadoutManager.BodyLoadout self)
        {
            Int32      bInd     = (Int32)self.bodyIndex;// bodyIndex.Get( self );
            UInt32     skinPref = self.skinPreference;
            GameObject body     = BodyCatalog.GetBodyPrefab((BodyIndex)bInd);

            return(validSkinOverrides.TryGetValue(body, out ValidSkinOverrideDelegate Override)
                ? Override(skinPref)
                : IsSkinValidOrig(self));
        }
Exemple #8
0
        private static Boolean IsSkinLocked(Loadout.BodyLoadoutManager.BodyLoadout self, UserProfile userProfile)
        {
            Int32      bInd     = (Int32)self.bodyIndex;
            UInt32     skinPref = self.skinPreference;//.Get( self );
            GameObject body     = BodyCatalog.GetBodyPrefab((BodyIndex)bInd);

            return(lockedSkinOverrides.TryGetValue(body, out LockedSkinOverrideDelegate Override)
                ? Override(skinPref)
                : IsSkinLockedOrig(self, userProfile));
        }
Exemple #9
0
 // Token: 0x060020F0 RID: 8432 RVA: 0x0009AB60 File Offset: 0x00098D60
 private SurvivorIndex GetSelectedSurvivorIndexFromBodyPreference()
 {
     if (this.networkUser)
     {
         SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(BodyCatalog.GetBodyPrefab(this.networkUser.bodyIndexPreference));
         if (survivorDef != null && survivorDef.survivorIndex != SurvivorIndex.None)
         {
             return(survivorDef.survivorIndex);
         }
     }
     return(SurvivorIndex.Commando);
 }
Exemple #10
0
        private static void SaveFile(RunReport report, WeeklyRun run)
        {
            String time = ((Int32)Math.Ceiling((Double)report.runStopwatchValue / 1000.0)).ToString();

            var    cycle      = WeeklyRun.GetCurrentSeedCycle();
            var    cycleStart = WeeklyRun.GetSeedCycleStartDateTime(WeeklyRun.GetCurrentSeedCycle());
            String cycleDate  = cycleStart.ToShortDateString();

            var body = BodyCatalog.GetBodyPrefab(NetworkUser.readOnlyLocalPlayersList[0].bodyIndexPreference);

            if (body == null)
            {
                instance.Logger.LogError("Invalid body selected");
                return;
            }
            var survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(body);

            if (survivorDef == null)
            {
                instance.Logger.LogError("Selected body is not in survivorcatalog");
                return;
            }
            String character = Language.GetString(survivorDef.displayNameToken);

            instance.Logger.LogMessage("Your character was: " + character);
            instance.Logger.LogMessage("Your time was: " + time);
            instance.Logger.LogMessage("Score send aborted, saving run report to disk instead.");
            instance.Logger.LogMessage("In the future, there may be a leaderboard set up such that you can upload the file to submit a run");

            String directory       = "\\ModdedTrials\\" + cycleStart + "\\" + character + "\\";
            String directoryGlobal = getRunReportsFolder() + directory;

            System.IO.Directory.CreateDirectory(directoryGlobal);
            String fileBaseName = time;
            Int32  i            = 0;

            while (System.IO.File.Exists(directoryGlobal + fileBaseName + (i != 0 ? "(" + i + ")" : String.Empty)))
            {
                ++i;
            }

            RunReport.Save(report, directory + fileBaseName);
        }
Exemple #11
0
        ////// Hooks //////

        private void DeathState_OnImpactServer(On.EntityStates.Drone.DeathState.orig_OnImpactServer orig, EntityStates.Drone.DeathState self, Vector3 contactPoint)
        {
            orig(self, contactPoint);
            if (self.characterBody && BodyCatalog.GetBodyPrefab(self.characterBody.bodyIndex) == bulwarkDroneBodyPrefab)
            {
                var broken = DirectorCore.instance.TrySpawnObject(
                    new DirectorSpawnRequest(bulwarkDroneSpawnCard, new DirectorPlacementRule {
                    placementMode = DirectorPlacementRule.PlacementMode.Direct,
                    position      = contactPoint
                }, this.rng));
                if (broken)
                {
                    var purch = broken.GetComponent <PurchaseInteraction>();
                    if (purch && purch.costType == CostTypeIndex.Money)
                    {
                        purch.Networkcost = Run.instance.GetDifficultyScaledCost(purch.cost);
                    }
                }
            }
        }
Exemple #12
0
        private static JoinAsResult SpawnNewPlayerWithBody(NetworkUser player, BodyIndex newBodyIndex)
        {
            player.CmdSetBodyPreference(newBodyIndex);

            Run.instance.SetFieldValue("allowNewParticipants", true);
            Run.instance.OnUserAdded(player);
            Run.instance.SetFieldValue("allowNewParticipants", false);


            Transform spawnTransform = GetSpawnTransformForPlayer(player);

            player.master.SpawnBody(spawnTransform.position, spawnTransform.rotation);

            HandleBodyItems(player, null, BodyCatalog.GetBodyPrefab(newBodyIndex));

            if (DropInConfig.GiveCatchUpItems.Value)
            {
                GiveCatchUpItems(player);
            }

            return(JoinAsResult.Success);
        }
Exemple #13
0
        private static JoinAsResult RespawnExistingPlayerWithBody(NetworkUser player, BodyIndex newBodyIndex)
        {
            GameObject oldBodyPrefab = player.master.bodyPrefab;

            player.CmdSetBodyPreference(newBodyIndex);

            JoinAsResult result = JoinAsResult.Success;

            if (player.GetCurrentBody() == null && player.master.lostBodyToDeath && !DropInConfig.AllowRespawn.Value)
            {
                Logger.LogMessage($"Unable immediately to spawn {player.userName} with bodyIndex = {newBodyIndex} due to being player being dead and AllowRespawn being set to false");
                result = JoinAsResult.DeadAndNotAllowRespawn;
            }
            else
            {
                Transform spawnTransform = GetSpawnTransformForPlayer(player);
                player.master.Respawn(spawnTransform.position, spawnTransform.rotation);
            }

            HandleBodyItems(player, oldBodyPrefab, BodyCatalog.GetBodyPrefab(newBodyIndex));

            return(result);
        }
Exemple #14
0
        private static SkillLocator FindSkillLocator(int bodyIndex)
        {
            SkillLocator locator = BodyCatalog.GetBodyPrefab(bodyIndex)?.GetComponent <SkillLocator>();

            return(locator);
        }
        // Token: 0x06002210 RID: 8720 RVA: 0x0009325C File Offset: 0x0009145C
        private void RebuildLocal()
        {
            Loadout   loadout   = new Loadout();
            LocalUser localUser = this.localUser;

            if (localUser != null)
            {
                UserProfile userProfile = localUser.userProfile;
                if (userProfile != null)
                {
                    userProfile.CopyLoadout(loadout);
                }
            }
            SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(this.selectedSurvivorIndex);
            int         bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(this.selectedSurvivorIndex);
            Color       color        = Color.white;
            string      text         = string.Empty;
            string      text2        = string.Empty;
            string      viewableName = string.Empty;

            if (survivorDef != null)
            {
                color = survivorDef.primaryColor;
                text  = Language.GetString(survivorDef.displayNameToken);
                text2 = Language.GetString(survivorDef.descriptionToken);
            }
            List <CharacterSelectController.StripDisplayData> list = new List <CharacterSelectController.StripDisplayData>();

            if (bodyIndexFromSurvivorIndex != -1)
            {
                GameObject   bodyPrefab = BodyCatalog.GetBodyPrefab(bodyIndexFromSurvivorIndex);
                SkillLocator component  = bodyPrefab.GetComponent <SkillLocator>();
                if (component.passiveSkill.enabled)
                {
                    list.Add(new CharacterSelectController.StripDisplayData
                    {
                        enabled           = true,
                        primaryColor      = color,
                        icon              = component.passiveSkill.icon,
                        titleString       = Language.GetString(component.passiveSkill.skillNameToken),
                        descriptionString = Language.GetString(component.passiveSkill.skillDescriptionToken)
                    });
                }
                GenericSkill[] components = bodyPrefab.GetComponents <GenericSkill>();
                for (int i = 0; i < components.Length; i++)
                {
                    uint     skillVariant = loadout.bodyLoadoutManager.GetSkillVariant(bodyIndexFromSurvivorIndex, i);
                    SkillDef skillDef     = components[i].skillFamily.variants[(int)skillVariant].skillDef;
                    list.Add(new CharacterSelectController.StripDisplayData
                    {
                        enabled           = true,
                        primaryColor      = color,
                        icon              = skillDef.icon,
                        titleString       = Language.GetString(skillDef.skillNameToken),
                        descriptionString = Language.GetString(skillDef.skillDescriptionToken)
                    });
                }
                viewableName = "/Loadout/Bodies/" + BodyCatalog.GetBodyName(bodyIndexFromSurvivorIndex) + "/";
            }
            this.skillStripAllocator.AllocateElements(list.Count);
            for (int j = 0; j < list.Count; j++)
            {
                this.RebuildStrip(this.skillStripAllocator.elements[j], list[j]);
            }
            this.survivorName.SetText(text);
            this.survivorDescription.SetText(text2);
            Image[] array = this.primaryColorImages;
            for (int k = 0; k < array.Length; k++)
            {
                array[k].color = color;
            }
            TextMeshProUGUI[] array2 = this.primaryColorTexts;
            for (int k = 0; k < array2.Length; k++)
            {
                array2[k].color = color;
            }
            this.loadoutViewableTag.viewableName = viewableName;
        }
 private bool isNonSurvivor(PlayerCharacterMasterController enumerator)
 {
     if (enumerator.master.hasBody)
     {
         if (!enumerator.networkUser.GetCurrentBody().name.Split('(')[0].Equals(BodyCatalog.GetBodyPrefab(enumerator.networkUser.NetworkbodyIndexPreference).name))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #17
0
        // Token: 0x060021AA RID: 8618 RVA: 0x0009E870 File Offset: 0x0009CA70
        private void SetPlayerInfo([CanBeNull] RunReport.PlayerInfo playerInfo)
        {
            ulong num = 0UL;

            if (playerInfo != null)
            {
                StatSheet statSheet = playerInfo.statSheet;
                this.AllocateStatStrips(this.statsToDisplay.Length);
                for (int i = 0; i < this.statsToDisplay.Length; i++)
                {
                    string  text    = this.statsToDisplay[i];
                    StatDef statDef = StatDef.Find(text);
                    if (statDef == null)
                    {
                        Debug.LogWarningFormat("GameEndReportPanelController.SetStatSheet: Could not find stat def \"{0}\".", new object[]
                        {
                            text
                        });
                    }
                    else
                    {
                        this.AssignStatToStrip(statSheet, statDef, this.statStrips[i]);
                        num += statSheet.GetStatPointValue(statDef);
                    }
                }
                int unlockableCount = statSheet.GetUnlockableCount();
                int num2            = 0;
                for (int j = 0; j < unlockableCount; j++)
                {
                    if (!statSheet.GetUnlockable(j).hidden)
                    {
                        num2++;
                    }
                }
                this.AllocateUnlockStrips(num2);
                int num3 = 0;
                for (int k = 0; k < unlockableCount; k++)
                {
                    UnlockableDef unlockable = statSheet.GetUnlockable(k);
                    if (!unlockable.hidden)
                    {
                        this.AssignUnlockToStrip(unlockable, this.unlockStrips[num3]);
                        num3++;
                    }
                }
                if (this.itemInventoryDisplay)
                {
                    this.itemInventoryDisplay.SetItems(playerInfo.itemAcquisitionOrder, playerInfo.itemAcquisitionOrder.Length, playerInfo.itemStacks);
                    this.itemInventoryDisplay.UpdateDisplay();
                }
            }
            else
            {
                this.AllocateStatStrips(0);
                this.AllocateUnlockStrips(0);
                if (this.itemInventoryDisplay)
                {
                    this.itemInventoryDisplay.ResetItems();
                }
            }
            string @string = Language.GetString("STAT_POINTS_FORMAT");

            this.totalPointsLabel.text = string.Format(@string, num);
            GameObject gameObject = null;

            if (playerInfo != null)
            {
                gameObject = BodyCatalog.GetBodyPrefab(playerInfo.bodyIndex);
            }
            string  arg     = "";
            Texture texture = null;

            if (gameObject)
            {
                texture = gameObject.GetComponent <CharacterBody>().portraitIcon;
                arg     = Language.GetString(gameObject.GetComponent <CharacterBody>().baseNameToken);
            }
            string string2 = Language.GetString("STAT_CLASS_NAME_FORMAT");

            this.playerBodyLabel.text            = string.Format(string2, arg);
            this.playerBodyPortraitImage.texture = texture;
            GameObject gameObject2 = null;

            if (playerInfo != null)
            {
                gameObject2 = BodyCatalog.GetBodyPrefab(playerInfo.killerBodyIndex);
            }
            string  arg2     = "";
            Texture texture2 = null;

            if (gameObject2)
            {
                texture2 = gameObject2.GetComponent <CharacterBody>().portraitIcon;
                arg2     = Language.GetString(gameObject2.GetComponent <CharacterBody>().baseNameToken);
            }
            string string3 = Language.GetString("STAT_KILLER_NAME_FORMAT");

            this.killerBodyLabel.text            = string.Format(string3, arg2);
            this.killerBodyPortraitImage.texture = texture2;
            this.killerPanelObject.SetActive(gameObject2);
        }
        public void Awake()
        {
            InitConfig();

            //On.RoR2.PurchaseInteraction.OnTeleporterBeginCharging += PurchaseInteraction_OnTeleporterBeginCharging;

            On.RoR2.OutsideInteractableLocker.LockPurchasable += OutsideInteractableLocker_LockPurchasable;

            On.RoR2.SceneDirector.PlaceTeleporter += (orig, self) =>
                                                     //On.RoR2.SceneDirector.PopulateScene += (orig, self) =>
            {
                orig(self);
                if (!RoR2Application.isInSinglePlayer)
                {
                    SpawnShrineOfDio(self);
                }
            };

            On.RoR2.ShrineHealingBehavior.FixedUpdate += (orig, self) =>
            {
                orig(self);
                if (!NetworkServer.active)
                {
                    if (clientCost == UNINITIALIZED)
                    {
                        int piCost = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction").cost;
                        if (piCost != clientCost)
                        {
                            clientCost = piCost;
                            if (clientCost == BALANCED_MODE)
                            {
                                isBalancedMode = true;
                            }
                            else
                            {
                                isBalancedMode = false;
                            }
                            Type[] arr = ((IEnumerable <System.Type>) typeof(ChestRevealer).Assembly.GetTypes()).Where <System.Type>((Func <System.Type, bool>)(t => typeof(IInteractable).IsAssignableFrom(t))).ToArray <System.Type>();
                            for (int i = 0; i < arr.Length; i++)
                            {
                                foreach (UnityEngine.MonoBehaviour instances in InstanceTracker.FindInstancesEnumerable(arr[i]))
                                {
                                    if (((IInteractable)instances).ShouldShowOnScanner())
                                    {
                                        string item = ((IInteractable)instances).ToString().ToLower();
                                        if (item.Contains("shrinehealing"))
                                        {
                                            UpdateShrineDisplay(instances.GetComponentInParent <ShrineHealingBehavior>());
                                        }
                                    }
                                    ;
                                }
                            }
                        }
                    }
                }
            };

            On.RoR2.Stage.Start += (orig, self) =>
            {
                orig(self);
                if (!RoR2Application.isInSinglePlayer && NetworkServer.active)
                {
                    isDead.Clear();
                }
            };

            On.RoR2.ShrineHealingBehavior.Awake += (orig, self) =>
            {
                orig(self);
                if (!RoR2Application.isInSinglePlayer)
                {
                    PurchaseInteraction pi = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction");
                    pi.contextToken                = "Offer to the Shrine of Dio";
                    pi.displayNameToken            = "Shrine of Dio";
                    self.costMultiplierPerPurchase = 1f;


                    if (NetworkServer.active)
                    {
                        isBalancedMode = UseBalancedMode.Value;
                        if (UseBalancedMode.Value)
                        {
                            pi.costType = CostTypeIndex.None;
                            pi.cost     = BALANCED_MODE;
                            pi.GetComponent <HologramProjector>().displayDistance   = 0f;
                            self.GetComponent <HologramProjector>().displayDistance = 0f;
                        }
                        else
                        {
                            pi.costType = CostTypeIndex.Money;
                            pi.cost     = ResurrectionCost.Value;
                        }
                    }
                    else
                    {
                        clientCost = UNINITIALIZED;
                    }
                }
            };

            On.RoR2.ShrineHealingBehavior.AddShrineStack += (orig, self, interactor) =>
            {
                if (!RoR2Application.isInSinglePlayer)
                {
                    if (NetworkServer.active)
                    {
                        PlayerCharacterMasterController deadCharacter = GetRandomDeadCharacter();
                        isDead.Remove(deadCharacter.networkUser);

                        GameObject prefab = BodyCatalog.GetBodyPrefab(deadCharacter.networkUser.NetworkbodyIndexPreference);
                        if (prefab != null)
                        {
                            deadCharacter.master.bodyPrefab = prefab;
                        }
                        deadCharacter.master.Respawn(deadCharacter.master.GetFieldValue <Vector3>("deathFootPosition"), deadCharacter.master.transform.rotation, true);

                        string resurrectionMessage = $"<color=#beeca1>{interactor.GetComponent<CharacterBody>().GetUserName()}</color> resurrected <color=#beeca1>{deadCharacter.networkUser.userName}</color>";
                        Chat.SendBroadcastChat(new Chat.SimpleChatMessage
                        {
                            baseToken = resurrectionMessage
                        });

                        GameObject spawnEffect = Resources.Load <GameObject>("Prefabs/Effects/HippoRezEffect");
                        EffectManager.SpawnEffect(spawnEffect, new EffectData
                        {
                            origin   = deadCharacter.master.GetBody().footPosition,
                            rotation = deadCharacter.master.gameObject.transform.rotation
                        }, true);
                        self.SetFieldValue("waitingForRefresh", true);
                        self.SetFieldValue("refreshTimer", 2f);
                        EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData()
                        {
                            origin   = self.transform.position,
                            rotation = Quaternion.identity,
                            scale    = 1f,
                            color    = (Color32)Color.green
                        }, true);
                        // dio
                        CharacterBody cb = interactor.GetComponent <CharacterBody>();
                        if (UseBalancedMode.Value)
                        {
                            PurchaseInteraction pi = self.GetComponent <PurchaseInteraction>();
                            PurchaseInteraction.CreateItemTakenOrb(cb.corePosition, pi.gameObject, ItemIndex.ExtraLife);
                            cb.inventory.RemoveItem(ItemIndex.ExtraLife, 1);
                            cb.inventory.GiveItem(ItemIndex.ExtraLifeConsumed, 1);
                        }
                    }
                }
                else
                {
                    orig(self, interactor);
                }
            };

            On.RoR2.CharacterMaster.OnBodyDeath += (orig, self, masterbody) =>
            {
                orig(self, masterbody);
                if (!RoR2Application.isInSinglePlayer)
                {
                    if (NetworkServer.active)
                    {
                        if (masterbody.isPlayerControlled)
                        {
                            PlayerCharacterMasterController player = self.GetComponent <PlayerCharacterMasterController>();
                            if (!isDead.Contains(player.networkUser))
                            {
                                isDead.Add(player.networkUser);
                            }
                        }
                    }
                }
            };

            On.RoR2.PurchaseInteraction.CanBeAffordedByInteractor += (orig, self, interactor) =>
            {
                if (!RoR2Application.isInSinglePlayer)
                {
                    if (self.displayNameToken.Contains("Shrine of Dio") || self.displayNameToken.Contains("SHRINE_HEALING"))
                    {
                        if (isBalancedMode)
                        {
                            if (interactor.GetComponent <CharacterBody>().inventory.GetItemCount(ItemIndex.ExtraLife) > 0)
                            {
                                if (IsAnyoneDead())
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }
                        else
                        {
                            if (IsAnyoneDead())
                            {
                                return(orig(self, interactor));
                            }
                            return(false);
                        }
                    }
                    return(orig(self, interactor));
                }
                return(orig(self, interactor));
            };
        }
        private PlayerCharacterMasterController GetRandomDeadCharacter()
        {
            List <PlayerCharacterMasterController> deadCharacterList = new List <PlayerCharacterMasterController>();

            foreach (NetworkUser enumerator in isDead)
            {
                if (enumerator.master.playerCharacterMasterController.isConnected)
                {
                    if (enumerator.master.IsDeadAndOutOfLivesServer() || enumerator.master.bodyPrefab != BodyCatalog.GetBodyPrefab(enumerator.NetworkbodyIndexPreference))
                    {
                        deadCharacterList.Add(enumerator.master.playerCharacterMasterController);
                    }
                }
            }
            Random random = new Random();
            int    index  = random.Next(deadCharacterList.Count);

            return(deadCharacterList[index]);


            //List<PlayerCharacterMasterController> deadCharacterList = new List<PlayerCharacterMasterController>();
            //foreach (PlayerCharacterMasterController enumerator in PlayerCharacterMasterController.instances)
            //{
            //    if (enumerator.isConnected)
            //    {
            //        if (enumerator.master.IsDeadAndOutOfLivesServer() || enumerator.master.bodyPrefab != BodyCatalog.GetBodyPrefab(enumerator.networkUser.NetworkbodyIndexPreference))
            //        {
            //            deadCharacterList.Add(enumerator);
            //        }
            //    }
            //}
            //Random random = new Random();
            //int index = random.Next(deadCharacterList.Count);

            //return deadCharacterList[index];
        }
Exemple #20
0
        internal static void Init()
        {
            On.RoR2.Console.Awake += (orig, self) =>
            {
                CommandHelper.AddToConsoleWhenReady();
                orig(self);
            };
            On.RoR2.HuntressTracker.Awake += (orig, self) =>
            {
                orig(self);
                Variables.DefaultHuntressTrackingDistance = self.maxTrackingDistance;
            };
            On.RoR2.CharacterBody.OnInventoryChanged += (orig, self) =>
            {
                orig(self);
                if (self.isPlayerControlled && Variables.MyCharacterIndex == 6)
                {
                    self.GetComponent <HuntressTracker>().maxTrackingDistance = Variables.DefaultHuntressTrackingDistance + (15 * self.inventory.GetItemCount(Assets.MagnifingGlassItemDef.itemIndex));
                }
                if (self.isPlayerControlled && Variables.MyCharacterIndex == 0)
                {
                    SkillLocator locator = self.GetComponent <SkillLocator>();
                    locator.primary.SetBonusStockFromBody((self.inventory.GetItemCount(Assets.ExtendedMagItemDef.itemIndex)));
                    locator.primary.stock = locator.primary.maxStock;
                }
            };
            On.RoR2.Run.Start += (orig, self) =>
            {
                foreach (var playerCharacterMasterControllerInstance in PlayerCharacterMasterController.instances)
                {
                    if (playerCharacterMasterControllerInstance.isLocalPlayer)
                    {
                        Variables.MyBody = playerCharacterMasterControllerInstance.master.bodyPrefab.GetComponent <CharacterBody>();
                        break;
                    }
                }
                orig(self);
            };
            On.RoR2.Run.BuildDropTable += (orig, self) =>
            {
                if (!Variables.HasHuntress)
                {
                    self.availableItems.Remove(Assets.MagnifingGlassItemDef.itemIndex);
                }
                if (!Variables.HasBandit)
                {
                    self.availableItems.Remove(Assets.ExtendedMagItemDef.itemIndex);
                }
                orig(self);
            };
            On.RoR2.GenericPickupController.GetInteractability += (orig, self, activator) =>
            {
                if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.MagnifingGlassItemDef.itemIndex && Variables.MyCharacterIndex != 6)
                {
                    return(Interactability.ConditionsNotMet);
                }
                if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.ExtendedMagItemDef.itemIndex && Variables.MyCharacterIndex != 0)
                {
                    return(Interactability.ConditionsNotMet);
                }
                return(orig(self, activator));
            };
            On.RoR2.GenericPickupController.OnTriggerStay += (orig, self, other) =>
            {
                if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.MagnifingGlassItemDef.itemIndex && Variables.MyCharacterIndex != 6)
                {
                    return;
                }
                if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.ExtendedMagItemDef.itemIndex && Variables.MyCharacterIndex != 0)
                {
                    return;
                }
                orig(self, other);
            };
            On.RoR2.SceneDirector.PopulateScene += (orig, self) =>
            {
                self.interactableCredit = (int)(self.interactableCredit * Variables.interactableMultiplier.Value);
                orig(self);
            };
            On.RoR2.CharacterMaster.GiveMoney += (orig, self, amount) =>
            {
                amount = (uint)(amount * Variables.moneyMultiplier.Value);
                orig(self, amount);
            };
            On.RoR2.PreGameController.StartRun += (orig, self) =>
            {
                int count = NetworkUser.readOnlyInstancesList.Count;
                for (int i = 0; i < count; i++)
                {
                    var body  = BodyCatalog.GetBodyPrefab(NetworkUser.readOnlyInstancesList[i].bodyIndexPreference);
                    int index = (int)SurvivorCatalog.FindSurvivorDefFromBody(body).survivorIndex;
                    //Stores your survivor index
                    if (i == 0)
                    {
                        Variables.MyCharacterIndex = index;
                    }
                    if (index == 0)
                    {
                        Variables.HasBandit = true;
                    }
                    if (index == 6)
                    {
                        Variables.HasHuntress = true;
                    }
                }

                orig(self);
            };
        }
 // Token: 0x06002219 RID: 8729 RVA: 0x000936D8 File Offset: 0x000918D8
 private void Update()
 {
     this.SetEventSystem(this.eventSystemLocator.eventSystem);
     if (this.previousSurvivorIndex != this.selectedSurvivorIndex)
     {
         this.RebuildLocal();
         this.previousSurvivorIndex = this.selectedSurvivorIndex;
     }
     if (this.characterDisplayPads.Length != 0)
     {
         List <NetworkUser> sortedNetworkUsersList = this.GetSortedNetworkUsersList();
         for (int i = 0; i < this.characterDisplayPads.Length; i++)
         {
             ref CharacterSelectController.CharacterPad ptr = ref this.characterDisplayPads[i];
             NetworkUser networkUser = null;
             if (i < sortedNetworkUsersList.Count)
             {
                 networkUser = sortedNetworkUsersList[i];
             }
             if (networkUser)
             {
                 GameObject  bodyPrefab  = BodyCatalog.GetBodyPrefab(networkUser.bodyIndexPreference);
                 SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab);
                 if (survivorDef != null)
                 {
                     SurvivorDef survivorDef2 = SurvivorCatalog.GetSurvivorDef(ptr.displaySurvivorIndex);
                     bool        flag         = true;
                     if (survivorDef2 != null && survivorDef2.bodyPrefab == bodyPrefab)
                     {
                         flag = false;
                     }
                     if (flag)
                     {
                         GameObject displayPrefab = survivorDef.displayPrefab;
                         this.ClearPadDisplay(ptr);
                         if (displayPrefab)
                         {
                             ptr.displayInstance = UnityEngine.Object.Instantiate <GameObject>(displayPrefab, ptr.padTransform.position, ptr.padTransform.rotation, ptr.padTransform);
                         }
                         ptr.displaySurvivorIndex = survivorDef.survivorIndex;
                         this.OnNetworkUserLoadoutChanged(networkUser);
                     }
                 }
                 else
                 {
                     this.ClearPadDisplay(ptr);
                 }
             }
             else
             {
                 this.ClearPadDisplay(ptr);
             }
             if (!ptr.padTransform)
             {
                 return;
             }
             if (this.characterDisplayPads[i].padTransform)
             {
                 this.characterDisplayPads[i].padTransform.gameObject.SetActive(this.characterDisplayPads[i].displayInstance != null);
             }
         }
     }
Exemple #22
0
 // Token: 0x060020F1 RID: 8433 RVA: 0x0009ABA4 File Offset: 0x00098DA4
 private void Update()
 {
     this.SetEventSystem(this.eventSystemLocator.eventSystem);
     if (this.previousSurvivorIndex != this.selectedSurvivorIndex)
     {
         this.RebuildLocal();
         this.previousSurvivorIndex = this.selectedSurvivorIndex;
     }
     if (this.characterDisplayPads.Length != 0)
     {
         for (int i = 0; i < this.characterDisplayPads.Length; i++)
         {
             CharacterSelectController.CharacterPad characterPad = this.characterDisplayPads[i];
             NetworkUser        networkUser = null;
             List <NetworkUser> list        = new List <NetworkUser>(NetworkUser.readOnlyInstancesList.Count);
             list.AddRange(NetworkUser.readOnlyLocalPlayersList);
             for (int j = 0; j < NetworkUser.readOnlyInstancesList.Count; j++)
             {
                 NetworkUser item = NetworkUser.readOnlyInstancesList[j];
                 if (!list.Contains(item))
                 {
                     list.Add(item);
                 }
             }
             if (i < list.Count)
             {
                 networkUser = list[i];
             }
             if (networkUser)
             {
                 GameObject  bodyPrefab  = BodyCatalog.GetBodyPrefab(networkUser.bodyIndexPreference);
                 SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab);
                 if (survivorDef != null)
                 {
                     SurvivorDef survivorDef2 = SurvivorCatalog.GetSurvivorDef(characterPad.displaySurvivorIndex);
                     bool        flag         = true;
                     if (survivorDef2 != null && survivorDef2.bodyPrefab == bodyPrefab)
                     {
                         flag = false;
                     }
                     if (flag)
                     {
                         GameObject displayPrefab = survivorDef.displayPrefab;
                         this.ClearPadDisplay(characterPad);
                         if (displayPrefab)
                         {
                             characterPad.displayInstance = UnityEngine.Object.Instantiate <GameObject>(displayPrefab, characterPad.padTransform.position, characterPad.padTransform.rotation, characterPad.padTransform);
                         }
                         characterPad.displaySurvivorIndex = survivorDef.survivorIndex;
                     }
                 }
                 else
                 {
                     this.ClearPadDisplay(characterPad);
                 }
             }
             else
             {
                 this.ClearPadDisplay(characterPad);
             }
             if (!characterPad.padTransform)
             {
                 return;
             }
             this.characterDisplayPads[i] = characterPad;
             if (this.characterDisplayPads[i].padTransform)
             {
                 this.characterDisplayPads[i].padTransform.gameObject.SetActive(this.characterDisplayPads[i].displayInstance != null);
             }
         }
     }
     if (!RoR2Application.isInSinglePlayer)
     {
         bool flag2 = this.IsClientReady();
         this.readyButton.gameObject.SetActive(!flag2);
         this.unreadyButton.gameObject.SetActive(flag2);
     }
 }
        public void Awake()
        {
            Chat.AddMessage("A5 Skill Component Booted");
            SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e)
            {
                int          bodyIndex    = BodyCatalog.FindBodyIndex("BomberBody");
                SkillLocator skillLocator = BodyCatalog.GetBodyPrefab(bodyIndex).GetComponent <SkillLocator>();
                SkillFamily  SkillFamily  = BodyCatalog.GetBodyPrefab(bodyIndex).GetComponent <SkillFamily>();
                SkillFamily  skillFamily  = skillLocator.primary.skillFamily;
                SkillFamily  skillFamily2 = skillLocator.secondary.skillFamily;
                SkillFamily  skillFamily3 = skillLocator.utility.skillFamily;
                SkillFamily  skillFamily4 = skillLocator.special.skillFamily;
                SkillDef     defaultSkill = skillFamily.variants[skillFamily.defaultVariantIndex].skillDef;
                SkillDef     secondskill  = skillFamily2.variants[skillFamily2.defaultVariantIndex].skillDef;
                SkillDef     thirdskill   = skillFamily3.variants[skillFamily3.defaultVariantIndex].skillDef;
                SkillDef     fourthskill  = skillFamily4.variants[skillFamily4.defaultVariantIndex].skillDef;
                //Alt skills
                //SkillFamily altskillFamily = skillLocator.primary.skillFamily;
                //SkillFamily altskillFamily2 = skillLocator.secondary.skillFamily;
                //SkillFamily altskillFamily3 = skillLocator.utility.skillFamily;
                //SkillFamily altskillFamily4 = skillLocator.special.skillFamily;
                //SkillDef altdefaultSkill = skillFamily.variants[skillFamily.defaultVariantIndex].skillDef;
                //SkillDef altsecondskill = skillFamily2.variants[skillFamily2.defaultVariantIndex].skillDef;
                //SkillDef altthirdskill = skillFamily3.variants[skillFamily3.defaultVariantIndex].skillDef;
                //SkillDef altfourthskill = skillFamily4.variants[skillFamily4.defaultVariantIndex].skillDef;
                //Primary
                defaultSkill.beginSkillCooldownOnSkillEnd = true;
                defaultSkill.baseRechargeInterval         = 1f;
                defaultSkill.rechargeStock         = 1;
                defaultSkill.baseMaxStock          = 6;
                defaultSkill.stockToConsume        = 1;
                defaultSkill.requiredStock         = 1;
                defaultSkill.canceledFromSprinting = false;
                defaultSkill.noSprint              = false;
                defaultSkill.skillNameToken        = "Shotgun";
                defaultSkill.skillDescriptionToken = "Fire a shotgun that does <style=cIsDamage>15 base damage per bullet</style>. Has six rounds.";
                defaultSkill.activationState       = new EntityStates.SerializableEntityStateType(typeof(EntityStates.BomberRework.Shotgun.FireShotgun));
                //alt primary

                //Secondary
                secondskill.beginSkillCooldownOnSkillEnd = true;
                secondskill.baseRechargeInterval         = 3;
                secondskill.rechargeStock         = 1;
                secondskill.baseMaxStock          = 1;
                secondskill.stockToConsume        = 1;
                secondskill.requiredStock         = 1;
                secondskill.canceledFromSprinting = false;
                secondskill.noSprint              = false;
                secondskill.skillNameToken        = "Shotgun Slug";
                secondskill.skillDescriptionToken = "Fire a shotgun slug that does <style=cIsDamage>50 base damage</style>."; //Fire a snare that pulls all enemies in and deals damage
                secondskill.activationState       = new EntityStates.SerializableEntityStateType(typeof(EntityStates.BomberRework.Shotgun.FireSlug));
                //Utility
                // thirdskill.activationState = (EntityStates.SerializableEntityStateType)BodyCatalog.FindBodyPrefab("BomberBody").GetComponent<SkillLocator>().utility.activationState;
                thirdskill.beginSkillCooldownOnSkillEnd = true;
                thirdskill.baseRechargeInterval         = 12;
                thirdskill.rechargeStock         = 1;
                thirdskill.baseMaxStock          = 1;
                thirdskill.stockToConsume        = 1;
                thirdskill.requiredStock         = 1;
                thirdskill.canceledFromSprinting = true;
                thirdskill.noSprint              = false;
                thirdskill.skillNameToken        = "Repurposed MED-E";                                                                                                                                                                               //thumper
                thirdskill.skillDescriptionToken = "Summon a repurposed MED-E bot that does <style=cIsDamage>12 base damage</style> on first hit, but does <style=cIsDamage>15 base damage</style> on second hit and onward. Also called Thumpers."; //thumpa dump thumpa dump
                thirdskill.noSprint              = false;
                thirdskill.activationState       = new EntityStates.SerializableEntityStateType(typeof(EntityStates.Treebot.Weapon.CreatePounder));
                //SkillFamily utility = skillFamily3;
                //utility.activationState = new EntityStates.SerializableEntityStateType(EntityState.Instantiate(74).GetType());
                //Special
                //fourthskill.activationState = (EntityStates.SerializableEntityStateType)BodyCatalog.FindBodyPrefab("BomberBody").GetComponent<SkillLocator>().special.activationState;
                fourthskill.beginSkillCooldownOnSkillEnd = true;
                fourthskill.baseRechargeInterval         = 5;
                fourthskill.rechargeStock         = 1;
                fourthskill.stockToConsume        = 1;
                fourthskill.requiredStock         = 1;
                fourthskill.baseMaxStock          = 1;
                fourthskill.canceledFromSprinting = false;
                fourthskill.noSprint              = false;
                fourthskill.skillNameToken        = "Disperse Pellets";
                fourthskill.skillDescriptionToken = "Launch a <style=cIsDamage>stun</style> pellet canister that does <style=cIsDamage>37 base damage</style> on hit, then explodes into 5 pellets that do <style=cIsDamage>7 base damage</style>.";
                fourthskill.mustKeyPress          = true;
                fourthskill.activationState       = new EntityStates.SerializableEntityStateType(typeof(EntityStates.Toolbot.AimStunDrone));
                //SkillFamily special = skillFamily4; EntityStates.Treebot.Weapon
                //Reflection.SetFieldValue(special, "activationState", new SerializableEntityStateType(EntityState.Instantiate(6).GetType()));
            };
        }
Exemple #24
0
        private RoR2.NetworkPlayerName NetworkUser_GetNetworkPlayerName(On.RoR2.NetworkUser.orig_GetNetworkPlayerName orig, RoR2.NetworkUser self)
        {
            var nameOverride = NameOverride.Value;
            var bodyName     = BodyFallbackName.Value;

            if (GetBodyName)
            {
                if (self.GetCurrentBody())
                {
                    bodyName = self.GetCurrentBody().GetDisplayName();
                }
                else
                {
                    if (BodyCatalog.GetBodyPrefab(self.bodyIndexPreference))
                    {
                        bodyName = BodyCatalog.GetBodyPrefabBodyComponent(self.bodyIndexPreference).GetDisplayName();
                    }
                }
            }

            /*if (false == true && !SteamworksLobbyManager.isInLobby)
             * {
             *  if (GetBodyName || (!GetBodyName && GetSkinName))
             *  {
             *      nameOverride = bodyName;
             *  }
             *  return new RoR2.NetworkPlayerName
             *  {
             *      nameOverride = nameOverride,
             *      steamId = self.id.steamId
             *  };
             * }*/
            var     skinName = SkinFallbackName.Value;
            SkinDef skinDef;
            bool    isDefaultSkin = false;

            if (GetSkinName)
            {
                var body = self.GetCurrentBody();
                if (body)
                {
                    skinDef = SkinCatalog.FindCurrentSkinDefForBodyInstance(body.gameObject);
                    if (skinDef)
                    {
                        var skinDefs = SkinCatalog.FindSkinsForBody(body.bodyIndex);
                        skinName      = Language.GetString(skinDef.nameToken);
                        isDefaultSkin = skinDefs[0] == skinDef;
                    }
                }
                else
                {
                    if (self.bodyIndexPreference >= 0)
                    {
                        var skinDefs = SkinCatalog.FindSkinsForBody(self.bodyIndexPreference);
                        if (skinDefs != null)
                        {
                            if (self.localUser?.userProfile?.loadout?.bodyLoadoutManager != null)
                            {
                                int skinIndex = (int)self.localUser.userProfile.loadout.bodyLoadoutManager.GetSkinIndex(self.bodyIndexPreference);

                                var userSkinDef = skinDefs[skinIndex];
                                //var sksadinIndex = SkinCatalog.FindLocalSkinIndexForBody(self.bodyIndexPreference, userSkinDef);
                                skinName      = Language.GetString(userSkinDef.nameToken);
                                isDefaultSkin = skinDefs[0] == userSkinDef;
                            }
                        }
                    }
                }
                if (isDefaultSkin && ReplaceDefaultName)
                {
                    skinName = DefaultSkinNameOverride.Value;
                }
            }
            if (GetSkinName || GetBodyName)
            {
                nameOverride = "";
                if (GetSkinName)
                {
                    nameOverride = string.Format(SkinNameFormatting.Value, bodyName, skinName);
                }
                else if (GetBodyName)
                {
                    nameOverride = bodyName;
                }
            }

            if (self && self.id.steamId != null)
            {
                GetHost();
                if (GetHostID && self.id.steamId == HostSteamID)
                {
                    nameOverride = string.Format(hostFormattingString, nameOverride);
                }

                SteamID_to_DisplayName[self.id.steamId] = nameOverride;
            }

            return(new RoR2.NetworkPlayerName
            {
                nameOverride = nameOverride,
                steamId = self.id.steamId
            });
        }