英雄属性、战力计算,新玩家初始化

This commit is contained in:
sk 2025-06-09 18:33:52 +08:00
parent ea2fca4572
commit b1bd0139c8
24 changed files with 654 additions and 398 deletions

View File

@ -123,11 +123,14 @@ const (
// TipExistedRoleName 已存在的角色名称 // TipExistedRoleName 已存在的角色名称
TipExistedRoleName StringTipError = "ExistedRoleName" TipExistedRoleName StringTipError = "ExistedRoleName"
// TipLineupHeroNotSet 需要上级天赋满级 // TipLineupNotFound 找不到阵容
TipLineupNotFound StringTipError = "LineupNotFound"
// TipLineupHeroNotSet 阵容英雄未设置
TipLineupHeroNotSet StringTipError = "BattleHeroNotSet" TipLineupHeroNotSet StringTipError = "BattleHeroNotSet"
// TipLineupNotFound 需要上级天赋满级 // TipLineupHeroHasSet 阵容英雄已设置
TipLineupNotFound StringTipError = "LineupNotFound" TipLineupHeroHasSet StringTipError = "LineupHeroHasSet"
// TipLineupsAlreadyMax 需要上级天赋满级 // TipLineupsAlreadyMax 需要上级天赋满级
TipLineupsAlreadyMax StringTipError = "LineupsAlreadyMax" TipLineupsAlreadyMax StringTipError = "LineupsAlreadyMax"
@ -189,6 +192,9 @@ const (
// TipHeroNotFound 找不到英雄 // TipHeroNotFound 找不到英雄
TipHeroNotFound StringTipError = "HeroNotFound" TipHeroNotFound StringTipError = "HeroNotFound"
// TipRoleHeroCanNotUpgrade 主角不能升级
TipRoleHeroCanNotUpgrade StringTipError = "RoleHeroCanNotUpgrade"
// TipHeroBreakLevelAlreadyMax 英雄名将册已激活 // TipHeroBreakLevelAlreadyMax 英雄名将册已激活
TipHeroBreakLevelAlreadyMax StringTipError = "HeroBreakLevelAlreadyMax" TipHeroBreakLevelAlreadyMax StringTipError = "HeroBreakLevelAlreadyMax"

View File

@ -45,21 +45,18 @@ enum RolePropertyType {
// //
RoleTitle = 5; RoleTitle = 5;
//
RoleLevel = 6;
// //
LoginDays = 7; LoginDays = 6;
// //
PowerNextTime = 8; PowerNextTime = 7;
} }
// //
enum MoneyType { enum MoneyType {
MoneyTypeNone = 0; MoneyTypeNone = 0;
// // ,
Exp = 1; Exp = 1;
// //
@ -174,7 +171,7 @@ enum EquipType {
enum TreasureType { enum TreasureType {
WarBook = 0; WarBook = 0;
WarToken = 2; WarToken = 1;
} }
enum CopyType { enum CopyType {

View File

@ -74,7 +74,14 @@ message EquipChangeListAck {
// //
message EquipUpgradeReq { message EquipUpgradeReq {
uint64 EquipUid = 1; uint64 EquipUid = 1;
uint32 Levels = 2; // 1/5 uint32 Times = 2; // 1/5
}
// ModEquipRefine: 6014
//
message EquipRefineReq {
uint64 EquipUid = 1;
// uint32 Times = 2; // 1/5
} }
message Treasure { message Treasure {

View File

@ -10,6 +10,7 @@ import "enums.proto";
// MsgId.ModRoleProperty: 2001 // MsgId.ModRoleProperty: 2001
// //
//
message RolePropertyAck { message RolePropertyAck {
//unchangeable //unchangeable
uint64 UserId = 1; uint64 UserId = 1;
@ -28,9 +29,8 @@ message RolePropertyAck {
uint32 NamePrefix = 12; uint32 NamePrefix = 12;
uint32 NameTitle = 13; uint32 NameTitle = 13;
uint32 RoleTitle = 14; uint32 RoleTitle = 14;
uint32 RoleLevel = 15; uint32 LoginDays = 15;
uint32 LoginDays = 16; int64 PowerNextTime = 16;
int64 PowerNextTime = 17;
} }
// MsgId.ModRoleProperty: 2001 // MsgId.ModRoleProperty: 2001
@ -113,12 +113,17 @@ message LineupHeroChangeReq {
uint64 HeroUid = 3; uint64 HeroUid = 3;
} }
// ModRoleLineupHeroChange: 2007
//
message LineupHeroChangeAck {
repeated LineupHero HeroList = 1;
}
// ModRoleBattleHeroPosition = 2008; // ModRoleBattleHeroPosition = 2008;
// //
message LineupHeroPositionReq { message LineupHeroPositionReq {
uint64 LineupUid = 1; uint64 LineupUid = 1;
repeated uint32 IndexList = 2; // repeated uint32 PositionList = 3; // 6
repeated uint32 PositionList = 3; //
} }
// ModRoleBattleHeroEquip = 2009; // ModRoleBattleHeroEquip = 2009;
@ -126,7 +131,7 @@ message LineupHeroPositionReq {
message LineupHeroEquipReq { message LineupHeroEquipReq {
uint64 LineupUid = 1; uint64 LineupUid = 1;
uint32 Index = 2; uint32 Index = 2;
EquipType EquipType = 3; // Uid为0时不知道是什么类型的装备 EquipType EquipType = 3; // EquipUid为0时不知道是什么类型的装备
uint64 EquipUid = 4; // 0 uint64 EquipUid = 4; // 0
} }
@ -135,7 +140,7 @@ message LineupHeroEquipReq {
message LineupHeroTreasureReq { message LineupHeroTreasureReq {
uint64 LineupUid = 1; uint64 LineupUid = 1;
uint32 Index = 2; uint32 Index = 2;
TreasureType TreasureType = 3; // Uid为0时不知道是什么类型的宝物 TreasureType TreasureType = 3; // TreasureUid为0时不知道是什么类型的宝物
uint64 TreasureUid = 4; // 0 uint64 TreasureUid = 4; // 0
} }

View File

@ -212,11 +212,14 @@ enum MsgId {
// //
ModItemEquipUpgrade = 6013; ModItemEquipUpgrade = 6013;
//
ModItemEquipRefine = 6014;
// //
ModItemTreasureList = 6014; ModItemTreasureList = 6021;
// //
ModItemTreasureChange = 6015; ModItemTreasureChange = 6022;
//ModCounter begin ----------------------------------------------------------------------------------------------------------- //ModCounter begin -----------------------------------------------------------------------------------------------------------
// //

View File

@ -28,6 +28,8 @@ type Tables struct {
Scene SceneTable Scene SceneTable
ServerConfig ServerConfigTable ServerConfig ServerConfigTable
Treasure TreasureTable Treasure TreasureTable
TreasureLevel TreasureLevelTable
UpgradeMaster UpgradeMasterTable
} }
func NewTables(dataDir string) (*Tables, error) { func NewTables(dataDir string) (*Tables, error) {

View File

@ -0,0 +1,60 @@
package data
import (
json "github.com/json-iterator/go"
"github.com/oylshe1314/framework/util"
)
type TreasureLevel struct {
Id int `json:"id"`
TreasureId int `json:"treasure_id"`
Level int `json:"level"`
NeedExp int `json:"need_exp"`
AttrType int `json:"attr_type"`
AttrValue int `json:"attr_value"`
}
type TreasureLevelTable struct {
l []*TreasureLevel
m1 map[int]*TreasureLevel
m2 map[int][]*TreasureLevel
m3 map[uint64]*TreasureLevel
}
func (this *TreasureLevelTable) load(buf []byte) error {
var err = json.Unmarshal(buf, &this.l)
if err != nil {
return err
}
this.m1 = make(map[int]*TreasureLevel)
this.m2 = make(map[int][]*TreasureLevel)
this.m3 = make(map[uint64]*TreasureLevel)
for i := range this.l {
this.m1[this.l[i].Id] = this.l[i]
this.m2[this.l[i].TreasureId] = append(this.m2[this.l[i].TreasureId], this.l[i])
this.m3[util.Compose2uint32(uint32(this.l[i].TreasureId), uint32(this.l[i].Level))] = this.l[i]
}
return nil
}
func (this *TreasureLevelTable) List() []*TreasureLevel {
return this.l
}
func (this *TreasureLevelTable) Get(i int) *TreasureLevel {
return this.l[i]
}
func (this *TreasureLevelTable) Find1(id int) *TreasureLevel {
return this.m1[id]
}
func (this *TreasureLevelTable) Find2(treasureId int) []*TreasureLevel {
return this.m2[treasureId]
}
func (this *TreasureLevelTable) Find3(treasureId, level int) *TreasureLevel {
return this.m3[util.Compose2uint32(uint32(treasureId), uint32(level))]
}

View File

@ -0,0 +1,47 @@
package data
import (
json "github.com/json-iterator/go"
"github.com/oylshe1314/framework/util"
)
type UpgradeMaster struct {
Id int `json:"id"`
Type int `json:"type"`
Level int `json:"level"`
NeedLevel int `json:"need_level"`
AttrType1 int `json:"attr_type1"`
AttrValue1 int `json:"attr_value1"`
AttrType2 int `json:"attr_type2"`
AttrValue2 int `json:"attr_value2"`
AttrType3 int `json:"attr_type3"`
AttrValue3 int `json:"attr_value3"`
AttrType4 int `json:"attr_type4"`
AttrValue4 int `json:"attr_value4"`
AttrType5 int `json:"attr_type5"`
AttrValue5 int `json:"attr_value5"`
AttrType6 int `json:"attr_type6"`
AttrValue6 int `json:"attr_value6"`
}
type UpgradeMasterTable struct {
l []*UpgradeMaster
m1 map[int][]*UpgradeMaster
m2 map[uint64]*UpgradeMaster
}
func (this *UpgradeMasterTable) load(buf []byte) error {
var err = json.Unmarshal(buf, &this.l)
if err != nil {
return err
}
this.m1 = make(map[int][]*UpgradeMaster)
this.m2 = make(map[uint64]*UpgradeMaster)
for i := range this.l {
this.m1[this.l[i].Type] = append(this.m1[this.l[i].Type], this.l[i])
this.m2[util.Compose2uint32(uint32(this.l[i].Type), uint32(this.l[i].Level))] = this.l[i]
}
return nil
}

View File

@ -17,10 +17,17 @@ func (this *PlayerHandler) HeroUpgrade(player *logic.Player, msg *net.Message) {
} }
if req.HeroUid == 0 { if req.HeroUid == 0 {
this.logger.Error("Parameter error, req.HeroUid == 0")
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
return return
} }
if req.HeroUid == player.RoleHero.Uid {
this.logger.Error("Parameter error, Role hero can not upgrade here, req.HeroUid: ", req.HeroUid)
_ = player.TipNotice(proto.TipRoleHeroCanNotUpgrade)
return
}
if req.Levels != 1 && req.Levels != 5 { if req.Levels != 1 && req.Levels != 5 {
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
return return

View File

@ -38,11 +38,13 @@ func (this *PlayerHandler) EquipUpgrade(player *logic.Player, msg *net.Message)
} }
if req.EquipUid == 0 { if req.EquipUid == 0 {
this.logger.Error("Parameter error, req.EquipUid == 0")
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
return return
} }
if req.Levels != 1 && req.Levels != 5 { if req.Times != 1 && req.Times != 5 {
this.logger.Error("Parameter error, req.Level: ", req.Times)
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
return return
} }
@ -68,7 +70,7 @@ func (this *PlayerHandler) EquipUpgrade(player *logic.Player, msg *net.Message)
var consumeItems = map[uint32]uint32{} var consumeItems = map[uint32]uint32{}
levelLoop: levelLoop:
for range req.Levels { for range req.Times {
var equipLevelTable = this.tables.EquipLevel.Find3(int(equip.Id), int(equip.Level)) var equipLevelTable = this.tables.EquipLevel.Find3(int(equip.Id), int(equip.Level))
if equipLevelTable == nil { if equipLevelTable == nil {
_ = player.TipNotice(proto.TipDataTablesError) _ = player.TipNotice(proto.TipDataTablesError)
@ -99,3 +101,20 @@ levelLoop:
}) })
return return
} }
func (this *PlayerHandler) EquipRefine(player *logic.Player, msg *net.Message) {
var req = new(pb.EquipUpgradeReq)
var err = msg.Read(req)
if err != nil {
this.logger.Error("Read message failed, ", err)
_ = player.TipNotice(proto.TipMessageError)
return
}
if req.EquipUid == 0 {
this.logger.Error("Parameter error, req.EquipUid == 0")
_ = player.TipNotice(proto.TipParameterError)
return
}
}

View File

@ -82,23 +82,16 @@ func (this *PlayerHandler) RolePropertyChange(player *logic.Player, msg *net.Mes
} }
switch req.Property.Type { switch req.Property.Type {
case pb.RolePropertyType_AvatarFrame: case pb.RolePropertyType_AvatarFrame,
player.AvatarFrame = uint32(req.Property.Value) pb.RolePropertyType_ChatBubble,
case pb.RolePropertyType_ChatBubble: pb.RolePropertyType_NamePrefix,
player.ChatBubble = uint32(req.Property.Value) pb.RolePropertyType_NameTitle,
case pb.RolePropertyType_NamePrefix: pb.RolePropertyType_RoleTitle:
player.NamePrefix = uint32(req.Property.Value) player.ChangeProperty(util.NewPair(req.Property.Type, req.Property.Value))
case pb.RolePropertyType_NameTitle:
player.NameTitle = uint32(req.Property.Value)
case pb.RolePropertyType_RoleTitle:
player.RoleTitle = uint32(req.Property.Value)
default: default:
this.logger.Error("Parameter error, req.Property.Type: ", req.Property.Type)
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
} }
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRolePropertyChange), &pb.RolePropertyChangeAck{
PropertyList: []*pb.RoleProperty{req.Property},
})
return return
} }
@ -111,6 +104,12 @@ func (this *PlayerHandler) LineupHeroChange(player *logic.Player, msg *net.Messa
return return
} }
if req.LineupUid == 0 {
this.logger.Error("Parameter error, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipParameterError)
return
}
if req.Index >= 8 { if req.Index >= 8 {
this.logger.Error("Parameter error, req.Index: ", req.Index) this.logger.Error("Parameter error, req.Index: ", req.Index)
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
@ -128,30 +127,60 @@ func (this *PlayerHandler) LineupHeroChange(player *logic.Player, msg *net.Messa
return return
} }
var lineup = player.Lineup[req.LineupUid]
if lineup == nil {
this.logger.Error("Parameter error, Lineup not found, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipLineupNotFound)
return
}
var hero = player.Hero[req.HeroUid] var hero = player.Hero[req.HeroUid]
if hero == nil { if hero == nil {
this.logger.Error("Parameter error, Lineup not found, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipHeroNotFound) _ = player.TipNotice(proto.TipHeroNotFound)
return return
} }
var LineupHero = player.LineupHeroes[req.Index] var setups [7]bool
if LineupHero == nil { for i := 0; i < 8; i++ {
LineupHero = &logic.PlayerLineupHero{ if lineup.Heroes[i] != nil && hero.Uid == lineup.Heroes[i].HeroUid {
this.logger.Errorf("The hero has set into the lineup, hero.Uid: %d, index: %d", hero.Uid, i)
_ = player.TipNotice(proto.TipLineupHeroHasSet)
return
}
if i < 6 {
if lineup.Heroes[i].Position > 0 {
setups[lineup.Heroes[i].Position] = true
}
}
}
var lineupHero = lineup.Heroes[req.Index]
if lineupHero == nil {
lineupHero = &logic.PlayerLineupHero{
HeroUid: hero.Uid, HeroUid: hero.Uid,
} }
player.LineupHeroes[req.Index] = LineupHero
} else { for position := 1; position < 7; position++ {
LineupHero.HeroUid = hero.Uid if !setups[position] {
lineupHero.Position = uint32(position)
}
} }
player.SaveArray("lineup_heroes", int(req.Index), LineupHero) lineup.Heroes[req.Index] = lineupHero
} else {
lineupHero.HeroUid = hero.Uid
}
player.SaveArray("lineup.heroes", int(req.Index), lineupHero)
player.UpdateHeroAttrs(hero) player.UpdateHeroAttrs(hero)
//TODO lineup hero capacity //TODO lineup hero capacity
//_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroListAck{ _ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroChangeAck{
// HeroList: []*pb.LineupHero{LineupHero.BuildMsgLineupHero(req.Index)}, HeroList: []*pb.LineupHero{lineupHero.BuildMsgLineupHero(req.Index)},
//}) })
} }
func (this *PlayerHandler) LineupHeroPosition(player *logic.Player, msg *net.Message) { func (this *PlayerHandler) LineupHeroPosition(player *logic.Player, msg *net.Message) {
@ -163,39 +192,54 @@ func (this *PlayerHandler) LineupHeroPosition(player *logic.Player, msg *net.Mes
return return
} }
if len(req.IndexList) != len(req.PositionList) { if len(req.PositionList) != 6 {
this.logger.Errorf("Read message failed, len(req.IndexList) = %d, len(req.PositionList) = %d", len(req.IndexList), len(req.PositionList)) this.logger.Errorf("Parameter error, len(req.IndexList) != 6, len(req.IndexList) = %d", len(req.PositionList))
_ = player.TipNotice(proto.TipMessageError)
return
}
for i := range req.IndexList {
if req.IndexList[i] >= 6 {
this.logger.Errorf("Parameter error, req.IndexList[%d]: %d", i, req.IndexList[i])
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
return return
} }
if req.PositionList[i] > 6 {
var lineup = player.Lineup[req.LineupUid]
if lineup == nil {
this.logger.Error("Parameter error, Lineup not found, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipLineupNotFound)
return
}
var setups [7]bool
for i := range req.PositionList {
if req.PositionList[i] < 1 || req.PositionList[i] > 6 {
this.logger.Errorf("Parameter error, req.PositionList[%d]: %d", i, req.PositionList[i]) this.logger.Errorf("Parameter error, req.PositionList[%d]: %d", i, req.PositionList[i])
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
return return
} }
if setups[req.PositionList[i]] {
this.logger.Errorf("Parameter error, repeated hero battle position, position: %d, index: %d", req.PositionList[i], i)
_ = player.TipNotice(proto.TipParameterError)
return
}
setups[req.PositionList[i]] = true
} }
var lineupHeroList []*pb.LineupHero var lineupHeroList []*pb.LineupHero
for i := range req.IndexList { for i, lineupHero := range lineup.Heroes {
var lineupHero = player.LineupHeroes[req.IndexList[i]] if i > 5 {
if lineupHero != nil { break
if lineupHero.Position != req.PositionList[i] {
lineupHero.Position = req.PositionList[i]
player.SaveArray("lineup_heroes", int(req.IndexList[i]), lineupHero)
lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(req.IndexList[i]))
}
}
} }
if lineupHero == nil {
continue
}
lineupHero.Position = req.PositionList[i]
lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(uint32(i)))
}
player.SaveField("lineup.heroes", lineup.Heroes)
if len(lineupHeroList) > 0 { if len(lineupHeroList) > 0 {
//_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroListAck{HeroList: lineupHeroList}) _ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroChangeAck{HeroList: lineupHeroList})
} }
} }
@ -208,6 +252,12 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
return return
} }
if req.LineupUid == 0 {
this.logger.Error("Parameter error, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipParameterError)
return
}
if req.Index >= 8 { if req.Index >= 8 {
this.logger.Error("Parameter error, req.Index: ", req.Index) this.logger.Error("Parameter error, req.Index: ", req.Index)
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
@ -225,15 +275,16 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
return return
} }
var LineupHero = player.LineupHeroes[req.Index] var lineup = player.Lineup[req.LineupUid]
if LineupHero == nil { if lineup == nil {
_ = player.TipNotice(proto.TipLineupHeroNotSet) this.logger.Error("Parameter error, Lineup not found, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipLineupNotFound)
return return
} }
var hero = player.Hero[LineupHero.HeroUid] var lineupHero = lineup.Heroes[req.Index]
if hero == nil { if lineupHero == nil {
_ = player.TipNotice(proto.TipHeroNotFound) _ = player.TipNotice(proto.TipLineupHeroNotSet)
return return
} }
@ -257,13 +308,11 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
} }
} }
var equipIndex = int(req.EquipType) var lineupHeroList []*pb.LineupHero
var LineupHeroList []*pb.LineupHero
var equipChangeList []*pb.EquipChange var equipChangeList []*pb.EquipChange
if LineupHero.Equip[equipIndex] != 0 { if lineupHero.Equip[req.EquipType] != 0 {
var preEquip = player.Equip[LineupHero.Equip[equipIndex]] var preEquip = player.Equip[lineupHero.Equip[req.EquipType]]
if preEquip != nil && preEquip.HeroUid != 0 { if preEquip != nil && preEquip.HeroUid != 0 {
preEquip.HeroUid = 0 preEquip.HeroUid = 0
player.SaveModel(preEquip) player.SaveModel(preEquip)
@ -274,25 +323,25 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
} }
} }
LineupHero.Equip[equipIndex] = req.EquipUid lineupHero.Equip[req.EquipType] = req.EquipUid
player.SaveArray("lineup_heroes", int(req.Index), LineupHero) player.SaveArray("lineup.heroes", int(req.Index), lineupHero)
LineupHeroList = append(LineupHeroList, LineupHero.BuildMsgLineupHero(req.Index)) lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(req.Index))
if equip != nil { if equip != nil {
if equip.HeroUid != 0 { if equip.HeroUid != 0 {
for i := range player.LineupHeroes { for i := range lineup.Heroes {
if player.LineupHeroes[i].HeroUid == equip.HeroUid { if lineup.Heroes[i].HeroUid == equip.HeroUid {
var preLineupHero = player.LineupHeroes[i] var preLineupHero = lineup.Heroes[i]
if preLineupHero.Equip[equipIndex] != 0 { if preLineupHero.Equip[req.EquipType] != 0 {
preLineupHero.Equip[equipIndex] = 0 preLineupHero.Equip[req.EquipType] = 0
player.SaveArray("lineup_heroes", i, preLineupHero) player.SaveArray("lineup.heroes", i, preLineupHero)
LineupHeroList = append(LineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i))) lineupHeroList = append(lineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i)))
} }
} }
} }
} }
equip.HeroUid = LineupHero.HeroUid equip.HeroUid = lineupHero.HeroUid
player.SaveModel(equip) player.SaveModel(equip)
equipChangeList = append(equipChangeList, &pb.EquipChange{ equipChangeList = append(equipChangeList, &pb.EquipChange{
ChangeType: pb.ChangeType_Changed, ChangeType: pb.ChangeType_Changed,
@ -300,7 +349,7 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
}) })
} }
//_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroListAck{HeroList: LineupHeroList}) _ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroChangeAck{HeroList: lineupHeroList})
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipChange), &pb.EquipChangeListAck{ChangeList: equipChangeList}) _ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipChange), &pb.EquipChangeListAck{ChangeList: equipChangeList})
return return
} }
@ -314,6 +363,12 @@ func (this *PlayerHandler) LineupHeroTreasure(player *logic.Player, msg *net.Mes
return return
} }
if req.LineupUid == 0 {
this.logger.Error("Parameter error, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipParameterError)
return
}
if req.Index >= 8 { if req.Index >= 8 {
this.logger.Error("Parameter error, req.Index: ", req.Index) this.logger.Error("Parameter error, req.Index: ", req.Index)
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
@ -331,15 +386,16 @@ func (this *PlayerHandler) LineupHeroTreasure(player *logic.Player, msg *net.Mes
return return
} }
var LineupHero = player.LineupHeroes[req.Index] var lineup = player.Lineup[req.LineupUid]
if LineupHero == nil { if lineup == nil {
_ = player.TipNotice(proto.TipLineupHeroNotSet) this.logger.Error("Parameter error, Lineup not found, req.LineupUid: ", req.LineupUid)
_ = player.TipNotice(proto.TipLineupNotFound)
return return
} }
var hero = player.Hero[LineupHero.HeroUid] var lineupHero = lineup.Heroes[req.Index]
if hero == nil { if lineupHero == nil {
_ = player.TipNotice(proto.TipHeroNotFound) _ = player.TipNotice(proto.TipLineupHeroNotSet)
return return
} }
@ -351,63 +407,61 @@ func (this *PlayerHandler) LineupHeroTreasure(player *logic.Player, msg *net.Mes
return return
} }
var treasureTable = this.tables.Treasure.Find(int(treasure.Id)) var equipTable = this.tables.Treasure.Find(int(treasure.Id))
if treasureTable == nil { if equipTable == nil {
_ = player.TipNotice(proto.TipDataTablesError) _ = player.TipNotice(proto.TipDataTablesError)
return return
} }
if req.TreasureType != pb.TreasureType(treasureTable.Type) { if req.TreasureType != pb.TreasureType(equipTable.Type) {
_ = player.TipNotice(proto.TipParameterError) _ = player.TipNotice(proto.TipParameterError)
return return
} }
} }
var treasureIndex = int(req.TreasureType) var lineupHeroList []*pb.LineupHero
var equipChangeList []*pb.TreasureChange
var LineupHeroList []*pb.LineupHero if lineupHero.Treasure[req.TreasureType] != 0 {
var treasureChangeList []*pb.TreasureChange var preTreasure = player.Treasure[lineupHero.Treasure[req.TreasureType]]
if LineupHero.Treasure[treasureIndex] != 0 {
var preTreasure = player.Treasure[LineupHero.Treasure[treasureIndex]]
if preTreasure != nil && preTreasure.HeroUid != 0 { if preTreasure != nil && preTreasure.HeroUid != 0 {
preTreasure.HeroUid = 0 preTreasure.HeroUid = 0
player.SaveModel(preTreasure) player.SaveModel(preTreasure)
treasureChangeList = append(treasureChangeList, &pb.TreasureChange{ equipChangeList = append(equipChangeList, &pb.TreasureChange{
ChangeType: pb.ChangeType_Changed, ChangeType: pb.ChangeType_Changed,
Treasure: preTreasure.BuildMsgTreasure(), Treasure: preTreasure.BuildMsgTreasure(),
}) })
} }
} }
LineupHero.Treasure[treasureIndex] = req.TreasureUid lineupHero.Treasure[req.TreasureType] = req.TreasureUid
player.SaveArray("lineup_heroes", int(req.Index), LineupHero) player.SaveArray("lineup.heroes", int(req.Index), lineupHero)
LineupHeroList = append(LineupHeroList, LineupHero.BuildMsgLineupHero(req.Index)) lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(req.Index))
if treasure != nil { if treasure != nil {
if treasure.HeroUid != 0 { if treasure.HeroUid != 0 {
for i := range player.LineupHeroes { for i := range lineup.Heroes {
if player.LineupHeroes[i].HeroUid == treasure.HeroUid { if lineup.Heroes[i].HeroUid == treasure.HeroUid {
var preLineupHero = player.LineupHeroes[i] var preLineupHero = lineup.Heroes[i]
if preLineupHero.Treasure[treasureIndex] != 0 { if preLineupHero.Treasure[req.TreasureType] != 0 {
preLineupHero.Treasure[treasureIndex] = 0 preLineupHero.Treasure[req.TreasureType] = 0
player.SaveArray("lineup_heroes", i, preLineupHero) player.SaveArray("lineup.heroes", i, preLineupHero)
LineupHeroList = append(LineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i))) lineupHeroList = append(lineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i)))
} }
} }
} }
} }
treasure.HeroUid = LineupHero.HeroUid treasure.HeroUid = lineupHero.HeroUid
player.SaveModel(treasure) player.SaveModel(treasure)
treasureChangeList = append(treasureChangeList, &pb.TreasureChange{ equipChangeList = append(equipChangeList, &pb.TreasureChange{
ChangeType: pb.ChangeType_Changed, ChangeType: pb.ChangeType_Changed,
Treasure: treasure.BuildMsgTreasure(), Treasure: treasure.BuildMsgTreasure(),
}) })
} }
//_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroListAck{HeroList: LineupHeroList}) _ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroChange), &pb.LineupHeroChangeAck{HeroList: lineupHeroList})
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemTreasureChange), &pb.TreasureChangeListAck{ChangeList: treasureChangeList}) _ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemTreasureChange), &pb.TreasureChangeListAck{ChangeList: equipChangeList})
return return
} }

