Honestly, it isn't very hard to add everything manually.
Under GameObject* go = NULL; add inside "void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)"
MiscHandler.cpp, search for "void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)" (Line 89 - Latest TC). Once you found it, you should already see "if (IS_CRE_OR_VEH_GUID(guid))" (Line 105 - 127 - Latest TC). After "if (IS_CRE_OR_VEH_GUID(guid))", put:
Code:
else if (IS_PLAYER_GUID(guid))
{
if(_player->GetGUID() == guid && _player->PlayerTalkClass->GetGossipMenu().GetMenuId() == menuId)
{
if(code.empty())
sScriptMgr->OnGossipSelect(_player, menuId, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId));
else
sScriptMgr->OnGossipSelectCode(_player, menuId, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
}
return;
}
else if(IS_ITEM_GUID(guid))
{
if(Item* item = _player->GetItemByGuid(guid))
{
if(code.empty())
sScriptMgr->OnGossipSelect(_player, item, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId));
else
sScriptMgr->OnGossipSelectCode(_player, item, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
}
return;
}
So now it should look like:
Code:
if (IS_CRE_OR_VEH_GUID(guid))
{
unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
{
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
}
}
[COLOR=#00ff00] else if (IS_PLAYER_GUID(guid))
{
if(_player->GetGUID() == guid && _player->PlayerTalkClass->GetGossipMenu().GetMenuId() == menuId)
{
if(code.empty())
sScriptMgr->OnGossipSelect(_player, menuId, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId));
else
sScriptMgr->OnGossipSelectCode(_player, menuId, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
}
return;
}
else if(IS_ITEM_GUID(guid))
{
if(Item* item = _player->GetItemByGuid(guid))
{
if(code.empty())
sScriptMgr->OnGossipSelect(_player, item, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId));
else
sScriptMgr->OnGossipSelectCode(_player, item, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
}
return;
}[/COLOR]
else if (IS_GAMEOBJECT_GUID(guid))
{
go = _player->GetMap()->GetGameObject(guid);
if (!go)
{
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid)));
return;
}
}
else
{
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid)));
return;
}
In ScriptMgr.h on line (369 - LatestTC -- is ItemScript that holds virtual functions). Under line 389 (Latest TC), add:
Code:
virtual void OnGossipSelect(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/) { }
virtual void OnGossipSelectCode(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { }
After that, we still need to do one more thing in ScriptMgr.h. Go to line 914 (Latest TC) and you should see "public: /* ItemScript */". Below line 919 (Latest TC) add:
Code:
void OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action);
void OnGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code);
After you have done that, we need to edit ScriptMgr.cpp (Last one) - Go to line 680 (Latest TC) and at the end of that function put:
Code:
void ScriptMgr::OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action)
{
ASSERT(player);
ASSERT(item);
FOREACH_SCRIPT(ItemScript)->OnGossipSelect(player, item, sender, action);
}
void ScriptMgr::OnGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code)
{
ASSERT(player);
ASSERT(item);
FOREACH_SCRIPT(ItemScript)->OnGossipSelectCode(player, item, sender, action, code);
}
In ScriptMgr.h, Add this on line 687 or below:
Code:
// Called when a player selects an option in a player gossip window
virtual void OnGossipSelect(Player* /*player*/, uint32 /*menu_id*/, uint32 /*sender*/, uint32 /*action*/) { }
// Called when a player selects an option in a player gossip window
virtual void OnGossipSelectCode(Player* /*player*/, uint32 /*menu_id*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { }
Last one in ScriptMgr.h, on line 1020 or below, add:
Code:
void OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action);
void OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code);
Add this in ScriptMgr.cpp:
Code:
void ScriptMgr::OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action)
{
ASSERT(player);
FOREACH_SCRIPT(PlayerScript)->OnGossipSelect(player, menu_id, sender, action);
}
void ScriptMgr::OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code)
{
ASSERT(player);
FOREACH_SCRIPT(PlayerScript)->OnGossipSelectCode(player, menu_id, sender, action, code);
}
Alright, you should be done! However, if you need help with the lines, I have something below for you to click on to see the exact line:
MiscHandler.cpp - "void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)" (Line 89 - Latest TC):
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Handlers/MiscHandler.cpp#L89
MiscHandler.cpp - if (IS_CRE_OR_VEH_GUID(guid))" (Line 105 - 127 - Latest TC)
https://github.com/TrinityCore/Trin...erver/game/Handlers/MiscHandler.cpp#L105-L127
MiscHandler.cpp - Under Line (113) Add the Item code:
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Handlers/MiscHandler.cpp#L113
ScriptMgr.h - Go to line 914 (Latest TC) and you should see "public: /* ItemScript */"
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Scripting/ScriptMgr.h#L914
ScriptMgr.h - on line (369 - LatestTC -- is ItemScript that holds virtual functions).
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Scripting/ScriptMgr.h#L369
ScriptMgr.h - Under line 389 (Latest TC), add:
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Scripting/ScriptMgr.h#L389
ScriptMgr.cpp - Go to line 680 (Latest TC) and at the end of that function put:
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Scripting/ScriptMgr.cpp#L680
END OF FUNCTION:
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Scripting/ScriptMgr.cpp#L687
I added the code from the Item Gossip thread, so if there's an issue don't hate on me. :3