服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
51 lines
1.8 KiB
Go
51 lines
1.8 KiB
Go
package town
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
type questConditionTestSource map[string]string
|
|
|
|
func (source questConditionTestSource) ReadText(name string) (string, error) {
|
|
value, ok := source[name]
|
|
if !ok {
|
|
return "", fmt.Errorf("missing %s", name)
|
|
}
|
|
return value, nil
|
|
}
|
|
|
|
// Town maps declare one [quest condition] block per gating quest. The loader
|
|
// must gather every block, in order, without duplicates, and an area whose map
|
|
// declares none must carry nil rather than an empty slice.
|
|
func TestLoadCollectsRepeatedQuestConditionBlocksPerArea(t *testing.T) {
|
|
table, err := Load(context.Background(), questConditionTestSource{
|
|
"town/town.lst": "39 `hendon.twn` 40 `plain.twn`",
|
|
"town/hendon.twn": "[area]\n0 `hendon_main.map` `[normal]`\n[/area]\n[name]\n`Hendon`",
|
|
"town/plain.twn": "[area]\n0 `plain.map` `[normal]`\n[/area]\n[name]\n`Plain`",
|
|
"map/hendon_main.map": "[quest condition]\n3186\n[/quest condition]\n" +
|
|
"[quest condition]\n10100\n[/quest condition]\n" +
|
|
"[quest condition]\n10100\n[/quest condition]\n",
|
|
"map/plain.map": "[name]\n`plain`\n",
|
|
}, Options{})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
area, ok := table.FindArea(39, 0)
|
|
if !ok || !reflect.DeepEqual(area.QuestConditions, []int64{3186, 10100}) {
|
|
t.Fatalf("hendon area=(%+v,%t), want quest conditions [3186 10100]", area, ok)
|
|
}
|
|
plain, ok := table.FindArea(40, 0)
|
|
if !ok || plain.QuestConditions != nil {
|
|
t.Fatalf("plain area=(%+v,%t), want no quest conditions", plain, ok)
|
|
}
|
|
// A caller mutating the returned slice must not reach into the table.
|
|
area.QuestConditions[0] = 999
|
|
again, _ := table.FindArea(39, 0)
|
|
if !reflect.DeepEqual(again.QuestConditions, []int64{3186, 10100}) {
|
|
t.Fatalf("table quest conditions were mutated through a lookup result: %v", again.QuestConditions)
|
|
}
|
|
}
|