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_ModuleCaravanSettlement core.Rpc_Key = "Rpc_ModuleCaravanSettlement" //商队比赛结算信息
|
||||||
|
|
||||||
Rpc_ModuleBuriedTrigger core.Rpc_Key = "Rpc_ModuleBuriedTrigger" //埋点跨服触发通知
|
Rpc_ModuleBuriedTrigger core.Rpc_Key = "Rpc_ModuleBuriedTrigger" //埋点跨服触发通知
|
||||||
Rpc_OpendCond core.Rpc_Key = "Rpc_OpendCond"
|
|
||||||
//战令结算事件
|
//战令结算事件
|
||||||
Rpc_ModuleWarorderSettlement core.Rpc_Key = "Rpc_ModuleWarorderSettlement"
|
Rpc_ModuleWarorderSettlement core.Rpc_Key = "Rpc_ModuleWarorderSettlement"
|
||||||
//工会boos战结算 事件
|
//工会boos战结算 事件
|
||||||
|
@ -41,14 +41,9 @@ type (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
ISys interface {
|
ISys interface {
|
||||||
IsAccess(funcName string, uid string) (errdata *pb.ErrorData)
|
|
||||||
ValidCond(uid string, conf *cfg.GameOpencondData) string
|
ValidCond(uid string, conf *cfg.GameOpencondData) string
|
||||||
CheckLvUpCond(session IUserSession, lv int32)
|
CheckLvUpCond(session IUserSession, lv int32)
|
||||||
CheckTaskCond(session IUserSession, id int32)
|
|
||||||
CheckMlineCond(session IUserSession, id int32)
|
|
||||||
|
|
||||||
// 校验好友数量判断功能是否开启
|
|
||||||
CheckFriendCond(session IUserSession, num int32)
|
|
||||||
// 查询opencond 配置
|
// 查询opencond 配置
|
||||||
CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData)
|
CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData)
|
||||||
QueryOpenCondData(uid string) (data map[string]int32, 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
|
break
|
||||||
case comm.Reddot29101:
|
case comm.Reddot29101:
|
||||||
|
activity, process := this.CheckPoint29101(session.GetUserId())
|
||||||
reddot[comm.Reddot29101] = &pb.ReddotItem{
|
reddot[comm.Reddot29101] = &pb.ReddotItem{
|
||||||
Rid: int32(comm.Reddot29101),
|
Rid: int32(comm.Reddot29101),
|
||||||
Activated: this.CheckPoint29101(session.GetUserId()),
|
Activated: activity,
|
||||||
|
Progress: process,
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *Pagoda) CheckPoint29101(uid string) bool {
|
|
||||||
|
func (this *Pagoda) CheckPoint29101(uid string) (activated bool, progress int32) {
|
||||||
var (
|
var (
|
||||||
curWeekDay int32 //今天周几
|
curWeekDay int32 //今天周几
|
||||||
)
|
)
|
||||||
@ -179,34 +182,30 @@ func (this *Pagoda) CheckPoint29101(uid string) bool {
|
|||||||
}
|
}
|
||||||
list, err := this.modelRacePagoda.getPagodaRaceList(uid)
|
list, err := this.modelRacePagoda.getPagodaRaceList(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
for _, v := range list.Race {
|
for _, v := range list.Race {
|
||||||
if v.Race < 10 {
|
if v.Race < 10 { // 10以内的是阵营塔
|
||||||
bOpen := false
|
var defeat int32
|
||||||
// 校验今天是否开启
|
// 校验今天是否开启
|
||||||
if c, err := this.configure.GetPagodaCirculateConf(v.Race, v.Curfloor); err != nil {
|
if c, err := this.configure.GetPagodaCirculateConf(v.Race, v.Curfloor); err != nil {
|
||||||
for _, v := range c.Openingtime {
|
for _, v1 := range c.Openingtime {
|
||||||
if curWeekDay == v {
|
if curWeekDay == v1 {
|
||||||
bOpen = true
|
if utils.IsToday(v.Rtime) {
|
||||||
|
defeat = v.Defeat
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if defeat < 10 { // 每天固定打10次
|
||||||
|
progress += (10 - defeat)
|
||||||
|
activated = true
|
||||||
|
}
|
||||||
break
|
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,7 +14,8 @@ import (
|
|||||||
type ModelSys struct {
|
type ModelSys struct {
|
||||||
modules.MCompModel
|
modules.MCompModel
|
||||||
moduleSys *ModuleSys
|
moduleSys *ModuleSys
|
||||||
service core.IService
|
|
||||||
|
service core.IService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelSys) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *ModelSys) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
@ -25,28 +26,6 @@ func (this *ModelSys) Init(service core.IService, module core.IModule, comp core
|
|||||||
return
|
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 {
|
func (this *ModelSys) validCond(uid string, condData *cfg.GameOpencondData) string {
|
||||||
for _, conf := range condData.Main {
|
for _, conf := range condData.Main {
|
||||||
switch conf.Key {
|
switch conf.Key {
|
||||||
@ -61,45 +40,22 @@ func (this *ModelSys) validCond(uid string, condData *cfg.GameOpencondData) stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 2: //关卡ID
|
case 2: //关卡ID
|
||||||
iuser := this.moduleSys.ModuleUser
|
// 查询主线进度
|
||||||
ex, err := iuser.GetUserExpand(uid)
|
if levels := this.moduleSys.mainline.InquireMainLinePassLevel(uid); len(levels) > 0 {
|
||||||
if err != nil {
|
if _, ok := levels[conf.Param]; ok {
|
||||||
return ""
|
return condData.Id
|
||||||
}
|
} else {
|
||||||
if ex.Uid == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if v, ok := ex.Mline[1]; ok {
|
|
||||||
if v < conf.Param {
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3: //世界任务ID
|
case 3: //世界任务ID
|
||||||
module, err := this.service.GetModule(comm.ModuleWtask)
|
d := this.moduleSys.wtask.InquireCompletes(uid)
|
||||||
if err != nil {
|
for _, taskId := range d {
|
||||||
this.moduleSys.Debugln(err)
|
if taskId == conf.Param {
|
||||||
return ""
|
return condData.Id
|
||||||
}
|
|
||||||
if i, ok := module.(comm.IWtask); ok {
|
|
||||||
d := i.InquireCompletes(uid)
|
|
||||||
bFound := false
|
|
||||||
for _, taskId := range d {
|
|
||||||
if taskId == conf.Param {
|
|
||||||
bFound = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !bFound {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
return ""
|
||||||
case 4:
|
case 4:
|
||||||
module, err := this.service.GetModule(comm.ModuleFriend)
|
module, err := this.service.GetModule(comm.ModuleFriend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package sys
|
package sys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
@ -9,7 +8,6 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ comm.ISys = (*ModuleSys)(nil)
|
var _ comm.ISys = (*ModuleSys)(nil)
|
||||||
@ -21,6 +19,7 @@ type ModuleSys struct {
|
|||||||
configure *configureComp
|
configure *configureComp
|
||||||
service base.IRPCXService
|
service base.IRPCXService
|
||||||
modelSys *ModelSys
|
modelSys *ModelSys
|
||||||
|
mainline comm.IMainline
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
@ -49,7 +48,12 @@ func (this *ModuleSys) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.wtask = module.(comm.IWtask)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,10 +61,6 @@ func (this *ModuleSys) GetType() core.M_Modules {
|
|||||||
return comm.ModuleSys
|
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 {
|
func (this *ModuleSys) ValidCond(uid string, conf *cfg.GameOpencondData) string {
|
||||||
return this.modelSys.validCond(uid, conf)
|
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 {
|
func (this *ModuleSys) AutoActivate(session comm.IUserSession, cids []string) bool {
|
||||||
var (
|
var (
|
||||||
@ -151,19 +122,6 @@ func (this *ModuleSys) CheckOpenCondCfgById(uid string, id string) (bOpen bool,
|
|||||||
}
|
}
|
||||||
return
|
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) {
|
func (this *ModuleSys) FriendCountChange(uid string, count int32) {
|
||||||
if cond := this.configure.getFriendTask(count); len(cond) > 0 {
|
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)
|
this.SNum = make(map[int64]int32, 0)
|
||||||
configure.RegisterConfigure(game_lottery, cfg.NewGameLottery, this.LoadGroupData)
|
configure.RegisterConfigure(game_lottery, cfg.NewGameLottery, this.LoadGroupData)
|
||||||
|
|
||||||
_d := this.GetGroupDataByLottery(100101, 1, 1)
|
|
||||||
fmt.Printf("%v", _d)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user