azerothcore / mod-eluna

Eluna Lua Engine © for WoW Emulators
https://elunaluaengine.github.io/
GNU General Public License v3.0
96 stars 127 forks source link

player:SendTrainerList(sender) does not fire! #121

Closed New-HavenWotLK closed 9 months ago

New-HavenWotLK commented 1 year ago

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 ^^

55Honey commented 1 year ago

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