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

Multi Vendor&trainer Eluna Methods patch

dsy86

Enthusiast
Thanks to Rochet2 for the c++ multi vendor patch and AlexeWarr for the c++ multi trainer patch.
I just put the two patch together and add the Eluna methods support this.

patch link: http://paste.emudevs.com/?paste=67

Now the following three Eluna methods have the second param:
SendTrainerList(WorldObject, TrainerEntry) -- Sends the TrainerEntry's trainer list from object to player. The WorldObject should have trainer flag.
SendListInventory(WorldObject, VendorEntry) -- Sends the VendorEntry's vendor list from object to player. The WorldObject should have vendor flag.
SendVendorWindow(unit, VendorEntry) --Same as SendListInventory

If you set the secomd param nil, it will open the WorldObject's trainer/vendor list.

example:
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)

p.s. If you use the SendTrainerList method you should open a gossip menu first, otherwise it won't work. Like this:
Code:
	    player:GossipClearMenu() -- Should be used when triggering gossip without OnGossipHello hook
	    player:GossipSendMenu(100, creature) -- Send gossip menu. If you comment this out, the code wont work
	    player:SendTrainerList(creature,npcId) -- Send trainer window
Credits:
Rochet2 - For the Multi Vendor C++ patch
AlexeWarr - For the Multi Trainer C++ patch
 
Last edited:
Is Outdated , anyone can update this please ?

Why eluna no use this by default ?

i changed lines and now worked , compiled ... But

I open npc gossip - Work
Open vendor options - Work
Item list is empty .... i think is this code


ItemHandler.cpp

Code:
// Stop the npc if moving
    if (vendor->HasUnitState(UNIT_STATE_MOVING))
        vendor->StopMoving();
	VendorItemData const* items = vendor->GetVendorItems();
	VendorItemData const* vendorItems = vendorEntry ? sObjectMgr->GetNpcVendorItemList(vendorEntry) : vendor->GetVendorItems();
	uint32 rawItemCount = vendorItems ? vendorItems->GetItemCount() : 0;

	SetCurrentVendor(vendorEntry);
	if (!items)
    {
        WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1);
        data << uint64(vendorGuid);
        data << uint8(0);                                   // count == 0, next will be error code
        data << uint8(0);                                   // "Vendor has no inventory"
        SendPacket(&data);
        return;
    }
 
Last edited:

Rochet2

Moderator / Eluna Dev
In the beginning we wanted to avoid core modifications.
On TC we have modded the core only to add the hooks and to add the flight path creation methods. (may be something else as well, but cant think of other atm)

Sure we could add it in now. But its not that easy.
We need to create the code for TC and mangos and for classic, tbc, wotlk and cata.
Do mind for example wotlk and cataclysm use different packet structures and possibly system totally. So implementing this will need to wait a bit if we do it.

If you want multivendor for TC wotlk, easy way would be to get the latest patch from here:
http://rochet2.github.io/?page=Multivendor
Then just add the eluna modification:
Go to PlayerMethods.h
find SendListInventory method
Add uint32 entry = sEluna->CHECKVAL<uint32>(L, 3, 0);
under whatever other checkthing there is
and add the entry as a parameter for the final call of player->getsession()->SendListInventory
 
Rochet , i did waht u said . Used multivendor c++ and change this line , now how i use in eluna gossip ?
how i use when player click gossip appear npc vendor list items ?

thx


i testing using this code

Code:
local vendorEntry = 60071
function vendorGossipHello(event, player, creature)
    player:GossipClearMenu()
    player:GossipMenuAddItem(0, "vendor1", 0, 3313)
    player:GossipMenuAddItem(0, "vendor2", 0, 6929)
    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)

but vendor item have blank page , without items
 
Last edited:

Rochet2

Moderator / Eluna Dev
if those numbers 6929 and the other are entries from npc_vendor, then the code is wrong somehow.
Check startup errors and if that doesnt help there is something wrong with the patch on the TC version you are using, or then the implementation went wrong on eluna side.

I assume the problem is the last thing.

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;
    }
 
Last edited:
yes , i see here my eluna is outdated in this core ... appear "Error CHECKVAL no Eluna argument " Only usse CHECK_Object for CHECKOBJ , is outdated , i can del LuaEngine folder and add new from git will work ? Or no ? Because i already set a lot of scripts in this core.
 

Rochet2

Moderator / Eluna Dev
Its not going to work properly without appropriate core changes as well.
Hard to tell directly what you could do like this, but you could try just merging with our git repo.

Use a separate branch to work on this so you wont lose your scripts and stuff for messing around.
 
Top