diff --git a/common/data/xmlres/file.go b/common/data/xmlres/file.go index a77836888..12471732a 100644 --- a/common/data/xmlres/file.go +++ b/common/data/xmlres/file.go @@ -48,6 +48,7 @@ var ( EffectMAP map[int]NewSeIdx PlayerEffectMAP map[int]NewSeIdx ItemsMAP map[int]Item + TaskMap map[int]Task ) func initfile() { @@ -67,6 +68,7 @@ func initfile() { }) TalkConfig = getXml[TalkCount](path + "talk.xml") + Monster := getXml[MonsterRoot](path + "地图配置野怪.xml") MonsterMap = utils.ToMap(Monster.Maps, func(m TMapConfig) int { @@ -82,7 +84,11 @@ func initfile() { v.SideEffectArgS = ParseSideEffectArgs(v.SideEffectArg) 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") PetMAP = utils.ToMap[PetInfo, int](pet.Monsters, func(m PetInfo) int { return m.ID diff --git a/common/data/xmlres/task.go b/common/data/xmlres/task.go new file mode 100644 index 000000000..9d7acf40e --- /dev/null +++ b/common/data/xmlres/task.go @@ -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 任务节点:对应 +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"` // 可选:节点(CDATA) + TaskDes *string `xml:"taskDes"` // 可选:节点(多段CDATA用$$分隔) + ProDes *string `xml:"proDes"` // 可选:节点(CDATA) + Pros []Pro `xml:"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是,可选) +} diff --git a/logic/controller/login.go b/logic/controller/login.go index 3f34b830e..51ab0cc69 100644 --- a/logic/controller/login.go +++ b/logic/controller/login.go @@ -2,6 +2,7 @@ package controller import ( "blazing/common/data/share" + "blazing/common/data/xmlres" "blazing/cool" "fmt" @@ -13,6 +14,7 @@ import ( "blazing/logic/service/maps" "blazing/logic/service/player" "blazing/logic/service/space" + "blazing/modules/blazing/model" blservice "blazing/modules/blazing/service" "context" "time" @@ -58,27 +60,31 @@ func (h *Controller) Login(data *user.MAIN_LOGIN_IN, c gnet.Conn) (result *user. //每天login时候检查重置时间,然后把电池,任务,挖矿重置 //挖矿需要单独存,因为防止多开挖矿 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 { - // te.Data = make([]uint32, 0) - // return true - // }) + for i := 400; i < 100; i++ { //每日任务区段 - // } - for i := 400; i < 50; i++ { //每日任务区段 - t.Info.DailyResArr[i] = 0 //重置每日任务 + if xmlres.TaskMap[i].Type == 1 { //日常任务 + t.Info.TaskList[i-1] = 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() //通知客户端登录成功 diff --git a/logic/controller/pet.go b/logic/controller/pet.go index 9a7620d6b..8aaf3c6ba 100644 --- a/logic/controller/pet.go +++ b/logic/controller/pet.go @@ -66,10 +66,6 @@ func (h *Controller) PetRelease( result = &pet.PetReleaseOutboundInfo{} result.Flag = uint32(data.Flag) - c.Service.PetInfo_One_exec(data.CatchTime, func(t *model.PetEX) { - t.InBag = int(data.Flag) - - }) switch data.Flag { case 0: @@ -82,6 +78,11 @@ func (h *Controller) PetRelease( } 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:]...) } diff --git a/logic/logic1 b/logic/logic1 index a26a03a43..1bac376e1 100644 Binary files a/logic/logic1 and b/logic/logic1 differ diff --git a/logic/service/fight/effect/effect_10-16_94_99_114.go b/logic/service/fight/effect/effect_10-16_94_99_114.go index 81e776d51..4b6c4ef38 100644 --- a/logic/service/fight/effect/effect_10-16_94_99_114.go +++ b/logic/service/fight/effect/effect_10-16_94_99_114.go @@ -67,3 +67,6 @@ func (e *Effect10) OnHit(opp *input.Input, skill *info.SkillEntity) { } } +func (e *Effect10) OnMiss(opp *input.Input, skill *info.SkillEntity) { + +} diff --git a/logic/service/fight/effect/effect_status.go b/logic/service/fight/effect/effect_status.go index 3bc2260f7..7ef00dfdb 100644 --- a/logic/service/fight/effect/effect_status.go +++ b/logic/service/fight/effect/effect_status.go @@ -67,7 +67,7 @@ func init() { tt(info.PetStatus.Paralysis, &StatusNotSkill{}) tt(info.PetStatus.Tired, &StatusNotSkill{}) - tt(info.PetStatus.Sleep, &StatusNotSkill{}) + tt(info.PetStatus.Fear, &StatusNotSkill{}) tt(info.PetStatus.Petrified, &StatusNotSkill{}) } diff --git a/logic/service/fight/node/skill.go b/logic/service/fight/node/skill.go index fd8caf0e6..ee115c968 100644 --- a/logic/service/fight/node/skill.go +++ b/logic/service/fight/node/skill.go @@ -24,9 +24,9 @@ func (e *EffectNode) Skill_Hit_to(ctx input.Ctx) bool { func (e *EffectNode) OnSkill(ctx input.Ctx) bool { if e.Effect != nil { if e.Hit() { //没命中 - e.OnHit(ctx.Input, ctx.SkillEntity) + e.Effect.OnHit(ctx.Input, ctx.SkillEntity) } else { - e.OnMiss(ctx.Input, ctx.SkillEntity) + e.Effect.OnMiss(ctx.Input, ctx.SkillEntity) } } return true diff --git a/logic/service/player/fight.go b/logic/service/player/fight.go index 6bb2114fe..20913fa36 100644 --- a/logic/service/player/fight.go +++ b/logic/service/player/fight.go @@ -10,9 +10,9 @@ func (lw *Player) InvitePlayerToBattle(pinfo *info.PVPinfo) { lw.PVPinfo = pinfo 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) t := info.NoteInviteToFightOutboundInfo{ UserID: lw.Info.UserID, @@ -97,7 +97,7 @@ func (lw *Player) AgreeBattle(userid, flag uint32, mode info.EnumBattleMode) (bo v.SendPack(t1.Pack(ret)) return false, nil } - if v.PVPinfo.PlayerID == userid && v.PVPinfo.Mode == mode { //成功找到,同意对战 + if v.Info.UserID == userid && v.PVPinfo.Mode == mode { //成功找到,同意对战 if lw.CanBattle() { ret.Result = 1 diff --git a/public/config/task.xml b/public/config/task.xml new file mode 120000 index 000000000..fae56d75d --- /dev/null +++ b/public/config/task.xml @@ -0,0 +1 @@ +E:/newcode/flash/src/Core/_assets/18_com.robot.core.config.xml.TasksXMLInfo_xmlClass.bin \ No newline at end of file