Kits via HumanNPC always show ALL KitsSolved

Greetings.

My Settings:

Kits V4.0.11
HumanNPC V0.3.50
GUIShop V2.1.0

Well all Plugins works good together. I have NPC with GuiShop or Kitshop.
Exepct one thing. I cant reduce the available Kits for a spezific NPC:

    "1276141773": {
      "The list of kits that can be claimed from this NPC": [
        "Miene",
        "Miene (VIP)",
        "Der Ölbaron",
        "Der Ölbaron (VIP)"
      ],
      "The NPC's response to opening their kit menu": "Miene gefällig ?"
    },
    "956995553": {
      "The list of kits that can be claimed from this NPC": [
        "Rusta Cola Kühlschrank",
        "50´s Kühlschrank",
        "Relaxed Glow Kühlschrank",
        "Rattan Gartenstuhl",
        "Lederstuhl",
        "Glow Stuhl",
        "Grüner Stuhl",
        "Holztisch",
        "Holztisch Eiche",
        "Glastisch",
        "Relaxed Glow Tisch",
        "Gamepad Teppich",
        "Rust Teppich",
        "Pacman Teppich",
        "Spieleteppich",
        "Welcome Teppich",
        "Relaxed Glow Teppich",
        "Generator"
      ],
      "The NPC's response to opening their kit menu": "Miene gefällig ?"
    },
    "877911213": {
      "The list of kits that can be claimed from this NPC": [
        "Light Prism Set"
      ],
      "The NPC's response to opening their kit menu": "Miene gefällig ?"
    }

They always show ALL Kits depending of the players Permission, Authlevel or Hidden Tag. That works fine. But how can i say that NPC A only shows Kit A?

Thx in advance
Mero

I did some Code Analyses

Here we go:
Here you check if the KitMenu is open via HumanNPC:

 #region HumanNPC
        private void OnUseNPC(BasePlayer npcPlayer, BasePlayer player)
        {
            if (Configuration.NPCKitMenu.ContainsKey(npcPlayer.userID))
                OpenKitGrid(player, 0, npcPlayer.userID);
        }

Then you call OpenKitGrid:

Here you build up the UI and check if the player is admin to create additional buttons:

 #region Kit Grid View
        private void OpenKitGrid(BasePlayer player, int page = 0, ulong npcId = 0UL)
        {
            CuiElementContainer container = UI.BlurContainer(UI_MENU, new UI4(0.2f, 0.15f, 0.8f, 0.85f));

            UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.005f, 0.93f, 0.995f, 0.99f));

            UI.Label(container, UI_MENU, Message("UI.Title", player.userID), 20, new UI4(0.015f, 0.93f, 0.99f, 0.99f), TextAnchor.MiddleLeft);

            UI.Button(container, UI_MENU, Configuration.Menu.Color3.Get, "<b>×</b>", 20, new UI4(0.9575f, 0.9375f, 0.99f, 0.9825f), "kits.close");

            if (IsAdmin(player) && npcId == 0UL)
                UI.Button(container, UI_MENU, Configuration.Menu.Color2.Get, Message("UI.CreateNew", player.userID), 14, new UI4(0.85f, 0.9375f, 0.9525f, 0.9825f), "kits.create");

            CreateGridView(player, container, page);

            CuiHelper.DestroyUi(player, UI_MENU);
            CuiHelper.AddUi(player, container);
        }

after that you call CreatGridView to fill up the created UI with found Kits . But you call this "function" (sorry for expression i dont code C#) without a npcId:

CreateGridView(player, container, page);

With leads in my understanding that npcId always will be 0UL:

 private void CreateGridView(BasePlayer player, CuiElementContainer container, int page = 0, ulong npcId = 0UL)
        {

So your call selecting the kits npcId will always use 0UL:

 GetUserValidKits(player, list, npcId);

Did i miss anything ? ;o)



Merged post

Workaround

 

FIND

CreateGridView(player, container, page);

IN

private void OpenKitGrid(BasePlayer player, int page = 0, ulong npcId = 0UL)
        {

         [...]

        }

REPLACE WITH

CreateGridView(player, container, page, npcId);

Did the trick for me. Now NPC only shows the Kits they should do.

 

Thx for you attention *smile*

Locked automatically