feat(inventory): items can carry where they came from to the client

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>
This commit is contained in:
Aaron Kimbrell
2026-09-30 07:45:50 -05:00
parent 3018312f29
commit a1ee18fce7
9 changed files with 112 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
#include "Inventory.h"
#include "InventoryComponent.h"
#include "Item.h"
#include "LootMetrics.h"
#include "BrickByBrick.h"
#include <ranges>
@@ -53,6 +54,13 @@ namespace GameMessages {
slotID = item.GetSlot();
}
void AddItemToInventoryClientSync::AddMetrics(const LootMetrics& metrics) {
const auto text = metrics.ToExtraInfo();
if (text.empty()) return;
if (!extraInfo.empty()) extraInfo += u',';
extraInfo += text;
}
void AddItemToInventoryClientSync::Serialize(RakNet::BitStream& bitStream) const {
bitStream.Write(bBound);
bitStream.Write(bIsBOE);