mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
70 lines
2.3 KiB
Go
70 lines
2.3 KiB
Go
package questflow
|
|
|
|
import (
|
|
"lunar-tear/server/internal/masterdata"
|
|
"lunar-tear/server/internal/model"
|
|
"lunar-tear/server/internal/store"
|
|
)
|
|
|
|
type RewardGrant struct {
|
|
PossessionType model.PossessionType
|
|
PossessionId int32
|
|
Count int32
|
|
}
|
|
|
|
type FinishOutcome struct {
|
|
DropRewards []RewardGrant
|
|
FirstClearRewards []RewardGrant
|
|
ReplayFlowFirstClearRewards []RewardGrant
|
|
MissionClearRewards []RewardGrant
|
|
MissionClearCompleteRewards []RewardGrant
|
|
BigWinClearedQuestMissionIds []int32
|
|
IsBigWin bool
|
|
ChangedWeaponStoryIds []int32
|
|
}
|
|
|
|
type QuestHandler struct {
|
|
*masterdata.QuestCatalog
|
|
Config *masterdata.GameConfig
|
|
Granter *store.PossessionGranter
|
|
}
|
|
|
|
func NewQuestHandler(catalog *masterdata.QuestCatalog, config *masterdata.GameConfig) *QuestHandler {
|
|
granter := BuildGranter(catalog)
|
|
return &QuestHandler{QuestCatalog: catalog, Config: config, Granter: granter}
|
|
}
|
|
|
|
func BuildGranter(catalog *masterdata.QuestCatalog) *store.PossessionGranter {
|
|
costumeById := make(map[int32]store.CostumeRef, len(catalog.CostumeById))
|
|
for id, cm := range catalog.CostumeById {
|
|
costumeById[id] = store.CostumeRef{CharacterId: cm.CharacterId}
|
|
}
|
|
weaponById := make(map[int32]store.WeaponRef, len(catalog.WeaponById))
|
|
for id, wm := range catalog.WeaponById {
|
|
weaponById[id] = store.WeaponRef{
|
|
WeaponSkillGroupId: wm.WeaponSkillGroupId,
|
|
WeaponAbilityGroupId: wm.WeaponAbilityGroupId,
|
|
WeaponStoryReleaseConditionGroupId: wm.WeaponStoryReleaseConditionGroupId,
|
|
}
|
|
}
|
|
releaseConditions := make(map[int32][]store.WeaponStoryReleaseCond, len(catalog.ReleaseConditionsByGroupId))
|
|
for groupId, rows := range catalog.ReleaseConditionsByGroupId {
|
|
conds := make([]store.WeaponStoryReleaseCond, len(rows))
|
|
for i, r := range rows {
|
|
conds[i] = store.WeaponStoryReleaseCond{
|
|
StoryIndex: r.StoryIndex,
|
|
WeaponStoryReleaseConditionType: model.WeaponStoryReleaseConditionType(r.WeaponStoryReleaseConditionType),
|
|
ConditionValue: r.ConditionValue,
|
|
}
|
|
}
|
|
releaseConditions[groupId] = conds
|
|
}
|
|
return &store.PossessionGranter{
|
|
CostumeById: costumeById,
|
|
WeaponById: weaponById,
|
|
WeaponSkillSlots: catalog.WeaponSkillSlots,
|
|
WeaponAbilitySlots: catalog.WeaponAbilitySlots,
|
|
ReleaseConditions: releaseConditions,
|
|
}
|
|
}
|