public static GrpcBooleanFilter Adapt(BooleanSearchFilter field)
 {
     return(new GrpcBooleanFilter()
     {
         IsActive = field.IsActive,
         Value = field.Value
     });
 }
 public static GrpcBooleanFilter GetFrom(BooleanSearchFilter filter)
 {
     return(new GrpcBooleanFilter()
     {
         IsActive = filter.IsActive,
         Value = filter.Value
     });
 }
예제 #3
0
        public ItemSearchWindow(ItemSearchPlugin plugin, string searchText = "")
        {
            this.pluginInterface = plugin.PluginInterface;
            this.data            = pluginInterface.Data;
            this.builder         = pluginInterface.UiBuilder;
            this.pluginConfig    = plugin.PluginConfig;
            this.plugin          = plugin;
            extraFiltersExpanded = pluginConfig.ExpandedFilters;
            autoTryOn            = pluginConfig.ShowTryOn && pluginConfig.TryOnEnabled;

            while (!data.IsDataReady)
            {
                Thread.Sleep(1);
            }

            stains = data.Excel.GetSheet <Stain>().ToList();
            FixStainsOrder();

            if (pluginConfig.SelectedStain > 0)
            {
                selectedStain = stains.FirstOrDefault(s => s.RowId == pluginConfig.SelectedStain);
                if (selectedStain != null)
                {
                    var b = selectedStain.Color & 255;
                    var g = (selectedStain.Color >> 8) & 255;
                    var r = (selectedStain.Color >> 16) & 255;
                    selectedStainColor = new Vector4(r / 255f, g / 255f, b / 255f, 1f);
                }
            }


            stainShadeHeaders = new Dictionary <byte, Vector4> {
                { 2, new Vector4(1, 1, 1, 1) },
                { 4, new Vector4(1, 0, 0, 1) },
                { 5, new Vector4(0.75f, 0.5f, 0.3f, 1) },
                { 6, new Vector4(1f, 1f, 0.1f, 1) },
                { 7, new Vector4(0.5f, 1f, 0.25f, 1f) },
                { 8, new Vector4(0.3f, 0.5f, 1f, 1f) },
                { 9, new Vector4(0.7f, 0.45f, 0.9f, 1) },
                { 10, new Vector4(1f, 1f, 1f, 1f) }
            };

            SearchFilters = new List <SearchFilter> {
                new ItemNameSearchFilter(pluginConfig, this, searchText),
                new ItemUICategorySearchFilter(pluginConfig, data),
                new LevelEquipSearchFilter(pluginConfig),
                new LevelItemSearchFilter(pluginConfig),
                new RaritySearchFilter(pluginConfig),
                new EquipAsSearchFilter(pluginConfig, data, pluginInterface),
                new RaceSexSearchFilter(pluginConfig, data, pluginInterface),
                new CraftableSearchFilter(pluginConfig, data),
                new DesynthableSearchFilter(pluginConfig, data),
                new SoldByNPCSearchFilter(pluginConfig, data),
                new BooleanSearchFilter(pluginConfig, "Dyeable", "Dyeable", "Not Dyeable", BooleanSearchFilter.CheckFunc("IsDyeable")),
                new BooleanSearchFilter(pluginConfig, "Unique", "Unique", "Not Unique", BooleanSearchFilter.CheckFunc("IsUnique")),
                new BooleanSearchFilter(pluginConfig, "Tradable", "Tradable", "Not Tradable", BooleanSearchFilter.CheckFunc("IsUntradable", true)),
                new BooleanSearchFilter(pluginConfig, "Key Item", "Key Item", "Normal Item", ((item, t, f) => !t), ((item, t, f) => !f)),

                new StatSearchFilter(pluginConfig, data),
                new CollectableSearchFilter(pluginConfig, plugin),
            };

            SearchFilters.ForEach(a => a.ConfigSetup());

            ActionButtons = new List <IActionButton> {
                new MarketBoardActionButton(pluginInterface, pluginConfig),
                new DataSiteActionButton(pluginConfig),
                new RecipeSearchActionButton(plugin.CraftingRecipeFinder),
                new CopyItemAsJson(plugin),
            };
        }