mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 19:03:43 +00:00
Live servers put _Metric_ keys in AddItemToInventoryClientSync's extra info, after the item's own config, saying where the items came from: the source object's LOT (_Metric_Souce_LOT_Int, misspelt as live had it), the mission, activity, coins paid, mail or trade. LootMetrics holds them and writes them with the key names and name value types live used (the mail ID as type 8, the trade ID as type 9). AddItem, ReceiveItem (its options), the new item constructor and Item::SetCount pass them through to the message; the item does not keep them. RemoveItem and Item::SetCount can also say what took items away (ItemRemovalSource), filling RemoveItemFromInventory's loot source and source object instead of none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
909 B
C++
28 lines
909 B
C++
#include "LootMetrics.h"
|
|
|
|
#include "LDFFormat.h"
|
|
|
|
namespace {
|
|
template<typename T>
|
|
void Append(std::u16string& out, const char16_t* key, const std::optional<T>& value) {
|
|
if (!value) return;
|
|
if (!out.empty()) out += u',';
|
|
out += GeneralUtils::ASCIIToUTF16(LDFData<T>(key, *value).GetString());
|
|
}
|
|
}
|
|
|
|
bool LootMetrics::Empty() const {
|
|
return !sourceLot && !missionId && !activityId && !currencyDelta && !mailId && !transactionId;
|
|
}
|
|
|
|
std::u16string LootMetrics::ToExtraInfo() const {
|
|
std::u16string out;
|
|
Append<int32_t>(out, u"_Metric_Souce_LOT_Int", sourceLot);
|
|
Append<int32_t>(out, u"_Metric_Mission_ID_Int", missionId);
|
|
Append<int32_t>(out, u"_Metric_Activity_ID_Int", activityId);
|
|
Append<int32_t>(out, u"_Metric_Currency_Delta_Int", currencyDelta);
|
|
Append<uint64_t>(out, u"_Metric_Mail_ID_Int64", mailId);
|
|
Append<LWOOBJID>(out, u"_Metric_Transaction_ID_Int64", transactionId);
|
|
return out;
|
|
}
|