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 @@
|
||||
package joust
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestTournamentForBuildsStableCompleteBracket(t *testing.T) {
|
||||
catalog, err := LoadCatalog(context.Background(), joustCatalogTestSource{EventPVFPath: testJoustPVF(12)})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
first, err := catalog.TournamentFor(91)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
second, err := catalog.TournamentFor(91)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(first, second) || first.Champion() != first.Matches[6].Winner {
|
||||
t.Fatalf("unstable tournament first=%+v second=%+v", first, second)
|
||||
}
|
||||
for index, match := range first.Matches {
|
||||
if match.Winner == match.Loser || match.WinnerAction > 3 || match.LoserAction > 3 {
|
||||
t.Fatalf("match[%d]=%+v", index, match)
|
||||
}
|
||||
}
|
||||
if first.Matches[4].Winner != first.Matches[6].Winner && first.Matches[5].Winner != first.Matches[6].Winner {
|
||||
t.Fatalf("final champion not a semifinal winner: %+v", first.Matches)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBattleActionUsesOpponentAttackTypeProfileKey(t *testing.T) {
|
||||
values := []uint16{
|
||||
0, 20, 35, 65, 75, 95, 100,
|
||||
0, 15, 20, 50, 80, 100, 100,
|
||||
0, 35, 60, 80, 80, 90, 100,
|
||||
0, 20, 35, 55, 75, 90, 100,
|
||||
}
|
||||
for _, test := range []struct {
|
||||
attackType byte
|
||||
want byte
|
||||
}{{0, 0}, {1, 1}, {27, 2}, {28, 3}} {
|
||||
got, err := battleAction(values, test.attackType)
|
||||
if err != nil || got != test.want {
|
||||
t.Fatalf("attack_type=%d action=%d err=%v want=%d", test.attackType, got, err, test.want)
|
||||
}
|
||||
}
|
||||
if _, err := battleAction(values, 2); err == nil {
|
||||
t.Fatal("unsupported attack type did not fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTournamentActionsMatchEachOpponentAttackType(t *testing.T) {
|
||||
catalog, err := LoadCatalog(context.Background(), joustCatalogTestSource{EventPVFPath: testJoustPVF(12)})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for round := uint16(0); ; round++ {
|
||||
tournament, tournamentErr := catalog.TournamentFor(round)
|
||||
if tournamentErr != nil {
|
||||
t.Fatalf("round=%d: %v", round, tournamentErr)
|
||||
}
|
||||
for index, match := range tournament.Matches {
|
||||
winner, winnerOK := catalog.rider(match.Winner)
|
||||
loser, loserOK := catalog.rider(match.Loser)
|
||||
winnerOffset, winnerTypeOK := attackTypeTableOffset(loser.AttackType)
|
||||
loserOffset, loserTypeOK := attackTypeTableOffset(winner.AttackType)
|
||||
if !winnerOK || !loserOK || !winnerTypeOK || !loserTypeOK ||
|
||||
match.WinnerAction != byte(winnerOffset/7) || match.LoserAction != byte(loserOffset/7) {
|
||||
t.Fatalf("round=%d match[%d]=%+v winner=%+v loser=%+v", round, index, match, winner, loser)
|
||||
}
|
||||
}
|
||||
if round == ^uint16(0) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimelineAtUsesBettingBracketAndSettlementBoundaries(t *testing.T) {
|
||||
start := time.Unix(7200*900, 0).UTC()
|
||||
tests := []struct {
|
||||
offset time.Duration
|
||||
phase Phase
|
||||
state byte
|
||||
stage byte
|
||||
}{
|
||||
{0, PhaseBetting, 1, 0},
|
||||
{90 * time.Minute, PhaseQuarterFinal, 2, 0},
|
||||
{95 * time.Minute, PhaseSemiFinal, 2, 1},
|
||||
{100 * time.Minute, PhaseFinal, 3, 2},
|
||||
{105 * time.Minute, PhaseFinal, 3, 3},
|
||||
{110 * time.Minute, PhaseSettled, 4, 3},
|
||||
}
|
||||
for _, test := range tests {
|
||||
got := TimelineAt(start.Add(test.offset))
|
||||
if got.Round != 900 || got.Phase != test.phase || got.State != test.state || got.Stage != test.stage {
|
||||
t.Fatalf("offset=%s timeline=%+v", test.offset, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user