public void RollItem() { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::RollItem()' called on client"); return; } if (dropPickup != PickupIndex.none) { 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); } }
public void BuildDropTable() { if (ItemDropManager.DefaultDrops) { // Setup default item lists DefaultItemDrops.AddDefaults(); } this.availableTier1DropList.Clear(); this.availableTier1DropList.AddRange(ItemDropManager.GetDefaultDropList(ItemTier.Tier1).Select(x => new PickupIndex(x)).ToList()); this.availableTier2DropList.Clear(); this.availableTier2DropList.AddRange(ItemDropManager.GetDefaultDropList(ItemTier.Tier2).Select(x => new PickupIndex(x)).ToList()); this.availableTier3DropList.Clear(); this.availableTier3DropList.AddRange(ItemDropManager.GetDefaultDropList(ItemTier.Tier3).Select(x => new PickupIndex(x)).ToList()); this.availableEquipmentDropList.Clear(); this.availableEquipmentDropList.AddRange(ItemDropManager.GetDefaultEquipmentDropList().Select(x => new PickupIndex(x)).ToList()); this.availableLunarDropList.Clear(); this.availableLunarDropList.AddRange(ItemDropManager.GetDefaultLunarDropList().Select(x => new PickupIndex(x)).ToList()); this.smallChestDropTierSelector.Clear(); this.smallChestDropTierSelector.AddChoice(this.availableTier1DropList, 0.8f); this.smallChestDropTierSelector.AddChoice(this.availableTier2DropList, 0.2f); this.smallChestDropTierSelector.AddChoice(this.availableTier3DropList, 0.01f); this.mediumChestDropTierSelector.Clear(); this.mediumChestDropTierSelector.AddChoice(this.availableTier2DropList, 0.8f); this.mediumChestDropTierSelector.AddChoice(this.availableTier3DropList, 0.2f); this.largeChestDropTierSelector.Clear(); }
public static void AddBossDefaultDrops() { ItemDropManager.IncludeSpecialBossDrops = true; var t2 = ItemDropManager.GetDefaultDropList(ItemTier.Tier2); ItemDropManager.AddDropInformation(ItemDropLocation.Boss, t2.ToSelection()); }
public void AddShrineStack(Interactor activator) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineChanceBehavior::AddShrineStack(RoR2.Interactor)' called on client"); return; } PickupIndex pickupIndex = ItemDropManager.GetSelection(ItemDropLocation.Shrine, 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" }); } Debug.Log(equipmentWeight); Debug.Log(failureWeight); Debug.Log(tier1Weight); Debug.Log(tier2Weight); Debug.Log(tier3Weight); 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); } }
public void RollEquipment() { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::RollEquipment()' called on client"); return; } this.dropPickup = ItemDropManager.GetSelection(ItemDropLocation.EquipmentChest, Run.instance.treasureRng.nextNormalizedFloat); }
public static void AddChestDefaultDrops() { var t1 = ItemDropManager.GetDefaultDropList(ItemTier.Tier1); var t2 = ItemDropManager.GetDefaultDropList(ItemTier.Tier2); var t3 = ItemDropManager.GetDefaultDropList(ItemTier.Tier3); var chestSelections = new List <PickupSelection> { t1.ToSelection(ItemDropManager.DefaultChestTier1DropChance), t2.ToSelection(ItemDropManager.DefaultChestTier2DropChance), t3.ToSelection(ItemDropManager.DefaultChestTier3DropChance), }; ItemDropManager.AddDropInformation(ItemDropLocation.SmallChest, chestSelections); ItemDropManager.AddDropInformation(ItemDropLocation.MediumChest, t2.ToSelection(0.8f), t3.ToSelection(0.2f)); ItemDropManager.AddDropInformation(ItemDropLocation.LargeChest, t3.ToSelection()); }
public static void AddDefaultShrineDrops() { var t1 = ItemDropManager.GetDefaultDropList(ItemTier.Tier1); var t2 = ItemDropManager.GetDefaultDropList(ItemTier.Tier2); var t3 = ItemDropManager.GetDefaultDropList(ItemTier.Tier3); var eq = ItemDropManager.GetDefaultEquipmentDropList(); var shrineSelections = new List <PickupSelection> { new List <ItemIndex> { ItemIndex.None }.ToSelection(ItemDropManager.DefaultShrineFailureWeight), t1.ToSelection(ItemDropManager.DefaultShrineTier1Weight), t2.ToSelection(ItemDropManager.DefaultShrineTier2Weight), t3.ToSelection(ItemDropManager.DefaultShrineTier3Weight), eq.ToSelection(ItemDropManager.DefaultShrineEquipmentWeight) }; ItemDropManager.AddDropInformation(ItemDropLocation.Shrine, shrineSelections); }
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); } } }
public static void AddEquipmentChestDefaultDrops() { var eq = ItemDropManager.GetDefaultEquipmentDropList(); ItemDropManager.AddDropInformation(ItemDropLocation.EquipmentChest, eq.ToSelection()); }