Core/Loot: Implemented automatic flagging of tracking quests from loot

(cherry picked from commit d913e38cba)

# Conflicts:
#	sql/updates/world/cata_classic/2024_12_29_00_world.sql
This commit is contained in:
Shauren
2024-12-29 01:02:52 +01:00
committed by Ovahlord
parent 4084b85352
commit fd52be9fe5
9 changed files with 177 additions and 22 deletions

View File

@@ -1174,7 +1174,7 @@ public:
name = itemTemplate->GetName(handler->GetSessionDbcLocale());
if (!name)
name = "Unknown item";
handler->PSendSysMessage(alternateString ? LANG_COMMAND_NPC_SHOWLOOT_ENTRY_2 : LANG_COMMAND_NPC_SHOWLOOT_ENTRY,
handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_ENTRY, alternateString ? 6 : 3 /*number of bytes from following string*/, "\xE2\x94\x80\xE2\x94\x80",
itemCount, ItemQualityColors[itemTemplate ? static_cast<ItemQualities>(itemTemplate->GetQuality()) : ITEM_QUALITY_POOR], itemId, name, itemId);
}
@@ -1190,6 +1190,23 @@ public:
count, ItemQualityColors[currency ? static_cast<ItemQualities>(currency->Quality) : ITEM_QUALITY_POOR], currencyId, count, name, currencyId);
}
static void _ShowLootTrackingQuestCurrencyEntry(ChatHandler* handler, uint32 questId, bool alternateString = false)
{
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
std::string_view name;
if (quest)
{
name = quest->GetLogTitle();
if (handler->GetSessionDbLocaleIndex() != LOCALE_enUS)
if (QuestTemplateLocale const* localeData = sObjectMgr->GetQuestLocale(questId))
ObjectMgr::GetLocaleString(localeData->LogTitle, handler->GetSessionDbLocaleIndex(), name);
}
if (name.empty())
name = "Unknown quest";
handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_TRACKING_QUEST, alternateString ? 6 : 3 /*number of bytes from following string*/, "\xE2\x94\x80\xE2\x94\x80",
questId, STRING_VIEW_FMT_ARG(name), questId);
}
static void _IterateNotNormalLootMap(ChatHandler* handler, NotNormalLootItemMap const& map, std::vector<LootItem> const& items)
{
for (NotNormalLootItemMap::value_type const& pair : map)
@@ -1212,6 +1229,9 @@ public:
case LootItemType::Currency:
_ShowLootCurrencyEntry(handler, item.itemid, item.count, true);
break;
case LootItemType::TrackingQuest:
_ShowLootTrackingQuestCurrencyEntry(handler, item.itemid, true);
break;
}
}
}
@@ -1237,6 +1257,9 @@ public:
case LootItemType::Currency:
_ShowLootCurrencyEntry(handler, item.itemid, item.count);
break;
case LootItemType::TrackingQuest:
_ShowLootTrackingQuestCurrencyEntry(handler, item.itemid);
break;
}
}
}
@@ -1256,6 +1279,9 @@ public:
case LootItemType::Currency:
_ShowLootCurrencyEntry(handler, item.itemid, item.count);
break;
case LootItemType::TrackingQuest:
_ShowLootTrackingQuestCurrencyEntry(handler, item.itemid);
break;
}
}
}