Exemplo n.º 1
0
        public static void EquipItem(object obj, object layer)
        {
            int serial = AliasCommands.ResolveSerial(obj);

            if (serial == 0)
            {
                UOC.SystemMessage(Strings.Invalid_or_unknown_object_id);
                return;
            }

            Layer layerValue = Layer.Invalid;

            switch (layer)
            {
            case string s:
                layerValue = Utility.GetEnumValueByName <Layer>(s);
                break;

            case int i:
                layerValue = (Layer)i;
                break;

            case Layer l:
                layerValue = l;
                break;
            }

            if (layerValue == Layer.Invalid)
            {
                UOC.SystemMessage(Strings.Invalid_layer_value___);
                return;
            }

            Item item = Engine.Items.GetItem(serial);

            if (item == null)
            {
                UOC.SystemMessage(Strings.Cannot_find_item___);
                return;
            }

            UOC.EquipItem(item, layerValue);
        }