Пример #1
0
    public async Task <(long, bool)> PickValue(long value, object context)
    {
        var entry = GetEntry(context as SmartBaseElement);

        if (!entry.HasValue)
        {
            return(await FallbackPicker(value));
        }
        else
        {
            try
            {
                var id = await tableEditorPickerService.PickByColumn("creature_text", new DatabaseKey(entry ?? 0), "GroupId",
                                                                     (uint)value);

                if (id.HasValue)
                {
                    return(id.Value, true);
                }
                return(0, false);
            }
            catch (UnsupportedTableException)
            {
                return(await FallbackPicker(value));
            }
        }
    }
    public async Task <(long, bool)> PickValue(long value, object context)
    {
        var entry = GetEntry(context as SmartBaseElement);

        if (!entry.HasValue)
        {
            return(await FallbackPicker());
        }
        else
        {
            var  script       = GetScript(context as SmartBaseElement);
            bool isGameObject = script !.SourceType == SmartScriptType.GameObject;
            var  table        = (isGameObject ? "gameobject" : "creature") + "_quest" + (isStarter ? "starter" : "ender");
            try
            {
                var id = await tableEditorPickerService.PickByColumn(table, new DatabaseKey(entry ?? 0), "quest", (uint)value);

                if (id.HasValue)
                {
                    return(id.Value, true);
                }
                return(0, false);
            }
            catch (UnsupportedTableException)
            {
                return(await FallbackPicker());
            }
        }
    }
Пример #3
0
    public async Task <(long, bool)> PickValue(long value, object context)
    {
        if (context is DatabaseEntity entity)
        {
            var entry  = entity.GetTypedValueOrThrow <long>("id");
            var result = await pickerService.PickByColumn("creature_equip_template", new DatabaseKey(entry), "ID", value);

            return(result ?? 0, result.HasValue);
        }

        return(await parameterPickerService.PickParameter(Parameter.Instance, value));
    }
Пример #4
0
 public async Task <(long, bool)> PickValue(long value)
 {
     var result = await tableEditorPickerService.PickByColumn(tableName, default, columnName, value);