服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
101 lines
3.0 KiB
Go
101 lines
3.0 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"longheng.io/server/internal/modules/dnf/packageitem"
|
|
)
|
|
|
|
const (
|
|
currentSeriaLuckGaugeMsgID uint16 = 0x019c
|
|
currentSeriaLuckEventID uint16 = 2037
|
|
)
|
|
|
|
func seriaLuckDisplayValue(stage int64) (byte, bool) {
|
|
if stage < 0 || stage > packageitem.SeriaLuckValueMax {
|
|
return 0, false
|
|
}
|
|
return byte(stage * 5), true
|
|
}
|
|
|
|
func buildSeriaLuckGaugeBody(before, after int64) ([]byte, bool) {
|
|
b, ok := seriaLuckDisplayValue(before)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
a, ok := seriaLuckDisplayValue(after)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
return []byte{b, a}, true
|
|
}
|
|
|
|
func (s *Service) sendCurrentSeriaLuckGauge(session *gameSession, before, after int64, source string) error {
|
|
body, ok := buildSeriaLuckGaugeBody(before, after)
|
|
if !ok {
|
|
return fmt.Errorf("invalid seria luck stage before=%d after=%d", before, after)
|
|
}
|
|
s.logPacketEvent("game-seria-luck-gauge-send", "source", source, "char_id", session.selectedCharacterID, "before", before, "after", after, "body", fmt.Sprintf("%x", body))
|
|
return s.sendGameUpperRawClass(session, currentSeriaLuckGaugeMsgID, body, 0)
|
|
}
|
|
|
|
// sendInitialSeriaLuckGauge restores the account-owned gauge only after the
|
|
// selected scene has installed its HUD. A missing or malformed durable value
|
|
// is not equivalent to a persisted zero stage, so it is deliberately omitted.
|
|
func (s *Service) sendInitialSeriaLuckGauge(session *gameSession, source string) error {
|
|
if s == nil || session == nil {
|
|
return nil
|
|
}
|
|
repositories, ok := s.repositoryGroup()
|
|
if !ok || repositories.Account == nil {
|
|
s.logGameEvent(session, "game-seria-luck-gauge-initial-skipped",
|
|
"source", source,
|
|
"reason", "account_repository_unavailable")
|
|
return nil
|
|
}
|
|
accountID := strings.TrimSpace(s.accountIDForSession(session))
|
|
if accountID == "" {
|
|
s.logGameEvent(session, "game-seria-luck-gauge-initial-skipped",
|
|
"source", source,
|
|
"reason", "account_id_unavailable")
|
|
return nil
|
|
}
|
|
account, found, err := repositories.Account.Load(context.Background(), accountID)
|
|
if err != nil {
|
|
s.logGameEvent(session, "game-seria-luck-gauge-initial-skipped",
|
|
"source", source,
|
|
"account_id", accountID,
|
|
"reason", "account_load_failed",
|
|
"error", err)
|
|
return nil
|
|
}
|
|
if !found {
|
|
s.logGameEvent(session, "game-seria-luck-gauge-initial-skipped",
|
|
"source", source,
|
|
"account_id", accountID,
|
|
"reason", "account_not_found")
|
|
return nil
|
|
}
|
|
raw := strings.TrimSpace(account.Metadata[packageitem.SeriaLuckMetadataKey])
|
|
if raw == "" {
|
|
s.logGameEvent(session, "game-seria-luck-gauge-initial-skipped",
|
|
"source", source,
|
|
"account_id", accountID,
|
|
"reason", "metadata_missing")
|
|
return nil
|
|
}
|
|
stage, err := strconv.ParseInt(raw, 10, 64)
|
|
if err != nil || stage < 0 || stage > packageitem.SeriaLuckValueMax {
|
|
s.logGameEvent(session, "game-seria-luck-gauge-initial-skipped",
|
|
"source", source,
|
|
"account_id", accountID,
|
|
"reason", "metadata_invalid",
|
|
"value", raw)
|
|
return nil
|
|
}
|
|
return s.sendCurrentSeriaLuckGauge(session, stage, stage, source)
|
|
}
|