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,90 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const scriptTokenSize = 5
|
||||
|
||||
func main() {
|
||||
root := flag.String("dir", "", "raw PVF replacement directory")
|
||||
flag.Parse()
|
||||
if *root == "" {
|
||||
fmt.Fprintln(os.Stderr, "FAILED: -dir is required")
|
||||
os.Exit(2)
|
||||
}
|
||||
for _, rel := range []string{
|
||||
"stackable/ptn_hplow.stk",
|
||||
"stackable/ptn_mplow.stk",
|
||||
} {
|
||||
if err := patchPotion(filepath.Join(*root, filepath.FromSlash(rel))); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "FAILED: %s: %v\n", rel, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("patched", rel)
|
||||
}
|
||||
}
|
||||
|
||||
func patchPotion(path string) error {
|
||||
raw, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(raw) != 45*scriptTokenSize {
|
||||
return fmt.Errorf("unexpected raw script size %d", len(raw))
|
||||
}
|
||||
for index, wantType := range map[int]byte{
|
||||
15: 3, 16: 0, // [minimum level] 6
|
||||
21: 3, 22: 0, // [cool time] 10000
|
||||
29: 3, 30: 6, 31: 0, // [stackable type] `[waste]` 4
|
||||
38: 3, 39: 0, // [cooltime group] N
|
||||
} {
|
||||
if got := raw[index*scriptTokenSize]; got != wantType {
|
||||
return fmt.Errorf("token %d type=%d want=%d", index, got, wantType)
|
||||
}
|
||||
}
|
||||
if got := tokenInt(raw, 16); got != 6 {
|
||||
return fmt.Errorf("minimum level=%d want=6", got)
|
||||
}
|
||||
if got := tokenInt(raw, 22); got != 10000 {
|
||||
return fmt.Errorf("cool time=%d want=10000", got)
|
||||
}
|
||||
if got := tokenInt(raw, 31); got != 4 {
|
||||
return fmt.Errorf("waste subtype=%d want=4", got)
|
||||
}
|
||||
|
||||
// Make the two beginner recovery items available from level 1 and route
|
||||
// them through the generic [waste] client path. The subtype-4 recovery
|
||||
// path suppresses op44 locally when the matching resource is already full.
|
||||
// Removing both cooldown tokens also removes the native 10-second local
|
||||
// and shared-group gate; the server cannot lift either gate because no
|
||||
// packet is sent while the client blocks the action.
|
||||
putTokenInt(raw, 16, 1)
|
||||
putTokenInt(raw, 31, 0)
|
||||
out := make([]byte, 0, len(raw)-4*scriptTokenSize)
|
||||
for index := 0; index < len(raw)/scriptTokenSize; index++ {
|
||||
if index == 21 || index == 22 || index == 38 || index == 39 {
|
||||
continue
|
||||
}
|
||||
start := index * scriptTokenSize
|
||||
out = append(out, raw[start:start+scriptTokenSize]...)
|
||||
}
|
||||
if len(out) != 41*scriptTokenSize {
|
||||
return fmt.Errorf("patched script size=%d want=%d", len(out), 41*scriptTokenSize)
|
||||
}
|
||||
return os.WriteFile(path, out, 0o644)
|
||||
}
|
||||
|
||||
func tokenInt(raw []byte, index int) int32 {
|
||||
start := index*scriptTokenSize + 1
|
||||
return int32(binary.LittleEndian.Uint32(raw[start : start+4]))
|
||||
}
|
||||
|
||||
func putTokenInt(raw []byte, index int, value int32) {
|
||||
start := index*scriptTokenSize + 1
|
||||
binary.LittleEndian.PutUint32(raw[start:start+4], uint32(value))
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPatchPotionRemovesClientGates(t *testing.T) {
|
||||
raw := make([]byte, 45*scriptTokenSize)
|
||||
for index := range 45 {
|
||||
raw[index*scriptTokenSize] = 3
|
||||
}
|
||||
for _, index := range []int{16, 22, 31, 39} {
|
||||
raw[index*scriptTokenSize] = 0
|
||||
}
|
||||
raw[30*scriptTokenSize] = 6
|
||||
putTokenInt(raw, 16, 6)
|
||||
putTokenInt(raw, 22, 10000)
|
||||
putTokenInt(raw, 31, 4)
|
||||
putTokenInt(raw, 39, 1)
|
||||
|
||||
path := filepath.Join(t.TempDir(), "potion.stk")
|
||||
if err := os.WriteFile(path, raw, 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := patchPotion(path); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(got) != 41*scriptTokenSize {
|
||||
t.Fatalf("patched length=%d", len(got))
|
||||
}
|
||||
if level := int32(binary.LittleEndian.Uint32(got[16*scriptTokenSize+1 : 16*scriptTokenSize+5])); level != 1 {
|
||||
t.Fatalf("minimum level=%d", level)
|
||||
}
|
||||
// Four removed tokens precede the original subtype token 31, so it is 29.
|
||||
if subtype := int32(binary.LittleEndian.Uint32(got[29*scriptTokenSize+1 : 29*scriptTokenSize+5])); subtype != 0 {
|
||||
t.Fatalf("waste subtype=%d", subtype)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user