From 081f990110f3c051d3a2158ed66573656ddd8df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <1@72wo.cn> Date: Sun, 24 Aug 2025 17:33:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(assets):=20=E9=87=8D=E6=9E=84=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E5=90=8C=E6=AD=A5=E6=B5=81=E7=A8=8B=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AE=A0=E7=89=A9=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了资产同步到私有 B 仓库的工作流 - 在玩家结构中添加了 IsFighting 字段 - 新增了宠物信息相关功能和数据结构 - 优化了地图进入和怪物刷新逻辑 - 调整了玩家登录和地图数据发送流程 - 重构了部分代码以提高可维护性和性能 --- .github/workflows/{assets.yml => assets.yml1} | 4 +- common/data/entity/player.go | 8 +- common/socket/handler/SocketHandler_Tomee.go | 4 +- logic/controller/controller.go | 5 +- logic/controller/fight.go | 68 +++ logic/controller/getserver.go | 2 +- logic/controller/login.go | 22 +- logic/controller/map.go | 20 +- logic/controller/pet.go | 40 ++ logic/service/fight/fight.go | 125 ++++++ logic/service/login/LoginSidInfo.go | 27 ++ logic/service/maps/Map_Ogre.go | 7 +- logic/service/pet/pet.go | 16 + logic/service/service.go | 4 +- modules/blazing/model/pet.go | 138 +++--- modules/blazing/model/player.go | 4 +- modules/blazing/service/monster_refresh.go | 28 +- public/assets/210.xml | 3 + public/assets/291.xml | 402 +++--------------- public/assets/50001.xml | 4 + public/assets/monster_refresh.xsd | 244 +++++++++++ public/assets/talk_count.xsd | 115 +++++ public/assets/异色.xml | 344 +++++++++++++++ 23 files changed, 1214 insertions(+), 420 deletions(-) rename .github/workflows/{assets.yml => assets.yml1} (95%) create mode 100644 logic/controller/fight.go create mode 100644 logic/service/fight/fight.go create mode 100644 logic/service/pet/pet.go create mode 100644 public/assets/50001.xml create mode 100644 public/assets/monster_refresh.xsd create mode 100644 public/assets/talk_count.xsd create mode 100644 public/assets/异色.xml diff --git a/.github/workflows/assets.yml b/.github/workflows/assets.yml1 similarity index 95% rename from .github/workflows/assets.yml rename to .github/workflows/assets.yml1 index a9e0af889..d5ecc979d 100644 --- a/.github/workflows/assets.yml +++ b/.github/workflows/assets.yml1 @@ -31,7 +31,7 @@ jobs: fi # 复制源文件到临时目录 - cp -rv public/assets/* public/assets/.* temp-b-repo/out/assets/ 2>/dev/null || true + cp -rv public/assets/* public/assets/.* temp-b-repo/resource/xml/ 2>/dev/null || true echo "Files copied to temp directory (before processing):" ls -la temp-b-repo/out/assets @@ -92,7 +92,7 @@ jobs: git pull origin $B_BRANCH || { echo "Failed to pull B repo"; exit 1; } mkdir -p out/assets - cp -rv ../temp-b-repo/out/assets/* ../temp-b-repo/out/assets/.* out/assets/ 2>/dev/null || true + cp -rv ../temp-b-repo/resource/xml/* ../temp-b-repo/resource/xml/.* resource/xml/ 2>/dev/null || true echo "Files in B repo target directory after copy:" ls -la out/assets diff --git a/common/data/entity/player.go b/common/data/entity/player.go index 142f4cbdc..fc87c4ac2 100644 --- a/common/data/entity/player.go +++ b/common/data/entity/player.go @@ -16,9 +16,10 @@ type Player struct { mu sync.Mutex MapId uint32 //当前所在的地图ID - loginChan chan struct{} // 登录完成通知通道 - Nick string //昵称 - StopChan chan struct{} //停止刷怪协程 + loginChan chan struct{} // 登录完成通知通道 + Nick string //昵称 + StopChan chan struct{} //停止刷怪协程 + IsFighting bool context.Context } @@ -57,6 +58,7 @@ func (p *Player) SetData(key any) uint32 { return p.UserID } func (p *Player) SendPack(b []byte) error { + fmt.Println("发送数据包", len(b)) err := p.MainConn.SendPack(b) return err } diff --git a/common/socket/handler/SocketHandler_Tomee.go b/common/socket/handler/SocketHandler_Tomee.go index d5c2de720..a480fc8a8 100644 --- a/common/socket/handler/SocketHandler_Tomee.go +++ b/common/socket/handler/SocketHandler_Tomee.go @@ -25,11 +25,13 @@ type TomeeHeader struct { //Return []byte `struc:"[0]pad"` //返回记录 } -func NewTomeeHeader() *TomeeHeader { +func NewTomeeHeader(cmd uint32, userid uint32) *TomeeHeader { return &TomeeHeader{ + CMD: cmd, // Len: 0, Version: "7", + Result: 0, } } diff --git a/logic/controller/controller.go b/logic/controller/controller.go index 2d6b6756c..8a40aa256 100644 --- a/logic/controller/controller.go +++ b/logic/controller/controller.go @@ -87,15 +87,16 @@ func init() { //默认初始化扫描 method := typ.Method(i) methodValue := value.MethodByName(method.Name) + fmt.Println("找到注册方法", method.Name) methodValue.Type().NumIn() - var func_cmd uint32 = getcmd(methodValue.Type().In(0)) + var func_cmd = getcmd(methodValue.Type().In(0)) if func_cmd == 0 { //说明不是注册方法 glog.Warning(context.Background(), "方法参数必须是结构体", method.Name, "跳过注册") continue } if cool.Config.PortBL == 0 && func_cmd > 1000 { //判断login服务器 - break + continue } diff --git a/logic/controller/fight.go b/logic/controller/fight.go new file mode 100644 index 000000000..7bf509ef4 --- /dev/null +++ b/logic/controller/fight.go @@ -0,0 +1,68 @@ +package controller + +import ( + "blazing/common/data/entity" + "blazing/common/socket/errorcode" + "blazing/common/socket/handler" + "blazing/logic/service/fight" + "blazing/modules/blazing/model" +) + +func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundInfo, c *entity.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { + c.IsFighting = true + t1 := handler.NewTomeeHeader(2503, c.UserID) + ttt := fight.NoteReadyToFightInfo{ + FightId: 3, + } + ttt.OurInfo = fight.FightUserInfo{UserID: c.UserID} + + ttt.OurPetList = []fight.ReadyFightPetInfo{{ID: 300, + Level: 100, + MaxHp: 100, + + Hp: 100, + SkillListLen: 4, + }} + + for i := 0; i < 4; i++ { + ttt.OurPetList[0].SkillList[i] = model.SkillInfo{ID: 10001, Pp: 1} + } + ttt.OpponentInfo = fight.FightUserInfo{UserID: 0} + ttt.OpponentPetList = []fight.ReadyFightPetInfo{{ID: 1, + Level: 100, + MaxHp: 100, + SkillListLen: 4, + Hp: 100}} + for i := 0; i < 4; i++ { + ttt.OpponentPetList[0].SkillList[i] = model.SkillInfo{ID: 10001, Pp: 1} + } + c.SendPack(t1.Pack(&ttt)) + return nil, -1 +} +func (h Controller) OnReadyToFight(data *fight.ReadyToFightInboundInfo, c *entity.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { + + t1 := handler.NewTomeeHeader(2504, c.UserID) + rett := fight.FightStartOutboundInfo{ + IsCanAuto: 0, + Info1: fight.FightPetInfo{PetID: 300, + UserID: c.UserID, + Hp: 1000, + MaxHp: 1000, + Level: 1, + CatchTime: 0, + Catchable: 1, + BattleLV: [6]byte{1, 1, 1, 1, 1, 1}, + }, + Info2: fight.FightPetInfo{ + UserID: 0, + PetID: 1, + Hp: 1000, + MaxHp: 1000, + Level: 1, + CatchTime: 0, + Catchable: 1, + BattleLV: [6]byte{1, 1, 1, 1, 1, 1}}, + } + c.SendPack(t1.Pack(&rett)) + return nil, -1 +} diff --git a/logic/controller/getserver.go b/logic/controller/getserver.go index cc0a2a34a..789e83b66 100644 --- a/logic/controller/getserver.go +++ b/logic/controller/getserver.go @@ -7,7 +7,7 @@ import ( ) // 处理命令: 105 -func (h Controller) GetServer(data *commendsvr.SidInfo, c *entity.Conn) (result *commendsvr.CommendSvrInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 +func (h *Controller) GetServer(data *commendsvr.SidInfo, c *entity.Conn) (result *commendsvr.CommendSvrInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 result = commendsvr.NewInInfo() result.ServerList = commendsvr.GetServerInfoList() return diff --git a/logic/controller/login.go b/logic/controller/login.go index 27797c22d..819809fe2 100644 --- a/logic/controller/login.go +++ b/logic/controller/login.go @@ -4,8 +4,10 @@ import ( "blazing/common/data/entity" "blazing/common/data/share" "blazing/common/socket/errorcode" + "blazing/common/socket/handler" "blazing/logic/service" "blazing/logic/service/login" + "blazing/logic/service/maps" "blazing/logic/service/space" blservice "blazing/modules/blazing/service" "context" @@ -43,9 +45,25 @@ func (h *Controller) Login(data *login.InInfo, c *entity.Conn) (result *login.Ou result.Pos = playerinfo.Pos result.Clothes = playerinfo.Clothes ///append(result.Clothes, model.PeopleItemInfo{ID: 100717, Level: 1}) result.MapID = t.MapId - result.TimeLimit = playerinfo.TimeLimit + result.TimeLimit = playerinfo.TimeLimit //todo 待修复电池不正确问题 result.TimeToday = playerinfo.TimeToday - result.PetList = playerinfo.PetList + //result.PetList = playerinfo.PetList + + defer func() { + space.GetSpace(t.MapId).Set(t.UserID, t) //添加玩家 + tt := maps.NewOutInfo() + tt.UserID = t.UserID + tt.Nick = t.Nick + tt.Pos = result.Pos + + t1 := handler.NewTomeeHeader(2001, t.UserID) + + space.GetSpace(t.MapId).Range(func(playerID uint32, player *entity.Player) bool { + + player.SendPack(t1.Pack(&tt)) + return true + }) + }() return result, 0 diff --git a/logic/controller/map.go b/logic/controller/map.go index 209551681..203f55dd1 100644 --- a/logic/controller/map.go +++ b/logic/controller/map.go @@ -41,7 +41,10 @@ func (h *Controller) MapEnter(data *maps.InInfo, c *entity.Player) (result *maps return case <-ticker.C: // 刷新当前地图的怪物 - spawnMonsters(currentMap, c) + if !c.IsFighting && c.MapId != 0 { + spawnMonsters(currentMap, c) + } + } } }(c.StopChan, int(c.MapId)) @@ -90,16 +93,19 @@ func spawnMonsters(mapID int, c *entity.Player) { } // 创建数据包 - tt := handler.NewTomeeHeader() - tt.CMD = 2004 - tt.Result = 0 - tt.UserID = c.UserID + tt := handler.NewTomeeHeader(2004, c.UserID) // 设置怪物信息 t1 := maps.OgreInfo{} //copy(t1.Data[:], monsterConfig) // 使用地图对应的怪物配置 - for i := 0; i < 9; i++ { - t1.Data[i] = mservice.NewMonsterService().GetId(c.MapId) + for i := 0; i < 3; i++ { + + ttt := maps.OgrePetInfo{} + ttt.Id = mservice.NewMonsterService().GetId(c.MapId) + + ttt.Shiny = uint32(i + 1) + //t1.Data[i] = mservice.NewMonsterService().GetId(c.MapId) + t1.Data[i] = ttt } // 发送数据包 c.SendPack(tt.Pack(&t1)) diff --git a/logic/controller/pet.go b/logic/controller/pet.go index b0b429f89..c113c0147 100644 --- a/logic/controller/pet.go +++ b/logic/controller/pet.go @@ -1 +1,41 @@ package controller + +import ( + "blazing/common/data/entity" + "blazing/common/socket/errorcode" + "blazing/logic/service/pet" + "blazing/modules/blazing/model" + "time" +) + +func (h *Controller) GetPetInfo(data *pet.InInfo, c *entity.Player) (result *pet.OutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 + + t := model.PetInfo{ + ID: 300, + Name: [16]byte{'1'}, + Dv: 1, + Attack: 1000, + Defence: 1000, + SpecialAttack: 1000, + CatchTime: uint32(time.Now().Unix()), + Speed: 1000, + Hp: 1000, + MaxHp: 1000, + Level: 1, + LvExp: 1000, + NextLvExp: 1000, + Exp: 1000, + //SkillList: [4]model.SkillInfo{{ID: 1, Pp: 1}}, + Nature: 1, + Shiny: 1, + } + t.SkillListLen = 1 + for i := 0; i < 4; i++ { + t.SkillList[i] = model.SkillInfo{ID: 10001, Pp: 10001} + } + t.EffectInfo = make([]model.PetEffectInfo, 0) + t.EffectInfo = append(t.EffectInfo, model.PetEffectInfo{EffectID: 1, ItemID: 1, LeftCount: 1}) + return &pet.OutInfo{ + PetInfo: t, + }, 0 +} diff --git a/logic/service/fight/fight.go b/logic/service/fight/fight.go new file mode 100644 index 000000000..fa9e71ca3 --- /dev/null +++ b/logic/service/fight/fight.go @@ -0,0 +1,125 @@ +package fight + +import ( + "blazing/common/socket/handler" + "blazing/modules/blazing/model" +) + +type FightNpcMonsterInboundInfo struct { + Head handler.TomeeHeader `cmd:"2408" struc:"[0]pad"` //玩家登录 + // Number 地图刷新怪物结构体对应的序号(1-9的位置序号) + // 对应Java的@UInt long类型,使用uint32保持无符号特性 + Number uint32 `fieldDesc:"地图刷新怪物结构体对应的序号 1 - 9 的位置序号" ` +} +type NullOutboundInfo struct { +} + +type ReadyToFightInboundInfo struct { + Head handler.TomeeHeader `cmd:"2404" struc:"[0]pad"` //玩家登录 + +} + +type FightStartOutboundInfo struct { + // 对应Java的@UInt long类型 + IsCanAuto uint32 `fieldDesc:"是否自动 默认给0 怀疑是自动战斗器使用的" ` + + // 当前战斗精灵信息1(前端通过userid判断是否为我方) + Info1 FightPetInfo `fieldDesc:"当前战斗精灵的信息 可能不准.看前端代码是以userid来判断哪个结构体是我方的" serialize:"struct"` + + // 当前战斗精灵信息2(前端通过userid判断是否为我方) + Info2 FightPetInfo `fieldDesc:"当前战斗精灵的信息 可能不准.看前端代码是以userid来判断哪个结构体是我方的" serialize:"struct"` +} + +// FightPetInfo 战斗精灵信息结构体,对应Java的FightPetInfo类 +type FightPetInfo struct { + // 用户ID(野怪为0),对应Java的@UInt long + UserID uint32 `fieldDesc:"用户ID 野怪为0" ` + + // 当前对战精灵ID,对应Java的@UInt long + PetID uint32 `fieldDesc:"当前对战精灵ID" ` + + // 空的16字节byte,对应Java的固定长度字符串 + // 使用[16]byte匹配固定长度16字节的要求 + PetName [16]byte `fieldDesc:"空的16字节byte" serialize:"fixedLength=16,type=byteArray"` + + // 精灵的捕获时间,对应Java的@UInt long + CatchTime uint32 `fieldDesc:"精灵的捕获时间" ` + + // 当前HP,对应Java的@UInt long + Hp uint32 `fieldDesc:"当前HP" ` + + // 最大HP,对应Java的@UInt long + MaxHp uint32 `fieldDesc:"最大HP" ` + + // 当前等级,对应Java的@UInt long + Level uint32 `fieldDesc:"当前等级" ` + + // 精灵是否能捕捉(1为能捕捉,0为不能捕捉),对应Java的@UInt long + Catchable uint32 `fieldDesc:"精灵是否能捕捉. 1为能捕捉 0为不能捕捉" ` + + // 战斗属性等级数组(6个单字节) + // 对应Java的byte[],固定长度6,存储buff等级、攻击、速度等属性 + BattleLV [6]byte `fieldDesc:"这里实际上应该是6个单字节byte, 内容为buff等级 攻击 速度 特攻 防御 特防 命中等.但具体顺序未知可能需要测试. 具体数值为1-6等级" serialize:"fixedLength=6,type=byteArray"` +} + +// NoteReadyToFightInfo 战斗准备就绪消息结构体,对应Java的NoteReadyToFightInfo +type NoteReadyToFightInfo struct { + // 战斗类型ID(与野怪战斗为3,与人战斗为1,前端似乎未使用) + // 对应Java的@UInt long + FightId uint32 `fieldDesc:"战斗类型ID 但前端好像没有用到 与野怪战斗为3,与人战斗似乎是1" ` + + // 我方信息 + OurInfo FightUserInfo `fieldDesc:"我方信息" serialize:"struct"` + OurPetListLen uint32 `struc:"sizeof=OurPetList"` + // 我方携带精灵的信息 + // 对应Java的ArrayList,使用切片模拟动态列表 + OurPetList []ReadyFightPetInfo `fieldDesc:"我方携带精灵的信息" serialize:"lengthFirst,lengthType=uint16,type=structArray"` + + // 对方信息 + OpponentInfo FightUserInfo `fieldDesc:"对方信息" serialize:"struct"` + OpponentPetListLen uint32 `struc:"sizeof=OpponentPetList"` + // 敌方的精灵信息 + // 野怪战斗时:客户端接收此包前已生成精灵PetInfo,将部分信息写入该列表 + OpponentPetList []ReadyFightPetInfo `fieldDesc:"敌方的精灵信息 如果是野怪 那么再给客户端发送这个包体时就提前生成好了这只精灵的PetInfo,然后把从PetInfo中把部分信息写入到这个敌方的精灵信息中再发送这个包结构体" serialize:"lengthFirst,lengthType=uint16,type=structArray"` +} +type FightUserInfo struct { + // 用户ID(野怪为0),对应Java的@UInt long + UserID uint32 `fieldDesc:"userID 如果为野怪则为0" ` + + // 玩家名称(野怪为UTF-8的'-',固定16字节) + // 使用[16]byte存储固定长度的字节数组 + Nickname [16]byte ` ` +} + +// ReadyFightPetInfo 准备战斗的精灵信息结构体,对应Java的ReadyFightPetInfo类 +type ReadyFightPetInfo struct { + // 精灵ID,对应Java的@UInt long + ID uint32 `fieldDesc:"精灵ID" ` + + // 精灵等级,对应Java的@UInt long + Level uint32 `fieldDesc:"精灵等级" ` + + // 精灵当前HP,对应Java的@UInt long + Hp uint32 `fieldDesc:"精灵HP" ` + + // 精灵最大HP,对应Java的@UInt long + MaxHp uint32 `fieldDesc:"最大HP" ` + SkillListLen uint32 + // 技能信息列表(固定4个元素,技能ID和剩余PP,无技能则为0) + // 对应Java的List,初始化容量为4 + SkillList [4]model.SkillInfo `fieldDesc:"技能信息 技能ID跟剩余PP 固定32字节 没有给0" serialize:"fixedLength=4,type=structArray"` + + // 精灵捕获时间,对应Java的@UInt long + CatchTime uint32 `fieldDesc:"精灵捕获时间" ` + + // 捕捉地图(固定给0),对应Java的@UInt long + CatchMap uint32 `fieldDesc:"捕捉地图 给0" ` + + // 固定给0,对应Java的@UInt long + CatchRect uint32 `fieldDesc:"给0" ` + + // 固定给0,对应Java的@UInt long + CatchLevel uint32 `fieldDesc:"给0" ` + SkinID uint32 `fieldDesc:"精灵皮肤ID" ` + Shiny uint32 `fieldDesc:"精灵是否闪" ` +} diff --git a/logic/service/login/LoginSidInfo.go b/logic/service/login/LoginSidInfo.go index ead611be8..8c3d9d663 100644 --- a/logic/service/login/LoginSidInfo.go +++ b/logic/service/login/LoginSidInfo.go @@ -6,6 +6,7 @@ import ( "blazing/modules/blazing/model" "context" "encoding/hex" + "time" "github.com/gogf/gf/v2/os/glog" ) @@ -41,6 +42,32 @@ func NewOutInfo() *OutInfo { l := &OutInfo{ PlayerInfo: *model.NewPlayerInfo(), } + t := model.PetInfo{ + ID: 300, + Name: [16]byte{'1'}, + Dv: 1, + Attack: 1000, + Defence: 1000, + SpecialAttack: 1000, + CatchTime: uint32(time.Now().Unix()), + Speed: 1000, + Hp: 1000, + MaxHp: 1000, + Level: 1, + LvExp: 1000, + NextLvExp: 1000, + Exp: 1000, + //SkillList: [4]model.SkillInfo{{ID: 1, Pp: 1}}, + Nature: 1, + Shiny: 1, + } + t.SkillListLen = 1 + for i := 0; i < 4; i++ { + t.SkillList[i] = model.SkillInfo{ID: 10001, Pp: 10001} + } + t.EffectInfo = make([]model.PetEffectInfo, 0) + t.EffectInfo = append(t.EffectInfo, model.PetEffectInfo{EffectID: 1, ItemID: 1, LeftCount: 1}) + l.PetList = append(l.PetList, t) return l } diff --git a/logic/service/maps/Map_Ogre.go b/logic/service/maps/Map_Ogre.go index fc75bbe74..2aa26e1e7 100644 --- a/logic/service/maps/Map_Ogre.go +++ b/logic/service/maps/Map_Ogre.go @@ -1,5 +1,10 @@ package maps type OgreInfo struct { - Data [9]uint32 + Data [9]OgrePetInfo +} + +type OgrePetInfo struct { + Id uint32 + Shiny uint32 } diff --git a/logic/service/pet/pet.go b/logic/service/pet/pet.go new file mode 100644 index 000000000..ab2ce9213 --- /dev/null +++ b/logic/service/pet/pet.go @@ -0,0 +1,16 @@ +package pet + +import ( + "blazing/common/socket/handler" + "blazing/modules/blazing/model" +) + +type InInfo struct { + Head handler.TomeeHeader `cmd:"2301" struc:"[0]pad"` + + CatchTime uint32 +} + +type OutInfo struct { + model.PetInfo +} diff --git a/logic/service/service.go b/logic/service/service.go index 2d0057435..d8814fc85 100644 --- a/logic/service/service.go +++ b/logic/service/service.go @@ -29,10 +29,8 @@ func KickPlayer(userid uint32) { //踢出玩家 //var player *entity.Player if player1, ok := cool.Mainplayer.Load((userid)); ok { //取成功,否则创建 - head := handler.NewTomeeHeader() + head := handler.NewTomeeHeader(1001, userid) head.Result = uint32(errorcode.ErrorCodes.ErrAccountLoggedInElsewhere) - head.UserID = userid - head.CMD = 1001 player1.SendPack(head.Pack(nil)) player1.MainConn.MainConn.Close() diff --git a/modules/blazing/model/pet.go b/modules/blazing/model/pet.go index d6be0f11a..70517df20 100644 --- a/modules/blazing/model/pet.go +++ b/modules/blazing/model/pet.go @@ -9,64 +9,98 @@ const TableNamePet = "pet" // Pet mapped from table type Pet struct { *cool.Model - PlayerID uint64 `gorm:"not null;index:idx_pet_by_player_id;comment:'所属玩家ID'" json:"player_id"` + PlayerID uint32 `gorm:"not null;index:idx_pet_by_player_id;comment:'所属玩家ID'" json:"player_id"` Data string `gorm:"type:text;not null;comment:'精灵全部数据'" json:"data"` } // PetInfo 精灵信息结构(合并后的优化版本) type PetInfo struct { - // 第一个版本字段 - CapturePlayerID uint64 `json:"capture_player_id"` - CaptureTime int64 `json:"capture_time"` - CaptureMap int32 `json:"capture_map"` - CaptureRect int16 `json:"capture_rect"` - CaptureLevel int16 `json:"capture_level"` - PetTypeID int32 `json:"pet_type_id"` - IndividualValue int16 `json:"individual_value"` - Nature int16 `json:"nature"` - AbilityTypeEnum int16 `json:"ability_type_enum"` - Shiny int32 `json:"shiny"` - Level int16 `json:"level"` - CurrentExp int32 `json:"current_exp"` - CurrentHP int32 `json:"current_hp"` - MaxHP int32 `json:"max_hp"` - Attack int32 `json:"attack"` - Defense int32 `json:"defense"` - SpecialAttack int32 `json:"special_attack"` - SpecialDefense int32 `json:"special_defense"` - Speed int32 `json:"speed"` - EvHP int16 `json:"ev_hp"` - EvAttack int16 `json:"ev_attack"` - EvDefense int16 `json:"ev_defense"` - EvSpecialAttack int16 `json:"ev_special_attack"` - EvSpecialDefense int16 `json:"ev_special_defense"` - EvSpeed int16 `json:"ev_speed"` - PetSkillLen int16 `struc:"sizeof=PetSkill" json:"pet_skill_len"` - PetSkill []SkillInfo `json:"pet_skill"` - ElementalOrbID int32 `json:"elemental_orb_id"` - SpecialOrbID int32 `json:"special_orb_id"` - ElementalOrbCount int16 `json:"elemental_orb_count"` - SpecialOrbCount int16 `json:"special_orb_count"` - IndividualGuarantee int64 `json:"individual_guarantee"` - NatureGuarantee int64 `json:"nature_guarantee"` - Freed bool `json:"freed"` - FreedTime string `json:"freed_time"` + // 精灵编号(@UInt long → uint32) + ID uint32 `fieldDesc:"精灵编号" ` - // 第二个版本字段 - ID uint32 `struc:"uint32" json:"id"` - Name [16]byte `struc:"[16]byte" json:"name"` - DV uint32 `struc:"uint32" json:"dv"` - LvExp uint32 `struc:"uint32" json:"lv_exp"` - NextLvExp uint32 `struc:"uint32" json:"next_lv_exp"` - Defence uint32 `struc:"uint32" json:"defence"` - SkillSize uint32 `struc:"uint32" json:"skill_size"` - SkillList [4]SkillInfo `json:"skill_list"` - CatchTime uint32 `struc:"uint32" json:"catch_time"` - CatchRect uint32 `struc:"uint32" json:"catch_rect"` - CatchLevel uint32 `struc:"uint32" json:"catch_level"` - SkinID uint32 `struc:"uint32" json:"skin_id"` - EffectInfoLen uint16 `struc:"sizeof=EffectInfo" json:"effect_info_len"` - EffectInfo []PetEffectInfo `json:"effect_info"` + // 名字:默认为全0,补齐到16字节(固定长度 → [16]byte) + Name [16]byte `fieldDesc:"名字 默认为全0 但要补齐到16字节" serialize:"fixedLength=16,type=byteArray"` + + // 个体值(@UInt long → uint32) + Dv uint32 `fieldDesc:"个体值" ` + + // 性格(@UInt long → uint32) + Nature uint32 `fieldDesc:"性格" ` + + // 等级(@UInt long → uint32) + Level uint32 `fieldDesc:"等级" ` + + // 当前等级已获得经验(@UInt long → uint32) + Exp uint32 `fieldDesc:"当前等级已经获得的经验 2538" ` + + // 当前等级所需经验(@UInt long → uint32) + LvExp uint32 `fieldDesc:"当前等级所需的经验" ` + + // 升到下一级的经验(@UInt long → uint32) + NextLvExp uint32 `fieldDesc:"升到下一级的经验" ` + + // 当前生命(@UInt long → uint32) + Hp uint32 `fieldDesc:"当前生命" ` + + // 最大生命(@UInt long → uint32) + MaxHp uint32 `fieldDesc:"最大生命" ` + + // 攻击(@UInt long → uint32) + Attack uint32 `fieldDesc:"攻击" ` + + // 防御(@UInt long → uint32) + Defence uint32 `fieldDesc:"防御" ` + + // 特攻(@UInt long → uint32) + SpecialAttack uint32 `fieldDesc:"特攻" ` + + // 特防(@UInt long → uint32) + SpecialDefence uint32 `fieldDesc:"特防" ` + + // 速度(@UInt long → uint32) + Speed uint32 `fieldDesc:"速度" ` + + // 生命学习力(@UInt long → uint32) + EvHp uint32 `fieldDesc:"生命学习力" ` + + // 攻击学习力(@UInt long → uint32) + EvAttack uint32 `fieldDesc:"攻击学习力" ` + + // 防御学习力(@UInt long → uint32) + EvDefence uint32 `fieldDesc:"防御学习力" ` + + // 特攻学习力(@UInt long → uint32) + EvSpecialAttack uint32 `fieldDesc:"特攻学习力" ` + + // 特防学习力(@UInt long → uint32,注意原Java拼写:evSpecialDefense) + EvSpecialDefense uint32 `fieldDesc:"特防学习力" ` + + // 速度学习力(@UInt long → uint32) + EvSpeed uint32 `fieldDesc:"速度学习力" ` + SkillListLen uint32 + // 技能信息:固定4条,空则赋值0(固定长度List → [4]SkillInfo,零值即符合“赋值0”) + SkillList [4]SkillInfo `fieldDesc:"32字节 技能信息 必须插入4条skillInfo,若技能信息为空则要赋值成0" serialize:"fixedLength=4,type=structArray"` + + // 捕捉时间(@UInt long → 若为时间戳用uint32;若需时间类型可改为time.Time,需配合序列化处理) + CatchTime uint32 `fieldDesc:"捕捉时间" ` + + // 捕捉地图(@UInt long → uint32) + CatchMap uint32 `fieldDesc:"捕捉地图" ` + + // 未知默认0(@UInt long → uint32) + CatchRect uint32 `fieldDesc:"未知默认为0" ` + + // 捕获等级默认0(@UInt long → uint32) + CatchLevel uint32 `fieldDesc:"捕获等级 默认为0" ` + EffectInfoLen uint16 `struc:"sizeof=EffectInfo"` + // 特性列表:长度用UShort存储(变长List → []PetEffectInfo + 长度前缀规则) + EffectInfo []PetEffectInfo `fieldDesc:"特性列表, 长度在头部以UShort存储" serialize:"lengthFirst,lengthType=uint16,type=structArray"` + + // 皮肤ID默认0(@UInt long → uint32) + SkinID uint32 `fieldDesc:"皮肤id默认为0" ` + + // 是否闪光(@UInt long → uint32,0=否,1=是) + Shiny uint32 `fieldDesc:"是不是闪" ` } // PetEffectInfo 精灵特性信息结构 diff --git a/modules/blazing/model/player.go b/modules/blazing/model/player.go index ccb976c49..eae9c0da4 100644 --- a/modules/blazing/model/player.go +++ b/modules/blazing/model/player.go @@ -85,8 +85,8 @@ type PlayerInfo struct { FightBadge uint32 `struc:"uint32" json:"fight_badge"` // 固定0 MapID uint32 `struc:"uint32" default:"1" json:"map_id"` // 上线地图ID Pos Pos `json:"pos"` // 坐标 - TimeToday uint32 `struc:"uint32" default:"43200" json:"time_today"` // 已消耗时间(秒) - TimeLimit uint32 `struc:"uint32" default:"339" json:"time_limit"` // 总电池限制(秒) + TimeToday uint32 `struc:"uint32" default:"0" json:"time_today"` // 已消耗时间(秒) + TimeLimit uint32 `struc:"uint32" default:"43200" json:"time_limit"` // 总电池限制(秒) IsClothHalfDay byte `struc:"byte" json:"is_cloth_half_day"` // 活动标志0/1 IsRoomHalfDay byte `struc:"byte" json:"is_room_half_day"` // 活动标志0/1 IFortressHalfDay byte `struc:"byte" json:"i_fortress_half_day"` // 活动标志0/1 diff --git a/modules/blazing/service/monster_refresh.go b/modules/blazing/service/monster_refresh.go index 1cd9c5981..b885d5073 100644 --- a/modules/blazing/service/monster_refresh.go +++ b/modules/blazing/service/monster_refresh.go @@ -3,6 +3,12 @@ package service import ( "blazing/cool" "blazing/modules/blazing/model" + "strconv" + "time" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" ) type MonsterService struct { @@ -22,9 +28,29 @@ func NewMonsterService() *MonsterService { }, } } + +func (s *MonsterService) ModifyAfter(ctx g.Ctx, method string, param g.MapStrAny) (err error) { + + gconv.String(param["map_id"]) + cool.DBM(s.Model).Cache((gdb.CacheOption{ + Duration: -1, + Name: model.TableNameMonsterRefresh + gconv.String(param["map_id"]), + Force: false, + })) + //todo 待测试,缓存优化 + return nil +} + func (s *MonsterService) GetId(mapid uint32) uint32 { - m := cool.DBM(s.Model).Where("map_id", mapid) + //todo 待修改更新时候删除缓存 + m := cool.DBM(s.Model).Where("map_id", mapid).Cache( + gdb.CacheOption{ + Duration: time.Hour, + Name: model.TableNameMonsterRefresh + strconv.Itoa(int(mapid)), + Force: false, + }, + ) var tt []model.MonsterRefresh m.Scan(&tt) diff --git a/public/assets/210.xml b/public/assets/210.xml index 0b89509b2..036714392 100644 --- a/public/assets/210.xml +++ b/public/assets/210.xml @@ -185,6 +185,7 @@ des 鼠标移上去的提示 des="时空解读机"/> + @@ -343,6 +344,7 @@ des 鼠标移上去的提示 + @@ -351,6 +353,7 @@ des 鼠标移上去的提示 + diff --git a/public/assets/291.xml b/public/assets/291.xml index 467c37227..95d3f70c7 100644 --- a/public/assets/291.xml +++ b/public/assets/291.xml @@ -1,344 +1,60 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/50001.xml b/public/assets/50001.xml new file mode 100644 index 000000000..dcea92b25 --- /dev/null +++ b/public/assets/50001.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/public/assets/monster_refresh.xsd b/public/assets/monster_refresh.xsd new file mode 100644 index 000000000..be0d90f6b --- /dev/null +++ b/public/assets/monster_refresh.xsd @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/talk_count.xsd b/public/assets/talk_count.xsd new file mode 100644 index 000000000..dfd25c241 --- /dev/null +++ b/public/assets/talk_count.xsd @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/异色.xml b/public/assets/异色.xml new file mode 100644 index 000000000..467c37227 --- /dev/null +++ b/public/assets/异色.xml @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +