feat(build): 更新构建脚本添加资源打包和proto编译

更新build.bat脚本,添加proto文件编译和资源打包功能,调整资源打包顺序。

BREAKING CHANGE: 构建流程发生变化,需要重新生成proto文件和打包资源。

---

refactor(xmlres): 使用gres替换gfile读取资源文件

将xmlres模块中文件读取方式从gfile.GetBytes改为gres.GetContent,
使
This commit is contained in:
2026-01-01 19:57:39 +08:00
parent d88a2d19ea
commit dd28d48ca4
23 changed files with 270 additions and 138 deletions

View File

@@ -8,7 +8,6 @@ import (
"blazing/logic/service/fight"
"blazing/logic/service/fight/info"
"blazing/logic/service/task"
"blazing/logic/service/player"
"blazing/modules/blazing/model"
@@ -138,33 +137,7 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, p *pla
fight.NewFight(p, ai, func(foi *info.FightOverInfo) {
if taskID != 0 {
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
if p.Info.GetTask(taskID) == model.Unaccepted {
p.Info.SetTask(taskID, model.Completed) //设置完成任务
gift := task.GetTaskInfo(uint32(taskID), 0)
if gift != nil {
res := &info.S2C_GET_BOSS_MONSTER{
BonusID: uint32(taskID),
}
if gift.Pet != nil {
p.Service.Pet.PetAdd(gift.Pet)
res.PetID = gift.Pet.ID
res.CaptureTm = gift.Pet.CatchTime
}
for _, item := range gift.ItemList {
success := p.ItemAdd(item.ItemId, item.ItemCnt)
if success {
res.ItemList = append(res.ItemList, item)
}
}
p.SendPackCmd(8004, res)
}
}
p.CompletedTask(taskID, 0)
}
}

View File

@@ -13,6 +13,7 @@ import (
configservice "blazing/modules/config/service"
"sync/atomic"
"github.com/gogf/gf/v2/util/gconv"
"github.com/jinzhu/copier"
)
@@ -38,6 +39,7 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV
c.Info.CurrentFreshStage = uint32((data.Level-1)*10) + 1
case 2414: //勇者之塔
c.Info.CurrentStage = uint32((data.Level-1)*10) + 1
}
}
@@ -51,7 +53,7 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV
case 2414: //勇者之塔
result.CurFightLevel = uint(c.Info.CurrentStage)
boss = service.NewTower500Service().Boss(c.Info.CurrentFreshStage)
boss = service.NewTower500Service().Boss(c.Info.CurrentStage)
//next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1)
}
@@ -95,13 +97,6 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
case 2429: //试炼之塔
boss = service.NewTower600Service().Boss(c.Info.CurrentFreshStage)
next = service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1)
if next != nil {
for _, v := range next.BossIds {
r := configservice.NewBossService().Get(v)
result.BossID = append(result.BossID, uint32(r.MonID))
}
}
result.CurFightLevel = uint32(c.Info.CurrentFreshStage)
case 2415: //勇者之塔
@@ -111,7 +106,7 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
result.CurFightLevel = uint32(c.Info.CurrentStage)
}
if next == nil {
if next != nil {
for _, v := range next.BossIds {
r := configservice.NewBossService().Get(v)
result.BossID = append(result.BossID, uint32(r.MonID))
@@ -122,15 +117,17 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
r := configservice.NewBossService().Get(v)
if r != nil {
monster := model.GenPetInfo(int(r.MonID), int(r.Lv), int(r.Nature), 0, int(r.Lv), nil)
monster := model.GenPetInfo(int(r.MonID), 24, int(r.Nature), 0, int(r.Lv), nil)
if r.Hp != 0 {
monster.Hp = uint32(r.Hp)
monster.MaxHp = uint32(r.Hp)
}
if len(r.Prop) != 0 {
copy(monster.Prop[:], r.Prop)
for i, v := range r.Prop {
if v != 0 {
monster.Prop[i] = v
}
}
@@ -144,6 +141,20 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
}
//todo 特性填装
if len(r.Effect) != 0 {
for _, v := range r.Effect {
EID, args := service.NewEffectService().Args(v)
monster.EffectInfo = append(monster.EffectInfo, model.PetEffectInfo{
Idx: uint16(v),
EID: gconv.Uint16(EID),
Args: gconv.Ints(args),
})
}
}
monster.CatchTime = uint32(i)
monsterInfo.PetList = append(monsterInfo.PetList, *monster)
}
@@ -155,11 +166,22 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
if foi.Reason == 0 && foi.WinnerId == c.Info.UserID { //我放获胜
switch data.Head.CMD {
case 2429: //试炼之塔
for _, v := range boss.TaskIds {
c.CompletedTask(int(v), 500)
}
c.Info.CurrentFreshStage++
if c.Info.CurrentFreshStage >= c.Info.MaxFreshStage {
c.Info.MaxFreshStage = c.Info.CurrentFreshStage
}
case 2415: //勇者之塔
for _, v := range boss.TaskIds {
c.CompletedTask(int(v), 600)
}
c.Info.CurrentStage++
if c.Info.CurrentStage >= c.Info.MaxStage {
c.Info.MaxStage = c.Info.CurrentStage
}
}
}

View File

@@ -3,6 +3,7 @@ package controller
import (
"blazing/common/data"
"blazing/common/socket/errorcode"
"fmt"
"blazing/logic/service/player"
"blazing/logic/service/task"
@@ -15,7 +16,9 @@ func (h Controller) AcceptTask(data *task.AcceptTaskInboundInfo, c *player.Playe
// if data.Head.CMD != 2201 { //判断是每日任务
// //isdaliy = true
// }
if c.Info.GetTask(int(data.TaskId)) == model.Completed {
return result, 0
}
if c.Info.GetTask(int(data.TaskId)) == model.Unaccepted {
c.Info.SetTask(int(data.TaskId), model.Accepted)
@@ -49,9 +52,12 @@ func (h Controller) AddTaskBuf(data *task.AddTaskBufInboundInfo, c *player.Playe
// 返回: 任务完成结果和错误码
func (h Controller) CompleteTask(data1 *task.CompleteTaskInboundInfo, c *player.Player) (result *task.CompleteTaskOutboundInfo, err errorcode.ErrorCode) {
if c.Info.GetTask(int(data1.TaskId)) != model.Accepted {
return result, errorcode.ErrorCodes.ErrAwardAlreadyClaimed
}
if data1.OutState > 10 {
fmt.Println("error", data1.OutState, c.Info.UserID, "分支溢出")
return result, 0
}
c.Info.SetTask(int(data1.TaskId), model.Completed)
result = &task.CompleteTaskOutboundInfo{
@@ -68,6 +74,7 @@ func (h Controller) CompleteTask(data1 *task.CompleteTaskInboundInfo, c *player.
c.Service.Pet.PetAdd(taskInfo.Pet)
result.CaptureTime = taskInfo.Pet.CatchTime
result.PetTypeId = taskInfo.Pet.ID
}
for _, item := range taskInfo.ItemList {