附魔boss 字段修改
This commit is contained in:
parent
5aedd33442
commit
08dfb99e03
@ -75,6 +75,7 @@ const (
|
||||
ModuleWorldtask core.M_Modules = "worldtask" //世界任务
|
||||
ModuleReddot core.M_Modules = "reddot" //红点
|
||||
ModuleCombat core.M_Modules = "combat" //关卡编辑
|
||||
ModuleEnchant core.M_Modules = "enchant" //附魔
|
||||
)
|
||||
|
||||
//数据表名定义处
|
||||
@ -203,6 +204,9 @@ const (
|
||||
TableCombat = "combat"
|
||||
/// vip
|
||||
TableVip = "vip"
|
||||
|
||||
TableEnchantRank = "enchantRank"
|
||||
TableEnchant = "enchant"
|
||||
)
|
||||
|
||||
//RPC服务接口定义处
|
||||
|
@ -20,7 +20,7 @@ type apiComp struct {
|
||||
modules.MCompGate
|
||||
service core.IService
|
||||
configure *configureComp
|
||||
module *Hunting
|
||||
module *Enchant
|
||||
friend comm.IFriend
|
||||
chat comm.IChat
|
||||
}
|
||||
@ -28,7 +28,7 @@ type apiComp struct {
|
||||
//组件初始化接口
|
||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.MCompGate.Init(service, module, comp, options)
|
||||
this.module = module.(*Hunting)
|
||||
this.module = module.(*Enchant)
|
||||
|
||||
this.service = service
|
||||
return
|
||||
|
@ -33,7 +33,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
list, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
list, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
@ -130,7 +130,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code
|
||||
}
|
||||
list.BuyCount = curByCount
|
||||
mapData["buyCount"] = curByCount
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
code = this.module.ModifyEnchantData(session.GetUserId(), mapData)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), HuntingBuyResp, &pb.HuntingBuyResp{Data: list})
|
||||
return
|
||||
|
@ -25,7 +25,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
hunting, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
return
|
||||
@ -44,11 +44,8 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
||||
code = pb.ErrorCode_HuntingNoChallengeCount
|
||||
return
|
||||
}
|
||||
// if hunting.ChallengeCount > this.module.configure.GetGlobalConf().HuntingNum+hunting.BuyCount {
|
||||
// code = pb.ErrorCode_HuntingMaxChallengeCount
|
||||
// return
|
||||
// }
|
||||
cfgData := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty)
|
||||
|
||||
cfgData := this.module.configure.GetEnchantBossConfigData(req.BossType)
|
||||
if cfgData == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
@ -71,7 +68,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
||||
Leadpos: req.Leadpos,
|
||||
Format: req.Teamids,
|
||||
},
|
||||
Mformat: cfgData.Boss,
|
||||
//Mformat: cfgData.Boss,
|
||||
})
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
|
@ -21,19 +21,19 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Hunti
|
||||
///挑战主线关卡
|
||||
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingChallengeOverReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
mapData map[string]interface{}
|
||||
newChallenge bool // 新的关卡
|
||||
reward []*cfg.Gameatn
|
||||
bWin bool // 战斗是否胜利
|
||||
mapData map[string]interface{}
|
||||
// newChallenge bool // 新的关卡
|
||||
// reward []*cfg.Gameatn
|
||||
bWin bool // 战斗是否胜利
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
reward = make([]*cfg.Gameatn, 0)
|
||||
// reward = make([]*cfg.Gameatn, 0)
|
||||
code = this.ChallengeOverCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
hunting, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
return
|
||||
@ -54,7 +54,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
return
|
||||
}
|
||||
|
||||
cfgHunting := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty)
|
||||
cfgHunting := this.module.configure.GetEnchantBossConfigData(req.BossType)
|
||||
if cfgHunting == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
@ -68,7 +68,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
return
|
||||
}
|
||||
newChallenge = true
|
||||
//newChallenge = true
|
||||
}
|
||||
// 校验门票数量够不够
|
||||
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{costRes}, true); code != pb.ErrorCode_Success {
|
||||
@ -92,28 +92,22 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
|
||||
|
||||
// 发放通关随机奖励
|
||||
reward = this.module.configure.GetDropReward(cfgHunting.Drop) // 获取掉落奖励
|
||||
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
|
||||
if code = this.module.DispenseRes(session, cfgHunting.Firstprize, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
hunting.Boss[req.BossType] += 1
|
||||
mapData["boss"] = hunting.Boss
|
||||
// reward = this.module.configure.GetDropReward(cfgHunting.) // 获取掉落奖励
|
||||
// if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
|
||||
// return
|
||||
// }
|
||||
// if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
|
||||
// if code = this.module.DispenseRes(session, cfgHunting.Firstprize, true); code != pb.ErrorCode_Success {
|
||||
// return
|
||||
// }
|
||||
// hunting.Boss[req.BossType] += 1
|
||||
// mapData["boss"] = hunting.Boss
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
for k := range hunting.Boss {
|
||||
hunting.Boss[k] += 1
|
||||
}
|
||||
mapData["challengeTime"] = hunting.BossTime
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
code = this.module.ModifyEnchantData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting})
|
||||
|
||||
// 随机任务统计
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype81, req.Difficulty, req.BossType)
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype82, req.BossType)
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
list, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
list, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
@ -85,7 +85,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe
|
||||
list.RecoveryTime = 0
|
||||
}
|
||||
mapData["recoveryTime"] = list.RecoveryTime
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData) //修改内存信息
|
||||
code = this.module.ModifyEnchantData(session.GetUserId(), mapData) //修改内存信息
|
||||
// 发送难度
|
||||
for k := range list.Boss {
|
||||
list.Boss[k] += 1
|
||||
|
@ -28,7 +28,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.HuntingRankList
|
||||
}
|
||||
if !req.Friend {
|
||||
var (
|
||||
pipe *pipe.RedisPipe = this.module.modelHunting.Redis.RedisPipe(context.TODO())
|
||||
pipe *pipe.RedisPipe = this.module.modelEnchant.Redis.RedisPipe(context.TODO())
|
||||
)
|
||||
rd = pipe.ZRange("huntingRank"+strconv.Itoa(int(req.BoosType)), 0, -1)
|
||||
|
||||
@ -47,7 +47,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.HuntingRankList
|
||||
} else {
|
||||
uids := this.friend.GetFriendList(session.GetUserId())
|
||||
for _, id := range uids {
|
||||
rankData := this.module.modulerank.getHuntingRankListByBossType(id, req.BoosType)
|
||||
rankData := this.module.modulerank.getEnchantRankListByBossType(id, req.BoosType)
|
||||
if rankData != nil {
|
||||
szRank = append(szRank, rankData)
|
||||
}
|
||||
|
@ -10,45 +10,45 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
game_huntingboss = "game_huntingboss.json"
|
||||
game_challenge = "game_huntingchallenge.json"
|
||||
game_enchantboss = "game_enchantboss.json"
|
||||
game_enchantshop = "game_enchantshop.json"
|
||||
)
|
||||
|
||||
///配置管理基础组件
|
||||
type configureComp struct {
|
||||
hlock sync.RWMutex
|
||||
modules.MCompConfigure
|
||||
_huntingMap map[int64]*cfg.GameHuntingBossData
|
||||
_enchantMap map[int32][]*cfg.GameEnchantBossData
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||
|
||||
this._huntingMap = make(map[int64]*cfg.GameHuntingBossData, 0)
|
||||
configure.RegisterConfigure(game_huntingboss, cfg.NewGameHuntingBoss, func() {
|
||||
if v, err := this.GetConfigure(game_huntingboss); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingBoss); ok {
|
||||
this._enchantMap = make(map[int32][]*cfg.GameEnchantBossData, 0)
|
||||
configure.RegisterConfigure(game_enchantboss, cfg.NewGameEnchantBoss, func() {
|
||||
if v, err := this.GetConfigure(game_enchantboss); err == nil {
|
||||
if configure, ok := v.(*cfg.GameEnchantBoss); ok {
|
||||
this.hlock.Lock()
|
||||
defer this.hlock.Unlock()
|
||||
for _, value := range configure.GetDataList() {
|
||||
this._huntingMap[int64(value.Type<<16)+int64(value.Difficulty)] = value
|
||||
this._enchantMap[value.Bossid] = append(this._enchantMap[value.Bossid], value)
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_huntingboss conf err:%v", err)
|
||||
log.Errorf("get game_enchantboss conf err:%v", err)
|
||||
}
|
||||
return
|
||||
})
|
||||
err = this.LoadConfigure(game_challenge, cfg.NewGameHuntingChallenge)
|
||||
err = this.LoadConfigure(game_enchantshop, cfg.NewGameEnchantShop)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数: boss类型 难度
|
||||
func (this *configureComp) GetHuntingBossConfigData(bossType int32, difficulty int32) (data *cfg.GameHuntingBossData) {
|
||||
func (this *configureComp) GetEnchantBossConfigData(bossId int32) (data []*cfg.GameEnchantBossData) {
|
||||
|
||||
return this._huntingMap[int64(bossType<<16)+int64(difficulty)]
|
||||
return this._enchantMap[bossId]
|
||||
}
|
||||
|
||||
//加载多个配置文件
|
||||
@ -69,16 +69,16 @@ func (this *configureComp) GetConfigure(name string) (v interface{}, err error)
|
||||
}
|
||||
|
||||
// get boss Type
|
||||
func (this *configureComp) GetHuntingBossTypeConfigData() (mapType map[int32]struct{}) {
|
||||
func (this *configureComp) GetEnchantBossTypeConfigData() (mapType map[int32]struct{}) {
|
||||
|
||||
mapType = make(map[int32]struct{}, 0)
|
||||
if v, err := this.GetConfigure(game_huntingboss); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingBoss); ok {
|
||||
if v, err := this.GetConfigure(game_enchantboss); err == nil {
|
||||
if configure, ok := v.(*cfg.GameEnchantBoss); ok {
|
||||
this.hlock.Lock()
|
||||
defer this.hlock.Unlock()
|
||||
for _, value := range configure.GetDataList() {
|
||||
if _, ok := mapType[value.Type]; !ok {
|
||||
mapType[value.Type] = struct{}{}
|
||||
if _, ok := mapType[value.Bossid]; !ok {
|
||||
mapType[value.Bossid] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,9 +87,9 @@ func (this *configureComp) GetHuntingBossTypeConfigData() (mapType map[int32]str
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetBuyChallengeCount(index int32) (data *cfg.GameHuntingChallengeData) {
|
||||
if v, err := this.GetConfigure(game_challenge); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingChallenge); ok {
|
||||
func (this *configureComp) GetBuyChallengeCount(index int32) (data *cfg.GameEnchantShopData) {
|
||||
if v, err := this.GetConfigure(game_enchantshop); err == nil {
|
||||
if configure, ok := v.(*cfg.GameEnchantShop); ok {
|
||||
data = configure.Get(index)
|
||||
return
|
||||
}
|
||||
@ -100,8 +100,8 @@ func (this *configureComp) GetBuyChallengeCount(index int32) (data *cfg.GameHunt
|
||||
return
|
||||
}
|
||||
func (this *configureComp) GetMaxBuyChallengeCount() int32 {
|
||||
if v, err := this.GetConfigure(game_challenge); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingChallenge); ok {
|
||||
if v, err := this.GetConfigure(game_enchantshop); err == nil {
|
||||
if configure, ok := v.(*cfg.GameEnchantShop); ok {
|
||||
return int32(len(configure.GetDataList()))
|
||||
}
|
||||
} else {
|
||||
|
@ -13,15 +13,15 @@ import (
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type modelHunting struct {
|
||||
type modelEnchant struct {
|
||||
modules.MCompModel
|
||||
module *Hunting
|
||||
module *Enchant
|
||||
}
|
||||
|
||||
func (this *modelHunting) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
func (this *modelEnchant) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = string(comm.TableHunting)
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Hunting)
|
||||
this.module = module.(*Enchant)
|
||||
// uid 创建索引
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
@ -29,12 +29,12 @@ func (this *modelHunting) Init(service core.IService, module core.IModule, comp
|
||||
return
|
||||
}
|
||||
|
||||
func (this *modelHunting) modifyHuntingDataByObjId(uid string, data map[string]interface{}) error {
|
||||
func (this *modelEnchant) modifyEnchantDataByObjId(uid string, data map[string]interface{}) error {
|
||||
return this.Change(uid, data)
|
||||
}
|
||||
|
||||
// 获取列表信息
|
||||
func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err error) {
|
||||
func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBHunting, err error) {
|
||||
result = &pb.DBHunting{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
@ -47,7 +47,7 @@ func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err
|
||||
}
|
||||
if mgo.MongodbNil == err {
|
||||
if len(result.Boss) == 0 {
|
||||
_cfg := this.module.configure.GetHuntingBossTypeConfigData()
|
||||
_cfg := this.module.configure.GetEnchantBossTypeConfigData()
|
||||
for k := range _cfg {
|
||||
result.Boss[k] = 0
|
||||
str := strconv.Itoa(int(k)) + "_1"
|
||||
@ -61,7 +61,7 @@ func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err
|
||||
}
|
||||
|
||||
// 红点检测
|
||||
func (this *modelHunting) checkReddot32(uid string) bool {
|
||||
func (this *modelEnchant) checkReddot32(uid string) bool {
|
||||
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
if conf == nil {
|
@ -14,13 +14,13 @@ import (
|
||||
|
||||
type ModelRank struct {
|
||||
modules.MCompModel
|
||||
moduleHunting *Hunting
|
||||
moduleHunting *Enchant
|
||||
}
|
||||
|
||||
func (this *ModelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = comm.TableHuntingRecord // 挑战记录
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.moduleHunting = module.(*Hunting)
|
||||
this.moduleHunting = module.(*Enchant)
|
||||
return
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ func (this *ModelRank) AddRankList(uId string, objId string, data *pb.DBHuntingR
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *ModelRank) getHuntingRankList(uid string) []*pb.DBHuntingRank {
|
||||
func (this *ModelRank) getEnchantRankList(uid string) []*pb.DBHuntingRank {
|
||||
ranks := make([]*pb.DBHuntingRank, 0)
|
||||
err := this.GetList(uid, &ranks)
|
||||
if err != nil {
|
||||
@ -41,7 +41,7 @@ func (this *ModelRank) getHuntingRankList(uid string) []*pb.DBHuntingRank {
|
||||
return ranks
|
||||
}
|
||||
|
||||
func (this *ModelRank) getHuntingRankListByBossType(uid string, bossType int32) *pb.DBHuntingRank {
|
||||
func (this *ModelRank) getEnchantRankListByBossType(uid string, bossType int32) *pb.DBHuntingRank {
|
||||
ranks := make([]*pb.DBHuntingRank, 0)
|
||||
err := this.GetList(uid, &ranks)
|
||||
if err != nil {
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type Hunting struct {
|
||||
type Enchant struct {
|
||||
modules.ModuleBase
|
||||
modelHunting *modelHunting
|
||||
modelEnchant *modelEnchant
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
modulerank *ModelRank
|
||||
@ -23,20 +23,20 @@ type Hunting struct {
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
return &Hunting{}
|
||||
return &Enchant{}
|
||||
}
|
||||
|
||||
func (this *Hunting) GetType() core.M_Modules {
|
||||
return comm.ModuleHunting
|
||||
func (this *Enchant) GetType() core.M_Modules {
|
||||
return comm.ModuleEnchant
|
||||
}
|
||||
|
||||
func (this *Hunting) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
func (this *Enchant) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Hunting) Start() (err error) {
|
||||
func (this *Enchant) Start() (err error) {
|
||||
err = this.ModuleBase.Start()
|
||||
var module core.IModule
|
||||
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
||||
@ -47,28 +47,28 @@ func (this *Hunting) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Hunting) OnInstallComp() {
|
||||
func (this *Enchant) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelHunting = this.RegisterComp(new(modelHunting)).(*modelHunting)
|
||||
this.modelEnchant = this.RegisterComp(new(modelEnchant)).(*modelEnchant)
|
||||
this.modulerank = this.RegisterComp(new(ModelRank)).(*ModelRank)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
}
|
||||
|
||||
// 接口信息
|
||||
func (this *Hunting) ModifyHuntingData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
|
||||
err := this.modelHunting.modifyHuntingDataByObjId(uid, data)
|
||||
func (this *Enchant) ModifyEnchantData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
|
||||
err := this.modelEnchant.modifyEnchantDataByObjId(uid, data)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Hunting) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) {
|
||||
list, err := this.modelHunting.getHuntingList(uid)
|
||||
func (this *Enchant) CheckUserBaseEnchantInfo(uid string) (data []*pb.DBHuntingRank) {
|
||||
list, err := this.modelEnchant.getEnchantList(uid)
|
||||
if err != nil {
|
||||
for k := range list.Boss {
|
||||
_d := this.modulerank.getHuntingRankListByBossType(uid, k)
|
||||
_d := this.modulerank.getEnchantRankListByBossType(uid, k)
|
||||
if _d != nil {
|
||||
data = append(data, _d)
|
||||
}
|
||||
@ -76,12 +76,12 @@ func (this *Hunting) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingR
|
||||
}
|
||||
return
|
||||
}
|
||||
func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, hunting *pb.DBHunting, report *pb.BattleReport) {
|
||||
func (this *Enchant) CheckRank(uid string, boosID int32, difficulty int32, Enchant *pb.DBHunting, report *pb.BattleReport) {
|
||||
costTime := report.Costtime
|
||||
key := strconv.Itoa(int(boosID)) + "_" + strconv.Itoa(int(difficulty))
|
||||
|
||||
if hunting.BossTime[key] > costTime || hunting.BossTime[key] == 0 && difficulty >= hunting.Boss[boosID] { // 刷新记录
|
||||
hunting.BossTime[key] = costTime
|
||||
if Enchant.BossTime[key] > costTime || Enchant.BossTime[key] == 0 && difficulty >= Enchant.Boss[boosID] { // 刷新记录
|
||||
Enchant.BossTime[key] = costTime
|
||||
szLine := make([]*pb.LineUp, 5)
|
||||
Leadpos := 0
|
||||
if report != nil && report.Info != nil && len(report.Info.Redflist) > 0 {
|
||||
@ -100,7 +100,7 @@ func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, hunti
|
||||
// 写入排行榜
|
||||
objID := ""
|
||||
bFind := false
|
||||
ranks := this.modulerank.getHuntingRankList(uid)
|
||||
ranks := this.modulerank.getEnchantRankList(uid)
|
||||
for _, v := range ranks {
|
||||
if v.Bosstype == boosID {
|
||||
mapRankData := make(map[string]interface{}, 0)
|
||||
@ -110,7 +110,7 @@ func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, hunti
|
||||
mapRankData["line"] = szLine
|
||||
mapRankData["costTime"] = costTime
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel := db.NewDBModel(comm.TableEnchantRank, time.Hour, conn_)
|
||||
dbModel.ChangeList(uid, v.Id, mapRankData)
|
||||
objID = v.Id
|
||||
bFind = true
|
||||
@ -133,49 +133,23 @@ func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, hunti
|
||||
}
|
||||
objID = new.Id
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel := db.NewDBModel(comm.TableEnchantRank, time.Hour, conn_)
|
||||
dbModel.AddList(uid, new.Id, new)
|
||||
}
|
||||
this.modulerank.SetRankListData("huntingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID)
|
||||
this.modulerank.SetRankListData("EnchantRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID)
|
||||
}
|
||||
}
|
||||
|
||||
//红点查询
|
||||
func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
|
||||
func (this *Enchant) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
|
||||
reddot = make(map[comm.ReddotType]bool)
|
||||
for _, v := range rid {
|
||||
switch v {
|
||||
case comm.Reddot32:
|
||||
reddot[comm.Reddot32] = this.modelHunting.checkReddot32(session.GetUserId())
|
||||
reddot[comm.Reddot32] = this.modelEnchant.checkReddot32(session.GetUserId())
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 解锁远征所有难度
|
||||
func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (code pb.ErrorCode) {
|
||||
list, err := this.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
// 查配置获取每个Boss的最大难度
|
||||
for k := range list.Boss {
|
||||
for i := 1; ; i++ {
|
||||
conf := this.configure.GetHuntingBossConfigData(k, int32(i))
|
||||
if conf == nil {
|
||||
list.Boss[k] = int32(i - 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user