练功改跨服
This commit is contained in:
parent
fd097b5784
commit
9c11102b5a
@ -324,10 +324,29 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf
|
|||||||
newhero *pb.DBHero
|
newhero *pb.DBHero
|
||||||
_changeHero []*pb.DBHero // 变化的英雄
|
_changeHero []*pb.DBHero // 变化的英雄
|
||||||
)
|
)
|
||||||
|
if this.IsCross() {
|
||||||
|
for _, tag := range db.GetServerTags() {
|
||||||
|
conn, err1 := db.ServerDBConn(tag) // 遍历连接对象
|
||||||
|
if err1 != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
sr := conn.Mgo.FindOne(comm.TableHero, bson.M{
|
||||||
|
"_id": heroObjID,
|
||||||
|
})
|
||||||
|
_hero = &pb.DBHero{}
|
||||||
|
if err := sr.Decode(_hero); err != nil {
|
||||||
|
this.modelHero.moduleHero.Errorf("find hero error: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID)
|
_hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID)
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if bKongfu && _hero.Status == pb.HeroType_HeroTypeKongFu {
|
if bKongfu && _hero.Status == pb.HeroType_HeroTypeKongFu {
|
||||||
code = pb.ErrorCode_HeroAlreadyKongFuStatus // 已经是练功状态
|
code = pb.ErrorCode_HeroAlreadyKongFuStatus // 已经是练功状态
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user