服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
55 lines
2.1 KiB
Go
55 lines
2.1 KiB
Go
package fatigue
|
|
|
|
import "testing"
|
|
|
|
func TestConsumeClampsAtZero(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
remaining int64
|
|
amount int64
|
|
wantNext int64
|
|
wantConsumed int64
|
|
}{
|
|
{name: "room", remaining: 100, amount: 1, wantNext: 99, wantConsumed: 1},
|
|
{name: "last point", remaining: 1, amount: 1, wantNext: 0, wantConsumed: 1},
|
|
{name: "exhausted", remaining: 0, amount: 1, wantNext: 0, wantConsumed: 0},
|
|
{name: "negative persisted value", remaining: -1, amount: 1, wantNext: 0, wantConsumed: 0},
|
|
{name: "non-positive request", remaining: 10, amount: 0, wantNext: 10, wantConsumed: 0},
|
|
}
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
next, consumed := Consume(test.remaining, test.amount)
|
|
if next != test.wantNext || consumed != test.wantConsumed {
|
|
t.Fatalf("Consume(%d, %d) = %d, %d; want %d, %d", test.remaining, test.amount, next, consumed, test.wantNext, test.wantConsumed)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestReconcileBlackDiamondLimitPreservesConsumedFatigue(t *testing.T) {
|
|
remaining, limit, changed := ReconcileLimit(120, DefaultLimit, BlackDiamondLimit)
|
|
if !changed || remaining != 152 || limit != BlackDiamondLimit {
|
|
t.Fatalf("activation = %d/%d changed=%t, want 152/188", remaining, limit, changed)
|
|
}
|
|
remaining, limit, changed = ReconcileLimit(remaining, limit, DefaultLimit)
|
|
if !changed || remaining != 120 || limit != DefaultLimit {
|
|
t.Fatalf("expiry = %d/%d changed=%t, want 120/156", remaining, limit, changed)
|
|
}
|
|
}
|
|
|
|
func TestDesiredBlackDiamondLimitPreservesCustomLimit(t *testing.T) {
|
|
if got := DesiredBlackDiamondLimit(200, true); got != 200 {
|
|
t.Fatalf("custom active limit=%d, want 200", got)
|
|
}
|
|
if got := DesiredBlackDiamondLimit(200, false); got != 200 {
|
|
t.Fatalf("custom inactive limit=%d, want 200", got)
|
|
}
|
|
}
|
|
|
|
func TestReconcileLimitPersistsNormalizedNativeState(t *testing.T) {
|
|
remaining, limit, changed := ReconcileLimit(999, 0, DefaultLimit)
|
|
if !changed || remaining != DefaultLimit || limit != DefaultLimit {
|
|
t.Fatalf("normalized state=%d/%d changed=%t, want 156/156 changed", remaining, limit, changed)
|
|
}
|
|
}
|