• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Can someone update this patch for eluna support multi vendor?

Status
Not open for further replies.

Rochet2

Moderator / Eluna Dev
Hmm I did not, would I still need to apply this patch or the changes you posted?

You would need to apply the patch from my site and then do the edit required to the lua method file
http://rochet2.github.io/?page=Multivendor
PlayerMethods.h
Use this code if the method code doesnt already look exactly like this:
Code:
    int SendListInventory(lua_State* L, Player* player)
    {
        WorldObject* obj = Eluna::CHECKOBJ<WorldObject>(L, 2);
        uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);

        player->GetSession()->SendListInventory(obj->GET_GUID(), entry);
        return 0;
    }
 

Ghostcrawler336

Epic Member
You would need to apply the patch from my site and then do the edit required to the lua method file
http://rochet2.github.io/?page=Multivendor
PlayerMethods.h

Yeah I already had the multi vendor patch you released. :)

I just get an error when trying to apply the edit you listed.

Code:
/home/wow/ghost-gaming/src/LuaEngine/PlayerMethods.h: In function ‘int LuaPlayer::SendListInventory(lua_State*, Player*)’:
/home/wow/ghost-gaming/src/LuaEngine/PlayerMethods.h:1476:61: error: cannot call member function ‘T* Eluna::CHECKOBJ(lua_State*, int, bool) [with T = WorldObject; lua_State = lua_State]’ without object
/home/wow/ghost-gaming/src/LuaEngine/PlayerMethods.h:1477:55: error: cannot call member function ‘T Eluna::CHECKVAL(lua_State*, int, T) [with T = unsigned int; lua_State = lua_State]’ without object
[ 99%] Built target scripts
 

Rochet2

Moderator / Eluna Dev
Depending on your eluna version it is handled differently.
See the other methods for how they get values.
Do they use sEluna->CHECKVAL
or what do they use
Or just provide the eluna version hash.

Incase you are not use, as the error says, it needs the eluna object, so try the sEluna-> instead of Eluna::
 

Ghostcrawler336

Epic Member
Depending on your eluna version it is handled differently.
See the other methods for how they get values.
Do they use sEluna->CHECKVAL
or what do they use
Or just provide the eluna version hash.

Incase you are not use, as the error says, it needs the eluna object, so try the sEluna-> instead of Eluna::

Hmm I see, I got the latest version of Eluna like I pulled it a day or two ago and there's been no changes since then

So would it be like this:
Code:
   int SendListInventory(lua_State* L, Player* player)
    {
        WorldObject* obj = sEluna::CHECKOBJ<WorldObject>(L, 2);
        uint32 entry = sEluna::CHECKVAL<uint32>(L, 3, 0);

        player->GetSession()->SendListInventory(obj->GET_GUID(), entry);
        return 0;
    }
 

Rochet2

Moderator / Eluna Dev
Hmm I see, I got the latest version of Eluna like I pulled it a day or two ago and there's been no changes since then

So would it be like this:
Code:
   int SendListInventory(lua_State* L, Player* player)
    {
        WorldObject* obj = sEluna::CHECKOBJ<WorldObject>(L, 2);
        uint32 entry = sEluna::CHECKVAL<uint32>(L, 3, 0);

        player->GetSession()->SendListInventory(obj->GET_GUID(), entry);
        return 0;
    }

.. no
Pretty obvious when you should replace Eluna:: with sEluna->, it includes the :: and -> changes :p
Also :: will be used to access stuff within a class etc without the object.
The -> operator or . (depending on if using pointer or reference for example) is used with objects, and as the error says you need the object (the functions are not static)
Code:
    int SendListInventory(lua_State* L, Player* player)
    {
        WorldObject* obj = sEluna->CHECKOBJ<WorldObject>(L, 2);
        uint32 entry = sEluna->CHECKVAL<uint32>(L, 3, 0);

        player->GetSession()->SendListInventory(obj->GET_GUID(), entry);
        return 0;
    }
 

Ghostcrawler336

