服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
62 lines
2.2 KiB
Go
62 lines
2.2 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"strconv"
|
|
"time"
|
|
|
|
dnfinventory "longheng.io/server/internal/modules/dnf/inventory"
|
|
)
|
|
|
|
const currentDamageFontSkinListMsgID uint16 = 1239
|
|
|
|
func buildCurrentDamageFontSkinListBody(stats map[string]int64, now time.Time) []byte {
|
|
selected, entries := dnfinventory.DamageFontStateFromStats(stats, now)
|
|
var writer packetWriter
|
|
writer.writeUint16(selected)
|
|
writer.writeUint16(uint16(len(entries) + 1))
|
|
// Index zero is the current client's built-in/default damage font. It has no
|
|
// backing PVF item or expiry record, but must remain present in every list so
|
|
// the player can switch back after unlocking another font.
|
|
writer.writeUint32(0)
|
|
writer.writeUint32(0)
|
|
for _, entry := range entries {
|
|
writer.writeUint32(uint32(entry.FontIndex))
|
|
writer.writeUint32(entry.ExpiresAt)
|
|
}
|
|
return writer.bytes()
|
|
}
|
|
|
|
func (s *Service) sendSelectedDamageFontState(session *gameSession, source string) error {
|
|
if session == nil || session.selectedCharacterID == 0 {
|
|
return fmt.Errorf("selected character is required for damage-font projection")
|
|
}
|
|
repositories, ok := s.repositoryGroup()
|
|
if !ok || repositories.Character == nil {
|
|
return fmt.Errorf("character repository unavailable for damage-font projection")
|
|
}
|
|
ctx, cancel := context.WithTimeout(context.Background(), createWriteTimeout)
|
|
defer cancel()
|
|
record, found, err := repositories.Character.Load(ctx, strconv.Itoa(int(session.selectedCharacterID)))
|
|
if err != nil {
|
|
return fmt.Errorf("load damage-font character state: %w", err)
|
|
}
|
|
if !found {
|
|
return fmt.Errorf("damage-font character %d not found", session.selectedCharacterID)
|
|
}
|
|
now := s.gameplayNow().UTC()
|
|
selected, entries := dnfinventory.DamageFontStateFromStats(record.Stats, now)
|
|
body := buildCurrentDamageFontSkinListBody(record.Stats, now)
|
|
s.logPacketEvent("game-damage-font-state-send",
|
|
"conn_id", session.connID,
|
|
"source", source,
|
|
"char_id", session.selectedCharacterID,
|
|
"msg_id", currentDamageFontSkinListMsgID,
|
|
"classification", 0,
|
|
"selected_font_index", selected,
|
|
"entry_count", len(entries)+1,
|
|
"body_len", len(body))
|
|
return s.sendGameUpperRawClass(session, currentDamageFontSkinListMsgID, body, 0)
|
|
}
|