示例#1
0
        private void GenericPickupController_AttemptGrant(On.RoR2.GenericPickupController.orig_AttemptGrant orig, RoR2.GenericPickupController self, RoR2.CharacterBody body)
        {
            if (PickupCatalog.GetPickupDef(self.pickupIndex).equipmentIndex != EquipmentIndex.None)
            {
                orig(self, body);
                return;
            }
            InventoryLimits limits = null;

            limits = body.master.gameObject.GetComponent <InventoryLimits>();
            if (limits != null && PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex != ItemIndex.None)
            {
                if (limits.Limited)
                {
                    /*
                     * Chat.AddMessage($"<color=#FFFF00>Inventory full: {limits.amount}/{limits.limit}. Gain experience to gain free space.</color>");
                     */
                    return;
                }
            }
            orig(self, body);
            if (limits != null && PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex != ItemIndex.None)
            {
                if (NetworkServer.active)
                {
                    DropperChat.ItemCountMessage(body.GetUserName(), limits.amount, limits.limit);
                }
            }
        }