void RpcItemAdded(On.RoR2.Inventory.orig_RpcItemAdded orig, RoR2.Inventory inventory, ItemIndex itemIndex) { if (Data.modEnabled) { if (Data.mode == DataShop.mode) { if (Data.modEnabled) { if (Data.mode == DataShop.mode) { if (inventoryLocal != null) { if (inventoryLocal == inventory) { //if (!Data.scrapItems.Contains(itemIndex)) { DataShop.AddScrap(characterBody, Data.GetItemTier(Data.allItemsIndexes[itemIndex])); //} } } } } } } orig(inventory, itemIndex); }
bool SetEquipmentInternal(On.RoR2.Inventory.orig_SetEquipmentInternal orig, RoR2.Inventory inventory, EquipmentState equipmentState, uint slot) { bool equipmentChanged = orig(inventory, equipmentState, slot); if (Data.modEnabled) { if (Data.mode == DataShop.mode) { if (inventoryLocal != null) { if (inventoryLocal == inventory) { int stageClearCountNew = Run.instance.stageClearCount; if (stageClearCountOld != stageClearCountNew) { stageClearCountOld = stageClearCountNew; equipmentFoundThisStage.Clear(); equipmentFoundThisStageTwice.Clear(); foreach (EquipmentState equipmentStateOlder in latestEquipment) { if (equipmentStateOlder.equipmentIndex != EquipmentIndex.None && !equipmentFoundThisStage.Contains(equipmentStateOlder.equipmentIndex)) { equipmentFoundThisStage.Add(equipmentStateOlder.equipmentIndex); } } } int slotAdjusted = (int)slot; if (slotAdjusted + 1 > latestEquipment.Count) { for (int appendIndex = 0; appendIndex < slotAdjusted + 1 - latestEquipment.Count; appendIndex++) { latestEquipment.Add(new EquipmentState(EquipmentIndex.None, new Run.FixedTimeStamp(), 0)); } } EquipmentState equipmentStateOld = latestEquipment[slotAdjusted]; if (!EquipmentState.Equals(equipmentStateOld, equipmentState)) { latestEquipment[slotAdjusted] = equipmentState; if (!equipmentFoundThisStage.Contains(latestEquipment[slotAdjusted].equipmentIndex)) { if (Data.allEquipmentIndexes.ContainsKey(equipmentState.equipmentIndex)) { if (DataShop.AddScrap(characterBody, Data.GetItemTier(Data.allEquipmentIndexes[equipmentState.equipmentIndex]))) { equipmentFoundThisStage.Add(equipmentState.equipmentIndex); } } } } } } } } return(equipmentChanged); }
void InteractionResult(On.RoR2.Interactor.orig_RpcInteractionResult orig, RoR2.Interactor interactor, bool boolean) { if (Data.modEnabled) { if (Data.mode == DataShop.mode) { if (interactor.GetComponent <NetworkBehaviour>().hasAuthority) { if (boolean) { if (DataShop.purchaseTier != -1 && DataShop.purchaseCost > 0) { DataShop.RemoveScrap(DataShop.purchaseTier, DataShop.purchaseCost); } Dictionary <string, string> specialCases = new Dictionary <string, string>() { { "BrokenDroneMissile", "BrokenMissileDrone" }, }; string prefix = "Broken"; string suffix = "Master(Clone)"; string adjustedName = latestInteractionName; if (adjustedName.Length > suffix.Length) { adjustedName = adjustedName.Substring(0, adjustedName.Length - suffix.Length); } adjustedName = prefix + adjustedName; if (specialCases.ContainsKey(adjustedName)) { adjustedName = specialCases[adjustedName]; } if (Data.allDroneNames.ContainsKey(adjustedName)) { DataShop.AddScrap(characterBody, 6); } } } } } orig(interactor, boolean); }