Skip to content

Commit 5d1d162

Browse files
committed
fix(protocol): encode weekly expansion in store summary
Write the 15.25 Cyclopedia store-summary fields in the decoded order: Prey slots, Prey wildcards, Permanent Weekly Task Expansion, collection tokens, Charm Expansion, and hirelings. Stop folding the legacy hunting-task slot into the Prey counter and source the dedicated expansion byte from the Task Board KV without changing the packet boundary. Validation: lua tests/lua/test_taskboard_store_summary_wire.lua (1 passed, 0 failed); clang-format check passed for the changed lines.
1 parent 7fe1ad7 commit 5d1d162

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

src/server/network/protocol/protocolgame.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5142,18 +5142,14 @@ void ProtocolGame::sendCyclopediaCharacterStoreSummary() {
51425142
slotP && slotP->state != PreyDataState_Locked) {
51435143
preySlotsUnlocked++;
51445144
}
5145-
// Task hunting third slot unlocked
5146-
if (const auto &slotH = player->getTaskHuntingSlotById(PreySlot_Three);
5147-
slotH && slotH->state != PreyTaskDataState_Locked) {
5148-
preySlotsUnlocked++;
5149-
}
5150-
msg.addByte(preySlotsUnlocked); // getPreySlotById + getTaskHuntingSlotById
5145+
msg.addByte(preySlotsUnlocked);
51515146

51525147
msg.addByte(cyclopediaSummary.m_preyWildcards); // getPreyCardsObtained
5148+
const auto weeklyExpansion = player->kv()->scoped("task-board")->scoped("general")->get("weekly-expansion-unlocked");
5149+
msg.addByte(weeklyExpansion && weeklyExpansion->get<bool>() ? 0x01 : 0x00);
51535150
msg.addByte(cyclopediaSummary.m_instantRewards); // getRewardCollectionObtained
51545151
msg.addByte(player->hasCharmExpansion() ? 0x01 : 0x00);
51555152
msg.addByte(cyclopediaSummary.m_hirelings); // getHirelingsObtained
5156-
msg.addByte(0x00); // Reserved current-client store summary field
51575153

51585154
std::vector<uint16_t> m_hSkills;
51595155
for (const auto &[skillId, skillName] : g_game().getHirelingSkills()) {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- Standalone source contract for the current-client store summary packet.
2+
-- Run from the repository root with: lua tests/lua/test_taskboard_store_summary_wire.lua
3+
4+
local protocolFile = assert(io.open("src/server/network/protocol/protocolgame.cpp", "r"))
5+
local protocol = protocolFile:read("*a")
6+
protocolFile:close()
7+
8+
local summary = assert(protocol:match("void ProtocolGame::sendCyclopediaCharacterStoreSummary%(%)%s*{(.-)std::vector<uint16_t> m_hSkills"))
9+
local preySlots = assert(summary:find("msg.addByte(preySlotsUnlocked);", 1, true))
10+
local preyWildcards = assert(summary:find("msg.addByte(cyclopediaSummary.m_preyWildcards);", 1, true))
11+
local weeklyExpansion = assert(summary:find('get("weekly-expansion-unlocked")', 1, true))
12+
local collectionTokens = assert(summary:find("msg.addByte(cyclopediaSummary.m_instantRewards);", 1, true))
13+
local charmExpansion = assert(summary:find("msg.addByte(player->hasCharmExpansion() ? 0x01 : 0x00);", 1, true))
14+
local hirelings = assert(summary:find("msg.addByte(cyclopediaSummary.m_hirelings);", 1, true))
15+
16+
assert(preySlots < preyWildcards)
17+
assert(preyWildcards < weeklyExpansion)
18+
assert(weeklyExpansion < collectionTokens)
19+
assert(collectionTokens < charmExpansion)
20+
assert(charmExpansion < hirelings)
21+
assert(summary:find("getTaskHuntingSlotById", 1, true) == nil)
22+
23+
print("\n1 passed, 0 failed")

0 commit comments

Comments
 (0)