PDA

View Full Version : [Patch] Multi Trainer



Wise
11-01-14, 11:35 PM
Since Rochet2 shared multi vendor patch, I tought I can make something similar such multi trainer :P



patch link:
https://docs.google.com/file/d/0B9MO...pITGFrU2M/edit (https://docs.google.com/file/d/0B9MOeIO4JRaNanBrM1pITGFrU2M/edit)


TRAINER_ID can be left blank and will use default npc's trainer list if has one.



For example I have a simple creature gossip script to test that:For example I have a simple creature gossip script to test that:



#include "ScriptPCH.h"

class TestGossipNpc : public CreatureScript
{
public: TestGossipNpc() : CreatureScript("TestGossipNpc") { }

bool OnGossipHello(Player* player, Creature* pCreature)
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "trainer 1 [default]", GOSSIP_SENDER_MAIN, 1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "trainer 2 [entry: 918]", GOSSIP_SENDER_MAIN, 2);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "trainer 3 [entry: 914]", GOSSIP_SENDER_MAIN, 3);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "trainer 4 [entry: 928]", GOSSIP_SENDER_MAIN, 4);
player->PlayerTalkClass->SendGossipMenu(1, pCreature->GetGUID());
return true;
}

bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
{
switch (uiAction)
{
case 1:
player->GetSession()->SendTrainerList(creature->GetGUID()); // if using without trainer_id specified, then the npc has to containthis flag id UNIT_NPC_FLAG_TRAINER = 16, in this case we will use 17 since the npc needs flag id 1 for gossip and 16 to set the npc as a trainer
break;
case 2:
player->GetSession()->SendTrainerList(creature->GetGUID(), 918); // rogue trainer list
break;
case 3:
player->GetSession()->SendTrainerList(creature->GetGUID(), 914); // warrior trainer list
break;
case 4:
player->GetSession()->SendTrainerList(creature->GetGUID(), 928); // paladin trainer list
break;
}
return true;
}
};

void AddSC_TestGossipNpc()
{
new TestGossipNpc();
}



This patch does NOT spawn any creature around, if you are going to think that.

Credits : Alexewarr

kusanagy
07-11-16, 09:51 AM
hello bro, can you upload the File Patch? please.

thanks!