Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c3913c609f
@ -91,7 +91,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
|
||||
}
|
||||
}
|
||||
|
||||
mapData["challengeTime"] = enchant.BossTime
|
||||
mapData["bossTime"] = enchant.BossTime
|
||||
mapData["boss"] = enchant.Boss
|
||||
code = this.module.ModifyEnchantData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant})
|
||||
|
@ -52,13 +52,11 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
||||
}
|
||||
value, ok := hunting.Boss[req.BossType]
|
||||
if !ok { // 类型校验
|
||||
hunting.Boss[req.BossType] = 0
|
||||
hunting.Boss[req.BossType] = 1
|
||||
}
|
||||
if value < req.Difficulty {
|
||||
if value+1 != req.Difficulty {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
return
|
||||
}
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
return
|
||||
}
|
||||
|
||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
|
@ -61,14 +61,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
}
|
||||
value, ok := hunting.Boss[req.BossType]
|
||||
if !ok { // 类型校验
|
||||
hunting.Boss[req.BossType] = 0
|
||||
hunting.Boss[req.BossType] = 1
|
||||
}
|
||||
if value < req.Difficulty {
|
||||
if value+1 != req.Difficulty {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
return
|
||||
}
|
||||
if value == req.Difficulty {
|
||||
|
||||
newChallenge = true
|
||||
} else if value < req.Difficulty {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
return
|
||||
}
|
||||
// 校验门票数量够不够
|
||||
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{costRes}, true); code != pb.ErrorCode_Success {
|
||||
@ -104,10 +104,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
mapData["boss"] = hunting.Boss
|
||||
|
||||
}
|
||||
for k := range hunting.Boss {
|
||||
hunting.Boss[k] += 1
|
||||
}
|
||||
mapData["challengeTime"] = hunting.BossTime
|
||||
|
||||
mapData["bossTime"] = hunting.BossTime
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting})
|
||||
|
||||
|
@ -51,8 +51,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
iCont := conf.EnchantbossInitial
|
||||
atn := conf.EnchantbossCos
|
||||
iCont := conf.HuntingNum
|
||||
atn := conf.HuntingCos
|
||||
if iCont > 0 {
|
||||
|
||||
this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{
|
||||
|
@ -173,9 +173,7 @@ func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (code pb.ErrorC
|
||||
}
|
||||
mapData["boss"] = list.Boss
|
||||
code = this.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
for k := range list.Boss {
|
||||
list.Boss[k] += 1
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})
|
||||
return
|
||||
}
|
||||
|
@ -2,11 +2,14 @@ package viking
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/utils"
|
||||
"strconv"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
@ -28,9 +31,36 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq
|
||||
}
|
||||
|
||||
list, err := this.module.modelViking.getVikingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
if mgo.MongodbNil == err {
|
||||
list = &pb.DBViking{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
Boss: make(map[int32]int32),
|
||||
BossTime: make(map[string]int32),
|
||||
}
|
||||
_cfg := this.module.configure.GetVikingBossTypeConfigData()
|
||||
for k := range _cfg {
|
||||
list.Boss[k] = 0
|
||||
str := strconv.Itoa(int(k)) + "_1"
|
||||
list.BossTime[str] = 0
|
||||
}
|
||||
|
||||
this.module.modelViking.Add(session.GetUserId(), list)
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
iCont := conf.VikingNum
|
||||
atn := conf.VikingExpeditionCos
|
||||
if iCont > 0 {
|
||||
|
||||
this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{
|
||||
A: atn.A,
|
||||
T: atn.T,
|
||||
N: iCont,
|
||||
}}, true)
|
||||
}
|
||||
}
|
||||
|
||||
// 校验 是不是当天
|
||||
|
@ -3,10 +3,8 @@ package viking
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"strconv"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
@ -36,21 +34,11 @@ func (this *modelViking) getVikingList(uid string) (result *pb.DBViking, err err
|
||||
Boss: make(map[int32]int32),
|
||||
BossTime: make(map[string]int32),
|
||||
}
|
||||
if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err {
|
||||
if err = this.Get(uid, result); err != nil {
|
||||
|
||||
return
|
||||
}
|
||||
if mgo.MongodbNil == err {
|
||||
if len(result.Boss) == 0 {
|
||||
_cfg := this.module.configure.GetVikingBossTypeConfigData()
|
||||
for k := range _cfg {
|
||||
result.Boss[k] = 0
|
||||
str := strconv.Itoa(int(k)) + "_1"
|
||||
result.BossTime[str] = 0
|
||||
}
|
||||
}
|
||||
this.Add(uid, result)
|
||||
}
|
||||
|
||||
err = nil
|
||||
return result, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user