azerothcore/mod-eluna

player:SendTrainerList(sender) does not fire!

Closed this issue · 1 comments

I tried right now to do a mixed npc (vendor + trainer in one).

When I tried it with:

player:SendTrainerList(creature,1) it didn't even give me an error... since it should do in regular for that clearly wrong function statement

so it seems to not fire at all.

how to replicate:

try a script like this here... just add a npc id at the gossipevents...

local function RidingTrainerMountVendorOnGossipHello(event, player, creature)
    player:GossipClearMenu()
    player:GossipMenuAddItem(1, "Let me browse your goods!", 0, 1)
    player:GossipMenuAddItem(4, "Train me.", 1, 2)
    player:GossipMenuAddItem(0, "Close", 1, 3)
    player:GossipSendMenu(1, creature, 1)
end

RegisterCreatureGossipEvent(NPC_ID, 1, RidingTrainerMountVendorOnGossipHello)


local function RidingTrainerMountVendorOnGossipSelect(event, player, creature, sender, intid, code, menu_id)
    if (intid == 1) then
        player:SendListInventory(creature)
    elseif (intid == 2) then
        player:SendTrainerList(creature)
    elseif (intid == 3) then
        player:GossipComplete()
    end
end

RegisterCreatureGossipEvent(NPC_ID, 2, RidingTrainerMountVendorOnGossipSelect)

then try the script... u will see that all will work except the SendTrainerList(creature)...

if u then add to the SendTrainerList(creature) a 1... so it looks like this:

local function RidingTrainerMountVendorOnGossipHello(event, player, creature)
    player:GossipClearMenu()
    player:GossipMenuAddItem(1, "Let me browse your goods!", 0, 1)
    player:GossipMenuAddItem(4, "Train me.", 1, 2)
    player:GossipMenuAddItem(0, "Close", 1, 3)
    player:GossipSendMenu(1, creature, 1)
end


RegisterCreatureGossipEvent(NPC_ID, 1, RidingTrainerMountVendorOnGossipHello)

local function RidingTrainerMountVendorOnGossipSelect(event, player, creature, sender, intid, code, menu_id)
    if (intid == 1) then
        player:SendListInventory(creature)
    elseif (intid == 2) then
        player:SendTrainerList(creature,1)
    elseif (intid == 3) then
        player:GossipComplete()
    end
end

RegisterCreatureGossipEvent(NPC_ID, 2, RidingTrainerMountVendorOnGossipSelect)

you will see that it does not give an error message to the console which it should ^^

Does the NPC have the trainer flags set?
https://www.azerothcore.org/wiki/creature_template#unitflags