Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
3fd878e271
@ -730,7 +730,7 @@ const (
|
|||||||
PrivilegeType7 //巨怪商队背包容量
|
PrivilegeType7 //巨怪商队背包容量
|
||||||
PrivilegeType8 //美食馆每日最大制作时间
|
PrivilegeType8 //美食馆每日最大制作时间
|
||||||
PrivilegeType9 //武馆每日最大练功时间
|
PrivilegeType9 //武馆每日最大练功时间
|
||||||
PrivilegeType10 //铁匠铺每日最大锻造时间
|
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
MainStarType1 = 1 //成功通关
|
MainStarType1 = 1 //成功通关
|
||||||
|
@ -67,7 +67,7 @@ type (
|
|||||||
//清理玩家英雄数据
|
//清理玩家英雄数据
|
||||||
CleanData(uid string)
|
CleanData(uid string)
|
||||||
// 获取指定星级等级的英雄
|
// 获取指定星级等级的英雄
|
||||||
GetSpecifiedHero(session IUserSession, heroConfId string, star, lv, amount int32) (code pb.ErrorCode)
|
GetSpecifiedHero(session IUserSession, heroConfId string, star, lv int32) (code pb.ErrorCode)
|
||||||
// 英雄加经验
|
// 英雄加经验
|
||||||
AddHeroExp(session IUserSession, heroObjID string, exp int32) (curAddExp int32, code pb.ErrorCode)
|
AddHeroExp(session IUserSession, heroObjID string, exp int32) (curAddExp int32, code pb.ErrorCode)
|
||||||
// 英雄练功
|
// 英雄练功
|
||||||
|
@ -41,7 +41,6 @@ type configureComp struct {
|
|||||||
hlock sync.RWMutex
|
hlock sync.RWMutex
|
||||||
drawCardCfg map[string]map[int32][]*cfg.GameDrawCardData // 第一个key 卡池id 第二个key 星级
|
drawCardCfg map[string]map[int32][]*cfg.GameDrawCardData // 第一个key 卡池id 第二个key 星级
|
||||||
awakenMap map[int64]*cfg.GameHeroAwakenData
|
awakenMap map[int64]*cfg.GameHeroAwakenData
|
||||||
|
|
||||||
starMap map[int64]*cfg.GameHeroStarupData
|
starMap map[int64]*cfg.GameHeroStarupData
|
||||||
module *Hero
|
module *Hero
|
||||||
}
|
}
|
||||||
@ -78,9 +77,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
defer this.hlock.Unlock()
|
defer this.hlock.Unlock()
|
||||||
if _configure, ok := v.(*cfg.GameHeroAwaken); ok {
|
if _configure, ok := v.(*cfg.GameHeroAwaken); ok {
|
||||||
for _, v := range _configure.GetDataList() {
|
for _, v := range _configure.GetDataList() {
|
||||||
this.awakenMap[int64(utils.ToInt32(v.Hid)<<8)+int64(v.Phase)] = v
|
this.awakenMap[utils.ToInt64(v.Hid)+int64(v.Phase<<31)] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -96,7 +94,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
this.hlock.Lock()
|
this.hlock.Lock()
|
||||||
defer this.hlock.Unlock()
|
defer this.hlock.Unlock()
|
||||||
for _, v := range _configure.GetDataList() {
|
for _, v := range _configure.GetDataList() {
|
||||||
this.starMap[int64(utils.ToInt32(v.Id)<<8)+int64(v.Star)] = v
|
this.starMap[utils.ToInt64(v.Id)+int64(v.Star<<31)] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -111,22 +109,23 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
|
|
||||||
// 获取英雄升星相关配置数据
|
// 获取英雄升星相关配置数据
|
||||||
func (this *configureComp) GetHeroStarupConfig(hid string, star int32) *cfg.GameHeroStarupData {
|
func (this *configureComp) GetHeroStarupConfig(hid string, star int32) *cfg.GameHeroStarupData {
|
||||||
return this.starMap[int64(utils.ToInt32(hid)<<8)+int64(star)]
|
return this.starMap[utils.ToInt64(hid)+int64(star<<31)]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前英雄最高星级
|
// 获取当前英雄最高星级
|
||||||
func (this *configureComp) GetHeroMaxStar(hid string, curStar int32) int32 {
|
func (this *configureComp) GetHeroMaxStar(hid string, curStar int32) int32 {
|
||||||
var star int32
|
var star int32
|
||||||
for star = curStar; star < 100; star++ {
|
for star = curStar; star < 100; star++ {
|
||||||
if _, ok := this.starMap[int64(utils.ToInt32(hid)<<8)+int64(star+1)]; !ok {
|
if _, ok := this.starMap[utils.ToInt64(hid)+int64((star+1)<<31)]; !ok {
|
||||||
return star
|
return star
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return star
|
return star
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取觉醒配置
|
||||||
func (this *configureComp) GetHeroAwakenConfig(hid string, phase int32) *cfg.GameHeroAwakenData {
|
func (this *configureComp) GetHeroAwakenConfig(hid string, phase int32) *cfg.GameHeroAwakenData {
|
||||||
return this.awakenMap[int64(utils.ToInt32(hid)<<8)+int64(phase)]
|
return this.awakenMap[utils.ToInt64(hid)+int64(phase<<31)]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 抽卡配置表
|
// 抽卡配置表
|
||||||
@ -238,7 +237,7 @@ func (this *configureComp) GetHeroLvgrow(heroId string) *cfg.GameHeroLevelgrowDa
|
|||||||
return configure.Get(heroId)
|
return configure.Get(heroId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.module.Errorf("cfg.GetHeroLvgrow :id = %s", heroId)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +250,7 @@ func (this *configureComp) GetHeroSkillUpConfig(skillid int32) (data *cfg.GameHe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.module.Errorf("cfg.GetHeroSkillUpConfig :id = %d", skillid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +266,7 @@ func (this *configureComp) GetHeroSkillMaxLvConfig(skillId uint32) int32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.module.Errorf("cfg.GetHeroSkillMaxLvConfig :id = %d", skillId)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ func (this *Hero) CleanData(uid string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建一些特殊的英雄
|
// 创建一些特殊的英雄
|
||||||
func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv, amount int32) (code pb.ErrorCode) {
|
func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv int32) (code pb.ErrorCode) {
|
||||||
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 || amount == 0 {
|
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 {
|
||||||
return pb.ErrorCode_ReqParameterError
|
return pb.ErrorCode_ReqParameterError
|
||||||
}
|
}
|
||||||
// 等级校验
|
// 等级校验
|
||||||
@ -235,11 +235,11 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
|
|||||||
}
|
}
|
||||||
hero.Lv = lv
|
hero.Lv = lv
|
||||||
hero.Star = star
|
hero.Star = star
|
||||||
hero.SameCount = amount
|
hero.SameCount = 1
|
||||||
_heroMap := map[string]interface{}{
|
_heroMap := map[string]interface{}{
|
||||||
"lv": hero.Lv,
|
"lv": hero.Lv,
|
||||||
"star": hero.Star,
|
"star": hero.Star,
|
||||||
"sameCount": amount,
|
"sameCount": 1,
|
||||||
}
|
}
|
||||||
// 保存数据
|
// 保存数据
|
||||||
err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap)
|
err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap)
|
||||||
|
@ -234,14 +234,14 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Debug("任务事件触发",
|
// this.Debug("任务事件触发",
|
||||||
log.Field{Key: "uid", Value: uid},
|
// log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "taskType", Value: rtaskType},
|
// log.Field{Key: "taskType", Value: rtaskType},
|
||||||
log.Field{Key: "params", Value: params},
|
// log.Field{Key: "params", Value: params},
|
||||||
)
|
// )
|
||||||
var (
|
var (
|
||||||
err error
|
// err error
|
||||||
condiId int32
|
// condiId int32
|
||||||
condis []*rtaskCondi
|
condis []*rtaskCondi
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -264,11 +264,11 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if condiId, err = v.find(codiConf, params...); condiId == 0 {
|
if condiId, _ := v.find(codiConf, params...); condiId != 0 {
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
this.Warnln(errors.WithMessage(err, uid).Error())
|
// this.Warnln(errors.WithMessage(err, uid).Error())
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
v.condId = codiConf.Id
|
v.condId = codiConf.Id
|
||||||
condis = append(condis, v)
|
condis = append(condis, v)
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
package rtask
|
package rtask
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/sys/log"
|
|
||||||
|
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
@ -109,12 +107,12 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData
|
|||||||
}
|
}
|
||||||
err = this.Change(uid, update)
|
err = this.Change(uid, update)
|
||||||
}
|
}
|
||||||
log.Debug("累计次数更新",
|
// log.Debug("累计次数更新",
|
||||||
log.Field{Key: "uid", Value: uid},
|
// log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "condiId", Value: cfg.Id},
|
// log.Field{Key: "condiId", Value: cfg.Id},
|
||||||
log.Field{Key: "params", Value: vals},
|
// log.Field{Key: "params", Value: vals},
|
||||||
log.Field{Key: "updated", Value: record.Vals[cfg.Id]},
|
// log.Field{Key: "updated", Value: record.Vals[cfg.Id]},
|
||||||
)
|
// )
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,6 @@ func (this *ModelRtask) verifyRtype3(uid string, cfg *cfg.GameRdtaskCondiData) (
|
|||||||
|
|
||||||
// 指定英雄等级
|
// 指定英雄等级
|
||||||
func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
m, err := this.service.GetModule(comm.ModuleHero)
|
m, err := this.service.GetModule(comm.ModuleHero)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -182,7 +181,6 @@ func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData) (
|
|||||||
|
|
||||||
// 指定英雄的指定装备数量
|
// 指定英雄的指定装备数量
|
||||||
func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
m, err := this.service.GetModule(comm.ModuleHero)
|
m, err := this.service.GetModule(comm.ModuleHero)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -220,7 +218,6 @@ func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData) (
|
|||||||
|
|
||||||
// 指定英雄星级
|
// 指定英雄星级
|
||||||
func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
m, err := this.service.GetModule(comm.ModuleHero)
|
m, err := this.service.GetModule(comm.ModuleHero)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -247,7 +244,6 @@ func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData) (
|
|||||||
|
|
||||||
// 日常登录一次
|
// 日常登录一次
|
||||||
func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
userModule, err := this.service.GetModule(comm.ModuleUser)
|
userModule, err := this.service.GetModule(comm.ModuleUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -263,7 +259,6 @@ func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData) (
|
|||||||
|
|
||||||
// 累计登陆xx天
|
// 累计登陆xx天
|
||||||
func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
userModule, err := this.service.GetModule(comm.ModuleUser)
|
userModule, err := this.service.GetModule(comm.ModuleUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -281,7 +276,6 @@ func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData) (
|
|||||||
|
|
||||||
// 连续登陆xx天
|
// 连续登陆xx天
|
||||||
func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
userModule, err := this.service.GetModule(comm.ModuleUser)
|
userModule, err := this.service.GetModule(comm.ModuleUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -299,7 +293,6 @@ func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData) (
|
|||||||
|
|
||||||
// 拥有xx个好友
|
// 拥有xx个好友
|
||||||
func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
m, err := this.service.GetModule(comm.ModuleFriend)
|
m, err := this.service.GetModule(comm.ModuleFriend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -314,7 +307,6 @@ func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData)
|
|||||||
|
|
||||||
// 用户等级达到xx级
|
// 用户等级达到xx级
|
||||||
func (this *ModelRtask) verifyRtype20(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
func (this *ModelRtask) verifyRtype20(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
|
||||||
defer printCondiLog(uid, cfg)
|
|
||||||
userModule, err := this.service.GetModule(comm.ModuleUser)
|
userModule, err := this.service.GetModule(comm.ModuleUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -22,7 +22,6 @@ func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.SmithyCreate
|
|||||||
var (
|
var (
|
||||||
res []*cfg.Gameatn
|
res []*cfg.Gameatn
|
||||||
costTime int32
|
costTime int32
|
||||||
privilegeAddItme int32 // 特权额外增加的时间
|
|
||||||
)
|
)
|
||||||
|
|
||||||
code = this.CreateOrderCheck(session, req)
|
code = this.CreateOrderCheck(session, req)
|
||||||
@ -83,8 +82,7 @@ func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.SmithyCreate
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
_smithy.OrderCostTime += costTime
|
_smithy.OrderCostTime += costTime
|
||||||
privilegeAddItme = this.module.ModulePrivilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType10)
|
if cfgCom.SmithyMaxtime < _smithy.OrderCostTime { // 大于总时长是不允许的
|
||||||
if cfgCom.SmithyMaxtime+privilegeAddItme < _smithy.OrderCostTime { // 大于总时长是不允许的
|
|
||||||
code = pb.ErrorCode_GourmetMoreOrderTime
|
code = pb.ErrorCode_GourmetMoreOrderTime
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ comm.ITask = (*ModuleTask)(nil)
|
var _ comm.ITask = (*ModuleTask)(nil)
|
||||||
@ -59,10 +57,6 @@ func (this *ModuleTask) Start() (err error) {
|
|||||||
|
|
||||||
// 初始化日常、周常、成就
|
// 初始化日常、周常、成就
|
||||||
func (this *ModuleTask) InitTaskAll(uid string) {
|
func (this *ModuleTask) InitTaskAll(uid string) {
|
||||||
t := configure.Now()
|
|
||||||
defer func() {
|
|
||||||
log.Debugf("初始化任务 耗时:%v", time.Since(t))
|
|
||||||
}()
|
|
||||||
this.modelTask.initTask(uid, comm.TASK_DAILY)
|
this.modelTask.initTask(uid, comm.TASK_DAILY)
|
||||||
this.modelTask.initTask(uid, comm.TASK_WEEKLY)
|
this.modelTask.initTask(uid, comm.TASK_WEEKLY)
|
||||||
this.modelTask.initTask(uid, comm.TASK_ACHIEVE)
|
this.modelTask.initTask(uid, comm.TASK_ACHIEVE)
|
||||||
|
@ -88,3 +88,11 @@ func ToInt32(s string) int32 {
|
|||||||
return int32(j)
|
return int32(j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ToInt64(s string) int64 {
|
||||||
|
if j, err := strconv.ParseInt(s, 10, 32); err != nil {
|
||||||
|
return 0
|
||||||
|
} else {
|
||||||
|
return int64(j)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user