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

Port From (https://github.com/TrinityCore/TrinityCore/commit/d913e38cbab9521c80d826417093d22b2c4a1c1a)
This commit is contained in:
Hondacrx
2025-05-19 18:56:02 -04:00
parent f62d303ec7
commit de59110fe8
7 changed files with 150 additions and 17 deletions
+27 -1
View File
@@ -524,7 +524,7 @@ namespace Game.Chat
if (itemTemplate != null)
name = itemTemplate.GetName(handler.GetSessionDbcLocale());
handler.SendSysMessage(alternateString ? CypherStrings.CommandNpcShowlootEntry2 : CypherStrings.CommandNpcShowlootEntry,
handler.SendSysMessage(CypherStrings.CommandNpcShowlootEntry, alternateString ? 6 : 3 /*number of bytes from following string*/, "\xE2\x94\x80\xE2\x94\x80",
itemCount, ItemConst.ItemQualityColors[(int)(itemTemplate != null ? itemTemplate.GetQuality() : ItemQuality.Poor)], itemId, name, itemId);
}
@@ -539,6 +539,23 @@ namespace Game.Chat
count, ItemConst.ItemQualityColors[currency != null ? currency.Quality : (int)ItemQuality.Poor], currencyId, count, name, currencyId);
}
static void _ShowLootTrackingQuestCurrencyEntry(CommandHandler handler, uint questId, bool alternateString = false)
{
Quest quest = Global.ObjectMgr.GetQuestTemplate(questId);
string name = "Unknown quest";
if (quest != null)
{
name = quest.LogTitle;
if (handler.GetSessionDbcLocale() != Locale.enUS)
{
QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(questId);
if (localeData != null)
ObjectManager.GetLocaleString(localeData.LogTitle, handler.GetSessionDbcLocale(), ref name);
}
}
handler.SendSysMessage(CypherStrings.CommandNpcShowlootTrackingQuest, alternateString ? 6 : 3 /*number of bytes from following string*/, "\xE2\x94\x80\xE2\x94\x80", questId, name, questId);
}
static void _IterateNotNormalLootMap(CommandHandler handler, MultiMap<ObjectGuid, NotNormalLootItem> map, List<LootItem> items)
{
foreach (var key in map.Keys)
@@ -564,6 +581,9 @@ namespace Game.Chat
case LootItemType.Currency:
_ShowLootCurrencyEntry(handler, item.itemid, item.count, true);
break;
case LootItemType.TrackingQuest:
_ShowLootTrackingQuestCurrencyEntry(handler, item.itemid, true);
break;
}
}
}
@@ -589,6 +609,9 @@ namespace Game.Chat
case LootItemType.Currency:
_ShowLootCurrencyEntry(handler, item.itemid, item.count);
break;
case LootItemType.TrackingQuest:
_ShowLootTrackingQuestCurrencyEntry(handler, item.itemid);
break;
}
}
}
@@ -608,6 +631,9 @@ namespace Game.Chat
case LootItemType.Currency:
_ShowLootCurrencyEntry(handler, item.itemid, item.count);
break;
case LootItemType.TrackingQuest:
_ShowLootTrackingQuestCurrencyEntry(handler, item.itemid);
break;
}
}
}