服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
74 lines
2.4 KiB
Go
74 lines
2.4 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"longheng.io/server/internal/modules/dnf/premium"
|
|
dnfquest "longheng.io/server/internal/modules/dnf/quest"
|
|
)
|
|
|
|
// reconcileCurrentDailyQuestSelectionIfNeeded clears repeatable quests that
|
|
// were last written in an earlier service day, once per character per service
|
|
// day.
|
|
//
|
|
// The scheduled 06:00 sweeps only fire while the process is alive. This
|
|
// deployment is started and stopped by hand, so every boundary the server
|
|
// slept through was skipped and yesterday's dailies stayed completed until
|
|
// someone happened to be online at 06:00. Reconciling from the login read
|
|
// makes the reset depend on the calendar instead of on uptime; the domain
|
|
// owner is idempotent, so a session that also crosses a live boundary is
|
|
// unaffected.
|
|
func (s *Service) reconcileCurrentDailyQuestSelectionIfNeeded(
|
|
ctx context.Context,
|
|
session *gameSession,
|
|
characterID uint16,
|
|
) {
|
|
if s == nil || session == nil || characterID == 0 {
|
|
return
|
|
}
|
|
now := s.gameplayNow().UTC()
|
|
serviceDayID := premium.ServiceDayID(now)
|
|
if session.dailyQuestResetCharacterID == characterID &&
|
|
session.dailyQuestResetServiceDayID == serviceDayID {
|
|
return
|
|
}
|
|
repositories, ok := s.repositoryGroup()
|
|
if !ok || repositories.Quest == nil {
|
|
return
|
|
}
|
|
catalog, err := s.loadQuestCatalog(ctx)
|
|
if err != nil || catalog == nil {
|
|
s.logGameEvent(session, "game-daily-quest-reset-deferred",
|
|
"char_id", characterID,
|
|
"reason", "quest_catalog_unavailable",
|
|
"error", err)
|
|
return
|
|
}
|
|
owner, err := dnfquest.NewOwner(repositories)
|
|
if err != nil {
|
|
return
|
|
}
|
|
result, err := owner.ReconcileDailyReset(ctx, catalog, strconv.Itoa(int(characterID)), now)
|
|
if err != nil {
|
|
s.logGameEvent(session, "game-daily-quest-reset-deferred",
|
|
"char_id", characterID,
|
|
"service_day_id", serviceDayID,
|
|
"error", err)
|
|
return
|
|
}
|
|
// Only remember the reconciliation once it actually ran against the
|
|
// repository, so a deferred attempt retries on the next read.
|
|
session.dailyQuestResetCharacterID = characterID
|
|
session.dailyQuestResetServiceDayID = serviceDayID
|
|
if !result.Changed {
|
|
return
|
|
}
|
|
s.logGameEvent(session, "game-daily-quest-reset-reconciled",
|
|
"char_id", characterID,
|
|
"service_day_id", result.ServiceDayID,
|
|
"reset_quest_count", len(result.ResetQuestIDs),
|
|
"reset_quest_ids", result.ResetQuestIDs,
|
|
"source", "login_read_catch_up_independent_of_server_uptime")
|
|
}
|