fix(clans): fix squadron timestamps, 20k RP cap, and configurable initial RP
Fix two 1970 squadron timestamps by sending nextRewardDayId as a 64-bit Unix timestamp in seconds and emitting dynamic bi-monthly season fields (clanDuelNextReward, clanSeasonStart, clanSeasonOrdinal, clanSeasonInYear) in clientProfile. Backfill preset normal squadrons to 58-60 deterministic NPC members so the client activity reward cap reaches 20,000, default startingPeriods and startingActivity to 0 in tuning/clans.jsonc, remove the hardcoded 20,000 empty-history fallback, and wire battle RP into squadron activity accumulation and period settlement.
This commit is contained in:
1 parent
b3211b89cd
commit
429c5eec12
11 files changed
+528
-60
No files matched your search
@@ -13,6 +13,7 @@ import type { BattleEconomy } from '../../battle/battle-economy.ts';
|
||||
import type { BattleStreaks } from '../../battle/battle-streaks.ts';
|
||||
import { withoutSupportPlanes } from '../../battle/battle-support-planes.ts';
|
||||
import type { CrewSkillCatalogue } from '../../crew/crew-skill-rules.ts';
|
||||
import type { ClanStore } from '../../clans/clan-store.ts';
|
||||
import type { ItemCatalogue } from '../../items/item-catalogue.ts';
|
||||
import type { EquipmentCatalogue } from '../../modifications/equipment-catalogue.ts';
|
||||
import { clientProfile } from '../../profile/client-profile.ts';
|
||||
@@ -41,6 +42,7 @@ export interface FinishBattleContext {
|
||||
readonly crew: CrewSkillCatalogue;
|
||||
readonly items: ItemCatalogue;
|
||||
readonly repair: RepairRules;
|
||||
readonly clans?: { readonly store: ClanStore } | undefined;
|
||||
}
|
||||
|
||||
export function finishBattleAction(ctx: FinishBattleContext, battle: BattleActionDependencies): CharActionHandler {
|
||||
@@ -67,7 +69,15 @@ export function finishBattleAction(ctx: FinishBattleContext, battle: BattleActio
|
||||
// The result log and expenses are written together. A retry can arrive after the profile
|
||||
// was saved but before the session was marked settled.
|
||||
if (hasBattleResultLog(profile, session.roomId)) return false;
|
||||
settleBattle(profile, report, session, settlementDeps);
|
||||
settleBattle(profile, report, session, {
|
||||
...settlementDeps,
|
||||
onBattleRpEarned: ctx.clans
|
||||
? (baseVehicleRp, nowSec) => {
|
||||
ctx.clans!.store.recordBattleActivity(account.userId, baseVehicleRp, nowSec);
|
||||
ctx.clans!.store.syncProfile(profile, account, nowSec);
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
battle.onAfterSettle?.({
|
||||
userId: account.userId,
|
||||
roomId: session.sessionId,
|
||||
|
||||
Reference in new issue
Block a user