fix: 修复空提交问题

This commit is contained in:
1
2025-11-16 21:11:44 +00:00
parent baaec283e6
commit f01068930b
3 changed files with 15 additions and 2 deletions

View File

@@ -102,7 +102,12 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *pla
Mode: info.BattleMode.MULTI_MODE,
}
ai := player.NewAI_player(moinfo)
//给予打过一次的奖励
c.Done.SPT(c.Info.MapID, data.BossId, 1, func() {
})
fight.NewFight(c, ai, func(foi *info.FightOverInfo) {
c.Done.Done(model.MilestoneMode.BOSS, data.BossId)
})

View File

@@ -12,6 +12,14 @@ type Done struct {
*bus.Topic[*model.MilestoneEX]
}
func NewDone(P *Player) Done {
return Done{
Player: P,
Topic: bus.NewTopic[*model.MilestoneEX](),
}
}
// 注册地图BOSS完成事件
// MAPID 地图ID
// BOSSID 地图BOSSID
@@ -37,7 +45,7 @@ func (d *Done) SPT(mapid, bossid, count uint32, fn func()) {
}
// 分发事件 ,指定事件+1 并触发是否完成
func (d *Done) Pub(Donetype model.EnumMilestone, id []uint32) {
func (d *Done) Done(Donetype model.EnumMilestone, id []uint32) {
d.Service.Done.Exec(Donetype, id, func(t *model.MilestoneEX) bool {

View File

@@ -14,7 +14,7 @@ func NewPlayer(opts ...PlayerOption) *Player {
baseplayer: newbaseplayer(),
}
p.monsters = generateThreeUniqueNumbers()
p.Done = NewDone(p) //发布订阅事件
p.StopChan = cool.Cron.ScheduleFunc(10*time.Second, func() {
if p.Canmon && p.FightC == nil { //已经进入地图或者没在战斗中,就可以刷新怪
p.SpawnMonsters()