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

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

98 lines
3.8 KiB
Go

package dnfbridge
import (
"context"
"strconv"
"strings"
"longheng.io/server/internal/modules/dnf/dnfenum"
)
const currentImageCommunicationEquipmentMsgID = uint16(dnfenum.CmdPacketImageCommunicationEquipmentUse)
func buildCurrentImageCommunicationEquipmentSuccessBody(actorObjectKey uint32, npcID uint32) []byte {
var writer packetWriter
writer.writeUint32(actorObjectKey)
writer.writeUint32(npcID)
return writer.bytes()
}
func buildCurrentImageCommunicationEquipmentActorNotifyBody(actorObjectKey uint32) []byte {
var writer packetWriter
writer.writeUint32(actorObjectKey)
return writer.bytes()
}
// handleCurrentImageCommunicationEquipmentUse owns the current client's
// bodyless op475 request. Its direction-dependent handlers have two distinct
// bodies: class1 sub_1D0DF30 consumes actor-object u32 + remote-NPC u32 and
// opens the communication UI with the latter; class0 sub_1D55C10 consumes the
// actor-object u32 and enables the matching type-0x821 town actor animation.
func (s *Service) handleCurrentImageCommunicationEquipmentUse(session *gameSession, body []byte) error {
if session == nil || session.selectedCharacterID == 0 {
return nil
}
if len(body) != 0 {
s.logGameEvent(session, "game-image-communication-equipment-use-blocked",
"body_len", len(body),
"reason", "current_exe_op475_requires_bodyless_request")
return nil
}
repositories, ok := s.repositoryGroup()
if !ok || repositories.Quest == nil {
s.logGameEvent(session, "game-image-communication-equipment-use-blocked",
"reason", "quest_repository_unavailable")
return nil
}
ctx, cancel := context.WithTimeout(context.Background(), createWriteTimeout)
defer cancel()
catalog, err := s.loadQuestCatalog(ctx)
if err != nil {
s.logGameEvent(session, "game-image-communication-equipment-use-blocked",
"reason", "quest_catalog_unavailable",
"error", err)
return nil
}
characterID := strconv.Itoa(int(session.selectedCharacterID))
record, found, err := repositories.Quest.Load(ctx, characterID)
if err != nil {
s.logGameEvent(session, "game-image-communication-equipment-use-blocked",
"char_id", session.selectedCharacterID,
"reason", "quest_record_load_failed",
"error", err)
return nil
}
if !found || strings.TrimSpace(record.CharacterID) != characterID {
s.logGameEvent(session, "game-image-communication-equipment-use-blocked",
"char_id", session.selectedCharacterID,
"quest_record_found", found,
"record_character_id", record.CharacterID,
"reason", "selected_character_quest_record_unavailable")
return nil
}
target, resolved := catalog.ActiveImageCommunicationTarget(record)
if !resolved {
s.logGameEvent(session, "game-image-communication-equipment-use-blocked",
"char_id", session.selectedCharacterID,
"reason", "active_image_communication_quest_missing_or_ambiguous")
return nil
}
actorObjectKey := uint32(currentSceneActorObjectKey(session.selectedCharacterID))
successBody := buildCurrentImageCommunicationEquipmentSuccessBody(actorObjectKey, target.NPCID)
actorNotifyBody := buildCurrentImageCommunicationEquipmentActorNotifyBody(actorObjectKey)
s.logGameEvent(session, "game-image-communication-equipment-use-accepted",
"char_id", session.selectedCharacterID,
"quest_id", target.QuestID,
"npc_id", target.NPCID,
"actor_object_key", actorObjectKey,
"response_msg_id", currentImageCommunicationEquipmentMsgID,
"response_sequence", "class1_success_then_class0_actor_notify",
"success_body_source", "current_exe_sub_1D0DF30_u32_actor_object_key_u32_remote_npc_index",
"notify_body_source", "current_exe_sub_1D55C10_u32_actor_object_key",
"quest_mutation", "none")
if err := s.sendGameUpperSuccess(session, currentImageCommunicationEquipmentMsgID, successBody); err != nil {
return err
}
return s.sendGameUpperRawClass(session, currentImageCommunicationEquipmentMsgID, actorNotifyBody, 0)
}