修复一些小问题

This commit is contained in:
UnKownOwO
2022-11-24 11:56:37 +08:00
parent 01bcaa0309
commit 6dd7cb3f43
3088 changed files with 26 additions and 91314 deletions

View File

@@ -1,5 +1,5 @@
[hk4e]
resource_path = "/usr/local/game_hk4e/resources/GameDataConfigTable"
resource_path = "./GameDataConfigTable"
gacha_history_server = "https://hk4e.flswld.com/api/v1"
[logger]

View File

@@ -3,7 +3,6 @@ package config
import (
"encoding/json"
"hk4e/logger"
"io/ioutil"
"os"
"strings"
)
@@ -24,7 +23,7 @@ type AbilityEmbryoEntry struct {
func (g *GameDataConfig) loadAbilityEmbryos() {
dirPath := g.binPrefix + "Avatar"
fileList, err := ioutil.ReadDir(dirPath)
fileList, err := os.ReadDir(dirPath)
if err != nil {
logger.LOG.Error("open dir error: %v", err)
return

View File

@@ -3,7 +3,6 @@ package config
import (
appConfig "hk4e/common/config"
"hk4e/logger"
"io/ioutil"
"os"
)
@@ -141,7 +140,7 @@ func (g *GameDataConfig) WriteWorldTerrain(data []byte) {
logger.LOG.Error("open game data world static dir error: %v", err)
return
}
err = ioutil.WriteFile(resourcePath+"/WorldStatic/world_terrain.bin", data, 0644)
err = os.WriteFile(resourcePath+"/WorldStatic/world_terrain.bin", data, 0644)
if err != nil {
logger.LOG.Error("write world terrain file error: %v", err)
return

View File

@@ -3,7 +3,6 @@ package config
import (
"encoding/json"
"hk4e/logger"
"io/ioutil"
"os"
"strings"
)
@@ -55,7 +54,7 @@ func (g *GameDataConfig) loadOpenConfig() {
folderNames := []string{"Talent/EquipTalents", "Talent/AvatarTalents"}
for _, v := range folderNames {
dirPath := g.binPrefix + v
fileList, err := ioutil.ReadDir(dirPath)
fileList, err := os.ReadDir(dirPath)
if err != nil {
logger.LOG.Error("open dir error: %v", err)
return

View File

@@ -3,7 +3,6 @@ package config
import (
"encoding/json"
"hk4e/logger"
"io/ioutil"
"os"
"strconv"
"strings"
@@ -37,7 +36,7 @@ func (g *GameDataConfig) loadScenePoints() {
g.ScenePointEntries = make(map[string]*ScenePointEntry)
g.ScenePointIdList = make([]int32, 0)
dirPath := g.binPrefix + "Scene/Point"
fileList, err := ioutil.ReadDir(dirPath)
fileList, err := os.ReadDir(dirPath)
if err != nil {
logger.LOG.Error("open dir error: %v", err)
return

View File

@@ -34,6 +34,9 @@ func (r *RouteManager) doRoute(cmdId uint16, userId uint32, clientSeq uint32, pa
}
player := r.gameManager.userManager.GetOnlineUser(userId)
if player == nil {
// 当gs重启后玩家并未退出gate 会持续触发nil
r.gameManager.ReconnectPlayer(userId)
logger.LOG.Error("player is nil, uid: %v", userId)
return
}

View File

@@ -363,7 +363,10 @@ func (g *GameManager) CreatePlayer(userId uint32, nickName string, mainCharAvata
// 添加选定的主角
player.AddAvatar(mainCharAvatarId)
// 添加初始武器
avatarDataConfig := gdc.CONF.AvatarDataMap[int32(mainCharAvatarId)]
avatarDataConfig, ok := gdc.CONF.AvatarDataMap[int32(mainCharAvatarId)]
if !ok {
logger.LOG.Error("avatarDataConfig error, mainCharAvatarId: %v", mainCharAvatarId)
}
weaponId := uint64(g.snowflake.GenId())
player.AddWeapon(uint32(avatarDataConfig.InitialWeapon), weaponId)
// 角色装上初始武器

View File

@@ -89,7 +89,7 @@ func (g *GameManager) MarkMapReq(player *model.Player, payloadMsg pb.Message) {
posYInt, err := strconv.ParseInt(req.Mark.Name, 10, 64)
if err != nil {
logger.LOG.Error("parse pos y error: %v", err)
posYInt = 0
posYInt = 300
}
// 传送玩家

View File

@@ -3,6 +3,7 @@ package model
import (
gdc "hk4e/gs/config"
"hk4e/gs/constant"
"hk4e/logger"
"time"
)
@@ -84,7 +85,11 @@ func (p *Player) AddAvatar(avatarId uint32) {
} else {
skillDepotId = avatarDataConfig.SkillDepotId
}
avatarSkillDepotDataConfig := gdc.CONF.AvatarSkillDepotDataMap[skillDepotId]
avatarSkillDepotDataConfig, ok := gdc.CONF.AvatarSkillDepotDataMap[skillDepotId]
if !ok {
logger.LOG.Error("avatarSkillDepotDataConfig error, skillDepotId: %v", skillDepotId)
return
}
avatar := &Avatar{
AvatarId: avatarId,
Level: 1,