```
feat(xmlres): 添加任务数据加载与初始化逻辑 在 xmlres 包中新增 TaskMap 用于存储任务数据,并在 initfile 函数中 加载 task.xml 文件内容。同时调整 login 控制器中的任务重置逻辑,根据 任务类型每日重置任务状态。修复 pet 控制器释放宠物时的数据更新问题。 战斗系统中增加 Effect 的 OnMiss 回调处理,并修正状态效果映射关系。 修复 PVP 邀
This commit is contained in:
@@ -48,6 +48,7 @@ var (
|
|||||||
EffectMAP map[int]NewSeIdx
|
EffectMAP map[int]NewSeIdx
|
||||||
PlayerEffectMAP map[int]NewSeIdx
|
PlayerEffectMAP map[int]NewSeIdx
|
||||||
ItemsMAP map[int]Item
|
ItemsMAP map[int]Item
|
||||||
|
TaskMap map[int]Task
|
||||||
)
|
)
|
||||||
|
|
||||||
func initfile() {
|
func initfile() {
|
||||||
@@ -67,6 +68,7 @@ func initfile() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
TalkConfig = getXml[TalkCount](path + "talk.xml")
|
TalkConfig = getXml[TalkCount](path + "talk.xml")
|
||||||
|
|
||||||
Monster := getXml[MonsterRoot](path + "地图配置野怪.xml")
|
Monster := getXml[MonsterRoot](path + "地图配置野怪.xml")
|
||||||
|
|
||||||
MonsterMap = utils.ToMap(Monster.Maps, func(m TMapConfig) int {
|
MonsterMap = utils.ToMap(Monster.Maps, func(m TMapConfig) int {
|
||||||
@@ -82,7 +84,11 @@ func initfile() {
|
|||||||
v.SideEffectArgS = ParseSideEffectArgs(v.SideEffectArg)
|
v.SideEffectArgS = ParseSideEffectArgs(v.SideEffectArg)
|
||||||
SkillMap[v.ID] = v
|
SkillMap[v.ID] = v
|
||||||
}
|
}
|
||||||
|
task := getXml[Tasks](path + "task.xml")
|
||||||
|
TaskMap = utils.ToMap[Task, int](task.Tasks, func(m Task) int {
|
||||||
|
return m.ID
|
||||||
|
|
||||||
|
})
|
||||||
pet := getXml[Monsters](path + "226.xml")
|
pet := getXml[Monsters](path + "226.xml")
|
||||||
PetMAP = utils.ToMap[PetInfo, int](pet.Monsters, func(m PetInfo) int {
|
PetMAP = utils.ToMap[PetInfo, int](pet.Monsters, func(m PetInfo) int {
|
||||||
return m.ID
|
return m.ID
|
||||||
|
|||||||
41
common/data/xmlres/task.go
Normal file
41
common/data/xmlres/task.go
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package xmlres
|
||||||
|
|
||||||
|
import "github.com/ECUST-XX/xml"
|
||||||
|
|
||||||
|
// Tasks 根节点:包含所有任务
|
||||||
|
type Tasks struct {
|
||||||
|
XMLName xml.Name `xml:"tasks"`
|
||||||
|
Tasks []Task `xml:"task"` // 任务列表
|
||||||
|
}
|
||||||
|
|
||||||
|
// Task 任务节点:对应 <task>
|
||||||
|
type Task struct {
|
||||||
|
// 任务属性(XML属性)
|
||||||
|
ID int `xml:"ID,attr"` // 任务标识
|
||||||
|
Name string `xml:"name,attr"` // 任务名
|
||||||
|
Parent string `xml:"parent,attr"` // 父级任务(格式:ID|ID)
|
||||||
|
IsMat int `xml:"isMat,attr"` // 父级匹配类型(0单配/1全配)
|
||||||
|
Type int `xml:"type,attr"` // 任务类型(0常规/1日常)
|
||||||
|
IsDir int `xml:"isDir,attr"` // 是否直接完成(0否/1是)
|
||||||
|
Doc string `xml:"doc,attr"` // 文档说明
|
||||||
|
Alert string `xml:"alert,attr"` // 提示说明
|
||||||
|
IsEnd int `xml:"isEnd,attr"` // 是否结束任务(0否/1是)
|
||||||
|
Especial *int `xml:"especial,attr"` // 可选:是否需要特殊提示框(1是,nil表示无)
|
||||||
|
Condition *string `xml:"condition,attr"` // 可选:接任务限制条件
|
||||||
|
|
||||||
|
// 任务子节点
|
||||||
|
Des *string `xml:"des"` // 可选:<des>节点(CDATA)
|
||||||
|
TaskDes *string `xml:"taskDes"` // 可选:<taskDes>节点(多段CDATA用$$分隔)
|
||||||
|
ProDes *string `xml:"proDes"` // 可选:<proDes>节点(CDATA)
|
||||||
|
Pros []Pro `xml:"pro"` // 步骤列表:<pro>节点集合
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pro 步骤节点:对应 <pro>
|
||||||
|
type Pro struct {
|
||||||
|
Name string `xml:"name,attr"` // 步骤名
|
||||||
|
Parent string `xml:"parent,attr"` // 父级步骤(格式:步骤|步骤)
|
||||||
|
IsMat string `xml:"isMat,attr"` // 父级步骤匹配类型(0单配/1全配,可能为空)
|
||||||
|
Doc string `xml:"doc,attr"` // 文档说明
|
||||||
|
Alert string `xml:"alert,attr"` // 提示说明
|
||||||
|
IsEnd int `xml:"isEnd,attr"` // 是否最后一步(0否/1是,可选)
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"blazing/common/data/share"
|
"blazing/common/data/share"
|
||||||
|
"blazing/common/data/xmlres"
|
||||||
"blazing/cool"
|
"blazing/cool"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ import (
|
|||||||
"blazing/logic/service/maps"
|
"blazing/logic/service/maps"
|
||||||
"blazing/logic/service/player"
|
"blazing/logic/service/player"
|
||||||
"blazing/logic/service/space"
|
"blazing/logic/service/space"
|
||||||
|
"blazing/modules/blazing/model"
|
||||||
blservice "blazing/modules/blazing/service"
|
blservice "blazing/modules/blazing/service"
|
||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
@@ -58,27 +60,31 @@ func (h *Controller) Login(data *user.MAIN_LOGIN_IN, c gnet.Conn) (result *user.
|
|||||||
//每天login时候检查重置时间,然后把电池,任务,挖矿重置
|
//每天login时候检查重置时间,然后把电池,任务,挖矿重置
|
||||||
//挖矿需要单独存,因为防止多开挖矿
|
//挖矿需要单独存,因为防止多开挖矿
|
||||||
t.Info.TimeToday = 0 //重置电池
|
t.Info.TimeToday = 0 //重置电池
|
||||||
defer func() {
|
|
||||||
// for i := 400; i < 500; i++ { //每日任务区段
|
|
||||||
// t.Info.TaskList[i] = 0 //重置每日任务
|
|
||||||
|
|
||||||
// t.Service.Task((uint32(i)), func(te *model.TaskEX) bool {
|
for i := 400; i < 100; i++ { //每日任务区段
|
||||||
// te.Data = make([]uint32, 0)
|
|
||||||
// return true
|
|
||||||
// })
|
|
||||||
|
|
||||||
// }
|
if xmlres.TaskMap[i].Type == 1 { //日常任务
|
||||||
for i := 400; i < 50; i++ { //每日任务区段
|
t.Info.TaskList[i-1] = 0 //重置每日任务
|
||||||
t.Info.DailyResArr[i] = 0 //重置每日任务
|
t.Service.Task(uint32(i), func(t *model.TaskEX) bool {
|
||||||
|
t.Data = []uint32{}
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
t.Service.Talk(func(m *map[uint32]uint32) bool {
|
|
||||||
m = &map[uint32]uint32{}
|
}
|
||||||
return true
|
for i := 0; i < 50; i++ { //每日任务区段
|
||||||
})
|
t.Info.DailyResArr[i] = 0 //重置每日任务
|
||||||
}()
|
|
||||||
|
}
|
||||||
|
t.Service.Talk(func(m *map[uint32]uint32) bool { //挖矿
|
||||||
|
m = &map[uint32]uint32{}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
t.Info.TaskList[3] = 3 //新手任务
|
||||||
|
|
||||||
t.CompleteLogin() //通知客户端登录成功
|
t.CompleteLogin() //通知客户端登录成功
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,6 @@ func (h *Controller) PetRelease(
|
|||||||
result = &pet.PetReleaseOutboundInfo{}
|
result = &pet.PetReleaseOutboundInfo{}
|
||||||
result.Flag = uint32(data.Flag)
|
result.Flag = uint32(data.Flag)
|
||||||
|
|
||||||
c.Service.PetInfo_One_exec(data.CatchTime, func(t *model.PetEX) {
|
|
||||||
t.InBag = int(data.Flag)
|
|
||||||
|
|
||||||
})
|
|
||||||
switch data.Flag {
|
switch data.Flag {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
@@ -82,6 +78,11 @@ func (h *Controller) PetRelease(
|
|||||||
|
|
||||||
}
|
}
|
||||||
if removeIndex != -1 {
|
if removeIndex != -1 {
|
||||||
|
c.Service.PetInfo_One_exec(data.CatchTime, func(t *model.PetEX) {
|
||||||
|
t.Data = c.Info.PetList[removeIndex]
|
||||||
|
t.InBag = int(data.Flag)
|
||||||
|
|
||||||
|
})
|
||||||
c.Info.PetList = append(c.Info.PetList[:removeIndex], c.Info.PetList[removeIndex+1:]...)
|
c.Info.PetList = append(c.Info.PetList[:removeIndex], c.Info.PetList[removeIndex+1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
logic/logic1
BIN
logic/logic1
Binary file not shown.
@@ -67,3 +67,6 @@ func (e *Effect10) OnHit(opp *input.Input, skill *info.SkillEntity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func (e *Effect10) OnMiss(opp *input.Input, skill *info.SkillEntity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ func init() {
|
|||||||
|
|
||||||
tt(info.PetStatus.Paralysis, &StatusNotSkill{})
|
tt(info.PetStatus.Paralysis, &StatusNotSkill{})
|
||||||
tt(info.PetStatus.Tired, &StatusNotSkill{})
|
tt(info.PetStatus.Tired, &StatusNotSkill{})
|
||||||
tt(info.PetStatus.Sleep, &StatusNotSkill{})
|
tt(info.PetStatus.Fear, &StatusNotSkill{})
|
||||||
tt(info.PetStatus.Petrified, &StatusNotSkill{})
|
tt(info.PetStatus.Petrified, &StatusNotSkill{})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ func (e *EffectNode) Skill_Hit_to(ctx input.Ctx) bool {
|
|||||||
func (e *EffectNode) OnSkill(ctx input.Ctx) bool {
|
func (e *EffectNode) OnSkill(ctx input.Ctx) bool {
|
||||||
if e.Effect != nil {
|
if e.Effect != nil {
|
||||||
if e.Hit() { //没命中
|
if e.Hit() { //没命中
|
||||||
e.OnHit(ctx.Input, ctx.SkillEntity)
|
e.Effect.OnHit(ctx.Input, ctx.SkillEntity)
|
||||||
} else {
|
} else {
|
||||||
e.OnMiss(ctx.Input, ctx.SkillEntity)
|
e.Effect.OnMiss(ctx.Input, ctx.SkillEntity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ func (lw *Player) InvitePlayerToBattle(pinfo *info.PVPinfo) {
|
|||||||
lw.PVPinfo = pinfo
|
lw.PVPinfo = pinfo
|
||||||
Mainplayer.Range(func(key uint32, value *Player) bool {
|
Mainplayer.Range(func(key uint32, value *Player) bool {
|
||||||
|
|
||||||
if key == uint32(lw.PVPinfo.PlayerID) {
|
if key == uint32(pinfo.PlayerID) {
|
||||||
|
|
||||||
value.HavePVPinfo = append([]*Player{value}, value.HavePVPinfo...)
|
value.HavePVPinfo = append([]*Player{lw}, value.HavePVPinfo...)
|
||||||
t1 := NewTomeeHeader(2501, value.Info.UserID)
|
t1 := NewTomeeHeader(2501, value.Info.UserID)
|
||||||
t := info.NoteInviteToFightOutboundInfo{
|
t := info.NoteInviteToFightOutboundInfo{
|
||||||
UserID: lw.Info.UserID,
|
UserID: lw.Info.UserID,
|
||||||
@@ -97,7 +97,7 @@ func (lw *Player) AgreeBattle(userid, flag uint32, mode info.EnumBattleMode) (bo
|
|||||||
v.SendPack(t1.Pack(ret))
|
v.SendPack(t1.Pack(ret))
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if v.PVPinfo.PlayerID == userid && v.PVPinfo.Mode == mode { //成功找到,同意对战
|
if v.Info.UserID == userid && v.PVPinfo.Mode == mode { //成功找到,同意对战
|
||||||
if lw.CanBattle() {
|
if lw.CanBattle() {
|
||||||
ret.Result = 1
|
ret.Result = 1
|
||||||
|
|
||||||
|
|||||||
1
public/config/task.xml
Symbolic link
1
public/config/task.xml
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
E:/newcode/flash/src/Core/_assets/18_com.robot.core.config.xml.TasksXMLInfo_xmlClass.bin
|
||||||
Reference in New Issue
Block a user