Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
6ec77156c4
@ -172,6 +172,13 @@
|
||||
"n": 1
|
||||
},
|
||||
"hunting_reset": 1,
|
||||
"hunting_cap": [
|
||||
25001,
|
||||
25004,
|
||||
34006,
|
||||
35001,
|
||||
35002
|
||||
],
|
||||
"enchantboss_initial": 10,
|
||||
"enchantboss_max": 10,
|
||||
"enchantboss_cos": {
|
||||
@ -179,6 +186,7 @@
|
||||
"t": "100005",
|
||||
"n": 1
|
||||
},
|
||||
"enchantboss_recovery": 144,
|
||||
"game_time": [
|
||||
1,
|
||||
24
|
||||
|
@ -50,7 +50,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.EnchantBuyReq) (code
|
||||
}
|
||||
curByCount += req.Count // 当前需要购买的数量
|
||||
if this.configure.GetMaxBuyChallengeCount() < curByCount {
|
||||
code = pb.ErrorCode_HuntingBuyMaxCount
|
||||
code = pb.ErrorCode_EnchantBuyMaxCount
|
||||
return
|
||||
}
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
@ -58,22 +58,22 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.EnchantBuyReq) (code
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes = conf.HuntingCos
|
||||
costRes = conf.EnchantbossCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量
|
||||
curCount = amount
|
||||
if amount < conf.HuntingNum {
|
||||
if amount < conf.EnchantbossMax {
|
||||
if list.RecoveryTime == 0 {
|
||||
list.RecoveryTime = configure.Now().Unix()
|
||||
}
|
||||
for { // 计算恢复时间
|
||||
if list.RecoveryTime+int64(conf.HuntingRecovery*60) <= configure.Now().Unix() {
|
||||
if list.RecoveryTime+int64(conf.EnchantbossRecovery*60) <= configure.Now().Unix() {
|
||||
curCount++
|
||||
list.RecoveryTime += int64(conf.HuntingRecovery * 60)
|
||||
if curCount >= conf.HuntingNum {
|
||||
list.RecoveryTime += int64(conf.EnchantbossRecovery * 60)
|
||||
if curCount >= conf.EnchantbossMax {
|
||||
list.RecoveryTime = 0
|
||||
break
|
||||
}
|
||||
@ -97,7 +97,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.EnchantBuyReq) (code
|
||||
for i := list.BuyCount + 1; i <= curByCount; i++ {
|
||||
_cfg := this.configure.GetBuyChallengeCount(i)
|
||||
if _cfg == nil {
|
||||
code = pb.ErrorCode_HuntingBuyMaxCount
|
||||
code = pb.ErrorCode_EnchantBuyMaxCount
|
||||
return
|
||||
}
|
||||
szCostRes = append(szCostRes, _cfg.Need...)
|
||||
|
@ -35,13 +35,13 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
costRes := conf.EnchantbossCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
if code = this.module.CheckRes(session, []*cfg.Gameatn{costRes}); code != pb.ErrorCode_Success {
|
||||
code = pb.ErrorCode_HuntingNoChallengeCount
|
||||
code = pb.ErrorCode_EnchantNoChallengeCount
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
costRes := conf.EnchantbossCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
@ -91,8 +91,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
|
||||
// mapData["boss"] = enchant.Boss
|
||||
|
||||
// }
|
||||
|
||||
mapData["challengeTime"] = enchant.BossTime
|
||||
mapData["boss"] = enchant.Boss
|
||||
code = this.module.ModifyEnchantData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant})
|
||||
|
||||
|
@ -11,12 +11,12 @@ import (
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.HuntingGetListReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.EnchantGetListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
mapData map[string]interface{}
|
||||
curCount int32
|
||||
@ -46,22 +46,22 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
costRes := conf.EnchantbossCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量
|
||||
curCount = amount
|
||||
if amount < conf.HuntingNum {
|
||||
if amount < conf.EnchantbossMax {
|
||||
if list.RecoveryTime == 0 {
|
||||
list.RecoveryTime = configure.Now().Unix()
|
||||
}
|
||||
for { // 计算恢复时间
|
||||
if list.RecoveryTime+int64(conf.HuntingRecovery*60) <= configure.Now().Unix() {
|
||||
if list.RecoveryTime+int64(conf.EnchantbossRecovery*60) <= configure.Now().Unix() {
|
||||
curCount++
|
||||
list.RecoveryTime += int64(conf.HuntingRecovery * 60)
|
||||
if curCount >= conf.HuntingNum {
|
||||
list.RecoveryTime += int64(conf.EnchantbossRecovery * 60)
|
||||
if curCount >= conf.EnchantbossMax {
|
||||
list.RecoveryTime = 0
|
||||
break
|
||||
}
|
||||
@ -86,10 +86,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe
|
||||
}
|
||||
mapData["recoveryTime"] = list.RecoveryTime
|
||||
code = this.module.ModifyEnchantData(session.GetUserId(), mapData) //修改内存信息
|
||||
// 发送难度
|
||||
for k := range list.Boss {
|
||||
list.Boss[k] += 1
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), EnchantGetListResp, &pb.EnchantGetListResp{Data: list})
|
||||
return
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ import (
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.HuntingRankListReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.EnchantRankListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) RankList(session comm.IUserSession, req *pb.HuntingRankListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
func (this *apiComp) RankList(session comm.IUserSession, req *pb.EnchantRankListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
szRank []*pb.DBEnchantRank
|
||||
rd *redis.StringSliceCmd
|
||||
@ -30,7 +30,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.HuntingRankList
|
||||
var (
|
||||
pipe *pipe.RedisPipe = this.module.modelEnchant.Redis.RedisPipe(context.TODO())
|
||||
)
|
||||
rd = pipe.ZRange("huntingRank"+strconv.Itoa(int(req.BoosType)), 0, -1)
|
||||
rd = pipe.ZRange("enchantRank"+strconv.Itoa(int(req.BoosType)), 0, -1)
|
||||
|
||||
if _, err := pipe.Exec(); err != nil {
|
||||
this.module.Errorln(err)
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"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"
|
||||
@ -19,7 +18,7 @@ type modelEnchant struct {
|
||||
}
|
||||
|
||||
func (this *modelEnchant) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = string(comm.TableHunting)
|
||||
this.TableName = string(comm.TableEnchant)
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Enchant)
|
||||
// uid 创建索引
|
||||
@ -39,7 +38,7 @@ func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBEnchant, err
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
Boss: make(map[int32]int32),
|
||||
BossTime: make(map[string]int32),
|
||||
BossTime: make(map[int32]int32),
|
||||
}
|
||||
if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err {
|
||||
|
||||
@ -49,9 +48,7 @@ func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBEnchant, err
|
||||
if len(result.Boss) == 0 {
|
||||
_cfg := this.module.configure.GetEnchantBossTypeConfigData()
|
||||
for k := range _cfg {
|
||||
result.Boss[k] = 0
|
||||
str := strconv.Itoa(int(k)) + "_1"
|
||||
result.BossTime[str] = 0
|
||||
result.BossTime[k] = 0
|
||||
}
|
||||
}
|
||||
this.Add(uid, result)
|
||||
@ -67,7 +64,7 @@ func (this *modelEnchant) checkReddot32(uid string) bool {
|
||||
if conf == nil {
|
||||
return false
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
costRes := conf.EnchantbossCos
|
||||
if costRes == nil {
|
||||
return false
|
||||
}
|
||||
|
@ -78,10 +78,9 @@ func (this *Enchant) CheckUserBaseEnchantInfo(uid string) (data []*pb.DBEnchantR
|
||||
}
|
||||
func (this *Enchant) CheckRank(uid string, boosID int32, Enchant *pb.DBEnchant, report *pb.BattleReport, score int32) {
|
||||
costTime := report.Costtime
|
||||
key := strconv.Itoa(int(boosID))
|
||||
|
||||
if Enchant.BossTime[key] > costTime || Enchant.BossTime[key] == 0 { // 刷新记录
|
||||
Enchant.BossTime[key] = costTime
|
||||
if Enchant.BossTime[boosID] > costTime || Enchant.BossTime[boosID] == 0 { // 刷新记录
|
||||
Enchant.BossTime[boosID] = costTime
|
||||
szLine := make([]*pb.LineUp, 5)
|
||||
Leadpos := 0
|
||||
if report != nil && report.Info != nil && len(report.Info.Redflist) > 0 {
|
||||
|
@ -25,13 +25,13 @@ type DBEnchant struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
Boss map[int32]int32 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分
|
||||
BuyCount int32 `protobuf:"varint,4,opt,name=buyCount,proto3" json:"buyCount" bson:"buyCount"` //购买次数
|
||||
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间
|
||||
BossTime map[string]int32 `protobuf:"bytes,6,rep,name=bossTime,proto3" json:"bossTime" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"bossTime"` //
|
||||
RecoveryTime int64 `protobuf:"varint,7,opt,name=recoveryTime,proto3" json:"recoveryTime" bson:"recoveryTime"` //// 开始恢复的时间
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
Boss map[int32]int32 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分
|
||||
BuyCount int32 `protobuf:"varint,4,opt,name=buyCount,proto3" json:"buyCount" bson:"buyCount"` //购买次数
|
||||
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间
|
||||
BossTime map[int32]int32 `protobuf:"bytes,6,rep,name=bossTime,proto3" json:"bossTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"bossTime"` //
|
||||
RecoveryTime int64 `protobuf:"varint,7,opt,name=recoveryTime,proto3" json:"recoveryTime" bson:"recoveryTime"` //// 开始恢复的时间
|
||||
}
|
||||
|
||||
func (x *DBEnchant) Reset() {
|
||||
@ -101,7 +101,7 @@ func (x *DBEnchant) GetCTime() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBEnchant) GetBossTime() map[string]int32 {
|
||||
func (x *DBEnchant) GetBossTime() map[int32]int32 {
|
||||
if x != nil {
|
||||
return x.BossTime
|
||||
}
|
||||
@ -244,7 +244,7 @@ var file_enchant_enchant_db_proto_rawDesc = []byte{
|
||||
0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
|
||||
0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x42, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
|
||||
0xcc, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e,
|
||||
|
@ -87,9 +87,11 @@ type GameGlobalData struct {
|
||||
HuntingRecovery int32
|
||||
HuntingCos *Gameatn
|
||||
HuntingReset int32
|
||||
HuntingCap []int32
|
||||
EnchantbossInitial int32
|
||||
EnchantbossMax int32
|
||||
EnchantbossCos *Gameatn
|
||||
EnchantbossRecovery int32
|
||||
GameTime []int32
|
||||
SellingTipsStrengthen int32
|
||||
SellingTipsStar int32
|
||||
@ -296,9 +298,24 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hunting_recovery"].(float64); !_ok_ { err = errors.New("hunting_recovery error"); return }; _v.HuntingRecovery = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["hunting_cos"].(map[string]interface{}); !_ok_ { err = errors.New("hunting_cos error"); return }; if _v.HuntingCos, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hunting_reset"].(float64); !_ok_ { err = errors.New("hunting_reset error"); return }; _v.HuntingReset = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["hunting_cap"].([]interface{}); !_ok_ { err = errors.New("hunting_cap error"); return }
|
||||
|
||||
_v.HuntingCap = make([]int32, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||
_v.HuntingCap = append(_v.HuntingCap, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["enchantboss_initial"].(float64); !_ok_ { err = errors.New("enchantboss_initial error"); return }; _v.EnchantbossInitial = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["enchantboss_max"].(float64); !_ok_ { err = errors.New("enchantboss_max error"); return }; _v.EnchantbossMax = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["enchantboss_cos"].(map[string]interface{}); !_ok_ { err = errors.New("enchantboss_cos error"); return }; if _v.EnchantbossCos, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["enchantboss_recovery"].(float64); !_ok_ { err = errors.New("enchantboss_recovery error"); return }; _v.EnchantbossRecovery = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
|
Loading…
Reference in New Issue
Block a user