Epic Member
.. no
Pretty obvious when you should replace Eluna:: with sEluna->, it includes the :: and -> changes :p
Also :: will be used to access stuff within a class etc without the object.
The -> operator or . (depending on if using pointer or reference for example) is used with objects, and as the error says you need the object (the functions are not static)
Code:
    int SendListInventory(lua_State* L, Player* player)
    {
        WorldObject* obj = sEluna->CHECKOBJ<WorldObject>(L, 2);
        uint32 entry = sEluna->CHECKVAL<uint32>(L, 3, 0);

        player->GetSession()->SendListInventory(obj->GET_GUID(), entry);
        return 0;
    }

Oh sorry for my stupidness, haha :p

But yeah that compiled successfully, hopefully it works ingame :)
 

Ghostcrawler336

Epic Member
So how would I go about calling the vendor via Lua?

I used the example shown in that thread.

Code:
local vendorEntry = 80011
function vendorGossipHello(event, player, creature)
    player:GossipClearMenu()
    player:GossipMenuAddItem(0, "vendor1", 0, 999916)
    player:GossipMenuAddItem(0, "vendor2", 0, 999927)
    player:GossipSendMenu(103, creature)
end

function vendorGossipSelect(event, player, creature, sender, intid, code)
    player:SendListInventory(creature,intid)
end

RegisterCreatureGossipEvent(vendorEntry, 1, vendorGossipHello)
RegisterCreatureGossipEvent(vendorEntry, 2, vendorGossipSelect)

I know to change 80011 to my npc entry id, and 999916, etc to my vendor ids. But which ones do I change to actually get the script to send the vendor window?
 

Rochet2

Moderator / Eluna Dev
So how would I go about calling the vendor via Lua?

I used the example shown in that thread.

Code:
local vendorEntry = 80011
function vendorGossipHello(event, player, creature)
    player:GossipClearMenu()
    player:GossipMenuAddItem(0, "vendor1", 0, 999916)
    player:GossipMenuAddItem(0, "vendor2", 0, 999927)
    player:GossipSendMenu(103, creature)
end

function vendorGossipSelect(event, player, creature, sender, intid, code)
    player:SendListInventory(creature,intid)
end

RegisterCreatureGossipEvent(vendorEntry, 1, vendorGossipHello)
RegisterCreatureGossipEvent(vendorEntry, 2, vendorGossipSelect)

I know to change 80011 to my npc entry id, and 999916, etc to my vendor ids. But which ones do I change to actually get the script to send the vendor window?

It should already do that.
The 999916 is passed as intid variable to the vendorGossipSelect function.
Then intid is passed to :SendListInventory(creature, vendorentry) as the vendor entry parameter.
So the intid is already passed as the multivendor entry parameter to the lua method.
Do note that that GossipClearMenu() is not needed on creature gossip.
Pretty much only if you send gossip form any other hook than OnGossipHello or OnGossipSelect. (which is required for player gossip as there is no on hello for them)

If its not working for you, I can test this tomorrow unless someone comes up with a solution if you have a problem.
Im planning on making a few changes like removing the mutex lock perhaps :thumbupguy:
 
Last edited:

Ghostcrawler336

Epic Member
It should already do that.
The 999916 is passed as intid variable to the vendorGossipSelect function.
Then intid is passed to :SendListInventory(creature, vendorentry) as the vendor entry parameter.
So the intid is already passed as the multivendor entry parameter to the lua method.
Do note that that GossipClearMenu() is not needed on creature gossip.
Pretty much only if you send gossip form any other hook than OnGossipHello or OnGossipSelect. (which is required for player gossip as there is no on hello for them)

If its not working for you, I can test this tomorrow unless someone comes up with a solution if you have a problem.
Im planning on making a few changes like removing the mutex lock perhaps :thumbupguy:

Ah I see, thank you for that information! :)

I got the script setup like this, just to test it:
Code:
local vendorEntry = 500075
function vendorGossipHello(event, player, creature)
    player:GossipClearMenu()
    player:GossipMenuAddItem(0, "vendor1", 0, 1)
    player:GossipMenuAddItem(0, "vendor2", 0, 2)
    player:GossipSendMenu(103, creature)
end

function vendorGossipSelect(event, player, creature, sender, intid, code)
    player:SendListInventory(500076, 1)
    player:SendListInventory(500077, 2)
end

