角色技能升级命座解锁
This commit is contained in:
1 parent
1af5fb128b
commit
17f3a7b466
21 files changed
+357
-56
No files matched your search
@@ -107,13 +107,14 @@ type PlayerMpInfo struct {
|
||||
}
|
||||
|
||||
type ChatMsgInfo struct {
|
||||
Time uint32
|
||||
ToUid uint32
|
||||
Uid uint32
|
||||
IsRead bool
|
||||
MsgType uint8
|
||||
Text string
|
||||
Icon uint32
|
||||
Time uint32
|
||||
ToUid uint32
|
||||
Uid uint32
|
||||
IsRead bool
|
||||
MsgType uint8
|
||||
Text string
|
||||
Icon uint32
|
||||
IsDelete bool
|
||||
}
|
||||
|
||||
type AddFriendInfo struct {
|
||||
|
||||
@@ -6,11 +6,12 @@ import (
|
||||
|
||||
// AvatarSkillData 角色技能配置表
|
||||
type AvatarSkillData struct {
|
||||
AvatarSkillId int32 `csv:"ID"`
|
||||
AbilityName string `csv:"Ability名称,omitempty"`
|
||||
CostStamina int32 `csv:"消耗体力,omitempty"`
|
||||
CostElemType int32 `csv:"消耗能量类型,omitempty"`
|
||||
CostElemVal int32 `csv:"消耗能量值,omitempty"`
|
||||
AvatarSkillId int32 `csv:"ID"`
|
||||
AbilityName string `csv:"Ability名称,omitempty"`
|
||||
CostStamina int32 `csv:"消耗体力,omitempty"`
|
||||
CostElemType int32 `csv:"消耗能量类型,omitempty"`
|
||||
CostElemVal int32 `csv:"消耗能量值,omitempty"`
|
||||
UpgradeSkillGroupId int32 `csv:"升级技能组ID,omitempty"`
|
||||
}
|
||||
|
||||
func (g *GameDataConfig) loadAvatarSkillData() {
|
||||
|
||||
@@ -12,12 +12,22 @@ import (
|
||||
|
||||
// AvatarSkillDepotData 角色技能库配置表
|
||||
type AvatarSkillDepotData struct {
|
||||
AvatarSkillDepotId int32 `csv:"ID"`
|
||||
EnergySkill int32 `csv:"充能技能,omitempty"`
|
||||
Skill1 int32 `csv:"技能1,omitempty"`
|
||||
Skill2 int32 `csv:"技能2,omitempty"`
|
||||
Skill3 int32 `csv:"技能3,omitempty"`
|
||||
Skill4 int32 `csv:"技能4,omitempty"`
|
||||
AvatarSkillDepotId int32 `csv:"ID"`
|
||||
// 元素爆发
|
||||
EnergySkill int32 `csv:"充能技能,omitempty"`
|
||||
// 其他战斗天赋
|
||||
Skill1 int32 `csv:"技能1,omitempty"`
|
||||
Skill2 int32 `csv:"技能2,omitempty"`
|
||||
Skill3 int32 `csv:"技能3,omitempty"`
|
||||
Skill4 int32 `csv:"技能4,omitempty"`
|
||||
// 命座
|
||||
Talent1 int32 `csv:"天赋1,omitempty"`
|
||||
Talent2 int32 `csv:"天赋2,omitempty"`
|
||||
Talent3 int32 `csv:"天赋3,omitempty"`
|
||||
Talent4 int32 `csv:"天赋4,omitempty"`
|
||||
Talent5 int32 `csv:"天赋5,omitempty"`
|
||||
Talent6 int32 `csv:"天赋6,omitempty"`
|
||||
// 固有天赋
|
||||
ProudSkill1GroupId int32 `csv:"固有得意技组1ID,omitempty"`
|
||||
ProudSkill1NeedAvatarPromoteLevel int32 `csv:"固有得意技组1激活所需角色突破等级,omitempty"`
|
||||
ProudSkill2GroupId int32 `csv:"固有得意技组2ID,omitempty"`
|
||||
@@ -30,8 +40,9 @@ type AvatarSkillDepotData struct {
|
||||
ProudSkill5NeedAvatarPromoteLevel int32 `csv:"固有得意技组5激活所需角色突破等级,omitempty"`
|
||||
SkillDepotAbilityGroup string `csv:"AbilityGroup,omitempty"`
|
||||
|
||||
Skills []int32
|
||||
InherentProudSkillOpens []*InherentProudSkillOpens
|
||||
Skills []int32 // 其他战斗天赋
|
||||
Talents []int32 // 命座
|
||||
InherentProudSkillOpens []*InherentProudSkillOpens // 固有天赋
|
||||
AbilityHashCodeList []int32
|
||||
}
|
||||
|
||||
@@ -73,6 +84,25 @@ func (g *GameDataConfig) loadAvatarSkillDepotData() {
|
||||
if avatarSkillDepotData.Skill4 != 0 {
|
||||
avatarSkillDepotData.Skills = append(avatarSkillDepotData.Skills, avatarSkillDepotData.Skill4)
|
||||
}
|
||||
avatarSkillDepotData.Talents = make([]int32, 0)
|
||||
if avatarSkillDepotData.Talent1 != 0 {
|
||||
avatarSkillDepotData.Talents = append(avatarSkillDepotData.Talents, avatarSkillDepotData.Talent1)
|
||||
}
|
||||
if avatarSkillDepotData.Talent2 != 0 {
|
||||
avatarSkillDepotData.Talents = append(avatarSkillDepotData.Talents, avatarSkillDepotData.Talent2)
|
||||
}
|
||||
if avatarSkillDepotData.Talent3 != 0 {
|
||||
avatarSkillDepotData.Talents = append(avatarSkillDepotData.Talents, avatarSkillDepotData.Talent3)
|
||||
}
|
||||
if avatarSkillDepotData.Talent4 != 0 {
|
||||
avatarSkillDepotData.Talents = append(avatarSkillDepotData.Talents, avatarSkillDepotData.Talent4)
|
||||
}
|
||||
if avatarSkillDepotData.Talent5 != 0 {
|
||||
avatarSkillDepotData.Talents = append(avatarSkillDepotData.Talents, avatarSkillDepotData.Talent5)
|
||||
}
|
||||
if avatarSkillDepotData.Talent6 != 0 {
|
||||
avatarSkillDepotData.Talents = append(avatarSkillDepotData.Talents, avatarSkillDepotData.Talent6)
|
||||
}
|
||||
avatarSkillDepotData.InherentProudSkillOpens = make([]*InherentProudSkillOpens, 0)
|
||||
if avatarSkillDepotData.ProudSkill1GroupId != 0 {
|
||||
avatarSkillDepotData.InherentProudSkillOpens = append(avatarSkillDepotData.InherentProudSkillOpens, &InherentProudSkillOpens{
|
||||
@@ -139,3 +169,20 @@ func GetAvatarEnergySkillConfig(skillDepotId uint32) *AvatarSkillData {
|
||||
}
|
||||
return avatarSkillDataConfig
|
||||
}
|
||||
|
||||
func GetAvatarInherentProudSkillList(skillDepotId uint32, promote uint8) []uint32 {
|
||||
// 角色技能库配置
|
||||
avatarSkillDepotDataConfig, exist := CONF.AvatarSkillDepotDataMap[int32(skillDepotId)]
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
inherentProudSkillList := make([]uint32, 0)
|
||||
for _, inherentProudSkillOpen := range avatarSkillDepotDataConfig.InherentProudSkillOpens {
|
||||
if inherentProudSkillOpen.NeedAvatarPromoteLevel >= int32(promote) {
|
||||
inherentProudSkill := uint32(0)
|
||||
inherentProudSkill = uint32(inherentProudSkillOpen.ProudSkillGroupId)*100 + 1
|
||||
inherentProudSkillList = append(inherentProudSkillList, inherentProudSkill)
|
||||
}
|
||||
}
|
||||
return inherentProudSkillList
|
||||
}
|
||||
@@ -78,6 +78,7 @@ type GameDataConfig struct {
|
||||
PubgWorldGadgetDataMap map[int32]*PubgWorldGadgetData // pubg世界物件
|
||||
MonsterRelationshipDataMap map[int32]*MonsterRelationshipData // 怪物关联
|
||||
MonsterDataMap map[int32]*MonsterData // 怪物
|
||||
ProudSkillDataMap map[int32]map[int32]*ProudSkillData // 天赋
|
||||
}
|
||||
|
||||
func InitGameDataConfig() {
|
||||
@@ -188,6 +189,7 @@ func (g *GameDataConfig) load(loadSceneLua bool) {
|
||||
g.loadPubgWorldGadgetData() // pubg世界物件
|
||||
g.loadMonsterRelationshipData() // 怪物关联
|
||||
g.loadMonsterData() // 怪物
|
||||
g.loadProudSkillData() // 天赋
|
||||
}
|
||||
|
||||
// CSV相关
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package gdconf
|
||||
|
||||
import (
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
type CostItem struct {
|
||||
ItemId int32
|
||||
ItemCount int32
|
||||
}
|
||||
|
||||
// ProudSkillData 天赋配置表
|
||||
type ProudSkillData struct {
|
||||
ProudSkillId int32 `csv:"技能ID"`
|
||||
ProudSkillGroupId int32 `csv:"技能组ID,omitempty"`
|
||||
Level int32 `csv:"等级,omitempty"`
|
||||
Type int32 `csv:"类型,omitempty"`
|
||||
CostSCoin int32 `csv:"消耗金币,omitempty"`
|
||||
CostItem1Id int32 `csv:"消耗道具1ID,omitempty"`
|
||||
CostItem1Count int32 `csv:"消耗道具1数量,omitempty"`
|
||||
CostItem2Id int32 `csv:"消耗道具2ID,omitempty"`
|
||||
CostItem2Count int32 `csv:"消耗道具2数量,omitempty"`
|
||||
CostItem3Id int32 `csv:"消耗道具3ID,omitempty"`
|
||||
CostItem3Count int32 `csv:"消耗道具3数量,omitempty"`
|
||||
CostItem4Id int32 `csv:"消耗道具4ID,omitempty"`
|
||||
CostItem4Count int32 `csv:"消耗道具4数量,omitempty"`
|
||||
|
||||
CostItemList []*CostItem
|
||||
}
|
||||
|
||||
func (g *GameDataConfig) loadProudSkillData() {
|
||||
g.ProudSkillDataMap = make(map[int32]map[int32]*ProudSkillData)
|
||||
proudSkillDataList := make([]*ProudSkillData, 0)
|
||||
readTable[ProudSkillData](g.txtPrefix+"ProudSkillData.txt", &proudSkillDataList)
|
||||
for _, proudSkillData := range proudSkillDataList {
|
||||
proudSkillData.CostItemList = make([]*CostItem, 0)
|
||||
if proudSkillData.CostItem1Id != 0 {
|
||||
proudSkillData.CostItemList = append(proudSkillData.CostItemList, &CostItem{
|
||||
ItemId: proudSkillData.CostItem1Id,
|
||||
ItemCount: proudSkillData.CostItem1Count,
|
||||
})
|
||||
}
|
||||
if proudSkillData.CostItem2Id != 0 {
|
||||
proudSkillData.CostItemList = append(proudSkillData.CostItemList, &CostItem{
|
||||
ItemId: proudSkillData.CostItem2Id,
|
||||
ItemCount: proudSkillData.CostItem2Count,
|
||||
})
|
||||
}
|
||||
if proudSkillData.CostItem3Id != 0 {
|
||||
proudSkillData.CostItemList = append(proudSkillData.CostItemList, &CostItem{
|
||||
ItemId: proudSkillData.CostItem3Id,
|
||||
ItemCount: proudSkillData.CostItem3Count,
|
||||
})
|
||||
}
|
||||
if proudSkillData.CostItem4Id != 0 {
|
||||
proudSkillData.CostItemList = append(proudSkillData.CostItemList, &CostItem{
|
||||
ItemId: proudSkillData.CostItem4Id,
|
||||
ItemCount: proudSkillData.CostItem4Count,
|
||||
})
|
||||
}
|
||||
_, exist := g.ProudSkillDataMap[proudSkillData.ProudSkillGroupId]
|
||||
if !exist {
|
||||
g.ProudSkillDataMap[proudSkillData.ProudSkillGroupId] = make(map[int32]*ProudSkillData)
|
||||
}
|
||||
g.ProudSkillDataMap[proudSkillData.ProudSkillGroupId][proudSkillData.Level] = proudSkillData
|
||||
}
|
||||
logger.Info("ProudSkillData count: %v", len(g.ProudSkillDataMap))
|
||||
}
|
||||
|
||||
func GetProudSkillDataByGroupIdAndLevel(groupId int32, level int32) *ProudSkillData {
|
||||
levelMap, exist := CONF.ProudSkillDataMap[groupId]
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
return levelMap[level]
|
||||
}
|
||||
+20
-2
@@ -263,7 +263,12 @@ func (d *Dao) QueryChatMsgListByUid(uid uint32) ([]*model.ChatMsg, error) {
|
||||
result := make([]*model.ChatMsg, 0)
|
||||
find, err := db.Find(
|
||||
context.TODO(),
|
||||
bson.D{{"$or", []bson.D{{{"to_uid", uid}}, {{"uid", uid}}}}},
|
||||
bson.D{
|
||||
{"$and", []bson.D{
|
||||
{{"$or", []bson.D{{{"to_uid", uid}}, {{"uid", uid}}}}},
|
||||
{{"is_delete", false}},
|
||||
}},
|
||||
},
|
||||
options.Find().SetLimit(MaxQueryChatMsgLen),
|
||||
options.Find().SetSort(bson.M{"time": 1}),
|
||||
)
|
||||
@@ -281,7 +286,7 @@ func (d *Dao) QueryChatMsgListByUid(uid uint32) ([]*model.ChatMsg, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (d *Dao) ReadAndUpdateChatMsgByUid(uid uint32, targetUid uint32) error {
|
||||
func (d *Dao) ReadUpdateChatMsgByUid(uid uint32, targetUid uint32) error {
|
||||
db := d.db.Collection("chat_msg")
|
||||
_, err := db.UpdateMany(
|
||||
context.TODO(),
|
||||
@@ -301,3 +306,16 @@ func (d *Dao) ReadAndUpdateChatMsgByUid(uid uint32, targetUid uint32) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Dao) DeleteAllUpdateChatMsgByUid(uid uint32) error {
|
||||
db := d.db.Collection("chat_msg")
|
||||
_, err := db.UpdateMany(
|
||||
context.TODO(),
|
||||
bson.D{{"$or", []bson.D{{{"to_uid", uid}}, {{"uid", uid}}}}},
|
||||
bson.D{{"$set", bson.D{{"is_delete", true}}}},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -541,6 +541,8 @@ func (p *PluginPubg) StartPubg() {
|
||||
FightPropMap: avatar.FightPropMap,
|
||||
})
|
||||
p.playerHitTimeMap[player.PlayerId] = 0
|
||||
player.WuDi = false
|
||||
player.EnergyInf = false
|
||||
player.StaminaInf = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,8 @@ func (r *RouteManager) initRoute() {
|
||||
cmd.QuestCreateEntityReq: GAME.QuestCreateEntityReq,
|
||||
cmd.QuestDestroyEntityReq: GAME.QuestDestroyEntityReq,
|
||||
cmd.QuestDestroyNpcReq: GAME.QuestDestroyNpcReq,
|
||||
cmd.AvatarSkillUpgradeReq: GAME.AvatarSkillUpgradeReq,
|
||||
cmd.UnlockAvatarTalentReq: GAME.UnlockAvatarTalentReq,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ func (u *UserManager) UserOfflineSave(player *model.Player, changeGsInfo *Change
|
||||
return
|
||||
}
|
||||
if player.OfflineClear {
|
||||
go u.DeleteUserAllChatMsgToDbSync(player.PlayerId)
|
||||
newPlayer := GAME.CreatePlayer(player.PlayerId)
|
||||
newPlayer.DbState = player.DbState
|
||||
player = newPlayer
|
||||
@@ -762,14 +763,22 @@ func (u *UserManager) SaveUserChatMsgToDbSync(chatMsg *model.ChatMsg) {
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UserManager) ReadAndUpdateUserChatMsgToDbSync(uid uint32, targetUid uint32) {
|
||||
err := u.db.ReadAndUpdateChatMsgByUid(uid, targetUid)
|
||||
func (u *UserManager) ReadUserChatMsgToDbSync(uid uint32, targetUid uint32) {
|
||||
err := u.db.ReadUpdateChatMsgByUid(uid, targetUid)
|
||||
if err != nil {
|
||||
logger.Error("read chat msg error: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UserManager) DeleteUserAllChatMsgToDbSync(uid uint32) {
|
||||
err := u.db.DeleteAllUpdateChatMsgByUid(uid)
|
||||
if err != nil {
|
||||
logger.Error("delete chat msg error: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UserManager) LoadUserFromRedisSync(userId uint32) *model.Player {
|
||||
player := u.db.GetRedisPlayer(userId)
|
||||
return player
|
||||
|
||||
@@ -807,6 +807,9 @@ func (w *World) AddChat(chatInfo *proto.ChatInfo) {
|
||||
w.chatMsgList = w.chatMsgList[1:]
|
||||
}
|
||||
w.chatMsgList = append(w.chatMsgList, chatInfo)
|
||||
chatMsg := GAME.ConvChatInfoToChatMsg(chatInfo)
|
||||
chatMsg.IsDelete = true
|
||||
go USER_MANAGER.SaveUserChatMsgToDbSync(chatMsg)
|
||||
}
|
||||
|
||||
func (w *World) GetChatList() []*proto.ChatInfo {
|
||||
|
||||
+115
-1
@@ -331,7 +331,7 @@ func (g *Game) AvatarChangeCostumeReq(player *model.Player, payloadMsg pb.Messag
|
||||
// 角色更换时装通知
|
||||
ntf := new(proto.AvatarChangeCostumeNotify)
|
||||
// 要更换时装的角色实体不存在代表更换的是仓库内的角色
|
||||
if scene.GetWorld().GetPlayerWorldAvatar(player, avatar.AvatarId) == nil {
|
||||
if world.GetPlayerWorldAvatar(player, avatar.AvatarId) == nil {
|
||||
ntf.EntityInfo = &proto.SceneEntityInfo{
|
||||
Entity: &proto.SceneEntityInfo_Avatar{
|
||||
Avatar: g.PacketSceneAvatarInfo(scene, player, avatar.AvatarId),
|
||||
@@ -349,6 +349,116 @@ func (g *Game) AvatarChangeCostumeReq(player *model.Player, payloadMsg pb.Messag
|
||||
g.SendMsg(cmd.AvatarChangeCostumeRsp, player.PlayerId, player.ClientSeq, rsp)
|
||||
}
|
||||
|
||||
// AvatarSkillUpgradeReq 角色技能升级请求
|
||||
func (g *Game) AvatarSkillUpgradeReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.AvatarSkillUpgradeReq)
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerId)
|
||||
g.SendError(cmd.AvatarSkillUpgradeRsp, player, &proto.AvatarSkillUpgradeRsp{})
|
||||
return
|
||||
}
|
||||
avatar, ok := player.GameObjectGuidMap[req.AvatarGuid].(*model.Avatar)
|
||||
if !ok {
|
||||
g.SendError(cmd.AvatarSkillUpgradeRsp, player, &proto.AvatarSkillUpgradeRsp{})
|
||||
return
|
||||
}
|
||||
skillLevel, exist := avatar.SkillLevelMap[req.AvatarSkillId]
|
||||
if !exist {
|
||||
g.SendError(cmd.AvatarSkillUpgradeRsp, player, &proto.AvatarSkillUpgradeRsp{})
|
||||
return
|
||||
}
|
||||
avatarSkillDataConfig := gdconf.GetAvatarSkillDataById(int32(req.AvatarSkillId))
|
||||
if avatarSkillDataConfig == nil {
|
||||
g.SendError(cmd.AvatarSkillUpgradeRsp, player, &proto.AvatarSkillUpgradeRsp{})
|
||||
return
|
||||
}
|
||||
proudSkillDataConfig := gdconf.GetProudSkillDataByGroupIdAndLevel(avatarSkillDataConfig.UpgradeSkillGroupId, int32(skillLevel))
|
||||
if proudSkillDataConfig == nil {
|
||||
g.SendError(cmd.AvatarSkillUpgradeRsp, player, &proto.AvatarSkillUpgradeRsp{})
|
||||
return
|
||||
}
|
||||
|
||||
// 消耗物品列表
|
||||
costItemList := make([]*ChangeItem, 0)
|
||||
for _, costItem := range proudSkillDataConfig.CostItemList {
|
||||
costItemList = append(costItemList, &ChangeItem{
|
||||
ItemId: uint32(costItem.ItemId),
|
||||
ChangeCount: uint32(costItem.ItemCount),
|
||||
})
|
||||
}
|
||||
costItemList = append(costItemList, &ChangeItem{
|
||||
ItemId: constant.ITEM_ID_SCOIN,
|
||||
ChangeCount: uint32(proudSkillDataConfig.CostSCoin),
|
||||
})
|
||||
ok = g.CostPlayerItem(player.PlayerId, costItemList)
|
||||
if !ok {
|
||||
g.SendError(cmd.AvatarSkillUpgradeRsp, player, &proto.AvatarSkillUpgradeRsp{})
|
||||
return
|
||||
}
|
||||
|
||||
skillLevel++
|
||||
avatar.SkillLevelMap[req.AvatarSkillId] = skillLevel
|
||||
|
||||
entityId := world.GetPlayerWorldAvatarEntityId(player, avatar.AvatarId)
|
||||
ntf := &proto.AvatarSkillChangeNotify{
|
||||
CurLevel: skillLevel,
|
||||
AvatarGuid: req.AvatarGuid,
|
||||
EntityId: entityId,
|
||||
SkillDepotId: avatar.SkillDepotId,
|
||||
OldLevel: req.OldLevel,
|
||||
AvatarSkillId: req.AvatarSkillId,
|
||||
}
|
||||
g.SendMsg(cmd.AvatarSkillChangeNotify, player.PlayerId, player.ClientSeq, ntf)
|
||||
|
||||
rsp := &proto.AvatarSkillUpgradeRsp{
|
||||
AvatarGuid: req.AvatarGuid,
|
||||
CurLevel: skillLevel,
|
||||
AvatarSkillId: req.AvatarSkillId,
|
||||
OldLevel: req.OldLevel,
|
||||
}
|
||||
g.SendMsg(cmd.AvatarSkillUpgradeRsp, player.PlayerId, player.ClientSeq, rsp)
|
||||
}
|
||||
|
||||
// UnlockAvatarTalentReq 角色命座解锁请求
|
||||
func (g *Game) UnlockAvatarTalentReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.UnlockAvatarTalentReq)
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerId)
|
||||
g.SendError(cmd.UnlockAvatarTalentRsp, player, &proto.UnlockAvatarTalentRsp{})
|
||||
return
|
||||
}
|
||||
avatar, ok := player.GameObjectGuidMap[req.AvatarGuid].(*model.Avatar)
|
||||
if !ok {
|
||||
g.SendError(cmd.UnlockAvatarTalentRsp, player, &proto.UnlockAvatarTalentRsp{})
|
||||
return
|
||||
}
|
||||
|
||||
ok = g.CostPlayerItem(player.PlayerId, []*ChangeItem{{ItemId: avatar.AvatarId - 10000000 + 1100, ChangeCount: 1}})
|
||||
if !ok {
|
||||
g.SendError(cmd.UnlockAvatarTalentRsp, player, &proto.UnlockAvatarTalentRsp{})
|
||||
return
|
||||
}
|
||||
|
||||
avatar.TalentIdList = append(avatar.TalentIdList, req.TalentId)
|
||||
|
||||
entityId := world.GetPlayerWorldAvatarEntityId(player, avatar.AvatarId)
|
||||
ntf := &proto.AvatarUnlockTalentNotify{
|
||||
EntityId: entityId,
|
||||
AvatarGuid: req.AvatarGuid,
|
||||
TalentId: req.TalentId,
|
||||
SkillDepotId: avatar.SkillDepotId,
|
||||
}
|
||||
g.SendMsg(cmd.AvatarUnlockTalentNotify, player.PlayerId, player.ClientSeq, ntf)
|
||||
|
||||
rsp := &proto.UnlockAvatarTalentRsp{
|
||||
TalentId: req.TalentId,
|
||||
AvatarGuid: req.AvatarGuid,
|
||||
}
|
||||
g.SendMsg(cmd.UnlockAvatarTalentRsp, player.PlayerId, player.ClientSeq, rsp)
|
||||
}
|
||||
|
||||
/************************************************** 游戏功能 **************************************************/
|
||||
|
||||
// GetAllAvatarDataConfig 获取所有角色数据配置表
|
||||
@@ -509,10 +619,12 @@ func (g *Game) UpdatePlayerAvatarFightProp(userId uint32, avatarId uint32) {
|
||||
logger.Error("player is nil, uid: %v", userId)
|
||||
return
|
||||
}
|
||||
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil || WORLD_MANAGER.IsAiWorld(world) {
|
||||
return
|
||||
}
|
||||
|
||||
dbAvatar := player.GetDbAvatar()
|
||||
avatar := dbAvatar.GetAvatarById(avatarId)
|
||||
if avatar == nil {
|
||||
@@ -813,6 +925,8 @@ func (g *Game) PacketAvatarInfo(avatar *model.Avatar) *proto.AvatarInfo {
|
||||
RewardedFetterLevelList: []uint32{10},
|
||||
},
|
||||
SkillLevelMap: avatar.SkillLevelMap,
|
||||
TalentIdList: avatar.TalentIdList,
|
||||
InherentProudSkillList: gdconf.GetAvatarInherentProudSkillList(avatar.SkillDepotId, avatar.Promote),
|
||||
AvatarType: 1,
|
||||
WearingFlycloakId: avatar.FlyCloak,
|
||||
CostumeId: avatar.Costume,
|
||||
|
||||
+19
-15
@@ -129,7 +129,7 @@ func (g *Game) ReadPrivateChatReq(player *model.Player, payloadMsg pb.Message) {
|
||||
player.ChatMsgMap[targetUid] = msgList
|
||||
|
||||
// 更新db
|
||||
go USER_MANAGER.ReadAndUpdateUserChatMsgToDbSync(player.PlayerId, targetUid)
|
||||
go USER_MANAGER.ReadUserChatMsgToDbSync(player.PlayerId, targetUid)
|
||||
|
||||
g.SendMsg(cmd.ReadPrivateChatRsp, player.PlayerId, player.ClientSeq, new(proto.ReadPrivateChatRsp))
|
||||
}
|
||||
@@ -188,6 +188,7 @@ func (g *Game) SendPrivateChat(player *model.Player, targetUid uint32, content a
|
||||
ToUid: targetUid,
|
||||
Uid: player.PlayerId,
|
||||
IsRead: false,
|
||||
IsDelete: false,
|
||||
}
|
||||
// 根据传入的值判断消息类型
|
||||
switch content.(type) {
|
||||
@@ -238,13 +239,14 @@ func (g *Game) SendPrivateChat(player *model.Player, targetUid uint32, content a
|
||||
EventId: mq.ServerChatMsgNotify,
|
||||
ServerMsg: &mq.ServerMsg{
|
||||
ChatMsgInfo: &mq.ChatMsgInfo{
|
||||
Time: chatMsg.Time,
|
||||
ToUid: chatMsg.ToUid,
|
||||
Uid: chatMsg.Uid,
|
||||
IsRead: chatMsg.IsRead,
|
||||
MsgType: chatMsg.MsgType,
|
||||
Text: chatMsg.Text,
|
||||
Icon: chatMsg.Icon,
|
||||
Time: chatMsg.Time,
|
||||
ToUid: chatMsg.ToUid,
|
||||
Uid: chatMsg.Uid,
|
||||
IsRead: chatMsg.IsRead,
|
||||
MsgType: chatMsg.MsgType,
|
||||
Text: chatMsg.Text,
|
||||
Icon: chatMsg.Icon,
|
||||
IsDelete: chatMsg.IsDelete,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -282,6 +284,7 @@ func (g *Game) ConvChatInfoToChatMsg(chatInfo *proto.ChatInfo) (chatMsg *model.C
|
||||
MsgType: 0,
|
||||
Text: "",
|
||||
Icon: 0,
|
||||
IsDelete: false,
|
||||
}
|
||||
switch chatInfo.Content.(type) {
|
||||
case *proto.ChatInfo_Text:
|
||||
@@ -329,13 +332,14 @@ func (g *Game) ServerChatMsgNotify(chatMsgInfo *mq.ChatMsgInfo) {
|
||||
return
|
||||
}
|
||||
chatMsg := &model.ChatMsg{
|
||||
Time: chatMsgInfo.Time,
|
||||
ToUid: chatMsgInfo.ToUid,
|
||||
Uid: chatMsgInfo.Uid,
|
||||
IsRead: chatMsgInfo.IsRead,
|
||||
MsgType: chatMsgInfo.MsgType,
|
||||
Text: chatMsgInfo.Text,
|
||||
Icon: chatMsgInfo.Icon,
|
||||
Time: chatMsgInfo.Time,
|
||||
ToUid: chatMsgInfo.ToUid,
|
||||
Uid: chatMsgInfo.Uid,
|
||||
IsRead: chatMsgInfo.IsRead,
|
||||
MsgType: chatMsgInfo.MsgType,
|
||||
Text: chatMsgInfo.Text,
|
||||
Icon: chatMsgInfo.Icon,
|
||||
IsDelete: chatMsgInfo.IsDelete,
|
||||
}
|
||||
// 消息加入目标玩家的队列
|
||||
msgList, exist := targetPlayer.ChatMsgMap[chatMsgInfo.Uid]
|
||||
|
||||
@@ -1770,12 +1770,14 @@ func (g *Game) PacketSceneAvatarInfo(scene *Scene, player *model.Player, avatarI
|
||||
Level: uint32(avatar.EquipWeapon.Level),
|
||||
AbilityInfo: new(proto.AbilitySyncStateInfo),
|
||||
},
|
||||
ReliquaryList: reliquaryList,
|
||||
SkillLevelMap: avatar.SkillLevelMap,
|
||||
WearingFlycloakId: avatar.FlyCloak,
|
||||
CostumeId: avatar.Costume,
|
||||
BornTime: uint32(avatar.BornTime),
|
||||
TeamResonanceList: make([]uint32, 0),
|
||||
ReliquaryList: reliquaryList,
|
||||
SkillLevelMap: avatar.SkillLevelMap,
|
||||
TalentIdList: avatar.TalentIdList,
|
||||
InherentProudSkillList: gdconf.GetAvatarInherentProudSkillList(avatar.SkillDepotId, avatar.Promote),
|
||||
WearingFlycloakId: avatar.FlyCloak,
|
||||
CostumeId: avatar.Costume,
|
||||
BornTime: uint32(avatar.BornTime),
|
||||
TeamResonanceList: make([]uint32, 0),
|
||||
}
|
||||
// for id := range player.TeamConfig.TeamResonances {
|
||||
// sceneAvatarInfo.TeamResonanceList = append(sceneAvatarInfo.TeamResonanceList, uint32(id))
|
||||
|
||||
@@ -179,7 +179,13 @@ func (g *Game) ChangeMpTeamAvatarReq(player *model.Player, payloadMsg pb.Message
|
||||
return
|
||||
}
|
||||
scene := world.GetSceneById(player.GetSceneId())
|
||||
if WORLD_MANAGER.IsAiWorld(world) || !world.IsMultiplayerWorld() || len(avatarIdList) == 0 || len(avatarIdList) > 4 {
|
||||
|
||||
if WORLD_MANAGER.IsAiWorld(world) {
|
||||
g.SendError(cmd.ChangeMpTeamAvatarRsp, player, &proto.ChangeMpTeamAvatarRsp{})
|
||||
return
|
||||
}
|
||||
|
||||
if !world.IsMultiplayerWorld() || len(avatarIdList) == 0 || len(avatarIdList) > 4 {
|
||||
g.SendError(cmd.ChangeMpTeamAvatarRsp, player, &proto.ChangeMpTeamAvatarRsp{})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ func (g *Game) GadgetInteractReq(player *model.Player, payloadMsg pb.Message) {
|
||||
}
|
||||
logger.Debug("[GadgetInteractReq] GadgetData: %+v, EntityId: %v, uid: %v", gadgetDataConfig, entity.GetId(), player.PlayerId)
|
||||
switch gadgetDataConfig.Type {
|
||||
case constant.GADGET_TYPE_GADGET:
|
||||
case constant.GADGET_TYPE_GADGET, constant.GADGET_TYPE_EQUIP:
|
||||
// 掉落物捡起
|
||||
interactType = proto.InteractType_INTERACT_PICK_ITEM
|
||||
gadgetNormalEntity := gadgetEntity.GetGadgetNormalEntity()
|
||||
@@ -471,6 +471,8 @@ func (g *Game) GadgetInteractReq(player *model.Player, payloadMsg pb.Message) {
|
||||
default:
|
||||
logger.Error("not support gadget type: %v, uid: %v", gadgetDataConfig.Type, player.PlayerId)
|
||||
}
|
||||
case constant.ENTITY_TYPE_MONSTER:
|
||||
g.KillEntity(player, scene, entity.GetId(), proto.PlayerDieType_PLAYER_DIE_NONE)
|
||||
default:
|
||||
logger.Error("not support entity type: %v, uid: %v", entity.GetEntityType(), player.PlayerId)
|
||||
}
|
||||
@@ -488,9 +490,14 @@ func (g *Game) EnterTransPointRegionNotify(player *model.Player, payloadMsg pb.M
|
||||
req := payloadMsg.(*proto.EnterTransPointRegionNotify)
|
||||
_ = req
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil || WORLD_MANAGER.IsAiWorld(world) {
|
||||
if world == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if WORLD_MANAGER.IsAiWorld(world) {
|
||||
return
|
||||
}
|
||||
|
||||
dbAvatar := player.GetDbAvatar()
|
||||
for _, worldAvatar := range world.GetPlayerWorldAvatarList(player) {
|
||||
avatar := dbAvatar.GetAvatarById(worldAvatar.GetAvatarId())
|
||||
|
||||
@@ -19,4 +19,5 @@ type ChatMsg struct {
|
||||
MsgType uint8 `bson:"msg_type"`
|
||||
Text string `bson:"text"`
|
||||
Icon uint32 `bson:"icon"`
|
||||
IsDelete bool `bson:"is_delete"`
|
||||
}
|
||||
@@ -46,6 +46,7 @@ type Avatar struct {
|
||||
CurrEnergy float64 // 当前元素能量值
|
||||
FetterList []uint32 // 资料解锁条目
|
||||
SkillLevelMap map[uint32]uint32 // 技能等级数据
|
||||
TalentIdList []uint32 // 命座数据
|
||||
SkillDepotId uint32 // 技能库id
|
||||
FlyCloak uint32 // 当前风之翼
|
||||
Costume uint32 // 当前衣装
|
||||
@@ -138,6 +139,7 @@ func (a *DbAvatar) AddAvatar(player *Player, avatarId uint32) {
|
||||
CurrEnergy: 0,
|
||||
FetterList: make([]uint32, 0),
|
||||
SkillLevelMap: make(map[uint32]uint32),
|
||||
TalentIdList: make([]uint32, 0),
|
||||
SkillDepotId: 0,
|
||||
FlyCloak: 140001,
|
||||
Costume: 0,
|
||||
|
||||
@@ -99,7 +99,6 @@ func (r *DbReliquary) AddReliquary(player *Player, itemId uint32, reliquaryId ui
|
||||
Guid: 0,
|
||||
}
|
||||
r.InitReliquary(player, reliquary)
|
||||
r.ReliquaryMap[reliquaryId] = reliquary
|
||||
}
|
||||
|
||||
func (r *DbReliquary) CostReliquary(player *Player, reliquaryId uint64) uint64 {
|
||||
|
||||
+4
-4
@@ -40,10 +40,10 @@ func (p *Player) GetDbTeam() *DbTeam {
|
||||
}
|
||||
if p.DbTeam.TeamList == nil {
|
||||
p.DbTeam.TeamList = []*Team{
|
||||
{Name: "冒险", AvatarIdList: make([]uint32, 4)},
|
||||
{Name: "委托", AvatarIdList: make([]uint32, 4)},
|
||||
{Name: "秘境", AvatarIdList: make([]uint32, 4)},
|
||||
{Name: "联机", AvatarIdList: make([]uint32, 4)},
|
||||
{Name: "", AvatarIdList: make([]uint32, 4)},
|
||||
{Name: "", AvatarIdList: make([]uint32, 4)},
|
||||
{Name: "", AvatarIdList: make([]uint32, 4)},
|
||||
{Name: "", AvatarIdList: make([]uint32, 4)},
|
||||
}
|
||||
}
|
||||
if p.DbTeam.CurrTeamIndex == 0 {
|
||||
|
||||
@@ -95,7 +95,6 @@ func (w *DbWeapon) AddWeapon(player *Player, itemId uint32, weaponId uint64) {
|
||||
weapon.AffixIdList = append(weapon.AffixIdList, uint32(skillAffix))
|
||||
}
|
||||
w.InitWeapon(player, weapon)
|
||||
w.WeaponMap[weaponId] = weapon
|
||||
}
|
||||
|
||||
func (w *DbWeapon) CostWeapon(player *Player, weaponId uint64) uint64 {
|
||||
|
||||
@@ -303,7 +303,7 @@ func (c *CmdProtoMap) registerMessage() {
|
||||
c.regMsg(AvatarAddNotify, func() any { return new(proto.AvatarAddNotify) }) // 角色新增通知
|
||||
c.regMsg(AvatarLifeStateChangeNotify, func() any { return new(proto.AvatarLifeStateChangeNotify) }) // 角色存活状态改变通知
|
||||
c.regMsg(AvatarUpgradeReq, func() any { return new(proto.AvatarUpgradeReq) }) // 角色升级请求
|
||||
c.regMsg(AvatarUpgradeRsp, func() any { return new(proto.AvatarUpgradeRsp) }) // 角色升级通知
|
||||
c.regMsg(AvatarUpgradeRsp, func() any { return new(proto.AvatarUpgradeRsp) }) // 角色升级响应
|
||||
c.regMsg(AvatarPropNotify, func() any { return new(proto.AvatarPropNotify) }) // 角色属性表更新通知
|
||||
c.regMsg(AvatarPromoteReq, func() any { return new(proto.AvatarPromoteReq) }) // 角色突破请求
|
||||
c.regMsg(AvatarPromoteRsp, func() any { return new(proto.AvatarPromoteRsp) }) // 角色突破响应
|
||||
@@ -318,6 +318,12 @@ func (c *CmdProtoMap) registerMessage() {
|
||||
c.regMsg(AvatarFlycloakChangeNotify, func() any { return new(proto.AvatarFlycloakChangeNotify) }) // 角色换风之翼通知
|
||||
c.regMsg(AvatarGainFlycloakNotify, func() any { return new(proto.AvatarGainFlycloakNotify) }) // 角色获得风之翼通知
|
||||
c.regMsg(AvatarSkillDepotChangeNotify, func() any { return new(proto.AvatarSkillDepotChangeNotify) }) // 角色技能库切换通知 主角切元素
|
||||
c.regMsg(AvatarSkillUpgradeReq, func() any { return new(proto.AvatarSkillUpgradeReq) }) // 角色技能升级请求
|
||||
c.regMsg(AvatarSkillUpgradeRsp, func() any { return new(proto.AvatarSkillUpgradeRsp) }) // 角色技能升级响应
|
||||
c.regMsg(AvatarSkillChangeNotify, func() any { return new(proto.AvatarSkillChangeNotify) }) // 角色技能更新通知
|
||||
c.regMsg(UnlockAvatarTalentReq, func() any { return new(proto.UnlockAvatarTalentReq) }) // 角色命座解锁请求
|
||||
c.regMsg(UnlockAvatarTalentRsp, func() any { return new(proto.UnlockAvatarTalentRsp) }) // 角色命座解锁通知
|
||||
c.regMsg(AvatarUnlockTalentNotify, func() any { return new(proto.AvatarUnlockTalentNotify) }) // 角色命座解锁通知
|
||||
|
||||
// 背包与道具
|
||||
c.regMsg(PlayerStoreNotify, func() any { return new(proto.PlayerStoreNotify) }) // 玩家背包数据通知
|
||||
|
||||
Reference in new issue
Block a user