private static void CharacterBody_OnEquipmentGained(On.RoR2.CharacterBody.orig_OnEquipmentGained orig, CharacterBody self, EquipmentDef equipmentDef) { orig(self, equipmentDef); if (equipmentDef.equipmentIndex == _equipIndex) { self.AddBuff(_buffIndex); } }
public static void CharacterBody_OnEquipmentGained(On.RoR2.CharacterBody.orig_OnEquipmentGained orig, CharacterBody self, EquipmentDef equipmentDef) { if (!self.masterObject.GetComponent <AffixEquipBehaviour>()) { //If I don't have a tracker behaviour and I should, give me one if (equipmentDef.equipmentIndex == BaseAffixEquip.index || equipmentDef.equipmentIndex == LunarAffixEquip.index) { self.masterObject.AddComponent <AffixEquipBehaviour>(); } } else if (self.masterObject && self.masterObject.GetComponent <AffixEquipBehaviour>() is AffixEquipBehaviour behaviour) { //If I have one, run the modified pickup hook in the behaviour behaviour.UpdateEquipment(equipmentDef.equipmentIndex, true); } orig(self, equipmentDef); }