refactor(fight): 重构战斗模块
- 移除未使用的结构体和接口 - 优化战斗准备和邀请逻辑 - 调整玩家和怪物信息的处理方式 - 更新战斗相关的数据结构 - 重构战斗模式和邀请相关代码
This commit is contained in:
@@ -65,6 +65,7 @@ func (t *InInfo) SpawnMonsters(c *socket.Player, isfrist bool) {
|
||||
}
|
||||
t1 := t.genMonster(c.Info.MapID)
|
||||
if t1 != nil {
|
||||
c.OgreInfo = t1
|
||||
t1 := tt.Pack(t1)
|
||||
c.SendPack(t1)
|
||||
}
|
||||
@@ -80,16 +81,16 @@ func RandomStringFromSlice(s []string) string {
|
||||
}
|
||||
|
||||
// 应该根据怪物信息决定后端生成
|
||||
func (t *InInfo) genMonster(mapid uint32) *OgreInfo {
|
||||
func (t *InInfo) genMonster(mapid uint32) *socket.OgreInfo {
|
||||
// 设置怪物信息
|
||||
t1 := OgreInfo{}
|
||||
t1 := socket.OgreInfo{}
|
||||
mapss, ok := xmlres.MonsterMap[gconv.Int(mapid)]
|
||||
|
||||
if ok && mapss.Monsters != nil {
|
||||
for i, m := range mapss.Monsters.Monsters { //这里是9个
|
||||
id := strings.Split(m.ID, " ")
|
||||
lv := strings.Split(m.Lv, " ")
|
||||
ttt := OgrePetInfo{
|
||||
ttt := socket.OgrePetInfo{
|
||||
Id: gconv.Uint32(RandomStringFromSlice(id)),
|
||||
}
|
||||
if ttt.Id != 0 {
|
||||
@@ -102,7 +103,7 @@ func (t *InInfo) genMonster(mapid uint32) *OgreInfo {
|
||||
|
||||
}
|
||||
|
||||
t2 := OgreInfo{}
|
||||
t2 := socket.OgreInfo{}
|
||||
for i := 0; i < 3; i++ {
|
||||
|
||||
t2.Data[t.monsters[i]] = t1.Data[t.monsters[i]]
|
||||
|
||||
Reference in New Issue
Block a user