Exemplo n.º 1
0
        public static void GiveItem(string itemIndex, int count = 1, NetworkUser offender = null)
        {
            if (!_player)
            {
                return;
            }

            ItemIndex item;

            try {
                ItemIndex.TryParse(itemIndex, true, out item);
                _player.inventory.GiveItem(item, count);
            }
            catch {
                var msg = "Was unable to find item " + itemIndex;

                _logger.LogWarning(msg);
                LogUtils.Log(msg);
            }
        }
Exemplo n.º 2
0
        public static void TakeItem(string itemIndex, int count = 1, NetworkUser offender = null)
        {
            if (!_player)
            {
                return;
            }
            ItemIndex item;

            try {
                ItemIndex.TryParse(itemIndex, true, out item);
                _player.inventory.RemoveItem(item, count);
                if (offender != null)
                {
                    LogUtils.Log($"Removing x{count} {item} from user: {offender?.userName} ");
                }
            }
            catch {
                var badMsg = $"Could not find item {itemIndex}";
                //Log to bep and in-game consoles.
                _logger.LogWarning(badMsg);
                LogUtils.Log(badMsg);
            }
        }