69 lines
1.7 KiB
Go
69 lines
1.7 KiB
Go
/*
|
|
模块名:Smithy
|
|
描述:美食家模块
|
|
开发:梅雄风
|
|
*/
|
|
package smithy
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
type Smithy struct {
|
|
modules.ModuleBase
|
|
modelSmithy *modelSmithy
|
|
modelTrade *modelTrade
|
|
api *apiComp
|
|
configure *configureComp
|
|
modelStove *modelStove
|
|
modelAtlas *modelAtlas
|
|
}
|
|
|
|
func NewModule() core.IModule {
|
|
return &Smithy{}
|
|
}
|
|
|
|
func (this *Smithy) GetType() core.M_Modules {
|
|
return comm.ModuleSmithy
|
|
}
|
|
|
|
func (this *Smithy) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
|
|
return
|
|
}
|
|
|
|
func (this *Smithy) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.modelSmithy = this.RegisterComp(new(modelSmithy)).(*modelSmithy)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
this.modelTrade = this.RegisterComp(new(modelTrade)).(*modelTrade)
|
|
this.modelStove = this.RegisterComp(new(modelStove)).(*modelStove)
|
|
}
|
|
|
|
// 接口信息
|
|
func (this *Smithy) ModifySmithyData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
|
|
err := this.modelSmithy.modifySmithyDataByUid(uid, data)
|
|
if err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
}
|
|
return
|
|
}
|
|
|
|
func (this *Smithy) SendRdTask(session comm.IUserSession, Items []*pb.UserAssets) {
|
|
var equip map[int32]int32 // key xingji value 数量
|
|
equip = make(map[int32]int32, 0)
|
|
for _, v := range Items {
|
|
if cfg := this.configure.GetEquipmentConfigureById(v.T); cfg == nil {
|
|
equip[cfg.Star]++
|
|
}
|
|
}
|
|
for k, v := range equip {
|
|
this.ModuleRtask.SendToRtask(session, comm.Rtype51, v, k)
|
|
}
|
|
}
|