RegisterCreatureGossipEvent(vendorEntry, 1, vendorGossipHello)
RegisterCreatureGossipEvent(vendorEntry, 2, vendorGossipSelect)

But I get the following errors:
Code:
lua_scripts/test.lua:10: bad argument #1 to 'SendListInventory' (WorldObject expected)

And ah alright, well hopefully you can figure it out tomorrow or maybe someone else can post a fix :)
 

Rochet2

Moderator / Eluna Dev
Ah I see, thank you for that information! :)
I got the script setup like this, just to test it:
-SNIP-
But I get the following errors:
Code:
lua_scripts/test.lua:10: bad argument #1 to 'SendListInventory' (WorldObject expected)
And ah alright, well hopefully you can figure it out tomorrow or maybe someone else can post a fix :)

You were not supposed to alter anything in vendorGossipSelect function.
This was intended to be done:
Code:
local vendorEntry = 500075
function vendorGossipHello(event, player, creature)
    player:GossipMenuAddItem(0, "vendor1", 0, 500076)
    player:GossipMenuAddItem(0, "vendor2", 0, 500077)
    player:GossipSendMenu(103, creature)
end

function vendorGossipSelect(event, player, creature, sender, intid, code)
    player:SendListInventory(creature, intid)
end

RegisterCreatureGossipEvent(vendorEntry, 1, vendorGossipHello)
RegisterCreatureGossipEvent(vendorEntry, 2, vendorGossipSelect)

If you want to script other things in the menu as well and the entries are annoying you since they might be in the way, you can do this (using if cases):

Code:
local vendorEntry = 500075
function vendorGossipHello(event, player, creature)
    player:GossipMenuAddItem(0, "vendor1", 0, 1)
    player:GossipMenuAddItem(0, "vendor2", 0, 2)
    player:GossipSendMenu(103, creature)
end

function vendorGossipSelect(event, player, creature, sender, intid, code)
    if (intid == 1) then
        player:SendListInventory(creature, 500076)
    elseif (intid == 2) then
        player:SendListInventory(creature, 500077)
    end
end

RegisterCreatureGossipEvent(vendorEntry, 1, vendorGossipHello)
RegisterCreatureGossipEvent(vendorEntry, 2, vendorGossipSelect)

The worldobject parameter is a creature object (or other worldobject, but those are not coded in) that is used to display the vendor menu, not the entry or guid of one.
 
Last edited:

Ghostcrawler336

Epic Member
You were not supposed to alter anything in vendorGossipSelect function.
This was intended to be done:
Code:
local vendorEntry = 500075
function vendorGossipHello(event, player, creature)
    player:GossipMenuAddItem(0, "vendor1", 0, 500076)
    player:GossipMenuAddItem(0, "vendor2", 0, 500077)
    player:GossipSendMenu(103, creature)
end

function vendorGossipSelect(event, player, creature, sender, intid, code)
    player:SendListInventory(creature, intid)
end

RegisterCreatureGossipEvent(vendorEntry, 1, vendorGossipHello)
RegisterCreatureGossipEvent(vendorEntry, 2, vendorGossipSelect)

If you want to script other things in the menu as well and the entries are annoying you since they might be in the way, you can do this (using if cases):

Code:
local vendorEntry = 500075
function vendorGossipHello(event, player, creature)
    player:GossipMenuAddItem(0, "vendor1", 0, 1)
    player:GossipMenuAddItem(0, "vendor2", 0, 2)
    player:GossipSendMenu(103, creature)
end

function vendorGossipSelect(event, player, creature, sender, intid, code)
    if (intid == 1) then
        player:SendListInventory(creature, 500076)
    elseif (intid == 2) then
        player:SendListInventory(creature, 500077)
    end
end

RegisterCreatureGossipEvent(vendorEntry, 1, vendorGossipHello)
RegisterCreatureGossipEvent(vendorEntry, 2, vendorGossipSelect)

The worldobject parameter is a creature object (or other worldobject, but those are not coded in) that is used to display the vendor menu, not the entry or guid of one.

Oh I see now, well I feel stupid. :(

Anyways! Everything is working fine now, thank you for the help! :)
 
Status
Not open for further replies.
Top