private void Interactor_PerformInteraction(On.RoR2.Interactor.orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { if (VotesEnabled.Value && InteractableObjectNames.IsRestictedInteractableObject(interactableObject.name)) { AttemptInteraction(self, new Action(() => orig(self, interactableObject))); } else { orig(self, interactableObject); } }
private void Interactor_PerformInteraction(On.RoR2.Interactor.orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { CharacterBody buddy = self.GetComponent <CharacterBody>(); var purchInter = interactableObject.GetComponent <PurchaseInteraction>(); if (purchInter && purchInter.displayNameToken.ToLower() == "lockbox_name") { Debug.Log(purchInter.displayNameToken.ToLower()); if (purchInter.costType == CostTypeIndex.None) { if (buddy && buddy.inventory && buddy.inventory.GetItemCount(ItemIndex.TreasureCache) == 0) { return; } } } orig(self, interactableObject); }
private void Interactor_PerformInteraction(On.RoR2.Interactor.orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { PurchaseInteraction purchaseInteraction = interactableObject.GetComponent <PurchaseInteraction>(); if (purchaseInteraction) { TrustyLockpicksComponent component = interactableObject.GetComponent <TrustyLockpicksComponent>(); if (!component || (component && !component.failed)) { CharacterBody characterBody = self.GetComponent <CharacterBody>(); if (characterBody) { Inventory inventory = characterBody.inventory; if (inventory) { int InventoryCount = characterBody.inventory.GetItemCount(catalogIndex); if (InventoryCount > 0) { purchaseInteraction.GetInteractability(self); if (purchaseInteraction.isShrine == false && purchaseInteraction.available && purchaseInteraction.costType == CostTypeIndex.Money) //if not shrine, is available, and is not a lunar pod { purchaseInteraction.SetAvailable(false); purchaseInteraction.Networkavailable = false; purchaseInteraction.gameObject.GetComponent <ChestBehavior>().Open(); //purchaseInteraction.cost = 0; //purchaseInteraction.Networkcost = 0; purchaseInteraction.onPurchase.Invoke(self); purchaseInteraction.lastActivator = self; inventory.RemoveItem(catalogIndex); } } } } } } orig(self, interactableObject); }
private void Interactor_PerformInteraction(On.RoR2.Interactor.orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { PurchaseInteraction purchaseInteraction = interactableObject.GetComponent <PurchaseInteraction>(); orig(self, interactableObject); }