Skip to content

Instantly share code, notes, and snippets.

@Haeniken
Last active October 12, 2021 23:16
Show Gist options
  • Save Haeniken/4ce6ba71ef3e939ba424152b3c94dde7 to your computer and use it in GitHub Desktop.
Save Haeniken/4ce6ba71ef3e939ba424152b3c94dde7 to your computer and use it in GitHub Desktop.
Correction of an error that occurs in the log when combining vendor and trainer for TrinityCore
From d2e54dc3e1970d1b1e7a25f13aabbbfcec712973 Mon Sep 17 00:00:00 2001
From: Haeniken <me@haeniken.com>
Date: Sun, 10 Oct 2021 14:13:39 +0300
Subject: [PATCH] fix
---
src/server/game/Entities/Player/Player.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 7fcef2250f..506e729c94 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -14367,12 +14367,14 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
case GOSSIP_OPTION_TRAINER:
{
Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(creature->GetEntry());
- if (!trainer || !trainer->IsTrainerValidForPlayer(this))
+ if (!trainer) // || !trainer->IsTrainerValidForPlayer(this))
{
TC_LOG_ERROR("sql.sql", "GOSSIP_OPTION_TRAINER:: Player %s %s requested wrong gossip menu: %u at Creature: %s (Entry: %u)",
GetName().c_str(), GetGUID().ToString().c_str(), menu->GetGossipMenu().GetMenuId(), creature->GetName().c_str(), creature->GetEntry());
canTalk = false;
}
+ if (!trainer->IsTrainerValidForPlayer(this))
+ canTalk = false;
[[fallthrough]];
}
case GOSSIP_OPTION_GOSSIP:
--
2.20.1
@Haeniken
Copy link
Author

Haeniken commented Oct 12, 2021

Known bugs:
If an npc has a flag 16 without a training sheet, the server crashes.
This seems breaks the "multivendor" by Rochet2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment