1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-14 03:05:51 +08:00
parent 7cdf7a0890
commit 06b77d598e
15 changed files with 102 additions and 59 deletions

View File

@@ -81,8 +81,13 @@ func (Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, p *playe
for i, bm := range bc.BossMon {
dv := 24
if bc.BossCatchable == 1 {
dv = -1
}
monster = model.GenPetInfo(
gconv.Int(processMonID(bm.MonID)), 24, //24个体
gconv.Int(processMonID(bm.MonID)), dv, //24个体
-1,
0, //野怪没特性

View File

@@ -2,10 +2,12 @@ package controller
import (
"blazing/common/socket/errorcode"
"blazing/cool"
"sync/atomic"
"blazing/logic/service/fight"
"blazing/logic/service/fight/info"
"blazing/logic/service/pet"
"blazing/logic/service/player"
"blazing/logic/service/space"
)
@@ -76,12 +78,22 @@ func (h Controller) ArenaFightOwner(data *fight.ARENA_FIGHT_OWENR, c *player.Pla
}
if foi.Reason == 0 { //正常获胜
addev := int64(int(1) * int(cool.Connected) * int(c.GetSpace().Owner.HostWins))
if foi.WinnerId == c.GetInfo().UserID {
c.Info.MaxArenaWins += 1
c.Info.EVPool += addev
c.SendPackCmd(50001, &pet.S2C_50001{
UseEV: int32(addev),
})
} else {
c.GetSpace().Owner.ARENA_Player.GetInfo().MaxArenaWins += 1
//这里给经验
c.GetSpace().Owner.ARENA_Player.GetInfo().EVPool += addev
c.GetSpace().Owner.ARENA_Player.SendPackCmd(50001, &pet.S2C_50001{
UseEV: int32(addev),
})
}
}

View File

@@ -46,6 +46,6 @@ func (h Controller) PetEVDiy(data *pet.PetEV, c *player.Player) (result *pet.S2C
c.Info.EVPool -= int64(usedEV)
result = &pet.S2C_50001{}
result.UseEV = usedEV
result.UseEV = -int32(usedEV)
return result, 0
}

View File

@@ -6,6 +6,7 @@ import (
"blazing/logic/service/player"
"blazing/modules/player/model"
"github.com/pointernil/bitset32"
"github.com/samber/lo"
)
@@ -15,10 +16,15 @@ func (h Controller) IsCollect(
ID: data.Type,
}
res := c.Info.GetTask(1335 + int(data.Type)) //第一期
if res == model.Completed {
result.IsCom = 1
}
c.Service.Task.Exec(uint32(1335), func(te *model.Task) bool {
r := bitset32.From(te.Data)
// 分支未完成时,标记完成并发放奖励
if r.Test(uint(data.Type)) {
result.IsCom = 1
}
return false
})
return result, 0
@@ -26,18 +32,30 @@ func (h Controller) IsCollect(
// 定义 Type 与合法 ID 集合的映射表,集中管理所有规则
var validTypeIDMap = map[int][]uint32{
1: {1, 4, 7}, // Type1合法ID为1、4、7
2: {71}, // Type2合法ID为71
3: {275}, // Type3合法ID为275
4: {669}, // Type4合法ID为669你之前提到的是670确认是否笔误
301: {1, 4, 7}, //精灵王计划
1: {1, 4, 7}, // Type1合法ID为1、4、7
2: {71}, // Type2合法ID为71
3: {275}, // Type3合法ID为275
4: {669}, // Type4合法ID为669你之前提到的是670确认是否笔误
301: {1, 4, 7}, //精灵王计划
100: {856, 857, 858}, //测试
}
func (h Controller) Collect(
data *pet.C2S_PET_COLLECT, c *player.Player) (result *pet.S2C_PET_COLLECT, err errorcode.ErrorCode) { //这个时候player应该是空的
result = &pet.S2C_PET_COLLECT{ID: data.ID}
res := c.Info.GetTask(1335 + int(data.Type)) //第一期
if res != model.Unaccepted {
_, ok := lo.Find([]uint32{1, 2, 3, 4, 301}, func(item uint32) bool {
return data.Type == item
})
if res == model.Completed && ok { //这块是为了兼容旧版本
c.Service.Task.Exec(uint32(1335), func(te *model.Task) bool {
r := bitset32.From(te.Data)
r.Set(uint(data.Type))
te.Data = r.Bytes()
return true
})
return nil, errorcode.ErrorCode(errorcode.ErrorCodes.ErrSystemError)
}
@@ -51,11 +69,25 @@ func (h Controller) Collect(
if !lo.Contains(validIDs, data.ID) {
return nil, errorcode.ErrorCode(errorcode.ErrorCodes.ErrSystemError)
}
c.Service.Task.Exec(uint32(1335), func(te *model.Task) bool {
c.Info.SetTask(1335+int(data.Type), model.Completed)
r := model.GenPetInfo(int(data.ID), -1, -1, 0, 1, nil, 0)
c.Service.Pet.PetAdd(r)
result.CatchTime = r.CatchTime
r := bitset32.From(te.Data)
// 分支未完成时,标记完成并发放奖励
if !r.Test(uint(data.Type)) {
r.Set(uint(data.Type))
te.Data = r.Bytes()
r := model.GenPetInfo(int(data.ID), -1, -1, 0, 1, nil, 0)
c.Service.Pet.PetAdd(r)
result.CatchTime = r.CatchTime
return true
}
return false
})
if result.CatchTime == 0 {
return nil, errorcode.ErrorCode(errorcode.ErrorCodes.ErrAwardAlreadyClaimed)
}
return result, 0

View File

@@ -28,7 +28,7 @@ func (h Controller) AcceptTask(data *task.AcceptTaskInboundInfo, c *player.Playe
}
c.Info.SetTask(int(data.TaskId), model.Accepted)
c.Service.Task.Exec(uint32(data.TaskId), func(t *model.TaskEX) bool {
c.Service.Task.Exec(uint32(data.TaskId), func(t *model.Task) bool {
t.Data = []uint32{}
return true
@@ -48,7 +48,7 @@ func (h Controller) AddTaskBuf(data *task.AddTaskBufInboundInfo, c *player.Playe
if c.Info.GetTask(int(data.TaskId)) != model.Accepted {
return result, errorcode.ErrorCodes.ErrAwardAlreadyClaimed
}
c.Service.Task.Exec(data.TaskId, func(taskEx *model.TaskEX) bool {
c.Service.Task.Exec(data.TaskId, func(taskEx *model.Task) bool {
taskEx.Data = data.TaskList
return true
})
@@ -105,7 +105,7 @@ func (h Controller) GetTaskBuf(data *task.GetTaskBufInboundInfo, c *player.Playe
result = &task.GetTaskBufOutboundInfo{
TaskId: data.TaskId,
}
c.Service.Task.Exec(data.TaskId, func(te *model.TaskEX) bool {
c.Service.Task.Exec(data.TaskId, func(te *model.Task) bool {
result.TaskList = te.Data
return false