public void GrantUnlock(Interactor interactor) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.BlueprintTerminal::GrantUnlock(RoR2.Interactor)' called on client"); return; } this.SetHasBeenPurchased(true); string unlockableName = this.unlockableOptions[this.unlockableChoice].unlockableName; EffectManager.SpawnEffect(this.unlockEffect, new EffectData { origin = base.transform.position }, true); if (Run.instance) { Util.PlaySound(this.unlockSoundString, interactor.gameObject); CharacterBody component = interactor.GetComponent <CharacterBody>(); Run.instance.GrantUnlockToSinglePlayer(unlockableName, component); string pickupToken = "???"; UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableName); if (unlockableDef != null) { pickupToken = unlockableDef.nameToken; } Chat.SendBroadcastChat(new Chat.PlayerPickupChatMessage { subjectAsCharacterBody = component, baseToken = "PLAYER_PICKUP", pickupToken = pickupToken, pickupColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Unlockable), pickupQuantity = 1U }); } }
private void RecalculateModifierAvailability() { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.PreGameController::RecalculateModifierAvailability()' called on client"); return; } for (int i = 0; i < RuleCatalog.choiceCount; i++) { RuleChoiceDef choiceDef = RuleCatalog.GetChoiceDef(i); bool flag = string.IsNullOrEmpty(choiceDef.unlockableName); if (!flag) { UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(choiceDef.unlockableName); if (unlockableDef != null) { flag = PreGameController.AnyUserHasUnlockable(unlockableDef); } } this.unlockedChoiceMask[i] = flag; } this.ResolveChoiceMask(); Action <PreGameController> action = PreGameController.onServerRecalculatedModifierAvailability; if (action == null) { return; } action(this); }
public void GrantUnlock(Interactor interactor) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.RadiotowerTerminal::GrantUnlock(RoR2.Interactor)' called on client"); return; } EffectManager.instance.SpawnEffect(this.unlockEffect, new EffectData { origin = base.transform.position }, true); this.SetHasBeenPurchased(true); if (Run.instance) { Util.PlaySound(this.unlockSoundString, interactor.gameObject); Run.instance.GrantUnlockToAllParticipatingPlayers(this.unlockableName); string pickupToken = "???"; UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(this.unlockableName); if (unlockableDef != null) { pickupToken = unlockableDef.nameToken; } Chat.SendBroadcastChat(new Chat.PlayerPickupChatMessage { subjectCharacterBodyGameObject = interactor.gameObject, baseToken = "PLAYER_PICKUP", pickupToken = pickupToken, pickupColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Unlockable), pickupQuantity = 1u }); } }
// Token: 0x06000B81 RID: 2945 RVA: 0x0004C07C File Offset: 0x0004A27C private void Awake() { this.unlockableProgressionDefs = new UnlockableDef[this.unlockableProgression.Length]; for (int i = 0; i < this.unlockableProgressionDefs.Length; i++) { this.unlockableProgressionDefs[i] = UnlockableCatalog.GetUnlockableDef(this.unlockableProgression[i]); } }
// Token: 0x06001B2E RID: 6958 RVA: 0x00073E9C File Offset: 0x0007209C public static int GetUnlockableSortScore(string unlockableName) { UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableName); if (unlockableDef == null) { return(0); } return(unlockableDef.sortScore); }
public void CmdReportUnlock(UnlockableIndex unlockIndex) { Debug.LogFormat("NetworkUser.CmdReportUnlock({0})", new object[] { unlockIndex }); UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockIndex); if (unlockableDef != null) { this.ServerHandleUnlock(unlockableDef); } }
// Token: 0x06000B85 RID: 2949 RVA: 0x0004C150 File Offset: 0x0004A350 private static bool ActivatorHasUnlockable(Interactor activator, string unlockableName) { NetworkUser networkUser = Util.LookUpBodyNetworkUser(activator.gameObject); if (!networkUser) { return(true); } LocalUser localUser = networkUser.localUser; if (localUser != null) { return(localUser.userProfile.HasUnlockable(unlockableName)); } return(networkUser.unlockables.Contains(UnlockableCatalog.GetUnlockableDef(unlockableName))); }
// Token: 0x06001B91 RID: 7057 RVA: 0x00081100 File Offset: 0x0007F300 private static int GuessUnlockableSortScore(string unlockableName) { int num = 0; UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableName); if (unlockableDef == null) { return(num); } num += 200; ItemDef itemDef = ItemCatalog.allItems.Select(new Func <ItemIndex, ItemDef>(ItemCatalog.GetItemDef)).FirstOrDefault((ItemDef v) => v.unlockableName == unlockableDef.name); if (itemDef != null) { return((int)(num + itemDef.tier)); } num += 200; EquipmentDef equipmentDef = EquipmentCatalog.allEquipment.Select(new Func <EquipmentIndex, EquipmentDef>(EquipmentCatalog.GetEquipmentDef)).FirstOrDefault((EquipmentDef v) => v.unlockableName == unlockableDef.name); if (equipmentDef != null) { if (equipmentDef.isBoss) { return(num + 1); } if (equipmentDef.isLunar) { return(num - 1); } return(num); } else { num += 200; if (SurvivorCatalog.allSurvivorDefs.FirstOrDefault((SurvivorDef v) => v.unlockableName == unlockableDef.name) != null) { return(num); } return(num + 200); } }
// Token: 0x06000674 RID: 1652 RVA: 0x0001A624 File Offset: 0x00018824 private void Rebuild() { BlueprintTerminal.UnlockableOption unlockableOption = this.unlockableOptions[this.unlockableChoice]; if (this.displayInstance) { UnityEngine.Object.Destroy(this.displayInstance); } this.displayBaseTransform.gameObject.SetActive(!this.hasBeenPurchased); if (!this.hasBeenPurchased && this.displayBaseTransform) { Debug.Log("Found base"); UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableOption.unlockableName); if (unlockableDef != null) { Debug.Log("Found unlockable"); GameObject gameObject = Resources.Load <GameObject>(unlockableDef.displayModelPath); if (gameObject) { Debug.Log("Found prefab"); this.displayInstance = UnityEngine.Object.Instantiate <GameObject>(gameObject, this.displayBaseTransform.position, this.displayBaseTransform.transform.rotation, this.displayBaseTransform); Renderer componentInChildren = this.displayInstance.GetComponentInChildren <Renderer>(); float num = 1f; if (componentInChildren) { this.displayInstance.transform.rotation = Quaternion.identity; Vector3 size = componentInChildren.bounds.size; float f = size.x * size.y * size.z; num *= Mathf.Pow(this.idealDisplayVolume, 0.33333334f) / Mathf.Pow(f, 0.33333334f); } this.displayInstance.transform.localScale = new Vector3(num, num, num); } } } PurchaseInteraction component = base.GetComponent <PurchaseInteraction>(); if (component) { component.Networkcost = unlockableOption.cost; } }
private void CmdSendNewUnlockables(UnlockableIndex[] newUnlockableIndices) { this.unlockables.Clear(); this.debugUnlockablesList.Clear(); int i = 0; int num = newUnlockableIndices.Length; while (i < num) { UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(newUnlockableIndices[i]); if (unlockableDef != null) { this.unlockables.Add(unlockableDef); this.debugUnlockablesList.Add(unlockableDef.name); } i++; } NetworkUser.NetworkUserGenericDelegate onNetworkUserUnlockablesUpdated = NetworkUser.OnNetworkUserUnlockablesUpdated; if (onNetworkUserUnlockablesUpdated == null) { return; } onNetworkUserUnlockablesUpdated(this); }
// Token: 0x06001730 RID: 5936 RVA: 0x0006E220 File Offset: 0x0006C420 private void GrantPickup(GameObject activator) { if (Run.instance) { Util.PlaySound(UnlockPickup.itemPickupSoundString, activator); Run.instance.GrantUnlockToAllParticipatingPlayers(this.unlockableName); string pickupToken = "???"; UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(this.unlockableName); if (unlockableDef != null) { pickupToken = unlockableDef.nameToken; } Chat.SendBroadcastChat(new Chat.PlayerPickupChatMessage { subjectCharacterBodyGameObject = activator, baseToken = "PLAYER_PICKUP", pickupToken = pickupToken, pickupColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Unlockable), pickupQuantity = 1u }); this.consumed = true; UnityEngine.Object.Destroy(base.transform.root.gameObject); } }
// Token: 0x0600038F RID: 911 RVA: 0x0000DB78 File Offset: 0x0000BD78 public static void CollectAchievementDefs(Dictionary <string, AchievementDef> map) { List <AchievementDef> list = new List <AchievementDef>(); map.Clear(); foreach (Type type2 in from type in typeof(BaseAchievement).Assembly.GetTypes() where type.IsSubclassOf(typeof(BaseAchievement)) orderby type.Name select type) { RegisterAchievementAttribute registerAchievementAttribute = (RegisterAchievementAttribute)type2.GetCustomAttributes(false).FirstOrDefault((object v) => v is RegisterAchievementAttribute); if (registerAchievementAttribute != null) { if (map.ContainsKey(registerAchievementAttribute.identifier)) { Debug.LogErrorFormat("Class {0} attempted to register as achievement {1}, but class {2} has already registered as that achievement.", new object[] { type2.FullName, registerAchievementAttribute.identifier, AchievementManager.achievementNamesToDefs[registerAchievementAttribute.identifier].type.FullName }); } else { AchievementDef achievementDef = new AchievementDef { identifier = registerAchievementAttribute.identifier, unlockableRewardIdentifier = registerAchievementAttribute.unlockableRewardIdentifier, prerequisiteAchievementIdentifier = registerAchievementAttribute.prerequisiteAchievementIdentifier, nameToken = "ACHIEVEMENT_" + registerAchievementAttribute.identifier.ToUpper(CultureInfo.InvariantCulture) + "_NAME", descriptionToken = "ACHIEVEMENT_" + registerAchievementAttribute.identifier.ToUpper(CultureInfo.InvariantCulture) + "_DESCRIPTION", iconPath = "Textures/AchievementIcons/tex" + registerAchievementAttribute.identifier + "Icon", type = type2, serverTrackerType = registerAchievementAttribute.serverTrackerType }; AchievementManager.achievementIdentifiers.Add(registerAchievementAttribute.identifier); map.Add(registerAchievementAttribute.identifier, achievementDef); list.Add(achievementDef); UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(achievementDef.unlockableRewardIdentifier); if (unlockableDef != null) { unlockableDef.getHowToUnlockString = (() => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[] { Language.GetString(achievementDef.nameToken), Language.GetString(achievementDef.descriptionToken) })); unlockableDef.getUnlockedString = (() => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[] { unlockableDef.getHowToUnlockString() })); } } } } AchievementManager.achievementDefs = list.ToArray(); AchievementManager.SortAchievements(AchievementManager.achievementDefs); AchievementManager.serverAchievementDefs = (from achievementDef in AchievementManager.achievementDefs where achievementDef.serverTrackerType != null select achievementDef).ToArray <AchievementDef>(); for (int i = 0; i < AchievementManager.achievementDefs.Length; i++) { AchievementManager.achievementDefs[i].index = new AchievementIndex { intValue = i }; } for (int j = 0; j < AchievementManager.serverAchievementDefs.Length; j++) { AchievementManager.serverAchievementDefs[j].serverIndex = new ServerAchievementIndex { intValue = j }; } for (int k = 0; k < AchievementManager.achievementIdentifiers.Count; k++) { string currentAchievementIdentifier = AchievementManager.achievementIdentifiers[k]; map[currentAchievementIdentifier].childAchievementIdentifiers = (from v in AchievementManager.achievementIdentifiers where map[v].prerequisiteAchievementIdentifier == currentAchievementIdentifier select v).ToArray <string>(); } Action action = AchievementManager.onAchievementsRegistered; if (action == null) { return; } action(); }