Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
5dbabf4432
@ -398,7 +398,7 @@ const ( //Rpc
|
||||
Rpc_ModuleCaravanSettlement core.Rpc_Key = "Rpc_ModuleCaravanSettlement" //商队比赛结算信息
|
||||
|
||||
Rpc_ModuleBuriedTrigger core.Rpc_Key = "Rpc_ModuleBuriedTrigger" //埋点跨服触发通知
|
||||
Rpc_OpendCond core.Rpc_Key = "Rpc_OpendCond"
|
||||
|
||||
//战令结算事件
|
||||
Rpc_ModuleWarorderSettlement core.Rpc_Key = "Rpc_ModuleWarorderSettlement"
|
||||
//工会boos战结算 事件
|
||||
|
@ -41,14 +41,9 @@ type (
|
||||
|
||||
type (
|
||||
ISys interface {
|
||||
IsAccess(funcName string, uid string) (errdata *pb.ErrorData)
|
||||
ValidCond(uid string, conf *cfg.GameOpencondData) string
|
||||
CheckLvUpCond(session IUserSession, lv int32)
|
||||
CheckTaskCond(session IUserSession, id int32)
|
||||
CheckMlineCond(session IUserSession, id int32)
|
||||
|
||||
// 校验好友数量判断功能是否开启
|
||||
CheckFriendCond(session IUserSession, num int32)
|
||||
// 查询opencond 配置
|
||||
CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData)
|
||||
QueryOpenCondData(uid string) (data map[string]int32, errdata *pb.ErrorData) // 查询玩家当前已开启的功能
|
||||
|
@ -160,16 +160,19 @@ func (this *Pagoda) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (r
|
||||
}
|
||||
break
|
||||
case comm.Reddot29101:
|
||||
activity, process := this.CheckPoint29101(session.GetUserId())
|
||||
reddot[comm.Reddot29101] = &pb.ReddotItem{
|
||||
Rid: int32(comm.Reddot29101),
|
||||
Activated: this.CheckPoint29101(session.GetUserId()),
|
||||
Activated: activity,
|
||||
Progress: process,
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (this *Pagoda) CheckPoint29101(uid string) bool {
|
||||
|
||||
func (this *Pagoda) CheckPoint29101(uid string) (activated bool, progress int32) {
|
||||
var (
|
||||
curWeekDay int32 //今天周几
|
||||
)
|
||||
@ -179,34 +182,30 @@ func (this *Pagoda) CheckPoint29101(uid string) bool {
|
||||
}
|
||||
list, err := this.modelRacePagoda.getPagodaRaceList(uid)
|
||||
if err != nil {
|
||||
return false
|
||||
return
|
||||
}
|
||||
for _, v := range list.Race {
|
||||
if v.Race < 10 {
|
||||
bOpen := false
|
||||
if v.Race < 10 { // 10以内的是阵营塔
|
||||
var defeat int32
|
||||
// 校验今天是否开启
|
||||
if c, err := this.configure.GetPagodaCirculateConf(v.Race, v.Curfloor); err != nil {
|
||||
for _, v := range c.Openingtime {
|
||||
if curWeekDay == v {
|
||||
bOpen = true
|
||||
for _, v1 := range c.Openingtime {
|
||||
if curWeekDay == v1 {
|
||||
if utils.IsToday(v.Rtime) {
|
||||
defeat = v.Defeat
|
||||
return
|
||||
}
|
||||
if defeat < 10 { // 每天固定打10次
|
||||
progress += (10 - defeat)
|
||||
activated = true
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if !bOpen {
|
||||
break
|
||||
}
|
||||
if !utils.IsToday(v.Rtime) {
|
||||
list.Race[v.Race].Rtime = configure.Now().Unix()
|
||||
list.Race[v.Race].Defeat = 0
|
||||
return true
|
||||
}
|
||||
if v.Defeat < 10 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
return
|
||||
}
|
||||
|
||||
// 红点检测
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
type ModelSys struct {
|
||||
modules.MCompModel
|
||||
moduleSys *ModuleSys
|
||||
|
||||
service core.IService
|
||||
}
|
||||
|
||||
@ -25,28 +26,6 @@ func (this *ModelSys) Init(service core.IService, module core.IModule, comp core
|
||||
return
|
||||
}
|
||||
|
||||
// 是否允许访问功能,条件:玩家等级
|
||||
func (this *ModelSys) IsAccess(funName string, uid string) (errdata *pb.ErrorData) {
|
||||
// user := this.moduleSys.ModuleUser.GetUser(uid)
|
||||
// if user != nil {
|
||||
// if conf := this.moduleSys.configure.getFuncCfg(funName); conf != nil {
|
||||
// if conf.ActivateType == 1 { // 已经手动激活过
|
||||
// list, _ := this.GetOpenCondList(uid)
|
||||
// if v, ok := list.Cond[funName]; ok && v == 1 {
|
||||
// return
|
||||
// }
|
||||
// } else {
|
||||
// if id := this.validCond(uid, conf); id != "" { // 条件满足已经激活
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
//code = pb.ErrorCode_OpenCondErr
|
||||
return
|
||||
}
|
||||
|
||||
func (this *ModelSys) validCond(uid string, condData *cfg.GameOpencondData) string {
|
||||
for _, conf := range condData.Main {
|
||||
switch conf.Key {
|
||||
@ -61,45 +40,22 @@ func (this *ModelSys) validCond(uid string, condData *cfg.GameOpencondData) stri
|
||||
}
|
||||
|
||||
case 2: //关卡ID
|
||||
iuser := this.moduleSys.ModuleUser
|
||||
ex, err := iuser.GetUserExpand(uid)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
if ex.Uid == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
if v, ok := ex.Mline[1]; ok {
|
||||
if v < conf.Param {
|
||||
return ""
|
||||
}
|
||||
// 查询主线进度
|
||||
if levels := this.moduleSys.mainline.InquireMainLinePassLevel(uid); len(levels) > 0 {
|
||||
if _, ok := levels[conf.Param]; ok {
|
||||
return condData.Id
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
|
||||
case 3: //世界任务ID
|
||||
module, err := this.service.GetModule(comm.ModuleWtask)
|
||||
if err != nil {
|
||||
this.moduleSys.Debugln(err)
|
||||
return ""
|
||||
}
|
||||
if i, ok := module.(comm.IWtask); ok {
|
||||
d := i.InquireCompletes(uid)
|
||||
bFound := false
|
||||
case 3: //世界任务ID
|
||||
d := this.moduleSys.wtask.InquireCompletes(uid)
|
||||
for _, taskId := range d {
|
||||
if taskId == conf.Param {
|
||||
bFound = true
|
||||
break
|
||||
return condData.Id
|
||||
}
|
||||
}
|
||||
if !bFound {
|
||||
return ""
|
||||
}
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
|
||||
case 4:
|
||||
module, err := this.service.GetModule(comm.ModuleFriend)
|
||||
if err != nil {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
@ -9,7 +8,6 @@ import (
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"time"
|
||||
)
|
||||
|
||||
var _ comm.ISys = (*ModuleSys)(nil)
|
||||
@ -21,6 +19,7 @@ type ModuleSys struct {
|
||||
configure *configureComp
|
||||
service base.IRPCXService
|
||||
modelSys *ModelSys
|
||||
mainline comm.IMainline
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
@ -49,7 +48,12 @@ func (this *ModuleSys) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.wtask = module.(comm.IWtask)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_OpendCond), this.OpenCond)
|
||||
|
||||
if module, err = this.service.GetModule(comm.ModuleMainline); err != nil {
|
||||
|
||||
return
|
||||
}
|
||||
this.mainline = module.(comm.IMainline)
|
||||
return
|
||||
}
|
||||
|
||||
@ -57,10 +61,6 @@ func (this *ModuleSys) GetType() core.M_Modules {
|
||||
return comm.ModuleSys
|
||||
}
|
||||
|
||||
func (this *ModuleSys) IsAccess(funcName string, userId string) (errdata *pb.ErrorData) {
|
||||
return this.modelSys.IsAccess(funcName, userId)
|
||||
}
|
||||
|
||||
func (this *ModuleSys) ValidCond(uid string, conf *cfg.GameOpencondData) string {
|
||||
return this.modelSys.validCond(uid, conf)
|
||||
}
|
||||
@ -71,35 +71,6 @@ func (this *ModuleSys) CheckLvUpCond(session comm.IUserSession, lv int32) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ModuleSys) CheckMlineCond(session comm.IUserSession, id int32) {
|
||||
if cond := this.configure.getOpencondMline(id); len(cond) > 0 {
|
||||
this.AutoActivate(session, cond)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ModuleSys) CheckTaskCond(session comm.IUserSession, id int32) {
|
||||
if cond := this.configure.getOpencondTask(id); len(cond) > 0 {
|
||||
this.AutoActivate(session, cond)
|
||||
}
|
||||
}
|
||||
func (this *ModuleSys) CheckFriendCond(session comm.IUserSession, num int32) {
|
||||
if cond := this.configure.getFriendTask(num); len(cond) > 0 {
|
||||
// 通知本服
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
|
||||
_, err := this.service.RpcGo(
|
||||
ctx,
|
||||
comm.Service_Worker,
|
||||
string(comm.Rpc_OpendCond),
|
||||
&pb.RPCFriendNumReq{Uid: session.GetUserId(), Cond: cond},
|
||||
nil)
|
||||
if err != nil {
|
||||
this.Errorln(err)
|
||||
return
|
||||
}
|
||||
this.AutoActivate(session, cond)
|
||||
}
|
||||
}
|
||||
|
||||
// 自动激活
|
||||
func (this *ModuleSys) AutoActivate(session comm.IUserSession, cids []string) bool {
|
||||
var (
|
||||
@ -151,19 +122,6 @@ func (this *ModuleSys) CheckOpenCondCfgById(uid string, id string) (bOpen bool,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (this *ModuleSys) OpenCond(ctx context.Context, req *pb.RPCFriendNumReq, resp interface{}) (err error) {
|
||||
if session, ok := this.GetUserSession(req.Uid); ok {
|
||||
this.AutoActivate(session, req.Cond)
|
||||
if err = session.Push(); err != nil {
|
||||
this.Errorln(err)
|
||||
}
|
||||
this.PutUserSession(session)
|
||||
} else {
|
||||
this.PutUserSession(session)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *ModuleSys) FriendCountChange(uid string, count int32) {
|
||||
if cond := this.configure.getFriendTask(count); len(cond) > 0 {
|
||||
|
@ -89,8 +89,6 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com
|
||||
this.SNum = make(map[int64]int32, 0)
|
||||
configure.RegisterConfigure(game_lottery, cfg.NewGameLottery, this.LoadGroupData)
|
||||
|
||||
_d := this.GetGroupDataByLottery(100101, 1, 1)
|
||||
fmt.Printf("%v", _d)
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user