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,87 @@
|
||||
package quest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
|
||||
)
|
||||
|
||||
type LinkedObjectiveCommitResult struct {
|
||||
CharacterID string
|
||||
RequestedQuestID int64
|
||||
ParentQuestID int64
|
||||
ParentProgress int64
|
||||
CompletedQuestIDs []int64
|
||||
ChangedFields []dnfrepo.QuestField
|
||||
PostCommitQuest dnfrepo.QuestRecord
|
||||
Applied bool
|
||||
}
|
||||
|
||||
func (o *Owner) ApplyTownLinkedProgress(ctx context.Context, catalog *Catalog, characterID string, questID int64, completedAt time.Time) (LinkedObjectiveCommitResult, error) {
|
||||
return o.applyLinkedObjectiveProgress(ctx, catalog, characterID, questID, completedAt, true)
|
||||
}
|
||||
|
||||
func (o *Owner) ApplyLinkedObjectiveFinish(ctx context.Context, catalog *Catalog, characterID string, questID int64, completedAt time.Time) (LinkedObjectiveCommitResult, error) {
|
||||
return o.applyLinkedObjectiveProgress(ctx, catalog, characterID, questID, completedAt, false)
|
||||
}
|
||||
|
||||
func (o *Owner) applyLinkedObjectiveProgress(
|
||||
ctx context.Context,
|
||||
catalog *Catalog,
|
||||
characterID string,
|
||||
questID int64,
|
||||
completedAt time.Time,
|
||||
townParentCallback bool,
|
||||
) (LinkedObjectiveCommitResult, error) {
|
||||
if o == nil || o.repositories.CharacterSettlement == nil || catalog == nil {
|
||||
return LinkedObjectiveCommitResult{}, ErrOwnerUnavailable
|
||||
}
|
||||
characterID = strings.TrimSpace(characterID)
|
||||
if characterID == "" {
|
||||
return LinkedObjectiveCommitResult{}, ErrCharacterRequired
|
||||
}
|
||||
if questID <= 0 {
|
||||
return LinkedObjectiveCommitResult{}, ErrQuestIDRequired
|
||||
}
|
||||
result := LinkedObjectiveCommitResult{CharacterID: characterID, RequestedQuestID: questID}
|
||||
err := o.repositories.CharacterSettlement.WithinCharacterSettlement(ctx, characterID, func(tx dnfrepo.Group) error {
|
||||
if tx.Quest == nil {
|
||||
return ErrOwnerUnavailable
|
||||
}
|
||||
record, found, err := tx.Quest.Load(ctx, characterID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !found || strings.TrimSpace(record.CharacterID) != characterID {
|
||||
return nil
|
||||
}
|
||||
var plan LinkedObjectiveProgressPlan
|
||||
if townParentCallback {
|
||||
plan, err = catalog.PlanTownLinkedProgress(record, questID, completedAt)
|
||||
} else {
|
||||
plan, err = catalog.PlanLinkedObjectiveFinish(record, questID, completedAt)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(plan.ChangedFields) == 0 {
|
||||
return nil
|
||||
}
|
||||
if err := dnfrepo.SaveQuestFields(ctx, tx.Quest, plan.Record, plan.ChangedFields...); err != nil {
|
||||
return err
|
||||
}
|
||||
result.ParentQuestID = plan.ParentQuestID
|
||||
result.ParentProgress = plan.ParentProgress
|
||||
result.CompletedQuestIDs = append([]int64(nil), plan.CompletedQuestIDs...)
|
||||
result.ChangedFields = append([]dnfrepo.QuestField(nil), plan.ChangedFields...)
|
||||
result.PostCommitQuest = dnfrepo.CloneQuest(plan.Record)
|
||||
result.Applied = true
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return LinkedObjectiveCommitResult{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
Reference in new issue
Block a user