public override bool OnUse(EquipmentSlot equipmentSlot) { MysticsRisky2UtilsEquipmentTarget targetInfo = equipmentSlot.GetComponent <MysticsRisky2UtilsEquipmentTarget>(); if (targetInfo) { if (targetInfo.obj) { PurchaseInteraction purchaseInteraction = targetInfo.obj.GetComponent <MysticsItemsDuplicatorLocator>().purchaseInteraction; purchaseInteraction.SetAvailable(false); purchaseInteraction.lockGameObject = null; ShopTerminalBehavior shopTerminalBehavior = targetInfo.obj.GetComponent <MysticsItemsDuplicatorLocator>().shopTerminalBehavior; EffectManager.SimpleEffect(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniRecycleEffect"), shopTerminalBehavior.pickupDisplay.transform.position, Quaternion.identity, true); shopTerminalBehavior.SetHasBeenPurchased(true); for (var i = 0; i < amount; i++) { PickupDropletController.CreatePickupDroplet( shopTerminalBehavior.pickupIndex, (shopTerminalBehavior.dropTransform ? shopTerminalBehavior.dropTransform : shopTerminalBehavior.transform).position, shopTerminalBehavior.transform.TransformVector(shopTerminalBehavior.dropVelocity) ); } shopTerminalBehavior.SetNoPickup(); targetInfo.Invalidate(); return(true); } } return(false); }
public static string PurchasableMessage(PurchaseInteraction PI) { string displayName = $"{PI.GetDisplayName()}"; string cost = PI.GetTextFromPurchasableType(); string costColor = PI.GetColorFromPurchasableType(); if (PI.InteractableIsUsedUp()) { if (PI.IsContainer()) { cost = "Opened"; } else if (PI.IsShrine()) { cost = "Used"; } else { cost = "Unavailable"; } costColor = RoR2Colors.Tier1ItemDark; } string message = $"<color={RoR2Colors.Tier1ItemDark}>{displayName}:</color> <color={costColor}>{cost}</color>"; return(message); }
public void Start() { RoR2.EntityLogic.DelayedEvent delayedEvent = GetComponent <RoR2.EntityLogic.DelayedEvent>(); delayedEvent.action = new UnityEvent(); delayedEvent.action.AddListener(() => { AddShrineStack(purchaseInteraction.lastActivator); }); delayedEvent.timeStepType = RoR2.EntityLogic.DelayedEvent.TimeStepType.FixedTime; purchaseInteraction = GetComponent <PurchaseInteraction>(); purchaseInteraction.onPurchase.AddListener((interactor) => { purchaseInteraction.SetAvailable(false); delayedEvent.CallDelayed(1.5f); }); availableItems = new List <ItemIndex>(); if (NetworkServer.active) { rng = new Xoroshiro128Plus(Run.instance.stageRng.nextUlong); foreach (PickupIndex pickupIndex in Run.instance.availableTier3DropList) { availableItems.Add(PickupCatalog.GetPickupDef(pickupIndex).itemIndex); } } }
// Token: 0x06003156 RID: 12630 RVA: 0x000D45DC File Offset: 0x000D27DC public virtual void OnImpactServer(Vector3 contactPoint) { string text = BodyCatalog.GetBodyName(base.characterBody.bodyIndex); text = text.Replace("Body", ""); text = "iscBroken" + text; SpawnCard spawnCard = Resources.Load <SpawnCard>("SpawnCards/InteractableSpawnCard/" + text); if (spawnCard != null) { DirectorPlacementRule placementRule = new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Direct, position = contactPoint }; GameObject gameObject = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(spawnCard, placementRule, new Xoroshiro128Plus(0UL))); if (gameObject) { PurchaseInteraction component = gameObject.GetComponent <PurchaseInteraction>(); if (component && component.costType == CostTypeIndex.Money) { component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost); } } } }
public void Awake() { PurchaseInteraction purchaseInteraction = GetComponent <PurchaseInteraction>(); purchaseInteraction.onPurchase = new PurchaseEvent(); purchaseInteraction.onPurchase.AddListener((interactor) => { if (OnUnlock != null) { OnUnlock(interactor); } CharacterBody body = interactor.GetComponent <CharacterBody>(); if (body) { Inventory inventory = body.inventory; if (inventory) { inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_Spotter); GenericPickupController.PickupMessage msg = new GenericPickupController.PickupMessage { masterGameObject = body.master.gameObject, pickupIndex = PickupCatalog.FindPickupIndex(MysticsItemsContent.Items.MysticsItems_Spotter.itemIndex), pickupQuantity = 1u }; NetworkServer.SendByChannelToAll(57, msg, QosChannelIndex.chat.intVal); } } PointSoundManager.EmitSoundServer(repairSoundEventDef.index, transform.position); }); }
// Token: 0x06000606 RID: 1542 RVA: 0x0001BC5C File Offset: 0x00019E5C protected void SetReady(bool ready) { Transform modelTransform = base.GetModelTransform(); if (modelTransform) { PrintController component = modelTransform.GetComponent <PrintController>(); component.paused = !ready; if (!ready) { component.age = 0f; } ChildLocator component2 = modelTransform.GetComponent <ChildLocator>(); if (component2) { component2.FindChild("Purchased").gameObject.SetActive(ready); } } PurchaseInteraction component3 = base.GetComponent <PurchaseInteraction>(); if (component3) { component3.SetAvailable(!ready); } HologramProjector component4 = base.GetComponent <HologramProjector>(); if (component4) { component4.hologramPivot.gameObject.SetActive(!ready); } }
public void Awake() { purchaseInteraction = GetComponent <PurchaseInteraction>(); purchaseInteraction.onPurchase.AddListener((interactor) => { AddShrineStack(interactor); }); }
/// <summary> /// Adds text labels for various interactables to a <see cref="PingIndicator"/> /// </summary> /// <param name="pingIndicator">Target <see cref="PingIndicator"/> that should have the text added</param> private static void AddLootText(RoR2.UI.PingIndicator pingIndicator) { const string textStart = "<size=70%>\n"; string price = GetPrice(pingIndicator.pingTarget); ShopTerminalBehavior shopTerminal = pingIndicator.pingTarget.GetComponent <ShopTerminalBehavior>(); if (shopTerminal && _config.ShowShopText.Value) { string text = textStart; PickupIndex pickupIndex = shopTerminal.CurrentPickupIndex(); PickupDef pickup = PickupCatalog.GetPickupDef(pickupIndex); text += shopTerminal.pickupIndexIsHidden ? "?" : $"{Language.GetString(pickup.nameToken)}"; pingIndicator.pingText.text += $"{text} ({price})"; return; } GenericPickupController pickupController = pingIndicator.pingTarget.GetComponent <GenericPickupController>(); if (pickupController && _config.ShowPickupText.Value) { PickupDef pickup = PickupCatalog.GetPickupDef(pickupController.pickupIndex); pingIndicator.pingText.text += $"{textStart}{Language.GetString(pickup.nameToken)}"; } ChestBehavior chest = pingIndicator.pingTarget.GetComponent <ChestBehavior>(); if (chest && _config.ShowChestText.Value) { pingIndicator.pingText.text += $"{textStart}{Util.GetBestBodyName(pingIndicator.pingTarget)} ({price})"; return; } string name = ""; PurchaseInteraction purchaseInteraction = pingIndicator.pingTarget.GetComponent <PurchaseInteraction>(); if (purchaseInteraction) { name = Language.GetString(purchaseInteraction.displayNameToken); } // Drones SummonMasterBehavior summonMaster = pingIndicator.pingTarget.GetComponent <SummonMasterBehavior>(); if (summonMaster && _config.ShowDroneText.Value) { pingIndicator.pingText.text += $"{textStart}{name} ({price})"; return; } if (_config.ShowShrineText.Value) { pingIndicator.pingText.text += $"{textStart}{name}"; } }
/// <summary> /// A method that can be overridden to add or change the logic when the interactable is spawned. /// Default logic is to compute for the scaled cost of the drone. /// </summary> protected virtual void OnInteractableSpawn(GameObject spawnedObject) { PurchaseInteraction purchaseInteraction = spawnedObject.GetComponent <PurchaseInteraction>(); if (purchaseInteraction && purchaseInteraction.costType == CostTypeIndex.Money) { purchaseInteraction.Networkcost = Run.instance.GetDifficultyScaledCost(purchaseInteraction.cost); } }
private static void OnShopPurchase(On.RoR2.PurchaseInteraction.orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (!self.CanBeAffordedByInteractor(activator)) { return; } #region Sharedmoney if (ShareSuite.MoneyIsShared.Value) { switch (self.costType) { case CostTypeIndex.Money: { // Remove money from shared money pool orig(self, activator); SharedMoneyValue -= self.cost; return; } case CostTypeIndex.PercentHealth: { // Share the damage taken from a sacrifice // as it generates shared money orig(self, activator); var teamMaxHealth = 0; foreach (var playerCharacterMasterController in PlayerCharacterMasterController.instances) { var charMaxHealth = playerCharacterMasterController.master.GetBody().maxHealth; if (charMaxHealth > teamMaxHealth) { teamMaxHealth = (int)charMaxHealth; } } var purchaseInteraction = self.GetComponent <PurchaseInteraction>(); var shrineBloodBehavior = self.GetComponent <ShrineBloodBehavior>(); var amount = (uint)(teamMaxHealth * purchaseInteraction.cost / 100.0 * shrineBloodBehavior.goldToPaidHpRatio); if (ShareSuite.MoneyScalarEnabled.Value) { amount *= (uint)ShareSuite.MoneyScalar.Value; } SharedMoneyValue += (int)amount; return; } } } orig(self, activator); #endregion }
/// <summary> /// Method to get the interactable tier color from a ping target /// </summary> /// <param name="gameObject">The ping target</param> /// <returns>An Color instance of the tier color</returns> private Color GetTargetTierColor(GameObject gameObject) { Color color = Color.black; ShopTerminalBehavior shopTerminal = gameObject.GetComponent <ShopTerminalBehavior>(); if (shopTerminal) { PickupIndex pickupIndex = shopTerminal.CurrentPickupIndex(); PickupDef pickup = PickupCatalog.GetPickupDef(pickupIndex); if (pickup != null) { color = pickup.baseColor; } } GenericPickupController pickupController = gameObject.GetComponent <GenericPickupController>(); if (pickupController) { PickupDef pickup = PickupCatalog.GetPickupDef(pickupController.pickupIndex); if (pickup != null) { color = pickup.baseColor; } } PurchaseInteraction purchaseInteraction = gameObject.GetComponent <PurchaseInteraction>(); if (purchaseInteraction) { CostTypeDef costType = CostTypeCatalog.GetCostTypeDef(purchaseInteraction.costType); color = ColorCatalog.GetColor(costType.colorIndex); } PickupIndexNetworker pickupIndexNetworker = gameObject.GetComponent <PickupIndexNetworker>(); if (pickupIndexNetworker) { PickupDef pickup = PickupCatalog.GetPickupDef(pickupIndexNetworker.NetworkpickupIndex); if (pickup != null) { color = pickup.baseColor; } } if (color == Color.black) { color = _colors["InteractablePingColor"]; } return(color); }
public FanData(PurchaseInteraction fan) { var jumpVolume = fan.GetComponentInChildren <JumpVolume>(true); transform = new SerializableTransform(fan.transform); cost = fan.cost; available = fan.available; jumpVelocity = new SerializableVector3(jumpVolume.jumpVelocity); }
/* * protected override bool ActivateEquipment(EquipmentSlot slot) * { * //Hacking Main State * SphereSearch sphereSearch = new SphereSearch * { * origin = slot.characterBody.footPosition, * mask = LayerIndex.CommonMasks.interactable, * queryTriggerInteraction = QueryTriggerInteraction.Collide, * radius = 3f * }; * * List<Collider> list = CollectionPool<Collider, List<Collider>>.RentCollection(); * sphereSearch.ClearCandidates(); * sphereSearch.RefreshCandidates(); * sphereSearch.FilterCandidatesByColliderEntities(); * sphereSearch.OrderCandidatesByDistance(); * sphereSearch.FilterCandidatesByDistinctColliderEntities(); * sphereSearch.GetColliders(list); * PurchaseInteraction result = null; * int i = 0; * int count = list.Count; * int keyAmount = 0; * while (i < count) * { * PurchaseInteraction component = list[i].GetComponent<EntityLocator>().entity.GetComponent<PurchaseInteraction>(); * if (EntityStates.CaptainSupplyDrop.HackingMainState.PurchaseInteractionIsValidTarget(component)) * { * switch (component.displayNameToken) * { * case "CHEST1_NAME": * case "CHEST1_STEALTHED_NAME": * keyAmount = cfgNormalKeys.Value; * break; * case "CHEST2_NAME": * keyAmount = cfgMediumKeys.Value; * break; * case "GOLDCHEST_NAME": * keyAmount = cfgLegendaryKeys.Value; * break; * default: * continue; * }; * result = component; * break; * } * i++; * } * CollectionPool<Collider, List<Collider>>.ReturnCollection(list); * * ScrapChest(result, keyAmount); * * * return false; * } */ private void ScrapChest(PurchaseInteraction purchaseInteraction, int keyAmount) { purchaseInteraction.SetAvailable(false); PickupIndex pickupIndex2 = PickupCatalog.FindPickupIndex(RoR2Content.Items.TreasureCache.itemIndex); for (int i = 0; i < keyAmount; i++) { PickupDropletController.CreatePickupDroplet(pickupIndex2, purchaseInteraction.transform.position, Vector3.up * i); } }
private void UpdateShrineDisplay(ShrineHealingBehavior self) { if (RoR2.SceneInfo.instance.sceneDef.stageOrder != 5) { return; } PurchaseInteraction pi = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction"); pi.costType = CostTypeIndex.Money; pi.cost = GetDifficultyScaledCost(ResurrectionCost);//clientCost*useCount; }
public void Awake() { purchaseInteraction = GetComponent <PurchaseInteraction>(); purchaseInteraction.costType = CostTypes.getCostTypeIndex(MoreShrines.costTypeDefShrineDisorder); purchaseInteraction.cost = 1; purchaseInteraction.Networkcost = 1; purchaseInteraction.onPurchase.AddListener((interactor) => { AddShrineStack(interactor); }); }
private void RaiseChestPrices(On.RoR2.PurchaseInteraction.orig_Awake orig, PurchaseInteraction self) { orig(self); var chest = self.GetComponent <ChestBehavior>(); if (ShouldIgnoreChestBehaviour(chest)) { return; } self.cost = (int)Mathf.Ceil(self.cost * config.chestPriceCoefficient.Value); }
private void MultiplyChestCost(On.RoR2.PurchaseInteraction.orig_Awake orig, PurchaseInteraction self) { var chest = self.GetComponent <ChestBehavior>(); if (chest && chest.tier3Chance == 1f) { var ResultAmt = (int)Mathf.Ceil(self.cost * CostMultiplier.Value); self.cost = ResultAmt; self.Networkcost = ResultAmt; } orig(self); }
public void Awake() { purchaseInteraction = GetComponent <PurchaseInteraction>(); purchaseInteraction.costType = (CostTypeIndex)CostTypes.getCostTypeIndex(MoreShrines.costTypeDefShrineFallen); purchaseInteraction.onPurchase.AddListener((interactor) => { AddShrineStack(interactor); }); On.RoR2.CharacterMaster.RespawnExtraLife += CharacterMaster_RespawnExtraLife; }
public void GetObject() { //---------------------------------------------------------------------\\ Pcontroller = FindObjectOfType <PlayerCharacterMasterController>(); Cbody = FindObjectOfType <CharacterBody>(); Cmaster = FindObjectOfType <CharacterMaster>(); Pinteraction = FindObjectOfType <PurchaseInteraction>(); Tmanager = FindObjectOfType <TeamManager>(); Cmotor = FindObjectOfType <CharacterMotor>(); Pinterobj = UnityEngine.Object.FindObjectsOfType(typeof(PurchaseInteraction)); Tinterobj = UnityEngine.Object.FindObjectsOfType(typeof(TeleporterInteraction)); //---------------------------------------------------------------------\\ }
private MultiShopController GetMultiShopController(PurchaseInteraction purchaseInteraction) { foreach (MultiShop shop in MultiShop.instances) { foreach (PurchaseInteraction shopPI in shop.terminalPurchaseInteractions) { if (shopPI == purchaseInteraction) { return(shop.multiShopController); } } } return(null); }
public void Awake() { purchaseInteraction = GetComponent<PurchaseInteraction>(); purchaseInteraction.onPurchase.AddListener((interactor) => { AddShrineStack(interactor); }); purchaseInteraction.costType = CostTypes.getCostTypeIndex(MoreShrines.costTypeDefShrineHeresy); possiblePicks.Add(RoR2Content.Items.LunarPrimaryReplacement); possiblePicks.Add(RoR2Content.Items.LunarSecondaryReplacement); possiblePicks.Add(RoR2Content.Items.LunarSpecialReplacement); possiblePicks.Add(RoR2Content.Items.LunarUtilityReplacement); }
private void RaiseMultishopPrices(On.RoR2.MultiShopController.orig_Start orig, MultiShopController self) { orig(self); self.Networkcost = (int)(self.Networkcost * config.multiShopPriceCoefficient.Value); if (self.GetFieldValue <GameObject[]>("terminalGameObjects") is GameObject[] terminalGameObjects) { GameObject[] array = terminalGameObjects; for (int i = 0; i < array.Length; i++) { PurchaseInteraction component = array[i].GetComponent <PurchaseInteraction>(); component.Networkcost = self.Networkcost; component.costType = self.costType; } } }
/// <summary> /// Get the price from a <see cref="GameObject"/> if it is a <see cref="PurchaseInteraction"/> /// </summary> /// <param name="go">The target <see cref="GameObject"/></param> /// <returns>The price of the game object</returns> private static string GetPrice(GameObject go) { PurchaseInteraction purchaseInteraction = go.GetComponent <PurchaseInteraction>(); if (purchaseInteraction) { StringBuilder sb = new StringBuilder(); CostTypeCatalog.GetCostTypeDef(purchaseInteraction.costType) .BuildCostStringStyled(purchaseInteraction.cost, sb, true); return(sb.ToString()); } return(null); }
public static string ShopTerminalMessage(ShopTerminalBehavior STB) { PickupIndex pickupIdx = STB.CurrentPickupIndex(); PurchaseInteraction PI = STB.GetComponent <PurchaseInteraction>(); string cost = $"<color={PI.GetColorFromPurchasableType()}>{PI.GetTextFromPurchasableType()}</color>"; string tierColor = $"#{ColorUtility.ToHtmlStringRGB(pickupIdx.GetPickupColor())}"; string tierColorDark = $"#{ColorUtility.ToHtmlStringRGB(pickupIdx.GetPickupColorDark())}"; if (STB.pickupIndexIsHidden) { string message = $"<color={tierColor}>??? ({cost}): <color={tierColorDark}>???</color>"; return(message); } return(ItemMessage(pickupIdx, cost)); }
private static void CreateGurrenSummonInteractableSpawnCard() { gurrenInteractSpawnCard = ScriptableObject.CreateInstance <InteractableSpawnCard>(); var gurrenInteractPrefab = Modules.Assets.LoadAsset <GameObject>("GurrenInteractPrefab"); gurrenInteractPrefab.AddComponent <NetworkIdentity>(); var childLocator = gurrenInteractPrefab.GetComponent <ChildLocator>(); var model = childLocator.FindChild("Model"); var hologramPivot = childLocator.FindChild("HologramPivot"); var modelLocator = model.gameObject.AddComponent <ModelLocator>(); modelLocator.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); var entityLocator = model.gameObject.AddComponent <EntityLocator>(); entityLocator.entity = gurrenInteractPrefab; var hightlight = gurrenInteractPrefab.AddComponent <Highlight>(); hightlight.targetRenderer = gurrenInteractPrefab.GetComponentInChildren <Renderer>(); hightlight.highlightColor = Highlight.HighlightColor.interactive; var hologramProjector = gurrenInteractPrefab.AddComponent <HologramProjector>(); hologramProjector.hologramPivot = hologramPivot; gurrenInteractPurchaseInteraction = gurrenInteractPrefab.AddComponent <PurchaseInteraction>(); gurrenInteractPurchaseInteraction.available = true; gurrenInteractPurchaseInteraction.displayNameToken = TTGL_SurvivorPlugin.developerPrefix + "_GURREN_INTERACTABLE_NAME"; gurrenInteractPurchaseInteraction.contextToken = TTGL_SurvivorPlugin.developerPrefix + "_GURREN_INTERACTABLE_CONTEXT"; //var summonMasterBehavior = gurrenInteractPrefab.AddComponent<SummonMasterBehavior>(); //summonMasterBehavior.masterPrefab = CreateGurrenAIMaster(); gurrenInteractPrefab.AddComponent <GurrenSpawnerBehavior>(); gurrenInteractSpawnCard.prefab = gurrenInteractPrefab; gurrenInteractSpawnCard.sendOverNetwork = true; gurrenInteractSpawnCard.hullSize = HullClassification.Golem; gurrenInteractSpawnCard.nodeGraphType = RoR2.Navigation.MapNodeGroup.GraphType.Ground; gurrenInteractSpawnCard.requiredFlags = NodeFlags.None; gurrenInteractSpawnCard.forbiddenFlags = NodeFlags.None; gurrenInteractSpawnCard.directorCreditCost = 15; gurrenInteractSpawnCard.occupyPosition = true; gurrenInteractSpawnCard.eliteRules = SpawnCard.EliteRules.Default; gurrenInteractSpawnCard.orientToFloor = true; gurrenInteractSpawnCard.slightlyRandomizeOrientation = false; gurrenInteractSpawnCard.skipSpawnWhenSacrificeArtifactEnabled = false; if (gurrenInteractPrefab == null) { TTGL_SurvivorPlugin.instance.Logger.LogError("Could not load GurrenInteractPrefab"); } PrefabAPI.RegisterNetworkPrefab(gurrenInteractPrefab); //TTGL_SurvivorPlugin.networkPrefabs.Add(gurrenInteractPrefab); }
public void Awake() { purchaseInteraction = GetComponent <PurchaseInteraction>(); purchaseInteraction.onPurchase = new PurchaseEvent(); purchaseInteraction.onPurchase.AddListener((interactor) => { purchaseInteraction.SetAvailable(false); GetComponent <ChestBehavior>().ItemDrop(); DestroyThingsOnOpen(); }); positionIndicator = Object.Instantiate <GameObject>(riftPositionIndicator, transform.position, Quaternion.identity).GetComponent <PositionIndicator>(); positionIndicator.targetTransform = transform; UpdateLock(); }
private void UpdateShrineDisplay(ShrineHealingBehavior self) { PurchaseInteraction pi = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction"); if (clientCost == BALANCED_MODE) { 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 = clientCost; } }
public static void Interactables() { foreach (TeleporterInteraction teleporterInteraction in FindObjectsOfType <TeleporterInteraction>()) { float distanceToObject = Vector3.Distance(Camera.main.transform.position, teleporterInteraction.transform.position); Vector3 Position = Camera.main.WorldToScreenPoint(teleporterInteraction.transform.position); var BoundingVector = new Vector3(Position.x, Position.y, Position.z); if (BoundingVector.z > 0.01) { Main.renderTeleporterStyle.normal.textColor = teleporterInteraction.isIdle ? Color.magenta : teleporterInteraction.isIdleToCharging || teleporterInteraction.isCharging ? Color.yellow : teleporterInteraction.isCharged ? Color.green : Color.yellow; int distance = (int)distanceToObject; String friendlyName = "Teleporter"; string status = "" + ( teleporterInteraction.isIdle ? "Idle" : teleporterInteraction.isCharging ? "Charging" : teleporterInteraction.isCharged ? "Charged" : teleporterInteraction.isActiveAndEnabled ? "Idle" : teleporterInteraction.isIdleToCharging ? "Idle-Charging" : teleporterInteraction.isInFinalSequence ? "Final-Sequence" : "???"); string boxText = $"{friendlyName}\n{status}\n{distance}m"; GUI.Label(new Rect(BoundingVector.x - 50f, (float)Screen.height - BoundingVector.y, 100f, 50f), boxText, Main.renderTeleporterStyle); } } foreach (PurchaseInteraction purchaseInteraction in PurchaseInteraction.FindObjectsOfType(typeof(PurchaseInteraction))) { if (purchaseInteraction.available) { float distanceToObject = Vector3.Distance(Camera.main.transform.position, purchaseInteraction.transform.position); Vector3 Position = Camera.main.WorldToScreenPoint(purchaseInteraction.transform.position); var BoundingVector = new Vector3(Position.x, Position.y, Position.z); if (BoundingVector.z > 0.01) { int distance = (int)distanceToObject; String friendlyName = purchaseInteraction.GetDisplayName(); int cost = purchaseInteraction.cost; string boxText = $"{friendlyName}\n${cost}\n{distance}m"; GUI.Label(new Rect(BoundingVector.x - 50f, (float)Screen.height - BoundingVector.y, 100f, 50f), boxText, Main.renderInteractablesStyle); } } } }
protected override bool PerformEquipmentAction(EquipmentSlot slot) { CharacterBody body = slot.characterBody; if (!body) { return(false); } InteractionDriver interactionDriver = body.GetComponent <InteractionDriver>(); if (!interactionDriver) { return(false); } GameObject BestInteractableObject = interactionDriver.FindBestInteractableObject(); if (!BestInteractableObject) { return(false); } PurchaseInteraction purchaseInteraction = BestInteractableObject.GetComponent <PurchaseInteraction>(); if (!purchaseInteraction) { return(false); } float newUnlockChance = TrustyLockpicks_UnlockChance; if (ClassicItemsCompat.enabled && ClassicItemsCompat.CheckEmbryoProc(instance, body)) { newUnlockChance *= 1.3f; } //interactionDriver.interactor.interactableCooldown = 0.25f; if (AttemptUnlock(BestInteractableObject, interactionDriver, newUnlockChance)) { return(true); } else { return(false); } }
private void GlobalEventManager_OnInteractionsGlobal(Interactor interactor, IInteractable interactable, GameObject interactableObject) { if (!eligible) { return; } if (IsCurrentBody(interactor.gameObject)) { PurchaseInteraction purchaseInteraction = interactableObject.GetComponent <PurchaseInteraction>(); if (purchaseInteraction && purchaseInteraction.costType == CostTypeIndex.Money && purchaseInteraction.cost > 0) { if (!purchaseInteraction.displayNameToken.Contains("MULTISHOP_TERMINAL_")) { eligible = false; } } } }