服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
93 lines
2.8 KiB
Go
93 lines
2.8 KiB
Go
package repository
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestCharacterContainerStateFromSettingsAcceptsCurrentExeInitialState(t *testing.T) {
|
|
state, err := characterContainerStateFromSettings(SettingsRecord{
|
|
Values: map[string]string{
|
|
"source": "current_exe_86jp_op13_container_state",
|
|
"main_list_param16": "24",
|
|
"avatar_list_param16": "0",
|
|
"personal_cargo_list_param16": "8",
|
|
"account_cargo_selection_key": "3",
|
|
"account_cargo_value32": "0x1234",
|
|
},
|
|
}, "27")
|
|
if err != nil {
|
|
t.Fatalf("decode container state: %v", err)
|
|
}
|
|
if state.CharacterID != "27" || state.MainSlotCount != 24 || state.AvatarExpansion != 0 ||
|
|
state.PersonalCargoSlotCount != 8 || state.AccountCargoSelectionKey != 3 ||
|
|
state.AccountCargoStateValue != 0x1234 {
|
|
t.Fatalf("container state = %+v", state)
|
|
}
|
|
}
|
|
|
|
func TestCurrentMainInventoryExpansionMatchesPythonWireTable(t *testing.T) {
|
|
for _, value := range []uint16{0, 8, 16, 24} {
|
|
if !currentMainInventoryExpansion(value) {
|
|
t.Fatalf("main expansion %d rejected", value)
|
|
}
|
|
}
|
|
for _, value := range []uint16{1, 7, 23, 25, 32} {
|
|
if currentMainInventoryExpansion(value) {
|
|
t.Fatalf("invalid main expansion %d accepted", value)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCurrentAvatarInventoryExpansionMatchesCurrentExeTicketTable(t *testing.T) {
|
|
for value := uint16(0); value <= 140; value += 7 {
|
|
if !currentAvatarInventoryExpansion(value) {
|
|
t.Fatalf("avatar expansion %d rejected", value)
|
|
}
|
|
}
|
|
for _, value := range []uint16{1, 6, 8, 139, 141} {
|
|
if currentAvatarInventoryExpansion(value) {
|
|
t.Fatalf("invalid avatar expansion %d accepted", value)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCharacterContainerStateRejectsValuesOutsideCurrentExeShape(t *testing.T) {
|
|
tests := []map[string]string{
|
|
{
|
|
"main_list_param16": "23",
|
|
"avatar_list_param16": "0",
|
|
"personal_cargo_list_param16": "8",
|
|
},
|
|
{
|
|
"main_list_param16": "24",
|
|
"avatar_list_param16": "0",
|
|
"personal_cargo_list_param16": "9",
|
|
},
|
|
{
|
|
"main_list_param16": "24",
|
|
"avatar_list_param16": "141",
|
|
"personal_cargo_list_param16": "8",
|
|
},
|
|
}
|
|
for _, values := range tests {
|
|
_, err := characterContainerStateFromSettings(SettingsRecord{Values: values}, "27")
|
|
if !errors.Is(err, ErrCharacterContainerStateInvalid) {
|
|
t.Fatalf("values=%v err=%v", values, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCurrentPersonalCargoSlotCountMatchesCurrentExeTable(t *testing.T) {
|
|
for _, value := range []uint16{8, 24, 40, 56, 72, 88, 104, 120, 136, 152, 168, 184, 200} {
|
|
if !currentPersonalCargoSlotCount(value) {
|
|
t.Fatalf("current EXE slot count %d rejected", value)
|
|
}
|
|
}
|
|
for _, value := range []uint16{0, 7, 9, 199, 201} {
|
|
if currentPersonalCargoSlotCount(value) {
|
|
t.Fatalf("non-table slot count %d accepted", value)
|
|
}
|
|
}
|
|
}
|