DNF90 服务端与启动器完整源码(含 GM 工具功能增强)

服务端(Go):
- GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面
- GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新
- 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新)
- 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍
- 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0)
- 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算

启动器(Python/JS):
- 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭
- GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐)
- 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
This commit is contained in:
hanfuit committed 2026-11-04 14:31:55 +08:00
commit 645b64fe21
4388 files changed
+1405457

No files matched your search

@@ -0,0 +1,81 @@
package dnfbridge
import "time"
// The current 90CN client reuses numeric opcode 42 in opposite directions:
// class-1 C2S op42 is GiveupGame, while empty class-0 S2C op42 calls
// sub_1CF4FB0 and clears the native dungeon object's item-use wait byte through
// sub_26906D0(object, 0). Keep this wire constant separate from the C2S enum so
// the two meanings cannot be conflated by a later protocol cleanup.
const currentDungeonConsumableUseGateResetWireOpcode uint16 = 42
func (s *Service) sendCurrentConsumableUseGateResetPacket(session *gameSession, source string) error {
if session == nil {
return nil
}
if err := s.sendGameUpperRawClass(
session,
currentDungeonConsumableUseGateResetWireOpcode,
nil,
0,
); err != nil {
return err
}
s.logGameEvent(session, "game-dungeon-consumable-use-gate-reset-sent",
"char_id", session.selectedCharacterID,
"source", source,
"msg_id", currentDungeonConsumableUseGateResetWireOpcode,
"classification", 0,
"body_len", 0,
"body_source", "current_exe_class0_op42_sub_1CF4FB0_calls_sub_26906D0_object_gate_zero")
return nil
}
// sendCurrentDungeonEntryConsumableUseGateReset clears the client gate once
// for each newly committed dungeon generation. A failed socket write leaves
// the generation armed, so a repeated finish-loading request retries only the
// missing reset. Room transitions within that generation do not replay it.
// scheduleConsumableGateResetResends re-sends the empty class-0/op42 gate reset
// after the client has had time to finish its scene transition. The first
// packet can be dropped while the client is still tearing down the old scene
// (live 2026-10-19: potion use stopped working after give-up + re-entry even
// though both resets had been sent). The packet only zeroes the item-use wait
// byte, so repeating it is idempotent.
func (s *Service) scheduleConsumableGateResetResends(session *gameSession, source string, delays ...time.Duration) {
if s == nil || session == nil || len(delays) == 0 {
return
}
for _, delay := range delays {
d := delay
time.AfterFunc(d, func() {
defer func() { _ = recover() }()
if err := s.sendCurrentConsumableUseGateResetPacket(session, source+"_resend_"+d.String()); err != nil {
s.logGameEvent(session, "game-dungeon-consumable-use-gate-reset-resend-failed",
"char_id", session.selectedCharacterID,
"source", source,
"delay", d.String(),
"error", err)
}
})
}
}
func (s *Service) sendCurrentDungeonEntryConsumableUseGateReset(session *gameSession, source string) error {
if session == nil {
return nil
}
session.dungeon.mu.Lock()
defer session.dungeon.mu.Unlock()
runtime := session.dungeon.runtime
if runtime == nil || runtime.Session == nil || runtime.consumableUseGateResetSent {
return nil
}
if err := s.sendCurrentConsumableUseGateResetPacket(session, source); err != nil {
return err
}
runtime.consumableUseGateResetSent = true
// 客户端在场景切换瞬间可能丢掉第一包,隔一会儿补两发。
s.scheduleConsumableGateResetResends(session, source,
800*time.Millisecond, 2000*time.Millisecond)
return nil
}