上传代码
This commit is contained in:
parent
f0bae825b4
commit
65b62a400b
@ -20,7 +20,7 @@ type (
|
|||||||
}
|
}
|
||||||
//功能开启通知
|
//功能开启通知
|
||||||
IOpenCmdNotice interface {
|
IOpenCmdNotice interface {
|
||||||
OpenCmdNotice(session IUserSession, keys ...string)
|
OpenCmdNotice(uid string, keys ...string)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -214,6 +214,9 @@ type (
|
|||||||
isepic:是否史诗 与 dyweight 互斥
|
isepic:是否史诗 与 dyweight 互斥
|
||||||
*/
|
*/
|
||||||
GetForgeEquip(session IUserSession, suiteId int32, pos int32, lv int32, dyweight []int32, isepic bool) (eruip *pb.DB_Equipment, errdata *pb.ErrorData)
|
GetForgeEquip(session IUserSession, suiteId int32, pos int32, lv int32, dyweight []int32, isepic bool) (eruip *pb.DB_Equipment, errdata *pb.ErrorData)
|
||||||
|
|
||||||
|
//GM接口 获取全部装备
|
||||||
|
GMGetAllEquip(session IUserSession, ismaxlv bool) (errdata *pb.ErrorData)
|
||||||
}
|
}
|
||||||
|
|
||||||
IMline interface {
|
IMline interface {
|
||||||
@ -373,6 +376,7 @@ type (
|
|||||||
ComputeHeroNumeric(uid string, hero ...*pb.DBHero)
|
ComputeHeroNumeric(uid string, hero ...*pb.DBHero)
|
||||||
///红点
|
///红点
|
||||||
IGetReddot
|
IGetReddot
|
||||||
|
GMFulllevel(session IUserSession) (errdata *pb.ErrorData)
|
||||||
}
|
}
|
||||||
IPrivilege interface {
|
IPrivilege interface {
|
||||||
// 创建一个新的特权卡
|
// 创建一个新的特权卡
|
||||||
|
@ -62,6 +62,15 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取全部资源
|
||||||
|
func (this *configureComp) GetAllEquipmentConfigure() (configure []*cfg.GameEquipData) {
|
||||||
|
if v, err := this.GetConfigure(game_equip); err == nil {
|
||||||
|
configure = v.(*cfg.GameEquip).GetDataList()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 获取装备配置数据
|
// 获取装备配置数据
|
||||||
func (this *configureComp) GetEquipmentConfigure() (configure *cfg.GameEquip, err error) {
|
func (this *configureComp) GetEquipmentConfigure() (configure *cfg.GameEquip, err error) {
|
||||||
var (
|
var (
|
||||||
@ -239,6 +248,31 @@ func (this *configureComp) GetEquipmentIntensifyConfigureById(etype, star, lv in
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取武器等级消耗表
|
||||||
|
func (this *configureComp) GetEquipmentMaxIntensifyConfigureById(etype, star int32) (configure *cfg.GameEquipIntensifyData, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
lv int32
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(equip_intensify); err != nil {
|
||||||
|
this.module.Errorf("err:%v", err)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
for _, v1 := range v.(*cfg.GameEquipIntensify).GetDataList() {
|
||||||
|
if v1.TypeId == etype && v1.Star == star && len(v1.Need) > 0 && v1.Level > lv {
|
||||||
|
lv = v1.Level
|
||||||
|
configure = v1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if configure == nil {
|
||||||
|
err = fmt.Errorf("EquipmentConfigure not found star :%d lv:%d", star, lv)
|
||||||
|
this.module.Errorf("err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 获取装备锻造数据
|
// 获取装备锻造数据
|
||||||
func (this *configureComp) GetEquipCompose(id int32) (result *cfg.GameEquipSComposeData, err error) {
|
func (this *configureComp) GetEquipCompose(id int32) (result *cfg.GameEquipSComposeData, err error) {
|
||||||
var (
|
var (
|
||||||
|
@ -448,3 +448,90 @@ func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equ
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建满级装备数据
|
||||||
|
func (this *modelEquipmentComp) newMaxEquipment(uid string, conf *cfg.GameEquipData) (equipment *pb.DB_Equipment, err error) {
|
||||||
|
var (
|
||||||
|
mattr []*cfg.GameEquipAttrlibrarySData
|
||||||
|
sattr []*cfg.GameEquipAttrlibrarySData
|
||||||
|
equipatt *cfg.GameEquipAttributeData
|
||||||
|
intensify *cfg.GameEquipIntensifyData
|
||||||
|
satterNum int32
|
||||||
|
)
|
||||||
|
if intensify, err = this.module.configure.GetEquipmentMaxIntensifyConfigureById(conf.EquipId, conf.Color); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
equipment = &pb.DB_Equipment{
|
||||||
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
CId: conf.Id,
|
||||||
|
Lv: intensify.Level + 1,
|
||||||
|
UId: uid,
|
||||||
|
OverlayNum: 1,
|
||||||
|
IsInitialState: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
if mattr, err = this.module.configure.GetEquipmentAttrlibraryConfigureById(conf.Leadlibrary); err != nil || len(mattr) == 0 {
|
||||||
|
err = fmt.Errorf("no found mattr%d", conf.Leadlibrary)
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
equipment.MainEntry = &pb.EquipmentAttributeEntry{
|
||||||
|
Id: mattr[0].Key,
|
||||||
|
Libraryid: mattr[0].Libraryid,
|
||||||
|
Lv: intensify.Level + 1,
|
||||||
|
AttrName: mattr[0].Attrkey,
|
||||||
|
Value: mattr[0].Attrvar,
|
||||||
|
BaseValue: mattr[0].Attrvar,
|
||||||
|
}
|
||||||
|
equipment.MainEntry.Value = equipment.MainEntry.BaseValue + int32(math.Floor(float64(equipment.MainEntry.BaseValue*intensify.Bonus)/1000.0))
|
||||||
|
if sattr, err = this.module.configure.GetEquipmentAttrlibraryConfigureById(conf.Addlibrary); err != nil || len(mattr) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, v := range sattr { //移除主属性
|
||||||
|
if v.Attrkey == equipment.MainEntry.AttrName {
|
||||||
|
sattr = append(sattr[0:i], sattr[i+1:]...)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
satterNum = int32(len(sattr))
|
||||||
|
if satterNum > 0 && satterNum <= 4 {
|
||||||
|
equipment.Star = satterNum
|
||||||
|
if conf.EquipId == 1 {
|
||||||
|
equipment.AdverbEntry = make([]*pb.EquipmentAttributeEntry, 0)
|
||||||
|
|
||||||
|
for _, v := range comm.RandShuffle(len(sattr))[:satterNum] {
|
||||||
|
adverbEntry := &pb.EquipmentAttributeEntry{
|
||||||
|
Id: sattr[v].Key,
|
||||||
|
Libraryid: sattr[v].Libraryid,
|
||||||
|
Lv: 5,
|
||||||
|
AttrName: sattr[v].Attrkey,
|
||||||
|
Value: sattr[v].Attrvar,
|
||||||
|
BaseValue: sattr[v].Attrvar,
|
||||||
|
}
|
||||||
|
value := adverbEntry.BaseValue + int32(float64(sattr[v].Addition[adverbEntry.Lv-1])/1000.0*float64(adverbEntry.BaseValue))
|
||||||
|
if adverbEntry.Value < value {
|
||||||
|
adverbEntry.Value = value
|
||||||
|
}
|
||||||
|
equipment.AdverbEntry = append(equipment.AdverbEntry, adverbEntry)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
equipment.Adverbskill = make([]*pb.EquipmentSkillEntry, 0)
|
||||||
|
for _, v := range comm.RandShuffle(len(sattr))[:satterNum] {
|
||||||
|
if equipatt, err = this.module.configure.getEquipAttribute(sattr[v].Attrkey); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
equipment.Adverbskill = append(equipment.Adverbskill, &pb.EquipmentSkillEntry{
|
||||||
|
Id: sattr[v].Key,
|
||||||
|
Libraryid: sattr[v].Libraryid,
|
||||||
|
AttrName: sattr[v].Attrkey,
|
||||||
|
SkillId: equipatt.SkillId,
|
||||||
|
Lv: 5,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -8,6 +8,7 @@ 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"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
@ -526,6 +527,59 @@ func (this *Equipment) GetForgeEquip(session comm.IUserSession, suiteId int32, p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GM 命令接口
|
||||||
|
获取全部装备
|
||||||
|
*/
|
||||||
|
func (this *Equipment) GMGetAllEquip(session comm.IUserSession, ismaxlv bool) (errdata *pb.ErrorData) {
|
||||||
|
|
||||||
|
var (
|
||||||
|
configure *cfg.GameEquip
|
||||||
|
equipments []*pb.DB_Equipment = make([]*pb.DB_Equipment, 0)
|
||||||
|
equipment *pb.DB_Equipment
|
||||||
|
model *db.DBModel
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if configure, err = this.configure.GetEquipmentConfigure(); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range configure.GetDataList() {
|
||||||
|
if equipment, err = this.modelEquipment.newMaxEquipment(session.GetUserId(), v); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
equipments = append(equipments, equipment)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(equipments) > 0 {
|
||||||
|
if this.IsCross() {
|
||||||
|
if model, err = this.GetDBModelByUid(session.GetUserId(), comm.TableEquipment); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
} else {
|
||||||
|
if err = model.AddLists(session.GetUserId(), equipments); err != nil {
|
||||||
|
this.Errorf("err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err = this.modelEquipment.AddLists(session.GetUserId(), equipments); err != nil {
|
||||||
|
this.Errorf("err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.equipmentsChangePush(session, equipments)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Evens--------------------------------------------------------------------------------------------------------------------------------
|
// Evens--------------------------------------------------------------------------------------------------------------------------------
|
||||||
// 推送道具变化消息
|
// 推送道具变化消息
|
||||||
func (this *Equipment) equipmentsChangePush(session comm.IUserSession, items []*pb.DB_Equipment) (err error) {
|
func (this *Equipment) equipmentsChangePush(session comm.IUserSession, items []*pb.DB_Equipment) (err error) {
|
||||||
|
@ -44,6 +44,27 @@ func (this *configureComp) getHoroscope(id int32) (result *cfg.GameHoroscopeData
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询星座信息
|
||||||
|
func (this *configureComp) getMaxHoroscopes() (result map[int32]*cfg.GameHoroscopeData, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(game_horoscope); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
} else {
|
||||||
|
for _, v := range v.(*cfg.GameHoroscope).GetDataMap() {
|
||||||
|
if _, ok = result[v.NodeId]; !ok {
|
||||||
|
result[v.NodeId] = v
|
||||||
|
}
|
||||||
|
if v.Lv > result[v.NodeId].Lv {
|
||||||
|
result[v.NodeId] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 查询星座信息
|
// 查询星座信息
|
||||||
func (this *configureComp) getHoroscopebylv(nodeid, lv int32) (result *cfg.GameHoroscopeData, err error) {
|
func (this *configureComp) getHoroscopebylv(nodeid, lv int32) (result *cfg.GameHoroscopeData, err error) {
|
||||||
var (
|
var (
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -76,3 +77,42 @@ func (this *Horoscope) Reddot(session comm.IUserSession, rid ...comm.ReddotType)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GM 满级星座图
|
||||||
|
func (this *Horoscope) GMFulllevel(session comm.IUserSession) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
confs map[int32]*cfg.GameHoroscopeData
|
||||||
|
info *pb.DBHoroscope
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
|
||||||
|
if confs, err = this.configure.getMaxHoroscopes(); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if info, err = this.modelHoroscope.queryInfo(session.GetUserId()); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v := range confs {
|
||||||
|
info.Nodes[k] = v.Lv
|
||||||
|
}
|
||||||
|
if err = this.modelHoroscope.updateInfo(session, info); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -203,16 +203,16 @@ func (this *Practice) TaskComplete(session comm.IUserSession, taskid int32) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Practice) OpenCmdNotice(session comm.IUserSession, keys ...string) {
|
func (this *Practice) OpenCmdNotice(uid string, keys ...string) {
|
||||||
this.Debug("OpenCmdNotice",
|
this.Debug("OpenCmdNotice",
|
||||||
log.Field{Key: "session", Value: session.GetUserId()},
|
log.Field{Key: "session", Value: uid},
|
||||||
log.Field{Key: "key", Value: keys},
|
log.Field{Key: "key", Value: keys},
|
||||||
)
|
)
|
||||||
if !this.IsCross() {
|
if !this.IsCross() {
|
||||||
for _, v := range keys {
|
for _, v := range keys {
|
||||||
err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||||
comm.Service_Worker, string(comm.RPC_ModulePracticeUnLockPillar),
|
comm.Service_Worker, string(comm.RPC_ModulePracticeUnLockPillar),
|
||||||
&pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: v}, &pb.EmptyResp{})
|
&pb.RPCGeneralReqA2{Param1: uid, Param2: v}, &pb.EmptyResp{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.Errorln(err)
|
this.Errorln(err)
|
||||||
return
|
return
|
||||||
@ -221,7 +221,7 @@ func (this *Practice) OpenCmdNotice(session comm.IUserSession, keys ...string) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
for _, v := range keys {
|
for _, v := range keys {
|
||||||
this.RPC_ModulePracticeUnLockPillar(context.Background(), &pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: v}, &pb.EmptyResp{})
|
this.RPC_ModulePracticeUnLockPillar(context.Background(), &pb.RPCGeneralReqA2{Param1: uid, Param2: v}, &pb.EmptyResp{})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ic, ok := i.(comm.IOpenCmdNotice); ok {
|
if ic, ok := i.(comm.IOpenCmdNotice); ok {
|
||||||
ic.OpenCmdNotice(session, req.Cid)
|
go ic.OpenCmdNotice(session.GetUserId(), req.Cid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -231,14 +231,13 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, userTask *
|
|||||||
userTask.Chapters = make(map[int32]int32)
|
userTask.Chapters = make(map[int32]int32)
|
||||||
}
|
}
|
||||||
userTask.Chapters[curTaskConf.Group] = 1 //已解锁待领取
|
userTask.Chapters[curTaskConf.Group] = 1 //已解锁待领取
|
||||||
|
}
|
||||||
|
}
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"chapters": userTask.Chapters,
|
"chapters": userTask.Chapters,
|
||||||
"currentTasks": userTask.CurrentTasks,
|
"currentTasks": userTask.CurrentTasks,
|
||||||
}
|
}
|
||||||
this.Change(session.GetUserId(), update)
|
this.Change(session.GetUserId(), update)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 任务完成推送
|
// 任务完成推送
|
||||||
session.SendMsg(string(this.moduleWorldtask.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{
|
session.SendMsg(string(this.moduleWorldtask.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{
|
||||||
NextTask: nextTask,
|
NextTask: nextTask,
|
||||||
|
@ -53,7 +53,7 @@ func (this *Worldtask) Start() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 功能开启
|
// 功能开启
|
||||||
func (this *Worldtask) OpenCmdNotice(session comm.IUserSession, keys ...string) {
|
func (this *Worldtask) OpenCmdNotice(uid string, keys ...string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@ type configureComp struct {
|
|||||||
module *WTask
|
module *WTask
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
condlTask map[int32][]*cfg.GameWorldTaskData //key 条件ID
|
condlTask map[int32][]*cfg.GameWorldTaskData //key 条件ID
|
||||||
|
desTask map[int32][]*cfg.GameWorldTaskData //key 分类
|
||||||
groupTask map[int32][]*cfg.GameWorldTaskData //key 任务组
|
groupTask map[int32][]*cfg.GameWorldTaskData //key 任务组
|
||||||
|
opencmdTask map[string][]*cfg.GameWorldTaskData //key 功能开启
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
@ -66,12 +68,27 @@ func (this *configureComp) updateconfigure() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
worldtaskConf := make(map[int32][]*cfg.GameWorldTaskData)
|
worldtaskConf := make(map[int32][]*cfg.GameWorldTaskData)
|
||||||
groupaskConf := make(map[int32][]*cfg.GameWorldTaskData)
|
destaskConf := make(map[int32][]*cfg.GameWorldTaskData)
|
||||||
|
grouptaskConf := make(map[int32][]*cfg.GameWorldTaskData)
|
||||||
|
opencmdConf := make(map[string][]*cfg.GameWorldTaskData)
|
||||||
for _, v := range gwt.GetDataList() {
|
for _, v := range gwt.GetDataList() {
|
||||||
if _, ok := groupaskConf[v.Group]; !ok {
|
|
||||||
groupaskConf[v.Group] = make([]*cfg.GameWorldTaskData, 0)
|
if _, ok := destaskConf[v.Des]; !ok {
|
||||||
|
destaskConf[v.Des] = make([]*cfg.GameWorldTaskData, 0)
|
||||||
|
}
|
||||||
|
destaskConf[v.Des] = append(destaskConf[v.Des], v)
|
||||||
|
|
||||||
|
if _, ok := grouptaskConf[v.Group]; !ok {
|
||||||
|
grouptaskConf[v.Group] = make([]*cfg.GameWorldTaskData, 0)
|
||||||
|
}
|
||||||
|
grouptaskConf[v.Group] = append(grouptaskConf[v.Group], v)
|
||||||
|
|
||||||
|
if v.Opencond != "" {
|
||||||
|
if _, ok := opencmdConf[v.Opencond]; !ok {
|
||||||
|
opencmdConf[v.Opencond] = make([]*cfg.GameWorldTaskData, 0)
|
||||||
|
}
|
||||||
|
opencmdConf[v.Opencond] = append(opencmdConf[v.Opencond], v)
|
||||||
}
|
}
|
||||||
groupaskConf[v.Group] = append(groupaskConf[v.Group], v)
|
|
||||||
|
|
||||||
for _, condl := range v.Completetask {
|
for _, condl := range v.Completetask {
|
||||||
if _, ok := worldtaskConf[condl]; !ok {
|
if _, ok := worldtaskConf[condl]; !ok {
|
||||||
@ -83,7 +100,9 @@ func (this *configureComp) updateconfigure() {
|
|||||||
|
|
||||||
this.lock.Lock()
|
this.lock.Lock()
|
||||||
this.condlTask = worldtaskConf
|
this.condlTask = worldtaskConf
|
||||||
this.groupTask = groupaskConf
|
this.desTask = destaskConf
|
||||||
|
this.groupTask = grouptaskConf
|
||||||
|
this.opencmdTask = opencmdConf
|
||||||
this.lock.Unlock()
|
this.lock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,12 +112,28 @@ func (this *configureComp) getcondlTask() map[int32][]*cfg.GameWorldTaskData {
|
|||||||
return this.condlTask
|
return this.condlTask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *configureComp) getdesTask(des int32) []*cfg.GameWorldTaskData {
|
||||||
|
this.lock.RLock()
|
||||||
|
defer this.lock.RUnlock()
|
||||||
|
if _, ok := this.desTask[des]; ok {
|
||||||
|
return this.desTask[des]
|
||||||
|
} else {
|
||||||
|
return make([]*cfg.GameWorldTaskData, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *configureComp) getgroupTask() map[int32][]*cfg.GameWorldTaskData {
|
func (this *configureComp) getgroupTask() map[int32][]*cfg.GameWorldTaskData {
|
||||||
this.lock.RLock()
|
this.lock.RLock()
|
||||||
defer this.lock.RUnlock()
|
defer this.lock.RUnlock()
|
||||||
return this.groupTask
|
return this.groupTask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *configureComp) getopencmdTask() map[string][]*cfg.GameWorldTaskData {
|
||||||
|
this.lock.RLock()
|
||||||
|
defer this.lock.RUnlock()
|
||||||
|
return this.opencmdTask
|
||||||
|
}
|
||||||
|
|
||||||
func (this *configureComp) gettaskconfconfigure(tid int32) (conf *cfg.GameWorldTaskData, err error) {
|
func (this *configureComp) gettaskconfconfigure(tid int32) (conf *cfg.GameWorldTaskData, err error) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -150,8 +150,129 @@ func (this *WTask) BuriedsNotify(uid string, condis []*pb.ConIProgress) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 功能开启
|
// 功能开启
|
||||||
func (this *WTask) OpenCmdNotice(session comm.IUserSession, keys ...string) {
|
func (this *WTask) OpenCmdNotice(uid string, keys ...string) {
|
||||||
|
var (
|
||||||
|
opencmdTask map[string][]*cfg.GameWorldTaskData
|
||||||
|
user *pb.DBUser
|
||||||
|
wtask *pb.DBWTask
|
||||||
|
err error
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
//初步校验
|
||||||
|
opencmdTask = this.configure.getopencmdTask()
|
||||||
|
for _, key := range keys {
|
||||||
|
if _, ok = opencmdTask[key]; ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if user = this.ModuleUser.GetUser(uid); user == nil {
|
||||||
|
this.Error("获取用户信息失败!", log.Field{Key: "uid", Value: uid})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if wtask, err = this.modelwtask.getUserWTasks(uid); err != nil {
|
||||||
|
this.Error("获取世界任务数据 失败!", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
session, _ := this.GetUserSession(uid)
|
||||||
|
defer func() {
|
||||||
|
session.Push()
|
||||||
|
this.PutUserSession(session)
|
||||||
|
}()
|
||||||
|
this.inquireActivations(session, wtask, user.Lv, keys, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商队任务
|
||||||
|
func (this *WTask) AcceptCaravanTask(session comm.IUserSession, groupId int32) (task *pb.Worldtask, errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
alltasks []*cfg.GameWorldTaskData
|
||||||
|
grouptask []*cfg.GameWorldTaskData = make([]*cfg.GameWorldTaskData, 0)
|
||||||
|
completeMap map[int32]struct{} = make(map[int32]struct{})
|
||||||
|
target *cfg.GameWorldTaskData
|
||||||
|
wtask *pb.DBWTask
|
||||||
|
err error
|
||||||
|
ok bool
|
||||||
|
changeActiva bool
|
||||||
|
changeAccept bool
|
||||||
|
)
|
||||||
|
alltasks = this.configure.getdesTask(5)
|
||||||
|
for _, v := range alltasks {
|
||||||
|
if v.Group == groupId {
|
||||||
|
grouptask = append(grouptask, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(grouptask) == 0 {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: fmt.Sprintf("no found des:%d groud:%d tasks", 5, groupId),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if wtask, err = this.modelwtask.getUserWTasks(session.GetUserId()); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range wtask.Completes {
|
||||||
|
completeMap[v] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range grouptask {
|
||||||
|
if _, ok = completeMap[v.Key]; !ok { //找到一个为完成任务
|
||||||
|
target = v
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if target != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: fmt.Sprintf("no found des:%d groud:%d nocomplete tasks", 5, groupId),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//有新任务接取
|
||||||
|
|
||||||
|
if target.AutoAccept == 0 {
|
||||||
|
wtask.Activations = append(wtask.Activations, target.Key)
|
||||||
|
changeActiva = true
|
||||||
|
|
||||||
|
} else if target.AutoAccept == 1 { //自动接取任务
|
||||||
|
wtask.Accepts = append(wtask.Accepts, target.Key)
|
||||||
|
changeAccept = true
|
||||||
|
}
|
||||||
|
|
||||||
|
//有新任务接取
|
||||||
|
if changeActiva {
|
||||||
|
session.SendMsg(string(this.GetType()), "activations", &pb.WTaskActivationsChangePush{Activations: wtask.Activations})
|
||||||
|
}
|
||||||
|
|
||||||
|
if changeAccept {
|
||||||
|
if _, errdata = this.pushtaskprogress(session, wtask, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = this.modelwtask.updateUserWTasks(session.GetUserId(), wtask); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验任务进度
|
// 校验任务进度
|
||||||
@ -258,6 +379,7 @@ func (this *WTask) checkgroupState(session comm.IUserSession, wtask *pb.DBWTask,
|
|||||||
var (
|
var (
|
||||||
groupTask map[int32][]*cfg.GameWorldTaskData
|
groupTask map[int32][]*cfg.GameWorldTaskData
|
||||||
completeMap map[int32]struct{} = make(map[int32]struct{})
|
completeMap map[int32]struct{} = make(map[int32]struct{})
|
||||||
|
des int32
|
||||||
ok bool
|
ok bool
|
||||||
)
|
)
|
||||||
groupTask = this.configure.getgroupTask()
|
groupTask = this.configure.getgroupTask()
|
||||||
@ -268,8 +390,12 @@ func (this *WTask) checkgroupState(session comm.IUserSession, wtask *pb.DBWTask,
|
|||||||
if _, ok = completeMap[v.Key]; !ok {
|
if _, ok = completeMap[v.Key]; !ok {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
des = v.Des
|
||||||
}
|
}
|
||||||
wtask.Groups[group] = 1
|
wtask.Groups[group] = 1
|
||||||
|
if des == 5 { //商队任务
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询可接取任务列表
|
// 查询可接取任务列表
|
||||||
|
Loading…
Reference in New Issue
Block a user