hi everybody, i have a question, need create npc gossip what show list with options, example :
[+] change faction
[+] customize character
[+] items
[-] shirt
[-] items lvl 80 pvp
[-] items lvl 80 pve
in the “sub list” display (example):
hi everybody, i have a question, need create npc gossip what show list with options, example :
[+] change faction
[+] customize character
[+] items
[-] shirt
[-] items lvl 80 pvp
[-] items lvl 80 pve
in the “sub list” display (example):
Having multiple vendors in one NPC requires a core patch:
http://www.trinitycore.org/f/topic/7768-multi-vendor-core-mod/
#include “ScriptMgr.h”
class custom_NPCMultiVendor : public CreatureScript
{
public:
custom_NPCMultiVendor() : CreatureScript(“custom_NPCMultiVendor”) { }
bool OnGossipHello(Player* player, Creature* creature)
{
OnGossipSelect(player, creature, 1, 0);
return true;
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
if(!action)
{
switch(sender)
{
case 1:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Change faction", 1, 1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Customize character", 1, 2);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Items", 2, 0);
break;
case 2:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Shirts", 0, 54); // 54 would be the vendor entry to show from npc_vendor
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Items lvl 80 pvp", 0, 54);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Items lvl 80 pve", 0, 54);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Back..", 1, 0);
break;
}
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
return true;
}
if(!sender)
{
if(sObjectMgr->GetNpcVendorItemList(action))
player->GetSession()->SendListInventory(creature->GetGUID(), action);
else
player->CLOSE_GOSSIP_MENU();
return true;
}
switch(action)
{
case 1:
{
if(player->HasAtLoginFlag(AT_LOGIN_CHANGE_FACTION))
player->GetSession()->SendNotification("Already ready to change faction, relog");
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION));
player->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
stmt->setUInt32(1, player->GetGUIDLow());
CharacterDatabase.Execute(stmt);
player->GetSession()->SendAreaTriggerMessage("Relog to change faction");
}
}break;
case 2:
{
if(player->HasAtLoginFlag(AT_LOGIN_CUSTOMIZE))
player->GetSession()->SendNotification("Already ready to customize, relog");
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE));
player->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
stmt->setUInt32(1, player->GetGUIDLow());
CharacterDatabase.Execute(stmt);
player->GetSession()->SendAreaTriggerMessage("Relog to customize");
}
}break;
}
OnGossipSelect(player, creature, sender, 0);
return true;
}
};
void AddSC_custom_NPCMultiVendor()
{
new custom_NPCMultiVendor();
}
Ingame:
when i apply this patch it just gives me the ability to allow vendors to do this correct?
This patch allows you to have gossip options on the NPC that open different vendors, yes.
And the script above in my earlier post is the gossip for the request here.
git apply filename.diff
i am use windows 7.
need install any application?
You dont HAVE to.
You can apply diff manually just by looking at the diff file contents and seeing where the code belongs in the source files and add the changes.
You can also download git, which you should already have and apply the patch with git to the source code.
I myself use git bash.
You can select to install the shell extension when you install git to get the folder right click menu addition.
There are different ways to apply a diff.
Thanks for your help /emoticons/default_biggrin.png