武馆图鉴
This commit is contained in:
parent
45d199b682
commit
d9fa0573a1
@ -83,6 +83,7 @@ const (
|
||||
ModuleDispatch core.M_Modules = "dispatch" //武馆派遣
|
||||
ModulePractice core.M_Modules = "practice" //熊猫武馆 练功系统
|
||||
ModuleFitness core.M_Modules = "fitness" //熊猫武馆 每日一健
|
||||
ModulePandaAtlas core.M_Modules = "atlas" //熊猫图鉴
|
||||
)
|
||||
|
||||
// 数据表名定义处
|
||||
|
@ -413,4 +413,8 @@ type (
|
||||
ISmithy interface {
|
||||
CheckActivateAtlasCollect(uid string, id string) (code pb.ErrorCode)
|
||||
}
|
||||
|
||||
IPandaAtlas interface {
|
||||
CheckActivatePandaAtlasCollect(uid string, id string) (code pb.ErrorCode)
|
||||
}
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ type apiComp struct {
|
||||
|
||||
//组件初始化接口
|
||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.MCompGate.Init(service, module, comp, options)
|
||||
this.MCompGate.Init(service, module, comp, options)
|
||||
this.module = module.(*PandaAtlas)
|
||||
this.service = service
|
||||
return
|
||||
@ -21,6 +21,5 @@ func (this *apiComp) Init(service core.IService, module core.IModule, comp core.
|
||||
|
||||
func (this *apiComp) Start() (err error) {
|
||||
err = this.MCompGate.Start()
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -35,7 +35,10 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateRe
|
||||
update["collect"] = list.Collect
|
||||
update["score"] = list.Score
|
||||
this.module.modelPandaAtlas.modifyPandaAtlasList(session.GetUserId(), update)
|
||||
session.SendMsg(string(this.module.GetType()), "activate", &pb.AtlasActivateResp{})
|
||||
session.SendMsg(string(this.module.GetType()), "activate", &pb.AtlasActivateResp{
|
||||
Data: list,
|
||||
})
|
||||
return
|
||||
} else {
|
||||
code = pb.ErrorCode_SmithyNoActivateAtlas
|
||||
}
|
||||
|
@ -16,6 +16,22 @@ func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.AtlasAwardReq
|
||||
// 获取铁匠铺图鉴信息
|
||||
func (this *apiComp) Award(session comm.IUserSession, req *pb.AtlasAwardReq) (code pb.ErrorCode, data proto.Message) {
|
||||
|
||||
list, _ := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId())
|
||||
conf := this.module.configure.GetPandoAtlasAwardConf(list.Award + 1)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_SmithyAtlasMaxLv
|
||||
return
|
||||
}
|
||||
// 校验积分够不够
|
||||
if list.Score < conf.AtlasScore {
|
||||
code = pb.ErrorCode_SmithyAtlasLackLv
|
||||
return
|
||||
}
|
||||
this.module.DispenseRes(session, conf.ItemId, true)
|
||||
update := make(map[string]interface{})
|
||||
list.Award += 1
|
||||
update["award"] = list.Award
|
||||
this.module.modelPandaAtlas.modifyPandaAtlasList(session.GetUserId(), update)
|
||||
session.SendMsg(string(this.module.GetType()), "award", &pb.AtlasAwardResp{})
|
||||
return
|
||||
}
|
||||
|
@ -8,18 +8,14 @@ import (
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) AtlasListCheck(session comm.IUserSession, req *pb.AtlasGetListReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.AtlasGetListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 获取铁匠铺图鉴信息
|
||||
func (this *apiComp) AtlasList(session comm.IUserSession, req *pb.AtlasGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
func (this *apiComp) GetList(session comm.IUserSession, req *pb.AtlasGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
|
||||
code = this.AtlasListCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
list, err := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
|
@ -31,10 +31,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
pandaAtlasAward: cfg.NewGamePandamasTjjl,
|
||||
})
|
||||
|
||||
_d := this.GetPandoAtlasConf("10110")
|
||||
_d1 := this.GetPandoJxConf("10001")
|
||||
_d2 := this.GetPandoAtlasAwardConf(1)
|
||||
this.module.Debugf("%v,%v,%v", _d, _d1, _d2)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -48,14 +48,3 @@ func (this *modelPandaAtlas) getPandaAtlasList(uid string) (result *pb.DBPandaAt
|
||||
func (this *modelPandaAtlas) modifyPandaAtlasList(uid string, data map[string]interface{}) error {
|
||||
return this.Change(uid, data)
|
||||
}
|
||||
|
||||
// 检查是否激活图鉴
|
||||
func (this *modelPandaAtlas) CheckActivateAtlas(uid string, id string, lv int32, quality int32, forgeCount int32) bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 检查是否激活收藏品
|
||||
func (this *modelPandaAtlas) CheckActivatePandaAtlas(uid string, id string) {
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
)
|
||||
|
||||
type PandaAtlas struct {
|
||||
@ -25,7 +26,7 @@ func NewModule() core.IModule {
|
||||
}
|
||||
|
||||
func (this *PandaAtlas) GetType() core.M_Modules {
|
||||
return comm.ModuleSmithy
|
||||
return comm.ModulePandaAtlas
|
||||
}
|
||||
|
||||
func (this *PandaAtlas) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
@ -41,7 +42,23 @@ func (this *PandaAtlas) OnInstallComp() {
|
||||
this.modelPandaAtlas = this.RegisterComp(new(modelPandaAtlas)).(*modelPandaAtlas)
|
||||
}
|
||||
|
||||
func (this *PandaAtlas) CheckActivateAtlasCollect(uid string, id string) (code pb.ErrorCode) {
|
||||
func (this *PandaAtlas) CheckActivatePandaAtlasCollect(uid string, id string) (code pb.ErrorCode) {
|
||||
list, _ := this.modelPandaAtlas.getPandaAtlasList(uid)
|
||||
if _, ok := list.Collect[id]; !ok {
|
||||
conf := this.configure.GetPandoAtlasConf(id)
|
||||
if conf != nil {
|
||||
list.Collect[id] = &pb.CollectInfo{
|
||||
Score: conf.AtlasScore,
|
||||
Time: configure.Now().Unix(),
|
||||
Activate: false,
|
||||
}
|
||||
update := make(map[string]interface{}, 0)
|
||||
update["collect"] = list.Collect
|
||||
this.modelPandaAtlas.modifyPandaAtlasList(uid, update)
|
||||
return
|
||||
}
|
||||
}
|
||||
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
this.Debugf("create CMD :%s", cmd) // 打印个日志方便查询
|
||||
datas := strings.Split(keys[1], ",")
|
||||
if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType ||
|
||||
datas[0] == comm.HeroType || datas[0] == comm.EquipmentType || datas[0] == comm.VipType) {
|
||||
datas[0] == comm.HeroType || datas[0] == comm.EquipmentType || datas[0] == comm.VipType || datas[0] == comm.PandaType) {
|
||||
num, err := strconv.Atoi(datas[2])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
|
@ -39,6 +39,7 @@ type ModuleBase struct {
|
||||
ModuleSociaty comm.ISociaty //公会
|
||||
ModulePrivilege comm.IPrivilege // 月卡
|
||||
ModuleSmithy comm.ISmithy //
|
||||
ModulePandaAtlas comm.IPandaAtlas //
|
||||
}
|
||||
|
||||
//重构模块配置对象
|
||||
@ -120,6 +121,10 @@ func (this *ModuleBase) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.ModuleSmithy = module.(comm.ISmithy)
|
||||
if module, err = this.service.GetModule(comm.ModulePandaAtlas); err != nil {
|
||||
return
|
||||
}
|
||||
this.ModulePandaAtlas = module.(comm.IPandaAtlas)
|
||||
return
|
||||
}
|
||||
|
||||
@ -393,6 +398,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
equips = make(map[string]uint32, 0)
|
||||
vip = make(map[string]int32, 0)
|
||||
atlas = make(map[string]int32, 0)
|
||||
panda = make(map[string]int32, 0)
|
||||
|
||||
for _, v := range res {
|
||||
switch v.A {
|
||||
@ -445,6 +451,12 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
this.Debugf("发放图鉴资源: %v [%v]", k, code)
|
||||
}
|
||||
}
|
||||
if len(panda) > 0 {
|
||||
for k := range panda {
|
||||
code = this.ModulePandaAtlas.CheckActivatePandaAtlasCollect(session.GetUserId(), k)
|
||||
this.Debugf("发放武馆图鉴资源: %v [%v]", k, code)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"go_dreamfactory/modules/academy"
|
||||
"go_dreamfactory/modules/arena"
|
||||
"go_dreamfactory/modules/atlas"
|
||||
"go_dreamfactory/modules/battle"
|
||||
"go_dreamfactory/modules/chat"
|
||||
"go_dreamfactory/modules/combat"
|
||||
@ -114,6 +115,7 @@ func main() {
|
||||
mline.NewModule(),
|
||||
pvp.NewModule(),
|
||||
dispatch.NewModule(),
|
||||
atlas.NewModule(),
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user