fix(rust): send reward notices, and keep a downed line's credit rule (W21, W4)
W21: the permission push named its fields one by one and left out `notices`, so no kit reward, lend or give ever told its player anything (D333). The body is now built by `pushBody`, which carries every field the payload has; a test fails if a payload field is dropped again. W4: a downed patrol helicopter, Chinook or Bradley is stored with the credit rule in force when it arrived, and the feed reads that stamp. Before, the line re-credited past rows with the server's current rule while the Rotorbane/Tankbreaker counts kept the old one. Rows stored before this change keep today's reading. PLAN_LAST_FIXES.md stage 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -72,7 +72,9 @@ const MAX_BATCHES_PER_TICK = 10
|
||||
* how to read.
|
||||
*/
|
||||
async function apply(serverId, item, server = null) {
|
||||
const frame = (item && item.frame) || {}
|
||||
// A downed helicopter, Chinook or Bradley is stored with the rule that
|
||||
// credits it now, so its line and its counts agree for good (W4).
|
||||
const frame = worldEvents.stampRule((item && item.frame) || {}, server && server.creditRule)
|
||||
const kind = item.kind || frame.kind
|
||||
const wipeId = frame.wipeId || null
|
||||
|
||||
@@ -278,8 +280,7 @@ async function apply(serverId, item, server = null) {
|
||||
// A protocol-13 plugin still sends `heliKills` / `apcKills` on its tally
|
||||
// instead, and the tally path above adds those as it always has.
|
||||
case 'world.event': {
|
||||
const rule = worldEvents.creditRuleOf(server && server.creditRule)
|
||||
for (const kill of worldEvents.killsOf(frame, rule)) {
|
||||
for (const kill of worldEvents.killsOf(frame, worldEvents.ruleOf(frame, server && server.creditRule))) {
|
||||
await db.touchPlayer(kill.steamId, kill.name || null)
|
||||
await db.addTitleStats({ serverId, wipeId, steamId: kill.steamId }, { [kill.field]: 1 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user