public void OnReceived() { if (NetworkServer.active) { return; } GameObject obj = Util.FindNetworkObject(objID); if (obj) { MysticsItemsManuscript controller = obj.GetComponent <MysticsItemsManuscript>(); if (controller) { controller.AddBuff((BuffType)chosenBuffType); } } }
public void Inventory_GiveItem_ItemIndex_int(On.RoR2.Inventory.orig_GiveItem_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count) { MysticsItemsManuscript component = self.GetComponent <MysticsItemsManuscript>(); if (!component) { component = self.gameObject.AddComponent <MysticsItemsManuscript>(); } orig(self, itemIndex, count); if (NetworkServer.active && itemIndex == itemDef.itemIndex) { for (var i = 0; i < count; i++) { component.AddBuff(); } } }