Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
0adc56ddc7
@ -34,51 +34,52 @@ const (
|
|||||||
|
|
||||||
// 模块名定义处
|
// 模块名定义处
|
||||||
const (
|
const (
|
||||||
ModuleSys core.M_Modules = "sys" //系统
|
ModuleSys core.M_Modules = "sys" //系统
|
||||||
ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块
|
ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块
|
||||||
ModuleWeb core.M_Modules = "web" //后台模块
|
ModuleWeb core.M_Modules = "web" //后台模块
|
||||||
ModuleUser core.M_Modules = "user" //用户模块
|
ModuleUser core.M_Modules = "user" //用户模块
|
||||||
ModulePack core.M_Modules = "pack" //背包模块
|
ModulePack core.M_Modules = "pack" //背包模块
|
||||||
ModuleMail core.M_Modules = "mail" //邮件模块
|
ModuleMail core.M_Modules = "mail" //邮件模块
|
||||||
ModuleFriend core.M_Modules = "friend" //好友模块
|
ModuleFriend core.M_Modules = "friend" //好友模块
|
||||||
ModuleMgoLog core.M_Modules = "mgolog" //日志模块
|
ModuleMgoLog core.M_Modules = "mgolog" //日志模块
|
||||||
ModuleEquipment core.M_Modules = "equipment" //装备模块
|
ModuleEquipment core.M_Modules = "equipment" //装备模块
|
||||||
ModuleHero core.M_Modules = "hero" //英雄模块
|
ModuleHero core.M_Modules = "hero" //英雄模块
|
||||||
ModuleForum core.M_Modules = "forum" //论坛模块
|
ModuleForum core.M_Modules = "forum" //论坛模块
|
||||||
ModuleItems core.M_Modules = "items" //道具模块
|
ModuleItems core.M_Modules = "items" //道具模块
|
||||||
ModuleShop core.M_Modules = "shop" //商店模块
|
ModuleShop core.M_Modules = "shop" //商店模块
|
||||||
ModuleTask core.M_Modules = "task" //任务模块
|
ModuleTask core.M_Modules = "task" //任务模块
|
||||||
ModuleMainline core.M_Modules = "mainline" //主线模块
|
ModuleMainline core.M_Modules = "mainline" //主线模块
|
||||||
ModuleNotify core.M_Modules = "notify" //公告模块
|
ModuleNotify core.M_Modules = "notify" //公告模块
|
||||||
ModuleChat core.M_Modules = "chat" //聊天模块
|
ModuleChat core.M_Modules = "chat" //聊天模块
|
||||||
ModuleGM core.M_Modules = "gm" //gm模块
|
ModuleGM core.M_Modules = "gm" //gm模块
|
||||||
ModulePagoda core.M_Modules = "pagoda" //魔塔模块
|
ModulePagoda core.M_Modules = "pagoda" //魔塔模块
|
||||||
ModuleMartialhall core.M_Modules = "martialhall" //武馆模块
|
ModuleMartialhall core.M_Modules = "martialhall" //武馆模块
|
||||||
ModuleGourmet core.M_Modules = "gourmet" //美食馆
|
ModuleGourmet core.M_Modules = "gourmet" //美食馆
|
||||||
ModuleRtask core.M_Modules = "rtask" //随机任务
|
ModuleRtask core.M_Modules = "rtask" //随机任务
|
||||||
ModuleSmithy core.M_Modules = "smithy" //铁匠铺
|
ModuleSmithy core.M_Modules = "smithy" //铁匠铺
|
||||||
ModuleTimer core.M_Modules = "timer" //定时任务模块
|
ModuleTimer core.M_Modules = "timer" //定时任务模块
|
||||||
ModuleViking core.M_Modules = "viking" //维京远征
|
ModuleViking core.M_Modules = "viking" //维京远征
|
||||||
ModuleMoonfantasy core.M_Modules = "moonfantasy" //月之秘境模块
|
ModuleMoonfantasy core.M_Modules = "moonfantasy" //月之秘境模块
|
||||||
ModuleHunting core.M_Modules = "hunting" //狩猎
|
ModuleHunting core.M_Modules = "hunting" //狩猎
|
||||||
ModuleLinestory core.M_Modules = "linestory" //支线剧情
|
ModuleLinestory core.M_Modules = "linestory" //支线剧情
|
||||||
ModuleBattle core.M_Modules = "battle" //战斗
|
ModuleBattle core.M_Modules = "battle" //战斗
|
||||||
ModuleLibrary core.M_Modules = "library" //藏书馆
|
ModuleLibrary core.M_Modules = "library" //藏书馆
|
||||||
ModuleArena core.M_Modules = "arena" //竞技场
|
ModuleArena core.M_Modules = "arena" //竞技场
|
||||||
ModuleTroll core.M_Modules = "troll" //巨怪商队
|
ModuleTroll core.M_Modules = "troll" //巨怪商队
|
||||||
ModuleHoroscope core.M_Modules = "horoscope" //星座图
|
ModuleHoroscope core.M_Modules = "horoscope" //星座图
|
||||||
ModuleSociaty core.M_Modules = "sociaty" //公会
|
ModuleSociaty core.M_Modules = "sociaty" //公会
|
||||||
ModulePay core.M_Modules = "pay" //支付
|
ModulePay core.M_Modules = "pay" //支付
|
||||||
ModuleAcademy core.M_Modules = "academy" //联盟学院
|
ModuleAcademy core.M_Modules = "academy" //联盟学院
|
||||||
ModulePrivilege core.M_Modules = "privilege" //特权
|
ModulePrivilege core.M_Modules = "privilege" //特权
|
||||||
ModuleGrowtask core.M_Modules = "growtask" //成长任务
|
ModuleGrowtask core.M_Modules = "growtask" //成长任务
|
||||||
ModuleWorldtask core.M_Modules = "worldtask" //世界任务
|
ModuleWorldtask core.M_Modules = "worldtask" //世界任务
|
||||||
ModuleReddot core.M_Modules = "reddot" //红点
|
ModuleReddot core.M_Modules = "reddot" //红点
|
||||||
ModuleCombat core.M_Modules = "combat" //关卡编辑
|
ModuleCombat core.M_Modules = "combat" //关卡编辑
|
||||||
ModuleEnchant core.M_Modules = "enchant" //附魔
|
ModuleEnchant core.M_Modules = "enchant" //附魔
|
||||||
ModuleAutoBattle core.M_Modules = "autobattle" //自动战斗
|
ModuleAutoBattle core.M_Modules = "autobattle" //自动战斗
|
||||||
ModuleMline core.M_Modules = "mline" //主线模块
|
ModuleMline core.M_Modules = "mline" //主线模块
|
||||||
ModulePvp core.M_Modules = "pvp" //实时pvp
|
ModulePvp core.M_Modules = "pvp" //实时pvp
|
||||||
|
ModulePandaTakekan core.M_Modules = "pandatakekan" //熊猫武馆
|
||||||
)
|
)
|
||||||
|
|
||||||
// 数据表名定义处
|
// 数据表名定义处
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@ -15,7 +16,10 @@ import (
|
|||||||
func newClient(addr string, mgr IClientMgr, log log.ILogger) (c *client, err error) {
|
func newClient(addr string, mgr IClientMgr, log log.ILogger) (c *client, err error) {
|
||||||
c = &client{addr: addr, mgr: mgr, log: log, seq: 1, state: 1, pending: make(map[uint64]*MessageCall)}
|
c = &client{addr: addr, mgr: mgr, log: log, seq: 1, state: 1, pending: make(map[uint64]*MessageCall)}
|
||||||
dialer := websocket.Dialer{}
|
dialer := websocket.Dialer{}
|
||||||
c.conn, _, err = dialer.Dial(addr, nil)
|
ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
|
||||||
|
if c.conn, _, err = dialer.DialContext(ctx, addr, nil); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
go c.run()
|
go c.run()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ func (this *modelBattleComp) createpve(session comm.IUserSession, conn *db.DBCon
|
|||||||
record.Redflist[0].Team[i].Ishelp = true
|
record.Redflist[0].Team[i].Ishelp = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ok := this.checkBattlereadyCapskill(req.Format.Leadpos, heros); ok {
|
if ok := this.checkBattlereadyCapskill(req.Format.Leadpos, heros); !ok {
|
||||||
code = pb.ErrorCode_BattleCapskillCheckFailed
|
code = pb.ErrorCode_BattleCapskillCheckFailed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ func (this *modelBattleComp) createpvb(session comm.IUserSession, conn *db.DBCon
|
|||||||
record.Redflist[ii].Team[i].Ishelp = true
|
record.Redflist[ii].Team[i].Ishelp = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ok := this.checkBattlereadyCapskill(v.Leadpos, heros); ok {
|
if ok := this.checkBattlereadyCapskill(v.Leadpos, heros); !ok {
|
||||||
code = pb.ErrorCode_BattleCapskillCheckFailed
|
code = pb.ErrorCode_BattleCapskillCheckFailed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ func (this *modelBattleComp) createpvp(session comm.IUserSession, conn *db.DBCon
|
|||||||
record.Redflist[0].Team[i] = nil
|
record.Redflist[0].Team[i] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ok := this.checkBattlereadyCapskill(req.Redformat.Leadpos, req.Redformat.Format); ok {
|
if ok := this.checkBattlereadyCapskill(req.Redformat.Leadpos, req.Redformat.Format); !ok {
|
||||||
code = pb.ErrorCode_BattleCapskillCheckFailed
|
code = pb.ErrorCode_BattleCapskillCheckFailed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ func (this *modelBattleComp) createpvp(session comm.IUserSession, conn *db.DBCon
|
|||||||
record.Buleflist[0].Team[i] = nil
|
record.Buleflist[0].Team[i] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ok := this.checkBattlereadyCapskill(req.Buleformat.Leadpos, req.Buleformat.Format); ok {
|
if ok := this.checkBattlereadyCapskill(req.Buleformat.Leadpos, req.Buleformat.Format); !ok {
|
||||||
code = pb.ErrorCode_BattleCapskillCheckFailed
|
code = pb.ErrorCode_BattleCapskillCheckFailed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ func (this *modelBattleComp) creatertpvp(redmodel, bluemodel *db.DBModel, btype
|
|||||||
record.Redflist[ii].Team[i] = nil
|
record.Redflist[ii].Team[i] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ok := this.checkBattlereadyCapskill(v.Leadpos, heros); ok {
|
if ok := this.checkBattlereadyCapskill(v.Leadpos, heros); !ok {
|
||||||
code = pb.ErrorCode_BattleCapskillCheckFailed
|
code = pb.ErrorCode_BattleCapskillCheckFailed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -472,7 +472,7 @@ func (this *modelBattleComp) creatertpvp(redmodel, bluemodel *db.DBModel, btype
|
|||||||
record.Buleflist[ii].Team[i] = nil
|
record.Buleflist[ii].Team[i] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ok := this.checkBattlereadyCapskill(v.Leadpos, heros); ok {
|
if ok := this.checkBattlereadyCapskill(v.Leadpos, heros); !ok {
|
||||||
code = pb.ErrorCode_BattleCapskillCheckFailed
|
code = pb.ErrorCode_BattleCapskillCheckFailed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,9 @@ func (this *Battle) Init(service core.IService, module core.IModule, options cor
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *Battle) Start() (err error) {
|
func (this *Battle) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
if err = this.ModuleBase.Start(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
var module core.IModule
|
var module core.IModule
|
||||||
if module, err = this.service.GetModule(comm.ModuleFriend); err != nil {
|
if module, err = this.service.GetModule(comm.ModuleFriend); err != nil {
|
||||||
return
|
return
|
||||||
|
@ -57,7 +57,9 @@ func (this *ModuleBase) Init(service core.IService, module core.IModule, options
|
|||||||
|
|
||||||
//模块启动接口
|
//模块启动接口
|
||||||
func (this *ModuleBase) Start() (err error) {
|
func (this *ModuleBase) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
if err = this.ModuleBase.Start(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
var comp core.IServiceComp
|
var comp core.IServiceComp
|
||||||
//注册远程路由
|
//注册远程路由
|
||||||
if comp, err = this.service.GetComp(comm.SC_ServiceGateRouteComp); err != nil {
|
if comp, err = this.service.GetComp(comm.SC_ServiceGateRouteComp); err != nil {
|
||||||
|
29
modules/pandatakekan/api.go
Normal file
29
modules/pandatakekan/api.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package pandatakekan
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
API
|
||||||
|
*/
|
||||||
|
type apiComp struct {
|
||||||
|
modules.MCompGate
|
||||||
|
service core.IService
|
||||||
|
module *PandaTakekan
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
this.MCompGate.Init(service, module, comp, options)
|
||||||
|
this.module = module.(*PandaTakekan)
|
||||||
|
this.service = service
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *apiComp) Start() (err error) {
|
||||||
|
err = this.MCompGate.Start()
|
||||||
|
return
|
||||||
|
}
|
49
modules/pandatakekan/module.go
Normal file
49
modules/pandatakekan/module.go
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package pandatakekan
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
模块名:熊猫武馆
|
||||||
|
描述:熊猫武馆 主系统 打桩 以及武馆相关数据管理
|
||||||
|
开发:李伟
|
||||||
|
*/
|
||||||
|
func NewModule() core.IModule {
|
||||||
|
m := new(PandaTakekan)
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
type PandaTakekan struct {
|
||||||
|
modules.ModuleBase
|
||||||
|
service base.IRPCXService
|
||||||
|
api *apiComp
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块名
|
||||||
|
func (this *PandaTakekan) GetType() core.M_Modules {
|
||||||
|
return comm.ModulePandaTakekan
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块初始化接口 注册用户创建角色事件
|
||||||
|
func (this *PandaTakekan) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (this *PandaTakekan) Start() (err error) {
|
||||||
|
err = this.ModuleBase.Start()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备组件
|
||||||
|
func (this *PandaTakekan) OnInstallComp() {
|
||||||
|
this.ModuleBase.OnInstallComp()
|
||||||
|
|
||||||
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
|
|
||||||
|
}
|
@ -71,8 +71,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
err = this.LoadConfigure(game_smithyatlaslv, cfg.NewGameSmithyAtlasLv)
|
err = this.LoadConfigure(game_smithyatlaslv, cfg.NewGameSmithyAtlasLv)
|
||||||
err = this.LoadConfigure(game_smithyatlasscore, cfg.NewGameSmithyAtlasScore)
|
err = this.LoadConfigure(game_smithyatlasscore, cfg.NewGameSmithyAtlasScore)
|
||||||
|
|
||||||
_d := this.GetSmithProficiencyConf(1)
|
|
||||||
this.module.Errorf("%v", _d)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +250,7 @@ func (this *configureComp) GetSmithyStoveConf(level int32) (data *cfg.GameSmithy
|
|||||||
|
|
||||||
// 获取图鉴信息
|
// 获取图鉴信息
|
||||||
func (this *configureComp) GetSmithyAtlasConf(id string) (data *cfg.GameSmithyAtlasData) {
|
func (this *configureComp) GetSmithyAtlasConf(id string) (data *cfg.GameSmithyAtlasData) {
|
||||||
if v, err := this.GetConfigure(game_smithystove); err == nil {
|
if v, err := this.GetConfigure(game_smithyatlas); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameSmithyAtlas); ok {
|
if configure, ok := v.(*cfg.GameSmithyAtlas); ok {
|
||||||
data = configure.Get(id)
|
data = configure.Get(id)
|
||||||
return
|
return
|
||||||
@ -263,7 +261,7 @@ func (this *configureComp) GetSmithyAtlasConf(id string) (data *cfg.GameSmithyAt
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *configureComp) GetSmithyAtlasLvConf(lv int32) (data *cfg.GameSmithyAtlasLvData) {
|
func (this *configureComp) GetSmithyAtlasLvConf(lv int32) (data *cfg.GameSmithyAtlasLvData) {
|
||||||
if v, err := this.GetConfigure(game_smithystove); err == nil {
|
if v, err := this.GetConfigure(game_smithyatlaslv); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameSmithyAtlasLv); ok {
|
if configure, ok := v.(*cfg.GameSmithyAtlasLv); ok {
|
||||||
data = configure.Get(lv)
|
data = configure.Get(lv)
|
||||||
return
|
return
|
||||||
@ -279,7 +277,7 @@ func (this *configureComp) GetSmithyAtlasScoreConf(quality int32, lv int32) (dat
|
|||||||
|
|
||||||
// 获取图鉴分数
|
// 获取图鉴分数
|
||||||
func (this *configureComp) LoadSmithyAtlasScoreConf() {
|
func (this *configureComp) LoadSmithyAtlasScoreConf() {
|
||||||
if v, err := this.GetConfigure(game_smithystove); err == nil {
|
if v, err := this.GetConfigure(game_smithyatlasscore); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameSmithyAtlasScore); ok {
|
if configure, ok := v.(*cfg.GameSmithyAtlasScore); ok {
|
||||||
this.hlock.Lock()
|
this.hlock.Lock()
|
||||||
defer this.hlock.Unlock()
|
defer this.hlock.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user