View File

@ -36,6 +36,7 @@ type Player struct {
NamePrefix uint32 `bson:"name_prefix"` NamePrefix uint32 `bson:"name_prefix"`
NameTitle uint32 `bson:"name_title"` NameTitle uint32 `bson:"name_title"`
RoleTitle uint32 `bson:"role_title"` RoleTitle uint32 `bson:"role_title"`
RoleExp uint64 `bson:"role_exp"`
RoleLevel uint32 `bson:"role_level"` RoleLevel uint32 `bson:"role_level"`
//Fields //Fields
@ -51,21 +52,19 @@ type Player struct {
//CopyMainSceneId uint32 `bson:"copy_main_scene_id"` //CopyMainSceneId uint32 `bson:"copy_main_scene_id"`
//BattlePassSeason uint32 `bson:"battle_pass_season"` //BattlePassSeason uint32 `bson:"battle_pass_season"`
//Arrays
LineupHeroes [8]*PlayerLineupHero `bson:"lineup_heroes"`
//Fields //Fields
RoleHero *PlayerHero `bson:"role_hero"`
//LoginReward *PlayerLoginReward `bson:"login_reward"` //LoginReward *PlayerLoginReward `bson:"login_reward"`
//IdleBattle *PlayerIdleBattle `bson:"idle_battle"` //IdleBattle *PlayerIdleBattle `bson:"idle_battle"`
//Arena *PlayerArena `bson:"arena"` //Arena *PlayerArena `bson:"arena"`
//
////Arrays ////Arrays
//BattlePassReward []*PlayerBattlePassRewrad `bson:"battle_pass_reward"` //BattlePassReward []*PlayerBattlePassReward `bson:"battle_pass_reward"`
// //
////Models ////Models
//Achievement map[uint64]*PlayerAchievement `bson:"achievement"` //Achievement map[uint64]*PlayerAchievement `bson:"achievement"`
//BattlePass map[uint32]*PlayerBattlePass `bson:"battle_pass"` //BattlePass map[uint32]*PlayerBattlePass `bson:"battle_pass"`
//Cdkey map[string]*PlayerCdkey `bson:"cdkey"` //CdKey map[string]*PlayerCdKey `bson:"cd_key"`
CopyPassed map[uint32]*PlayerCopyPassed `bson:"copy_passed"` CopyPassed map[uint32]*PlayerCopyPassed `bson:"copy_passed"`
//CopySpeed map[uint32]*PlayerCopySpeed `bson:"copy_speed"` //CopySpeed map[uint32]*PlayerCopySpeed `bson:"copy_speed"`
CopyStatus map[uint64]*PlayerCopyStatus `bson:"copy_status"` CopyStatus map[uint64]*PlayerCopyStatus `bson:"copy_status"`
@ -77,7 +76,7 @@ type Player struct {
Equip map[uint64]*PlayerEquip `bson:"rig_equip"` Equip map[uint64]*PlayerEquip `bson:"rig_equip"`
//GiftPack map[uint32]*PlayerGiftPack `bson:"gift_pack"` //GiftPack map[uint32]*PlayerGiftPack `bson:"gift_pack"`
//Mail map[uint64]*PlayerMail `bson:"mail"` //Mail map[uint64]*PlayerMail `bson:"mail"`
Lineup map[uint64]*PlayerLineup `bson:"lineups"` Lineup map[uint64]*PlayerLineup `bson:"lineup"`
Money map[uint32]*PlayerMoney `bson:"money"` Money map[uint32]*PlayerMoney `bson:"money"`
//MonthlyCard map[uint32]*PlayerMonthlyCard `bson:"monthly_card"` //MonthlyCard map[uint32]*PlayerMonthlyCard `bson:"monthly_card"`
//Planet map[uint32]*PlayerPlanet `bson:"planet"` //Planet map[uint32]*PlayerPlanet `bson:"planet"`
@ -152,11 +151,11 @@ func (this *Player) sync() {
//_ = this.Send(proto.ModIdLevel, proto.MsgIdPlanetList, this.BuildMsgPlanetListAck()) //_ = this.Send(proto.ModIdLevel, proto.MsgIdPlanetList, this.BuildMsgPlanetListAck())
//_ = this.Send(proto.ModIdLevel, proto.MsgIdPlanetRawStoneStatus, this.BuildMsgPlanetRawStoneStatusListAck()) //_ = this.Send(proto.ModIdLevel, proto.MsgIdPlanetRawStoneStatus, this.BuildMsgPlanetRawStoneStatusListAck())
//_ = this.Send(proto.ModIdLevel, proto.MsgIdCopyArenaStatus, this.BuildMsgCopyArenaStatusAck()) //_ = this.Send(proto.ModIdLevel, proto.MsgIdCopyArenaStatus, this.BuildMsgCopyArenaStatusAck())
//
////Battle module ////Battle module
//_ = this.Send(proto.ModIdBattle, proto.MsgIdIdleBattleStatus, this.BuildMsgIdleBattleStatusAck()) //_ = this.Send(proto.ModIdBattle, proto.MsgIdIdleBattleStatus, this.BuildMsgIdleBattleStatusAck())
//
////Hero module //Hero module
_ = this.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroList), this.BuildMsgHeroListAck()) _ = this.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroList), this.BuildMsgHeroListAck())
_ = this.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroBookList), this.BuildMsgHeroBookListAck()) _ = this.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroBookList), this.BuildMsgHeroBookListAck())
//_ = this.Send(proto.ModIdRig, proto.MsgIdRigComponentList, this.BuildMsgRigComponentListAck()) //_ = this.Send(proto.ModIdRig, proto.MsgIdRigComponentList, this.BuildMsgRigComponentListAck())
@ -169,30 +168,32 @@ func (this *Player) sync() {
//_ = this.Send(proto.ModIdRig, proto.MsgIdRigCoreList, this.BuildMsgRigCoreListAck()) //_ = this.Send(proto.ModIdRig, proto.MsgIdRigCoreList, this.BuildMsgRigCoreListAck())
//_ = this.Send(proto.ModIdRig, proto.MsgIdRigTrammelsList, this.BuildMsgRigTrammelsListAck()) //_ = this.Send(proto.ModIdRig, proto.MsgIdRigTrammelsList, this.BuildMsgRigTrammelsListAck())
//_ = this.Send(proto.ModIdRig, proto.MsgIdRigWarshipList, this.BuildMsgWarshipListAck()) //_ = this.Send(proto.ModIdRig, proto.MsgIdRigWarshipList, this.BuildMsgWarshipListAck())
//
//Item module
_ = this.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemList), this.BuildMsgItemListAck())
_ = this.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipList), this.BuildMsgEquipListAck())
_ = this.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemTreasureList), this.BuildMsgTreasureListAck())
//Counter module
_ = this.Send(uint16(pb.ModId_ModuleCounter), uint16(pb.MsgId_ModCounterList), this.BuildMsgCounterListAck())
////Mail module ////Mail module
//_ = this.Send(proto.ModIdMail, proto.MsgIdMailList, this.BuildMsgMailListAck()) //_ = this.Send(proto.ModIdMail, proto.MsgIdMailList, this.BuildMsgMailListAck())
//
////Counter module
//_ = this.Send(proto.ModIdCounter, proto.MsgIdCounterList, this.BuildMsgCounterListAck())
//
////Item module
//_ = this.Send(proto.ModIdItem, proto.MsgIdPackItemList, this.BuildMsgPackItemListAck())
//
////Achievement module ////Achievement module
//_ = this.Send(proto.ModIdAchievement, proto.MsgIdAchievementList, this.BuildMsgAchievementListAck()) //_ = this.Send(proto.ModIdAchievement, proto.MsgIdAchievementList, this.BuildMsgAchievementListAck())
//
////Task module ////Task module
//_ = this.Send(proto.ModIdTask, proto.MsgIdTaskList, this.BuildMsgTaskListAck()) //_ = this.Send(proto.ModIdTask, proto.MsgIdTaskList, this.BuildMsgTaskListAck())
//_ = this.Send(proto.ModIdTask, proto.MsgIdActiveInfo, this.BuildMsgActiveInfoAck()) //_ = this.Send(proto.ModIdTask, proto.MsgIdActiveInfo, this.BuildMsgActiveInfoAck())
//
////Store module ////Store module
//_ = this.Send(proto.ModIdStore, proto.MsgIdStorePoolList, this.BuildMsgStorePoolListAck()) //_ = this.Send(proto.ModIdStore, proto.MsgIdStorePoolList, this.BuildMsgStorePoolListAck())
//_ = this.Send(proto.ModIdStore, proto.MsgIdMonthlyCardList, this.BuildMsgMonthlyCardListAck()) //_ = this.Send(proto.ModIdStore, proto.MsgIdMonthlyCardList, this.BuildMsgMonthlyCardListAck())
//_ = this.Send(proto.ModIdStore, proto.MsgIdBattlePassInfo, this.BuildMsgBattlePassInfoAck()) //_ = this.Send(proto.ModIdStore, proto.MsgIdBattlePassInfo, this.BuildMsgBattlePassInfoAck())
//_ = this.Send(proto.ModIdStore, proto.MsgIdBattlePassRewardStatusList, this.BuildMsgBattlePassRewardListAck()) //_ = this.Send(proto.ModIdStore, proto.MsgIdBattlePassRewardStatusList, this.BuildMsgBattlePassRewardListAck())
//_ = this.Send(proto.ModIdStore, proto.MsgIdLimitGiftPackList, this.BuildMsgLimitGiftPackListAck()) //_ = this.Send(proto.ModIdStore, proto.MsgIdLimitGiftPackList, this.BuildMsgLimitGiftPackListAck())
//
////Activity module ////Activity module
//_ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck()) //_ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck())
} }

