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 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); }
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); } } }