服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
90 lines
3.1 KiB
Go
90 lines
3.1 KiB
Go
package inventory
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/binary"
|
|
"testing"
|
|
)
|
|
|
|
func TestDecodePurifyItemRequestExactCurrentEXELayout(t *testing.T) {
|
|
body := make([]byte, 12)
|
|
binary.LittleEndian.PutUint16(body[0:2], 9)
|
|
binary.LittleEndian.PutUint32(body[2:6], 700)
|
|
binary.LittleEndian.PutUint16(body[6:8], 12)
|
|
binary.LittleEndian.PutUint32(body[8:12], 1183)
|
|
request, err := DecodePurifyItemRequest(body)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if request.TargetSlotIndex != 9 || request.TargetItemTemplateID != 700 || request.MaterialSlotIndex != 12 || request.MaterialItemTemplateID != 1183 {
|
|
t.Fatalf("request = %+v", request)
|
|
}
|
|
if _, err := DecodePurifyItemRequest(append(body, 0)); err == nil {
|
|
t.Fatal("op204 accepted trailing bytes")
|
|
}
|
|
}
|
|
|
|
func TestDecodeInvestItemAmplifyOptionRequestConditionalDSTR(t *testing.T) {
|
|
fixed := make([]byte, 14)
|
|
fixed[0] = investAmplifyActionInvest
|
|
binary.LittleEndian.PutUint16(fixed[1:3], 9)
|
|
binary.LittleEndian.PutUint32(fixed[3:7], 700)
|
|
binary.LittleEndian.PutUint16(fixed[7:9], 12)
|
|
binary.LittleEndian.PutUint32(fixed[9:13], 1286)
|
|
fixed[13] = 3
|
|
request, err := DecodeInvestItemAmplifyOptionRequest(fixed)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if request.Action != 0 || request.SelectedOption != 3 || request.TargetItemName != "" {
|
|
t.Fatalf("fixed request = %+v", request)
|
|
}
|
|
if _, err := DecodeInvestItemAmplifyOptionRequest(append(fixed, 0)); err == nil {
|
|
t.Fatal("non-Pure-Gold op205 accepted trailing bytes")
|
|
}
|
|
|
|
pureGold := append([]byte(nil), fixed...)
|
|
pureGold[0] = investAmplifyActionPureGold
|
|
name := []byte("target-name")
|
|
length := make([]byte, 4)
|
|
binary.LittleEndian.PutUint32(length, uint32(len(name)))
|
|
pureGold = append(pureGold, length...)
|
|
pureGold = append(pureGold, name...)
|
|
request, err = DecodeInvestItemAmplifyOptionRequest(pureGold)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if request.Action != investAmplifyActionPureGold || request.TargetItemName != string(name) {
|
|
t.Fatalf("Pure Gold request = %+v", request)
|
|
}
|
|
if _, err := DecodeInvestItemAmplifyOptionRequest(pureGold[:len(pureGold)-1]); err == nil {
|
|
t.Fatal("Pure Gold op205 accepted truncated DSTR")
|
|
}
|
|
}
|
|
|
|
func TestAmplifyACKLayoutsMatchCurrentEXEReaders(t *testing.T) {
|
|
result := AmplifyMutationResult{
|
|
Action: investAmplifyActionPureGold,
|
|
MaterialSlotIndex: 12,
|
|
MaterialRemainingCount: 2,
|
|
TargetSlotIndex: 9,
|
|
AmplifyType: 3,
|
|
AmplifyValue: 0x1234,
|
|
AmplifyLevel: 7,
|
|
}
|
|
wantPurify := []byte{1, 12, 0, 2, 0, 0, 0, 9, 0, 3, 0x34, 0x12}
|
|
if got := buildPurifyItemSuccessAck(result); !bytes.Equal(got, wantPurify) {
|
|
t.Fatalf("op204 success = %x, want %x", got, wantPurify)
|
|
}
|
|
if got := buildPurifyItemErrorAck(); !bytes.Equal(got, []byte{0, 1}) {
|
|
t.Fatalf("op204 error = %x", got)
|
|
}
|
|
wantInvest := []byte{1, 2, 12, 0, 2, 0, 0, 0, 9, 0, 3, 0x34, 0x12, 7}
|
|
if got := buildInvestItemAmplifyOptionSuccessAck(result); !bytes.Equal(got, wantInvest) {
|
|
t.Fatalf("op205 success = %x, want %x", got, wantInvest)
|
|
}
|
|
if got := buildInvestItemAmplifyOptionErrorAck(23); !bytes.Equal(got, []byte{0, 23}) {
|
|
t.Fatalf("op205 error = %x", got)
|
|
}
|
|
}
|