优化代码

This commit is contained in:
flswld
2023-03-14 15:29:18 +08:00
parent 2ce948a5ce
commit 2c35fc0df4
12 changed files with 559 additions and 587 deletions

View File

@@ -8,15 +8,13 @@ import (
"hk4e/protocol/proto"
)
// AddUserPlayerExp 基于玩家冒险阅历
func (g *GameManager) AddUserPlayerExp(userId uint32, expCount uint32) {
// HandlePlayerExpAdd 玩家冒险阅历增加处理
func (g *GameManager) HandlePlayerExpAdd(userId uint32) {
player := USER_MANAGER.GetOnlineUser(userId)
if player == nil {
logger.Error("player is nil, uid: %v", userId)
return
}
// 玩家增加冒险阅历
player.PropertiesMap[constant.PLAYER_PROP_PLAYER_EXP] += expCount
// 玩家升级
for {
playerLevel := player.PropertiesMap[constant.PLAYER_PROP_PLAYER_LEVEL]