DNF90 服务端与启动器完整源码(含 GM 工具功能增强)
服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
This commit is contained in:
commit
645b64fe21
4388 files changed
+1405457
No files matched your search
@@ -0,0 +1,104 @@
|
||||
// 本文件解析角色选择链 C2S 请求体。
|
||||
// 字段顺序参考 C# CharacterSelectHandler;当前只用于 fallback 日志和后续 owner 化计划。
|
||||
package character
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// SelectCharacterRequest 描述选择角色请求。
|
||||
type SelectCharacterRequest struct {
|
||||
SlotOrCharacterID uint16
|
||||
}
|
||||
|
||||
// CreateCharacterRequest 描述创建角色请求。
|
||||
type CreateCharacterRequest struct {
|
||||
Job byte
|
||||
Name string
|
||||
}
|
||||
|
||||
// DeleteCharacterRequest 描述删除角色请求。
|
||||
type DeleteCharacterRequest struct {
|
||||
Slot uint16
|
||||
Name string
|
||||
}
|
||||
|
||||
// CheckNameRequest 描述角色名查重请求。
|
||||
type CheckNameRequest struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
// DecodeSelectCharacterRequest 解析 C# 选角请求的前 2 字节槽位。
|
||||
func DecodeSelectCharacterRequest(body []byte) (SelectCharacterRequest, error) {
|
||||
if len(body) < 2 {
|
||||
return SelectCharacterRequest{}, fmt.Errorf("body too short: got %d want >= 2", len(body))
|
||||
}
|
||||
return SelectCharacterRequest{SlotOrCharacterID: binary.LittleEndian.Uint16(body)}, nil
|
||||
}
|
||||
|
||||
// DecodeCreateCharacterRequest 解析创建角色请求:u8 job + i32 nameLen + name bytes。
|
||||
func DecodeCreateCharacterRequest(body []byte) (CreateCharacterRequest, error) {
|
||||
if len(body) < 6 {
|
||||
return CreateCharacterRequest{}, fmt.Errorf("body too short: got %d want >= 6", len(body))
|
||||
}
|
||||
nameLen := int(int32(binary.LittleEndian.Uint32(body[1:])))
|
||||
if nameLen < 0 || 5+nameLen+1 > len(body) {
|
||||
return CreateCharacterRequest{}, fmt.Errorf("name length %d invalid for body %d", nameLen, len(body))
|
||||
}
|
||||
return CreateCharacterRequest{
|
||||
Job: body[0],
|
||||
Name: string(body[5 : 5+nameLen]),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DecodeDeleteCharacterRequest parses the current u16 slot + i32 nameLen +
|
||||
// ANSI name layout. The historical u8-slot variant remains accepted.
|
||||
func DecodeDeleteCharacterRequest(body []byte) (DeleteCharacterRequest, error) {
|
||||
if len(body) < 6 {
|
||||
return DeleteCharacterRequest{}, fmt.Errorf("body too short: got %d want >= 6", len(body))
|
||||
}
|
||||
nameLen := int(int32(binary.LittleEndian.Uint32(body[2:])))
|
||||
if nameLen > 0 && 6+nameLen <= len(body) {
|
||||
return DeleteCharacterRequest{
|
||||
Slot: binary.LittleEndian.Uint16(body[:2]),
|
||||
Name: string(body[6 : 6+nameLen]),
|
||||
}, nil
|
||||
}
|
||||
nameLen = int(int32(binary.LittleEndian.Uint32(body[1:])))
|
||||
if nameLen <= 0 || 5+nameLen > len(body) {
|
||||
return DeleteCharacterRequest{}, fmt.Errorf("name length %d invalid for body %d", nameLen, len(body))
|
||||
}
|
||||
return DeleteCharacterRequest{
|
||||
Slot: uint16(body[0]),
|
||||
Name: string(body[5 : 5+nameLen]),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DecodeCheckNameRequest 解析角色名查重请求:i32 nameLen + name bytes。
|
||||
func DecodeCheckNameRequest(body []byte) (CheckNameRequest, error) {
|
||||
if len(body) < 5 {
|
||||
return CheckNameRequest{}, fmt.Errorf("body too short: got %d want >= 5", len(body))
|
||||
}
|
||||
nameLen := int(int32(binary.LittleEndian.Uint32(body)))
|
||||
if nameLen <= 0 || 4+nameLen > len(body) {
|
||||
return CheckNameRequest{}, fmt.Errorf("name length %d invalid for body %d", nameLen, len(body))
|
||||
}
|
||||
return CheckNameRequest{Name: string(body[4 : 4+nameLen])}, nil
|
||||
}
|
||||
|
||||
func (r SelectCharacterRequest) String() string {
|
||||
return fmt.Sprintf("slotOrChar=%d", r.SlotOrCharacterID)
|
||||
}
|
||||
|
||||
func (r CreateCharacterRequest) String() string {
|
||||
return fmt.Sprintf("job=%d name=%q", r.Job, r.Name)
|
||||
}
|
||||
|
||||
func (r DeleteCharacterRequest) String() string {
|
||||
return fmt.Sprintf("slot=%d name=%q", r.Slot, r.Name)
|
||||
}
|
||||
|
||||
func (r CheckNameRequest) String() string {
|
||||
return fmt.Sprintf("name=%q", r.Name)
|
||||
}
|
||||
Reference in new issue
Block a user