View File

@ -4,12 +4,12 @@ import (
"ecs/proto" "ecs/proto"
"ecs/proto/pb" "ecs/proto/pb"
"ecs/servers/game/data" "ecs/servers/game/data"
"math/rand/v2" "github.com/oylshe1314/framework/util"
) )
func (this *Player) EnterBattle(sceneTable *data.Scene) { func (this *Player) EnterBattle(sceneTable *data.Scene) {
this.Temp.Fighting = true this.Temp.Fighting = true
this.Temp.RandSeed = rand.Int64() this.Temp.RandSeed = util.DefaultRandom.Uint64()
this.copyBattle(sceneTable) this.copyBattle(sceneTable)
this.enterScene(uint32(sceneTable.Id)) this.enterScene(uint32(sceneTable.Id))

View File

@ -1,6 +1,6 @@
package logic package logic
//type PlayerCdkey struct { //type PlayerCdKey struct {
// Key string `bson:"key" key:"1"` // Key string `bson:"key" key:"1"`
// ExchangeTime int64 `bson:"exchange_time"` // ExchangeTime int64 `bson:"exchange_time"`
//} //}

View File

@ -2,6 +2,7 @@ package logic
import ( import (
"ecs/proto/pb" "ecs/proto/pb"
"github.com/oylshe1314/framework/util"
) )
func (this *Player) checkCorrect(firstLogin bool, cur *GameTime) { func (this *Player) checkCorrect(firstLogin bool, cur *GameTime) {
@ -165,19 +166,19 @@ func (this *Player) initRole(cur *GameTime) {
return return
} }
_ = this.addHero(heroTable) var roleHero = this.newHero(heroTable)
if roleHero == nil {
return
}
this.RoleHero = roleHero
this.SaveField("role_hero", this.RoleHero)
} }
func (this *Player) initHeroes(cur *GameTime) { func (this *Player) initHeroes(cur *GameTime) {
var initHeroIds = this.manager.tables.ServerConfig.GetInitHeroes() var initHeroIds = this.manager.tables.ServerConfig.GetInitHeroes()
for _, initHeroId := range initHeroIds { for _, initHeroId := range initHeroIds {
var heroTable = this.manager.tables.Hero.Find(initHeroId) this.AddHero(uint32(initHeroId))
if heroTable == nil {
this.manager.logger.Error("find hero table failed, initHeroId: ", initHeroId)
return
}
_ = this.addHero(heroTable)
} }
} }
@ -196,92 +197,45 @@ func (this *Player) initItems(cur *GameTime) {
} }
} }
// func (this *Player) initLineup(cur *GameTime) {
// func (this *Player) initComponents(cur *GameTime) { var roleHero = this.RoleHero
// var cfgTable = this.manager.tables.ServerCfg.Get("init_components") if roleHero == nil {
// if cfgTable == nil { return
// return }
// }
// var lineup = &PlayerLineup{
// itemPairs, err := util.SplitItemPairs(cfgTable.Value1, cfgTable.Value2, 1) Uid: util.RandomUid(),
// if err != nil { Name: "阵容1",
// return Active: true,
// } }
//
// for _, itemPair := range itemPairs { var roleLineupHero = &PlayerLineupHero{
// var componentTable = this.manager.tables.RigComponentExtend.Get(int(itemPair[0]), 1) HeroUid: roleHero.Uid,
// if componentTable == nil { Position: 1,
// continue }
// }
// this.updateHeroAttrs(roleHero, lineup, roleLineupHero)
// var componentStarTable = this.manager.tables.RigComponentStarExtend.Get(int(itemPair[0]), 0) this.UpdateBattleHeroCapacity(roleLineupHero)
// if componentStarTable == nil {
// continue lineup.Heroes[0] = roleLineupHero
// }
// var i = uint32(1)
// var component = &PlayerRigComponent{ for _, hero := range this.Hero {
// ItemId: uint32(componentTable.ItemId), var lineupHero = &PlayerLineupHero{
// Id: uint32(componentTable.Id), HeroUid: hero.Uid,
// StarId: uint32(componentStarTable.Id), Position: i + 1,
// Type: uint32(componentTable.Type), }
// Setup: true,
// } this.updateHeroAttrs(hero, lineup, lineupHero)
// this.UpdateBattleHeroCapacity(lineupHero)
// this.RigComponent[component.ItemId] = component
// lineup.Heroes[i] = lineupHero
// switch proto.EquipType(component.Type) { }
// case proto.EquipTypeHead:
// this.Rig.Head = component.ItemId this.Lineup[lineup.Uid] = lineup
// this.SaveField("rig.head", this.Rig.Head) this.SaveModel(lineup)
// case proto.EquipTypeBody: }
// this.Rig.Body = component.ItemId
// this.SaveField("rig.body", this.Rig.Body)
// case proto.EquipTypeTail:
// this.Rig.Tail = component.ItemId
// this.SaveField("rig.tail", this.Rig.Tail)
// }
//
// this.SaveModel(component)
//
// this.CheckAchievement(proto.AchievementTypeComponents, 0, 1)
// }
// }
//
// func (this *Player) initCharacters(cur *GameTime) {
// var cfgTable = this.manager.tables.ServerCfg.Get("init_characters")
// if cfgTable == nil {
// return
// }
//
// itemPairs, err := util.SplitItemPairs(cfgTable.Value1, cfgTable.Value2, 1)
// if err != nil {
// return
// }
//
// var characterCount = 0
// var teams proto.Teams
// for _, itemPair := range itemPairs {
// var characterTable = this.manager.tables.RigCharacterExtend.Get(int(itemPair[0]), 1)
// if characterTable != nil {
// var characterStarTable = this.manager.tables.RigCharacterStarExtend.Get(int(itemPair[0]), 0)
// if characterStarTable != nil {
// var character = this.AddRigCharacter(characterTable, characterStarTable)
// if character != nil {
// if characterCount%proto.TeamNum == 0 {
// teams = append(teams, proto.Team{})
// }
// teams[len(teams)-1][characterCount%proto.TeamNum] = character.ItemId
// characterCount += 1
// }
// }
// }
// }
// if len(teams) > 0 {
// this.Rig.Teams = teams
// this.SaveField("rig.teams", this.Rig.Teams)
// }
// }
//
// func (this *Player) initMails(cur *GameTime) { // func (this *Player) initMails(cur *GameTime) {
// var cfgTable = this.manager.tables.ServerCfg.Get("init_mails") // var cfgTable = this.manager.tables.ServerCfg.Get("init_mails")
// if cfgTable == nil { // if cfgTable == nil {
@ -326,8 +280,7 @@ func (this *Player) checkCorrectFirstLogin(cur *GameTime) {
this.initRole(cur) this.initRole(cur)
this.initHeroes(cur) this.initHeroes(cur)
//this.initItems(cur) //this.initItems(cur)
//this.initComponents(cur) this.initLineup(cur)
//this.initCharacters(cur)
//this.initMails(cur) //this.initMails(cur)
//this.initTasks(cur) //this.initTasks(cur)
this.initPower(cur) this.initPower(cur)
@ -336,7 +289,7 @@ func (this *Player) checkCorrectFirstLogin(cur *GameTime) {
func (this *Player) checkCorrectMemoryData(cur *GameTime) { func (this *Player) checkCorrectMemoryData(cur *GameTime) {
this.initTemp() this.initTemp()
for _, hero := range this.Hero { for _, hero := range this.Hero {
this.updateHeroAttrs(hero) this.UpdateHeroAttrs(hero)
} }
} }

View File

@ -142,7 +142,7 @@ func (this *Player) AddEquips(equipId, nums uint32, logType LogType) {
// this.UpdateRigAttrs() // this.UpdateRigAttrs()
//} //}
func (this *Player) BuildMsgRigEquipListAck() *pb.EquipListAck { func (this *Player) BuildMsgEquipListAck() *pb.EquipListAck {
var list []*pb.Equip var list []*pb.Equip
for _, equip := range this.Equip { for _, equip := range this.Equip {
list = append(list, equip.BuildMsgEquip()) list = append(list, equip.BuildMsgEquip())

View File

@ -4,6 +4,7 @@ import (
"ecs/proto/pb" "ecs/proto/pb"
"ecs/servers/game/data" "ecs/servers/game/data"
"github.com/oylshe1314/framework/util" "github.com/oylshe1314/framework/util"
"slices"
) )
type Attrs [pb.AttrType_Nums]uint64 type Attrs [pb.AttrType_Nums]uint64
@ -39,7 +40,7 @@ func (this *PlayerHero) Attrs() Attrs {
return this.attrs return this.attrs
} }
func (this *Player) addHero(heroTable *data.Hero) bool { func (this *Player) newHero(heroTable *data.Hero) *PlayerHero {
var hero = &PlayerHero{ var hero = &PlayerHero{
Uid: util.RandomUid(), Uid: util.RandomUid(),
Id: uint32(heroTable.Id), Id: uint32(heroTable.Id),
@ -50,7 +51,7 @@ func (this *Player) addHero(heroTable *data.Hero) bool {
heroLevelTable = this.manager.tables.HeroLevel.Find3(heroTable.Id, 1) heroLevelTable = this.manager.tables.HeroLevel.Find3(heroTable.Id, 1)
if heroLevelTable == nil { if heroLevelTable == nil {
this.manager.logger.Errorf("Find hero level table failed, heroId %d, level: %d", heroTable.Id, 1) this.manager.logger.Errorf("Find hero level table failed, heroId %d, level: %d", heroTable.Id, 1)
return false return nil
} }
hero.Level = uint32(heroLevelTable.Level) hero.Level = uint32(heroLevelTable.Level)
} }
@ -60,7 +61,7 @@ func (this *Player) addHero(heroTable *data.Hero) bool {
heroBreakTable = this.manager.tables.HeroBreak.Find3(heroTable.Id, 0) heroBreakTable = this.manager.tables.HeroBreak.Find3(heroTable.Id, 0)
if heroBreakTable == nil { if heroBreakTable == nil {
this.manager.logger.Errorf("Find hero break table failed, heroId %d, level: %d", heroTable.Id, 1) this.manager.logger.Errorf("Find hero break table failed, heroId %d, level: %d", heroTable.Id, 1)
return false return nil
} }
hero.BreakLevel = uint32(heroBreakTable.BreakLevel) hero.BreakLevel = uint32(heroBreakTable.BreakLevel)
} }
@ -69,11 +70,7 @@ func (this *Player) addHero(heroTable *data.Hero) bool {
//Awaken //Awaken
this.Hero[hero.Uid] = hero return hero
this.SaveModel(hero)
this.addHeroBook(hero.Id)
return true
} }
func (this *Player) AddHero(heroId uint32) bool { func (this *Player) AddHero(heroId uint32) bool {
@ -83,7 +80,16 @@ func (this *Player) AddHero(heroId uint32) bool {
return false return false
} }
return this.addHero(heroTable) var hero = this.newHero(heroTable)
if hero == nil {
return false
}
this.Hero[hero.Uid] = hero
this.SaveModel(hero)
this.addHeroBook(hero.Id)
return true
} }
func (this *Player) calcHeroLevelAttrs(hero *PlayerHero) (attrs Attrs) { func (this *Player) calcHeroLevelAttrs(hero *PlayerHero) (attrs Attrs) {
@ -120,84 +126,10 @@ func (this *Player) calcHeroBreakAttrs(hero *PlayerHero) (attrs Attrs) {
return return
} }
func (this *Player) calcHeroBondAttrs(hero *PlayerHero) (attrs Attrs) {
//var heroBondTables = this.manager.tables.HeroBond.Find(int(hero.Id))
//for i := range heroBondTables {
// var yes = false
// switch heroBondTables[i].BondType {
// case 1: //装备
// for _, equipUid := range hero.Equips {
// if equipUid == 0 {
// continue
// }
// if equip, ok := this.Equip[equipUid]; ok && slices.Contains(heroBondTables[i].BondId, int(equip.Id)) {
// yes = true
// break
// }
// }
// case 2: //宝物
// for _, treasureUid := range hero.Treasures {
// if treasureUid == 0 {
// continue
// }
// if treasure, ok := this.Treasure[treasureUid]; ok && slices.Contains(heroBondTables[i].BondId, int(treasure.Id)) {
// yes = true
// break
// }
// }
// case 3: //神兵
// for _, artifactUid := range hero.Artifact {
// if artifactUid == 0 {
// continue
// }
// if artifact, ok := this.Artifact[artifactUid]; ok && slices.Contains(heroBondTables[i].BondId, int(artifact.Id)) {
// yes = true
// break
// }
// }
// case 4: //英雄
//
// }
// if yes {
// attrs[heroBondTables[i].AttrType1] += uint64(heroBondTables[i].AttrValue1)
// attrs[heroBondTables[i].AttrType2] += uint64(heroBondTables[i].AttrValue2)
// attrs[heroBondTables[i].AttrType3] += uint64(heroBondTables[i].AttrValue3)
// }
//}
return
}
func (this *Player) calcHeroAwakenAttrs(hero *PlayerHero) (attrs Attrs) { func (this *Player) calcHeroAwakenAttrs(hero *PlayerHero) (attrs Attrs) {
return return
} }
func (this *Player) calcHeroEquipsAttrs(hero *PlayerHero) (attrs Attrs) {
//for _, equipUid := range hero.Equips {
// if equipUid == 0 {
// continue
// }
//
// var equip = this.Equip[equipUid]
// var equipLevelTable = this.manager.tables.EquipLevel.Find3(int(equip.Id), int(equip.Level))
// if equipLevelTable != nil {
// attrs[equipLevelTable.AttrType] += uint64(equipLevelTable.AttrValue)
// }
//}
return
}
func (this *Player) calcHeroTreasuresAttrs(hero *PlayerHero) (attrs Attrs) {
return
}
func (this *Player) calcHeroMountsAttrs(hero *PlayerHero) (attrs Attrs) {
return
}
func (this *Player) calcHeroArtifactAttrs(hero *PlayerHero) (attrs Attrs) {
return
}
func (this *Player) calcHeroBookAttrs(hero *PlayerHero) (attrs Attrs) { func (this *Player) calcHeroBookAttrs(hero *PlayerHero) (attrs Attrs) {
var heroBook = this.HeroBook[hero.Id] var heroBook = this.HeroBook[hero.Id]
if heroBook == nil { if heroBook == nil {
@ -221,6 +153,122 @@ func (this *Player) calcHeroBookAttrs(hero *PlayerHero) (attrs Attrs) {
return return
} }
func (this *Player) calcHeroBondAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) (attrs Attrs) {
if lineup == nil || lineupHero == nil {
return
}
var heroBondTables = this.manager.tables.HeroBond.Find(int(hero.Id))
for i := range heroBondTables {
var yes = false
switch heroBondTables[i].BondType {
case 1: //装备
for _, equipUid := range lineupHero.Equip {
if equipUid == 0 {
continue
}
if equip, ok := this.Equip[equipUid]; ok && slices.Contains(heroBondTables[i].BondId, int(equip.Id)) {
yes = true
break
}
}
case 2: //宝物
for _, treasureUid := range lineupHero.Treasure {
if treasureUid == 0 {
continue
}
if treasure, ok := this.Treasure[treasureUid]; ok && slices.Contains(heroBondTables[i].BondId, int(treasure.Id)) {
yes = true
break
}
}
case 3: //神兵
for _, artifactUid := range lineupHero.Artifact {
if artifactUid == 0 {
continue
}
if artifact, ok := this.Artifact[artifactUid]; ok && slices.Contains(heroBondTables[i].BondId, int(artifact.Id)) {
yes = true
break
}
}
case 4: //英雄
var bondIdMap = map[int]struct{}{}
for _, bondId := range heroBondTables[i].BondId {
bondIdMap[bondId] = struct{}{}
}
for lhi := range lineup.Heroes {
if lineup.Heroes[i] == nil {
continue
}
if another, ok := this.Hero[lineup.Heroes[lhi].HeroUid]; ok {
delete(bondIdMap, int(another.Id))
}
}
//所有羁绊英雄要全部上阵
yes = len(bondIdMap) == 0
}
if yes {
attrs[heroBondTables[i].AttrType1] += uint64(heroBondTables[i].AttrValue1)
attrs[heroBondTables[i].AttrType2] += uint64(heroBondTables[i].AttrValue2)
attrs[heroBondTables[i].AttrType3] += uint64(heroBondTables[i].AttrValue3)
}
}
return
}
func (this *Player) calcHeroEquipsAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) (attrs Attrs) {
if lineup == nil || lineupHero == nil {
return
}
for _, equipUid := range lineupHero.Equip {
if equipUid == 0 {
continue
}
var equip = this.Equip[equipUid]
var equipLevelTable = this.manager.tables.EquipLevel.Find3(int(equip.Id), int(equip.Level))
if equipLevelTable != nil {
attrs[equipLevelTable.AttrType] += uint64(equipLevelTable.AttrValue)
}
}
return
}
func (this *Player) calcHeroTreasuresAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) (attrs Attrs) {
if lineup == nil || lineupHero == nil {
return
}
for _, treasureUid := range lineupHero.Treasure {
if treasureUid == 0 {
continue
}
var treasure = this.Treasure[treasureUid]
var equipLevelTable = this.manager.tables.TreasureLevel.Find3(int(treasure.Id), int(treasure.Level))
if equipLevelTable != nil {
attrs[equipLevelTable.AttrType] += uint64(equipLevelTable.AttrValue)
}
}
return
}
func (this *Player) calcHeroMountsAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) (attrs Attrs) {
if lineup == nil || lineupHero == nil {
return
}
return
}
func (this *Player) calcHeroArtifactAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) (attrs Attrs) {
if lineup == nil || lineupHero == nil {
return
}
return
}
func (this *Player) calcHeroAttrs(hero *PlayerHero, attrsList ...Attrs) bool { func (this *Player) calcHeroAttrs(hero *PlayerHero, attrsList ...Attrs) bool {
var newAttrs Attrs var newAttrs Attrs
for _, attrs := range attrsList { for _, attrs := range attrsList {
@ -239,26 +287,40 @@ func (this *Player) calcHeroAttrs(hero *PlayerHero, attrsList ...Attrs) bool {
return false return false
} }
func (this *Player) updateHeroAttrs(hero *PlayerHero) bool { func (this *Player) updateHeroAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) bool {
return this.calcHeroAttrs(hero, return this.calcHeroAttrs(hero,
this.calcHeroLevelAttrs(hero), this.calcHeroLevelAttrs(hero),
this.calcHeroBreakAttrs(hero), this.calcHeroBreakAttrs(hero),
this.calcHeroBondAttrs(hero),
this.calcHeroAwakenAttrs(hero), this.calcHeroAwakenAttrs(hero),
this.calcHeroEquipsAttrs(hero),
this.calcHeroTreasuresAttrs(hero),
this.calcHeroMountsAttrs(hero),
this.calcHeroArtifactAttrs(hero),
this.calcHeroBookAttrs(hero), this.calcHeroBookAttrs(hero),
this.calcHeroBondAttrs(hero, lineup, lineupHero),
this.calcHeroEquipsAttrs(hero, lineup, lineupHero),
this.calcHeroTreasuresAttrs(hero, lineup, lineupHero),
this.calcHeroMountsAttrs(hero, lineup, lineupHero),
this.calcHeroArtifactAttrs(hero, lineup, lineupHero),
) )
} }
func (this *Player) UpdateHeroAttrs(hero *PlayerHero) bool { func (this *Player) UpdateHeroAttrs(hero *PlayerHero) bool {
return this.updateHeroAttrs(hero) if hero == nil {
return false
}
for _, lineup := range this.Lineup {
if lineup.Active {
for _, lineupHero := range lineup.Heroes {
if lineupHero.HeroUid == hero.Uid {
return this.updateHeroAttrs(hero, lineup, lineupHero)
}
}
}
}
return this.updateHeroAttrs(hero, nil, nil)
} }
func (this *Player) BuildMsgHeroListAck() *pb.HeroListAck { func (this *Player) BuildMsgHeroListAck() *pb.HeroListAck {
var list []*pb.Hero var list = []*pb.Hero{this.RoleHero.BuildMsgHero()}
for _, hero := range this.Hero { for _, hero := range this.Hero {
list = append(list, hero.BuildMsgHero()) list = append(list, hero.BuildMsgHero())
} }

View File

@ -35,7 +35,7 @@ func (this *Player) addItem(itemTable *data.Item, itemNum uint32, logType LogTyp
// this.manager.eventManager.PlayerItemObtain(this, logType, uint32(itemTable.Id), itemNum) // this.manager.eventManager.PlayerItemObtain(this, logType, uint32(itemTable.Id), itemNum)
//} //}
return &pb.ItemChange{Item: item.BuildMsgItem(), ChangeType: changeType} return &pb.ItemChange{ChangeType: changeType, Item: item.BuildMsgItem()}
} }
func (this *Player) useItem(itemTable *data.Item, itemNum uint32, logType LogType) bool { func (this *Player) useItem(itemTable *data.Item, itemNum uint32, logType LogType) bool {

View File

@ -38,3 +38,34 @@ func (this *PlayerLineupHero) BuildMsgLineupHero(index uint32) *pb.LineupHero {
} }
return msg return msg
} }
func (this *Player) UpdateBattleHeroCapacity(lineupHero *PlayerLineupHero) {
if lineupHero == nil {
return
}
var hero = this.Hero[lineupHero.HeroUid]
if hero == nil {
return
}
var attrs = hero.Attrs()
var capacity = (float64(attrs[pb.AttrType_Attack]) * 2) +
(float64(attrs[pb.AttrType_Hp]) * 0.2) +
(float64(attrs[pb.AttrType_AttrPhysicalDefense]) * 6) +
(float64(attrs[pb.AttrType_AttrMagicDefense]) * 6) +
(float64(attrs[pb.AttrType_AttrDamageRatio]) * 12) +
(float64(attrs[pb.AttrType_AttrDamageRelief]) * 12) +
(float64(attrs[pb.AttrType_AttrCriticalRatio]) * 12) +
(float64(attrs[pb.AttrType_AttrCriticalResistance]) * 12) +
(float64(attrs[pb.AttrType_AttrCriticalDamage]) * 12) +
(float64(attrs[pb.AttrType_AttrCriticalDamageRelief]) * 12) +
(float64(attrs[pb.AttrType_AttrHitRate]) * 12) +
(float64(attrs[pb.AttrType_AttrDodgeRate]) * 12) +
(float64(attrs[pb.AttrType_AttrTreatRatio]) * 12) +
(float64(attrs[pb.AttrType_AttrByTreatedRatio]) * 12) +
(float64(attrs[pb.AttrType_AttrFinalDamageRatio]) * 12)
lineupHero.Capacity = uint64(capacity)
}

View File

@ -27,7 +27,7 @@ func (this *Player) GetMoney(moneyType pb.MoneyType) *PlayerMoney {
func (this *Player) AddMoney(moneyType pb.MoneyType, value uint32, logType LogType) { func (this *Player) AddMoney(moneyType pb.MoneyType, value uint32, logType LogType) {
switch moneyType { switch moneyType {
case pb.MoneyType_Exp: case pb.MoneyType_Exp:
//this.addExp(value, logType) this.addExp(value, logType)
case pb.MoneyType_Power: case pb.MoneyType_Power:
this.addPower(value, logType) this.addPower(value, logType)
default: default:
@ -51,6 +51,8 @@ func (this *Player) CheckMoney(moneyType pb.MoneyType, value uint32) (bool, prot
func (this *Player) ReduceMoney(moneyType pb.MoneyType, value uint32, logType LogType) { func (this *Player) ReduceMoney(moneyType pb.MoneyType, value uint32, logType LogType) {
switch moneyType { switch moneyType {
case pb.MoneyType_Exp:
return
case pb.MoneyType_Power: case pb.MoneyType_Power:
this.reducePower(value, logType) this.reducePower(value, logType)
default: default:
@ -102,45 +104,49 @@ func (this *Player) reduceMoney(moneyType pb.MoneyType, value uint32, logType Lo
//} //}
} }
//func (this *Player) addExp(value uint32, logType LogType) { func (this *Player) addExp(value uint32, logType LogType) {
// if value == 0 { if value == 0 {
// return return
// } }
//
// var money = this.GetMoney(proto.MoneyTypeExp) var roleHero = this.RoleHero
// money.Value += value if roleHero == nil {
// return
// var curLevel = this.Role.Level }
// //for {
// // var roleLevelTable = this.manager.tables.RoleLevelExtend.Get(int(this.Role.Career), int(this.Role.Level)) var curExp = roleHero.Exp + uint64(value)
// // if roleLevelTable == nil { var curLevel = roleHero.Level
// // return for {
// // } var heroLevelTable = this.manager.tables.HeroLevel.Find3(int(roleHero.Id), int(curLevel))
// // if heroLevelTable == nil {
// // if money.Value < uint32(roleLevelTable.RequireExp) { return
// // break }
// // }
// // if curExp < uint64(heroLevelTable.NeedExp) {
// // curLevel += 1 break
// // money.Value -= uint32(roleLevelTable.RequireExp) }
// //}
// curLevel += 1
// this.SaveModel(money) curExp -= uint64(heroLevelTable.NeedExp)
// }
// _ = this.Send(proto.ModIdRole, proto.MsgIdRoleMoneyChange, &proto.MsgRoleMoneyListAck{List: []*proto.RoleMoney{money.BuildMsgMoney()}})
// roleHero.Exp = curExp
// if curLevel != this.Role.Level { roleHero.Level = curLevel
// var preLevel = this.Role.Level this.SaveModel(roleHero)
// this.ChangeProperty(util.NewPair(proto.RolePropertyTypeLevel, uint64(curLevel)))
// if logType != LogTypeNone { this.RoleExp = roleHero.Exp
// this.manager.eventManager.PlayerLevelUpgrade(this, logType, preLevel, curLevel) this.RoleLevel = roleHero.Level
// } this.SaveField("role_exp", this.RoleExp)
// } this.SaveField("role_level", this.RoleLevel)
//
_ = this.Send(uint16(pb.MsgId_ModHeroChange), uint16(pb.MsgId_ModHeroChange), &pb.HeroChangeListAck{
ChangeList: []*pb.HeroChange{{ChangeType: pb.ChangeType_Changed, Hero: roleHero.BuildMsgHero()}},
})
//if logType != LogTypeNone { //if logType != LogTypeNone {
// this.manager.eventManager.PlayerMoneyObtain(this, logType, uint32(proto.MoneyTypeExp), value, money.Value) // this.manager.eventManager.PlayerMoneyObtain(this, logType, uint32(proto.MoneyTypeExp), value, money.Value)
//} //}
//} }
func (this *Player) addPower(value uint32, logType LogType) { func (this *Player) addPower(value uint32, logType LogType) {
var money = this.GetMoney(pb.MoneyType_Power) var money = this.GetMoney(pb.MoneyType_Power)

View File

@ -21,7 +21,6 @@ func (this *Player) BuildMsgRolePropertyAck() *pb.RolePropertyAck {
NamePrefix: this.NamePrefix, NamePrefix: this.NamePrefix,
NameTitle: this.NameTitle, NameTitle: this.NameTitle,
RoleTitle: this.RoleTitle, RoleTitle: this.RoleTitle,
RoleLevel: this.RoleLevel,
LoginDays: this.LoginDays, LoginDays: this.LoginDays,
PowerNextTime: this.PowerNextTime, PowerNextTime: this.PowerNextTime,
} }
@ -50,9 +49,6 @@ func (this *Player) ChangeProperty(properties ...*util.Pair[pb.RolePropertyType,
case pb.RolePropertyType_RoleTitle: case pb.RolePropertyType_RoleTitle:
this.RoleTitle = uint32(property.Value) this.RoleTitle = uint32(property.Value)
this.SaveField("role_title", this.RoleTitle) this.SaveField("role_title", this.RoleTitle)
case pb.RolePropertyType_RoleLevel:
this.RoleLevel = uint32(property.Value)
this.SaveField("role_level", this.RoleLevel)
case pb.RolePropertyType_LoginDays: case pb.RolePropertyType_LoginDays:
this.LoginDays = uint32(property.Value) this.LoginDays = uint32(property.Value)
this.SaveField("login_days", this.LoginDays) this.SaveField("login_days", this.LoginDays)
@ -82,8 +78,6 @@ func (this *Player) BuildMsgRolePropertyChangeAck(types ...pb.RolePropertyType)
property.Value = int64(this.NameTitle) property.Value = int64(this.NameTitle)
case pb.RolePropertyType_RoleTitle: case pb.RolePropertyType_RoleTitle:
property.Value = int64(this.RoleTitle) property.Value = int64(this.RoleTitle)
case pb.RolePropertyType_RoleLevel:
property.Value = int64(this.RoleLevel)
case pb.RolePropertyType_LoginDays: case pb.RolePropertyType_LoginDays:
property.Value = int64(this.LoginDays) property.Value = int64(this.LoginDays)
case pb.RolePropertyType_PowerNextTime: case pb.RolePropertyType_PowerNextTime:

View File

@ -18,7 +18,7 @@ type PlayerTemp struct {
SceneId uint32 SceneId uint32
Fighting bool Fighting bool
RandSeed int64 RandSeed uint64
//ArenaEnemy *RankingPlayer //ArenaEnemy *RankingPlayer

View File

@ -5,6 +5,7 @@ import "ecs/proto/pb"
type PlayerTreasure struct { type PlayerTreasure struct {
Uid uint64 `bson:"uid" key:"1"` Uid uint64 `bson:"uid" key:"1"`
Id uint32 `bson:"id"` Id uint32 `bson:"id"`
Level uint32 `bson:"level"`
HeroUid uint64 `bson:"hero_id"` HeroUid uint64 `bson:"hero_id"`
} }
@ -16,7 +17,7 @@ func (this *PlayerTreasure) BuildMsgTreasure() *pb.Treasure {
} }
} }
func (this *Player) BuildMsgRigTreasureListAck() *pb.TreasureListAck { func (this *Player) BuildMsgTreasureListAck() *pb.TreasureListAck {
var list []*pb.Treasure var list []*pb.Treasure
for _, treasure := range this.Treasure { for _, treasure := range this.Treasure {
list = append(list, treasure.BuildMsgTreasure()) list = append(list, treasure.BuildMsgTreasure())

View File

@ -205,8 +205,9 @@ func (this *gameServer) Init() (err error) {
this.playerManager.Handler(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroQuality), this.playerHandler.HeroQuality) this.playerManager.Handler(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroQuality), this.playerHandler.HeroQuality)
this.playerManager.Handler(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroBookActivate), this.playerHandler.HeroBookActivate) this.playerManager.Handler(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroBookActivate), this.playerHandler.HeroBookActivate)
//Register player mail module message handlers //Register player item module message handlers
this.playerManager.Handler(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipUpgrade), this.playerHandler.EquipUpgrade) this.playerManager.Handler(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipUpgrade), this.playerHandler.EquipUpgrade)
this.playerManager.Handler(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipRefine), this.playerHandler.EquipRefine)
////Register player mail module message handlers ////Register player mail module message handlers
//this.playerManager.Handler(proto.ModIdMail, proto.MsgIdMailRead, this.playerHandler.MailRead) //this.playerManager.Handler(proto.ModIdMail, proto.MsgIdMailRead, this.playerHandler.MailRead)