private void PurchaseInteraction_Awake(On.RoR2.PurchaseInteraction.orig_Awake orig, PurchaseInteraction self) { orig(self); switch (self.costType) { case CostTypeIndex.ArtifactShellKillerItem: break; case CostTypeIndex.WhiteItem: self.Networkcost = multCommon; break; case CostTypeIndex.GreenItem: self.Networkcost = multUncommon; break; case CostTypeIndex.BossItem: self.Networkcost = multBoss; break; case CostTypeIndex.RedItem: self.Networkcost = multCommon; break; } }
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); }
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 LowerCosts(On.RoR2.PurchaseInteraction.orig_Awake orig, PurchaseInteraction self) { var chest = self.GetComponent <ChestBehavior>(); int InventoryCount = Util.GetItemCountForTeam(TeamIndex.Player, catalogIndex, false, true); if (chest) { if (InventoryCount > 0) { //var ResultMultUnclamp = 1 - CostReductionAmount + CostReductionAmountStack * (InventoryCount - 1); //var ResultMult = Mathf.Max(ResultMultUnclamp, 0); //credit to harb+bord listam var ResultMult = (CostReductionAmount + (1 - CostReductionAmount) * (1 - (CostReductionAmountLimit / Mathf.Pow(InventoryCount + CostReductionAmountLimit, CostReductionAmountPerStack)))); var ResultAmt = (int)Mathf.Ceil(self.cost * ResultMult); //Chat.AddMessage("Cost of chest reduced from" + self.cost + " to " + ResultAmt + " with multiplier "+ResultMult); self.cost = ResultAmt; self.Networkcost = ResultAmt; } } orig(self); }