private static void Init() { GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport) { CharacterMaster characterMaster = damageReport.attackerMaster; if (characterMaster) { if (characterMaster.minionOwnership.ownerMaster) { characterMaster = characterMaster.minionOwnership.ownerMaster; } PlayerCharacterMasterController component = characterMaster.GetComponent <PlayerCharacterMasterController>(); if (component && Util.CheckRoll(1f * component.lunarCoinChanceMultiplier, 0f, null)) { PickupDropletController.CreatePickupDroplet(PickupIndex.Find("LunarCoin.Coin0"), damageReport.victim.transform.position, Vector3.up * 10f); component.lunarCoinChanceMultiplier *= 0.5f; } } }; }
private void EndCycleServer([CanBeNull] Interactor activator) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.RouletteChestController::EndCycleServer(RoR2.Interactor)' called on client"); return; } float b = 0f; NetworkUser networkUser; if (activator && (networkUser = Util.LookUpBodyNetworkUser(activator.gameObject)) != null) { b = RttManager.GetConnectionRTT(networkUser.connectionToClient); } Run.FixedTimeStamp time = Run.FixedTimeStamp.now - b - RouletteChestController.rewindTime; PickupIndex pickupIndexForTime = this.GetPickupIndexForTime(time); this.EjectPickupServer(pickupIndexForTime); this.activationTime = Run.FixedTimeStamp.positiveInfinity; this.onCycleCompletedServer.Invoke(); }
// Token: 0x060005FA RID: 1530 RVA: 0x00018A68 File Offset: 0x00016C68 private static bool IsPickupAllowedForMonsters(PickupIndex pickupIndex) { PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return(false); } ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (itemDef == null) { return(false); } for (int i = 0; i < ArenaMissionController.forbiddenTags.Length; i++) { if (itemDef.ContainsTag(ArenaMissionController.forbiddenTags[i])) { return(false); } } return(true); }
public void RollItem() { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::RollItem()' called on client"); return; } if (tier1Chance == 0.8f) { this.dropPickup = ItemDropManager.GetSelection(ItemDropLocation.SmallChest, Run.instance.treasureRng.nextNormalizedFloat); } else if (tier2Chance == 0.8f) { this.dropPickup = ItemDropManager.GetSelection(ItemDropLocation.MediumChest, Run.instance.treasureRng.nextNormalizedFloat); } else { this.dropPickup = ItemDropManager.GetSelection(ItemDropLocation.LargeChest, Run.instance.treasureRng.nextNormalizedFloat); } }
// Token: 0x060011C8 RID: 4552 RVA: 0x00057FEC File Offset: 0x000561EC private void CreateTerminals() { this.terminalGameObjects = new GameObject[this.terminalPositions.Length]; for (int i = 0; i < this.terminalPositions.Length; i++) { PickupIndex newPickupIndex = PickupIndex.none; switch (this.itemTier) { case ItemTier.Tier1: newPickupIndex = Run.instance.availableTier1DropList[Run.instance.treasureRng.RangeInt(0, Run.instance.availableTier1DropList.Count)]; break; case ItemTier.Tier2: newPickupIndex = Run.instance.availableTier2DropList[Run.instance.treasureRng.RangeInt(0, Run.instance.availableTier2DropList.Count)]; break; case ItemTier.Tier3: newPickupIndex = Run.instance.availableTier3DropList[Run.instance.treasureRng.RangeInt(0, Run.instance.availableTier3DropList.Count)]; break; case ItemTier.Lunar: newPickupIndex = Run.instance.availableLunarDropList[Run.instance.treasureRng.RangeInt(0, Run.instance.availableLunarDropList.Count)]; break; } bool newHidden = this.hideDisplayContent && Run.instance.treasureRng.nextNormalizedFloat < 0.2f; GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.terminalPrefab, this.terminalPositions[i].position, this.terminalPositions[i].rotation); this.terminalGameObjects[i] = gameObject; gameObject.GetComponent <ShopTerminalBehavior>().SetPickupIndex(newPickupIndex, newHidden); NetworkServer.Spawn(gameObject); } GameObject[] array = this.terminalGameObjects; for (int j = 0; j < array.Length; j++) { array[j].GetComponent <PurchaseInteraction>().onPurchase.AddListener(new UnityAction <Interactor>(this.DisableAllTerminals)); } }
private List <RoR2.PickupIndex> GetAvailablePickups() { float difference = (float)upperLevel.Value - (float)lowerLevel.Value; float chanceScaling = ((float)levelsSpent - (float)lowerLevel.Value) / (float)upperLevel.Value; if (levelsSpent <= lowerLevel.Value) { chanceScaling = 0; } if (chanceScaling > 1) { chanceScaling = 1; } float totalMinimum = lowerLevelTier1Weight.Value + lowerLevelTier2Weight.Value + lowerLevelTier3Weight.Value + lowerLevelLunarWeight.Value + lowerLevelEquipmentWeight.Value; float totalMaximum = upperLevelTier1Weight.Value + upperLevelTier2Weight.Value + upperLevelTier3Weight.Value + upperLevelLunarWeight.Value + upperLevelEquipmentWeight.Value; float totalDifference = (float)totalMaximum - (float)totalMinimum; float currentTotal = totalMinimum + (chanceScaling * totalDifference); List <RoR2.PickupIndex> RollPickupList() { float roll = UnityEngine.Random.Range(0, currentTotal); List <RoR2.PickupIndex> dropList = new List <RoR2.PickupIndex>(); float checkLevel = 0; checkLevel += lowerLevelTier1Weight.Value + (chanceScaling * (upperLevelTier1Weight.Value - lowerLevelTier1Weight.Value)); if (roll <= checkLevel) { dropList.AddRange(RoR2.Run.instance.availableTier1DropList); return(dropList); } checkLevel += lowerLevelTier2Weight.Value + (chanceScaling * (upperLevelTier2Weight.Value - lowerLevelTier2Weight.Value)); if (roll <= checkLevel) { dropList.AddRange(RoR2.Run.instance.availableTier2DropList); return(dropList); } checkLevel += lowerLevelTier3Weight.Value + (chanceScaling * (upperLevelTier3Weight.Value - lowerLevelTier3Weight.Value)); if (roll <= checkLevel) { dropList.AddRange(RoR2.Run.instance.availableTier3DropList); return(dropList); } checkLevel += lowerLevelLunarWeight.Value + (chanceScaling * (upperLevelLunarWeight.Value - lowerLevelLunarWeight.Value)); if (roll <= checkLevel) { dropList.AddRange(RoR2.Run.instance.availableLunarDropList); return(dropList); } checkLevel += lowerLevelEquipmentWeight.Value + (chanceScaling * (upperLevelEquipmentWeight.Value - lowerLevelEquipmentWeight.Value)); if (roll <= checkLevel) { dropList.AddRange(RoR2.Run.instance.availableEquipmentDropList); return(dropList); } else { return(dropList); } } RoR2.PickupIndex RandomFromList(List <RoR2.PickupIndex> list) { int selection = Mathf.RoundToInt((UnityEngine.Random.Range(0, list.Count - 1))); if (selection < 0) { selection = 0; } RoR2.PickupIndex selectedPickup = list[selection]; return(selectedPickup); } List <RoR2.PickupIndex> selectedPickups = new List <RoR2.PickupIndex>(); while (selectedPickups.Count < 3) { List <RoR2.PickupIndex> tierList = RollPickupList(); RoR2.PickupIndex attemptedPickup = RandomFromList(tierList); for (int i = 0; i <= selectedPickups.Count - 1; i++) { if (attemptedPickup.itemIndex == selectedPickups[i].itemIndex) { attemptedPickup = RandomFromList(tierList); } } selectedPickups.Add(attemptedPickup); } return(selectedPickups); }
private void OnCharacterDeathCallback(DamageReport damageReport) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.BossGroup::OnCharacterDeathCallback(RoR2.DamageReport)' called on client"); return; } DamageInfo damageInfo = damageReport.damageInfo; GameObject gameObject = damageReport.victim.gameObject; CharacterBody component = gameObject.GetComponent <CharacterBody>(); if (!component) { return; } CharacterMaster master = component.master; if (!master) { return; } DeathRewards component2 = gameObject.GetComponent <DeathRewards>(); if (component2) { PickupIndex pickupIndex = (PickupIndex)component2.bossPickup; if (pickupIndex != PickupIndex.none && ItemDropManager.IncludeSpecialBossDrops) { this.bossDrops.Add(pickupIndex); } } GameObject victimMasterGameObject = master.gameObject; int num = this.membersList.FindIndex((CharacterMaster x) => x.gameObject == victimMasterGameObject); if (num >= 0) { this.RemoveMemberAt(num); if (!this.defeated && this.membersList.Count == 0) { Run.instance.OnServerBossKilled(true); if (component) { int participatingPlayerCount = Run.instance.participatingPlayerCount; if (participatingPlayerCount != 0 && this.dropPosition) { //ItemIndex itemIndex = ItemDropManager.BossDropList[this.rng.RangeInt(0, ItemDropManager.BossDropList.Count)]; ItemIndex itemIndex = ItemDropManager.GetSelection(ItemDropLocation.Boss, rng.nextNormalizedFloat).itemIndex; int num2 = participatingPlayerCount * (1 + (TeleporterInteraction.instance ? TeleporterInteraction.instance.shrineBonusStacks : 0)); float angle = 360f / (float)num2; Vector3 vector = Quaternion.AngleAxis((float)UnityEngine.Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f); Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.up); int i = 0; while (i < num2) { PickupIndex pickupIndex2 = new PickupIndex(itemIndex); if (this.bossDrops.Count > 0 && this.rng.nextNormalizedFloat <= this.bossDropChance) { pickupIndex2 = this.bossDrops[this.rng.RangeInt(0, this.bossDrops.Count)]; } PickupDropletController.CreatePickupDroplet(pickupIndex2, this.dropPosition.position, vector); i++; vector = rotation * vector; } } } this.defeated = true; Action <BossGroup> action = onBossGroupDefeatedServer; if (action == null) { return; } action(this); return; } else { Run.instance.OnServerBossKilled(false); } } }
// Token: 0x06000378 RID: 888 RVA: 0x0000D90A File Offset: 0x0000BB0A public static PickupIndex ReadPickupIndex(this NetworkReader reader) { return(PickupIndex.ReadFromNetworkReader(reader)); }
// Token: 0x06000377 RID: 887 RVA: 0x0000D901 File Offset: 0x0000BB01 public static void Write(this NetworkWriter writer, PickupIndex value) { PickupIndex.WriteToNetworkWriter(writer, value); }
private static void HandlePickupMessage(NetworkMessage netMsg) { Debug.Log("GenericPickupController.HandlePickupMessage: Received pickup message."); ReadOnlyCollection <NotificationQueue> readOnlyInstancesList = NotificationQueue.readOnlyInstancesList; GenericPickupController.PickupMessage pickupMessage = GenericPickupController.pickupMessageInstance; netMsg.ReadMessage <GenericPickupController.PickupMessage>(pickupMessage); GameObject masterGameObject = pickupMessage.masterGameObject; PickupIndex pickupIndex = pickupMessage.pickupIndex; uint pickupQuantity = pickupMessage.pickupQuantity; pickupMessage.Reset(); if (!masterGameObject) { Debug.Log("GenericPickupController.HandlePickupMessage: failed! masterObject is not valid."); return; } CharacterMaster component = masterGameObject.GetComponent <CharacterMaster>(); if (!component) { Debug.Log("GenericPickupController.HandlePickupMessage: failed! master component is not valid."); return; } PlayerCharacterMasterController component2 = component.GetComponent <PlayerCharacterMasterController>(); if (component2) { NetworkUser networkUser = component2.networkUser; if (networkUser) { LocalUser localUser = networkUser.localUser; if (localUser != null) { localUser.userProfile.DiscoverPickup(pickupIndex); } } } for (int i = 0; i < readOnlyInstancesList.Count; i++) { readOnlyInstancesList[i].OnPickup(component, pickupIndex); } CharacterBody body = component.GetBody(); if (!body) { Debug.Log("GenericPickupController.HandlePickupMessage: failed! characterBody is not valid."); } ItemDef itemDef = ItemCatalog.GetItemDef(pickupIndex.itemIndex); if (itemDef != null && itemDef.hidden) { Debug.LogFormat("GenericPickupController.HandlePickupMessage: skipped item {0}, marked hidden.", new object[] { itemDef.nameToken }); return; } Chat.AddPickupMessage(body, pickupIndex.GetPickupNameToken(), pickupIndex.GetPickupColor(), pickupQuantity); if (body) { Util.PlaySound("Play_UI_item_pickup", body.gameObject); } }
private static void YellowDrops(On.RoR2.PickupDropletController.orig_CreatePickupDroplet orig, RoR2.PickupIndex pickupIndex, Vector3 position, Vector3 velocity) { for (int i = 0; i < NewDefsList.Count; i++) { if (pickupIndex == PickupCatalog.FindPickupIndex(OldDefsList[i].equipmentIndex)) { if (NewDefsList[i] != null) { pickupIndex = PickupCatalog.FindPickupIndex(NewDefsList[i].itemIndex); } } } orig(pickupIndex, position, velocity); }
// Token: 0x06001327 RID: 4903 RVA: 0x000520FA File Offset: 0x000502FA private void OnSyncPickupIndex(PickupIndex newPickupIndex) { this.SetPickupIndex(newPickupIndex, this.hidden); }
public void SetDropPickup(ItemIndex itemIndex) { dropPickup = new PickupIndex(itemIndex); }
public void SetDropPickup(EquipmentIndex equipmentIndex) { dropPickup = new PickupIndex(equipmentIndex); }
public void AddShrineStack(Interactor activator) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineChanceBehavior::AddShrineStack(RoR2.Interactor)' called on client"); return; } PickupIndex none = PickupIndex.none; PickupIndex value = Run.instance.availableTier1DropList[this.rng.RangeInt(0, Run.instance.availableTier1DropList.Count)]; PickupIndex value2 = Run.instance.availableTier2DropList[this.rng.RangeInt(0, Run.instance.availableTier2DropList.Count)]; PickupIndex value3 = Run.instance.availableTier3DropList[this.rng.RangeInt(0, Run.instance.availableTier3DropList.Count)]; PickupIndex value4 = Run.instance.availableEquipmentDropList[this.rng.RangeInt(0, Run.instance.availableEquipmentDropList.Count)]; WeightedSelection <PickupIndex> weightedSelection = new WeightedSelection <PickupIndex>(8); weightedSelection.AddChoice(none, this.failureWeight); weightedSelection.AddChoice(value, this.tier1Weight); weightedSelection.AddChoice(value2, this.tier2Weight); weightedSelection.AddChoice(value3, this.tier3Weight); weightedSelection.AddChoice(value4, this.equipmentWeight); PickupIndex pickupIndex = weightedSelection.Evaluate(this.rng.nextNormalizedFloat); bool flag = pickupIndex == PickupIndex.none; if (flag) { Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage { subjectCharacterBodyGameObject = activator.gameObject, baseToken = "SHRINE_CHANCE_FAIL_MESSAGE" }); } else { this.successfulPurchaseCount++; PickupDropletController.CreatePickupDroplet(pickupIndex, this.dropletOrigin.position, this.dropletOrigin.forward * 20f); Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage { subjectCharacterBodyGameObject = activator.gameObject, baseToken = "SHRINE_CHANCE_SUCCESS_MESSAGE" }); } Chat.SendBroadcastChat(new Chat.UserChatMessage { sender = activator.gameObject, text = "Anyone want this?" }); Action <bool, Interactor> action = onShrineChancePurchaseGlobal; if (action != null) { action(flag, activator); } this.waitingForRefresh = true; this.refreshTimer = 2f; EffectManager.instance.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData { origin = base.transform.position, rotation = Quaternion.identity, scale = 1f, color = this.shrineColor }, true); if (this.successfulPurchaseCount >= this.maxPurchaseCount) { this.symbolTransform.gameObject.SetActive(false); } }
// Token: 0x06000B48 RID: 2888 RVA: 0x00031B15 File Offset: 0x0002FD15 private void SyncPickupIndex(PickupIndex newPickupIndex) { this.NetworkpickupIndex = newPickupIndex; this.UpdatePickupDisplay(); }
// Token: 0x06001808 RID: 6152 RVA: 0x00068AFB File Offset: 0x00066CFB public static PickupDef GetPickupDef(PickupIndex pickupIndex) { return(HGArrayUtilities.GetSafe <PickupDef>(PickupCatalog.entries, pickupIndex.value)); }