mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: show LFG dungeon name in Dungeon Finder queue messages
Add LFGDungeons.dbc cache (loadLfgDungeonDbc / getLfgDungeonName) and use it to enrich three LFG chat messages in WotLK: - handleLfgJoinResult: "Joined the queue for Culling of Stratholme." - handleLfgProposalUpdate case 1: "Group found for Halls of Lightning!" - handleLfgProposalUpdate case 2: "A group has been found for ... Accept or decline." Falls back to generic text when DBC is unavailable or dungeon ID unknown.
This commit is contained in:
parent
59e29e2988
commit
ed02f5872a
3 changed files with 66 additions and 5 deletions
|
|
@ -113,5 +113,8 @@
|
|||
"Threshold0": 38, "Threshold1": 39, "Threshold2": 40, "Threshold3": 41,
|
||||
"Threshold4": 42, "Threshold5": 43, "Threshold6": 44, "Threshold7": 45,
|
||||
"Threshold8": 46, "Threshold9": 47
|
||||
},
|
||||
"LFGDungeons": {
|
||||
"ID": 0, "Name": 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2977,6 +2977,12 @@ private:
|
|||
bool mapNameCacheLoaded_ = false;
|
||||
void loadMapNameCache();
|
||||
std::string getMapName(uint32_t mapId) const;
|
||||
|
||||
// LFG dungeon name cache (lazy-loaded from LFGDungeons.dbc; WotLK only)
|
||||
std::unordered_map<uint32_t, std::string> lfgDungeonNameCache_;
|
||||
bool lfgDungeonNameCacheLoaded_ = false;
|
||||
void loadLfgDungeonDbc();
|
||||
std::string getLfgDungeonName(uint32_t dungeonId) const;
|
||||
std::vector<TrainerTab> trainerTabs_;
|
||||
void handleTrainerList(network::Packet& packet);
|
||||
void loadSpellNameCache();
|
||||
|
|
|
|||
|
|
@ -14809,7 +14809,13 @@ void GameHandler::handleLfgJoinResult(network::Packet& packet) {
|
|||
// Success — state tells us what phase we're entering
|
||||
lfgState_ = static_cast<LfgState>(state);
|
||||
LOG_INFO("SMSG_LFG_JOIN_RESULT: success, state=", static_cast<int>(state));
|
||||
addSystemChatMessage("Dungeon Finder: Joined the queue.");
|
||||
{
|
||||
std::string dName = getLfgDungeonName(lfgDungeonId_);
|
||||
if (!dName.empty())
|
||||
addSystemChatMessage("Dungeon Finder: Joined the queue for " + dName + ".");
|
||||
else
|
||||
addSystemChatMessage("Dungeon Finder: Joined the queue.");
|
||||
}
|
||||
} else {
|
||||
const char* msg = lfgJoinResultString(result);
|
||||
std::string errMsg = std::string("Dungeon Finder: ") + (msg ? msg : "Join failed.");
|
||||
|
|
@ -14860,15 +14866,25 @@ void GameHandler::handleLfgProposalUpdate(network::Packet& packet) {
|
|||
lfgProposalId_ = 0;
|
||||
addSystemChatMessage("Dungeon Finder: Group proposal failed.");
|
||||
break;
|
||||
case 1:
|
||||
case 1: {
|
||||
lfgState_ = LfgState::InDungeon;
|
||||
lfgProposalId_ = 0;
|
||||
addSystemChatMessage("Dungeon Finder: Group found! Entering dungeon...");
|
||||
std::string dName = getLfgDungeonName(dungeonId);
|
||||
if (!dName.empty())
|
||||
addSystemChatMessage("Dungeon Finder: Group found for " + dName + "! Entering dungeon...");
|
||||
else
|
||||
addSystemChatMessage("Dungeon Finder: Group found! Entering dungeon...");
|
||||
break;
|
||||
case 2:
|
||||
}
|
||||
case 2: {
|
||||
lfgState_ = LfgState::Proposal;
|
||||
addSystemChatMessage("Dungeon Finder: A group has been found. Accept or decline.");
|
||||
std::string dName = getLfgDungeonName(dungeonId);
|
||||
if (!dName.empty())
|
||||
addSystemChatMessage("Dungeon Finder: A group has been found for " + dName + ". Accept or decline.");
|
||||
else
|
||||
addSystemChatMessage("Dungeon Finder: A group has been found. Accept or decline.");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -23118,6 +23134,42 @@ std::string GameHandler::getMapName(uint32_t mapId) const {
|
|||
return (it != mapNameCache_.end()) ? it->second : std::string{};
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// LFG dungeon name cache (WotLK: LFGDungeons.dbc)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void GameHandler::loadLfgDungeonDbc() {
|
||||
if (lfgDungeonNameCacheLoaded_) return;
|
||||
lfgDungeonNameCacheLoaded_ = true;
|
||||
|
||||
auto* am = core::Application::getInstance().getAssetManager();
|
||||
if (!am || !am->isInitialized()) return;
|
||||
|
||||
auto dbc = am->loadDBC("LFGDungeons.dbc");
|
||||
if (!dbc || !dbc->isLoaded()) return;
|
||||
|
||||
const auto* layout = pipeline::getActiveDBCLayout()
|
||||
? pipeline::getActiveDBCLayout()->getLayout("LFGDungeons") : nullptr;
|
||||
const uint32_t idField = layout ? (*layout)["ID"] : 0;
|
||||
const uint32_t nameField = layout ? (*layout)["Name"] : 1;
|
||||
|
||||
for (uint32_t i = 0; i < dbc->getRecordCount(); ++i) {
|
||||
uint32_t id = dbc->getUInt32(i, idField);
|
||||
if (id == 0) continue;
|
||||
std::string name = dbc->getString(i, nameField);
|
||||
if (!name.empty())
|
||||
lfgDungeonNameCache_[id] = std::move(name);
|
||||
}
|
||||
LOG_INFO("LFGDungeons.dbc: loaded ", lfgDungeonNameCache_.size(), " dungeon names");
|
||||
}
|
||||
|
||||
std::string GameHandler::getLfgDungeonName(uint32_t dungeonId) const {
|
||||
if (dungeonId == 0) return {};
|
||||
const_cast<GameHandler*>(this)->loadLfgDungeonDbc();
|
||||
auto it = lfgDungeonNameCache_.find(dungeonId);
|
||||
return (it != lfgDungeonNameCache_.end()) ? it->second : std::string{};
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Aura duration update
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue