实装大乱斗经验
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-14 04:27:57 +08:00
parent 06b77d598e
commit 24c413030f
10 changed files with 71 additions and 8 deletions

View File

@@ -22,8 +22,13 @@ func (h Controller) PetMelee(data *fight.StartPetWarInboundInfo, c *player.Playe
if foi.WinnerId == c.GetInfo().UserID {
c.Info.MessWin += 1
c.MessWin(true)
p.MessWin(false)
} else {
p.GetInfo().MessWin += 1
p.MessWin(true)
c.MessWin(false)
}
}

View File

@@ -26,6 +26,15 @@ func (h Controller) IsCollect(
return false
})
_, ok := lo.Find([]uint32{1, 2, 3, 4, 301}, func(item uint32) bool {
return data.Type == item
})
if ok {
res := c.Info.GetTask(1335 + int(data.Type)) //第一期
if res == model.Completed {
result.IsCom = 1
}
}
return result, 0
}

View File

@@ -15,8 +15,13 @@ import (
// 返回: 模拟用户信息及错误码
func (h Controller) GetUserSimInfo(data *user.SimUserInfoInboundInfo, player *player.Player) (result *user.SimUserInfoOutboundInfo, err errorcode.ErrorCode) {
result = &user.SimUserInfoOutboundInfo{}
t, ok := player.GetSpace().UserInfo.Load(data.UserId)
if ok {
copier.Copy(result, t)
} else {
copier.Copy(result, player.Service.Info.Person(data.UserId).Data)
}
copier.Copy(result, player.Service.Info.Person(data.UserId).Data)
return result, 0
}

View File

@@ -15,6 +15,7 @@ type PlayerI interface {
InvitePlayer(PlayerI)
SetFightC(FightI)
QuitFight()
MessWin(bool)
CanFight() bool
SendPackCmd(uint32, any)
}

View File

@@ -1,6 +1,8 @@
package pet
import "blazing/logic/service/common"
import (
"blazing/logic/service/common"
)
// PetBargeListInboundInfo 对应Java的PetBargeListInboundInfo实现InboundMessage接口
type PetBargeListInboundInfo struct {
@@ -47,3 +49,7 @@ type C2S_PET_EVOLVTION struct {
type C2S_2608 struct {
Head common.TomeeHeader `cmd:"2608" struc:"skip"`
}
type S2C_50006 struct {
ItemID uint32
Count uint32
}

View File

@@ -20,6 +20,10 @@ func (f *AI_player) SendPack(b []byte) error {
}
func (f *AI_player) MessWin(b bool) {
}
func (f *AI_player) SendPackCmd(_ uint32, _ any) {
//fmt.Println("战斗结束")

View File

@@ -2,9 +2,37 @@ package player
import (
"blazing/logic/service/common"
"blazing/logic/service/pet"
"blazing/modules/config/service"
)
func (p *Player) SendPackCmd(cmd uint32, b any) {
p.SendPack(common.NewTomeeHeader(cmd, p.Info.UserID).Pack(b))
}
func (p *Player) MessWin(win bool) {
var getcony uint32
_, ok := p.Service.Talk.Cheak(p.Info.MapID, 5000)
if ok {
//更新次数
config := service.NewTalkConfigService().GetCache(5000)
//service.NewItemService().GetItemCount(config.ItemID)
for _, itemID := range config.ItemIDS {
iteminfo := service.NewItemService().GetItem(itemID)
if win {
getcony = uint32(iteminfo.ItemMaxCount)
} else {
getcony = uint32(iteminfo.ItemMinCount)
}
p.ItemAdd(iteminfo.ItemID, int64(getcony))
}
p.Service.Talk.Update(5000)
}
p.SendPackCmd(50006, &pet.S2C_50006{
ItemID: 3,
Count: getcony,
})
}

View File

@@ -13,8 +13,14 @@ type ItemService struct {
*cool.Service
}
//实现物品数量的获取
// 实现物品数量的获取
func (s *ItemService) GetItem(id uint32) *model.ItemGift {
var item *model.ItemGift
dbm(s.Model).Where("id", id).Scan(&item)
return item
}
func (s *ItemService) GetItemCount(id uint32) data.ItemInfo {
var item model.ItemGift
var res data.ItemInfo

View File

@@ -56,8 +56,7 @@ func (s *InfoService) Reg(nick string, color uint32) *model.PlayerInfo {
}
func (s *InfoService) Person(userid uint32) (out *model.Player) {
s.dbm_fix(s.Model).Scan(&out)
cool.DBM(s.Model).Where("player_id", userid).Scan(&out)
return

View File

@@ -41,11 +41,11 @@ func (s *TalkService) Cheak(mapid uint32, flag int) (int, bool) {
m1.Save(talks)
return int(talks.Count), true
}
if uint32(mapid) != config.NewTalkConfigService().GetCache(flag).MapID {
c := config.NewTalkConfigService().GetCache(flag)
if uint32(mapid) != c.MapID {
return 0, false //没在地图
}
if talks.Count >= config.NewTalkConfigService().GetCache(flag).DailyCollectCount {
if talks.Count >= c.DailyCollectCount {
return 0, false
}
return int(talks.Count), true //int(config.MaxDailyCnt - talks.Count)