[DiscordArchive] dk script?
[DiscordArchive] dk script?
Archived author: Vel • Posted: 2024-05-23T12:33:14.074000+00:00
Original source
dk script?
![[Image: image.png?ex=690c9603&is=690b4483&hm=0ba...208d6322f&]](https://cdn.discordapp.com/attachments/870722120458600528/1243180446397894706/image.png?ex=690c9603&is=690b4483&hm=0ba779c1b351004a1a4361e93e2c1992dbfdfd52a4fee54c677302f208d6322f&)
Archived author: Vel • Posted: 2024-05-23T12:35:15.662000+00:00
Original source
This is the diff implemented. And then I have a player_test.cpp added (it's just copied ExamplePlayerGossip.cpp).
```
#include "Define.h"
#include "GossipDef.h"
#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptMgr.h"
#include "Log.h"
#define MENU_ID 123 // Our menuID used to match the sent menu to select hook (playerscript)
class example_PlayerGossip : public PlayerScript
{
public:
example_PlayerGossip() : PlayerScript("example_PlayerGossip") {}
void OnLevelChanged(Player* player, uint8 /*oldlevel*/) override // Any hook here
{
TC_LOG_ERROR("entities.player.cheat", "OnLevelChanged");
ClearGossipMenuFor(player); // Clears old options
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Morph", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Demorph", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
// SetMenuId must be after clear menu and before send menu!!
player->PlayerTalkClass->GetGossipMenu().SetMenuId(MENU_ID); // Sets menu ID so we can identify our menu in Select hook. Needs unique number for the menu
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, player->GetGUID());
}
void OnGossipSelect(Player* player, uint32 menu_id, uint32 /*sender*/, uint32 action) override
{
TC_LOG_ERROR("entities.player.cheat", "OnGossipSelect");
if (menu_id != MENU_ID) // Not the menu coded here? stop.
return;
ClearGossipMenuFor(player);
switch(action)
{
case GOSSIP_ACTION_INFO_DEF+1:
player->SetDisplayId(999);
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->DeMorph();
break;
}
CloseGossipMenuFor(player);
}
};
void AddSC_example_PlayerGossip() // Add to scriptloader normally
{
new example_PlayerGossip();
}
```
If it was a item, creature, gob script etc. I'd have to add it to _template table in DB as a scriptname to work, but here I have nowhere to hook the "example_PlayerGossip" to somewhere. Should it hook all player scripts from /Custom/ automatically or how it's supposed to work?
![[Image: image.png?ex=690c9603&is=690b4483&hm=0ba...208d6322f&]](https://cdn.discordapp.com/attachments/870722120458600528/1243180446397894706/image.png?ex=690c9603&is=690b4483&hm=0ba779c1b351004a1a4361e93e2c1992dbfdfd52a4fee54c677302f208d6322f&)
Archived author: Vel • Posted: 2024-05-23T12:36:06.396000+00:00
Original source
I verified that the script is added and compiled. It just won't trigger on player `OnLevelChanged`.
Archived author: M'Dic • Posted: 2024-05-23T12:38:52.706000+00:00
Original source
https://github.com/TrinityCore/TrinityCo...l/84/files
[Embed: fix (module\skipdk): Gossip Menu Realignment by acidmanifesto · Pul...]
Changes proposed:
Adjust module to Gossip Menu Standard
"No" gossip option now works
Target branch(es): 3.3.5-skip-dk
Issues addressed: Fixes #
Tests performed: (Does it build,...
https://github.com/TrinityCore/TrinityCo...l/84/files
Archived author: M'Dic • Posted: 2024-05-23T12:39:47.395000+00:00
Original source
Line 249 and 253 is what i had to change for it to work with the new player gossip standard