108 lines
3.2 KiB
Go
108 lines
3.2 KiB
Go
package guildgve
|
|
|
|
import (
|
|
"context"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
func NewModule() core.IModule {
|
|
m := new(GuildGve)
|
|
return m
|
|
}
|
|
|
|
type GuildGve struct {
|
|
modules.ModuleBase
|
|
service comm.IService
|
|
sociaty comm.ISociaty
|
|
mail comm.Imail
|
|
battle comm.IBattle
|
|
battlerecord comm.IBattleRecord
|
|
api *apiComp
|
|
modelGuildGve *ModelUniongve
|
|
modelUnionroulette *ModelUnionroulette
|
|
modelGuildMember *ModelGuildMember
|
|
modelbattlerank *Modelbattlerank
|
|
modelRank *modelRank
|
|
configure *MCompConfigure
|
|
}
|
|
|
|
// 模块名
|
|
func (this *GuildGve) GetType() core.M_Modules {
|
|
return comm.ModuleGuildGve
|
|
}
|
|
|
|
// 模块初始化接口 注册用户创建角色事件
|
|
func (this *GuildGve) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
this.service = service.(comm.IService)
|
|
return
|
|
}
|
|
func (this *GuildGve) Start() (err error) {
|
|
err = this.ModuleBase.Start()
|
|
var module core.IModule
|
|
if module, err = this.service.GetModule(comm.ModuleSociaty); err != nil {
|
|
return
|
|
}
|
|
this.sociaty = module.(comm.ISociaty)
|
|
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
|
|
return
|
|
}
|
|
this.mail = module.(comm.Imail)
|
|
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
|
return
|
|
}
|
|
this.battle = module.(comm.IBattle)
|
|
if module, err = this.service.GetModule(comm.ModuleBattleRecord); err != nil {
|
|
return
|
|
}
|
|
this.battlerecord = module.(comm.IBattleRecord)
|
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleGuildBossSettlement), this.Rpc_ModuleGuildBossSettlement)
|
|
return
|
|
}
|
|
|
|
// 装备组件
|
|
func (this *GuildGve) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
|
|
this.modelGuildGve = this.RegisterComp(new(ModelUniongve)).(*ModelUniongve)
|
|
this.modelGuildMember = this.RegisterComp(new(ModelGuildMember)).(*ModelGuildMember)
|
|
this.modelbattlerank = this.RegisterComp(new(Modelbattlerank)).(*Modelbattlerank)
|
|
this.modelUnionroulette = this.RegisterComp(new(ModelUnionroulette)).(*ModelUnionroulette)
|
|
this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank)
|
|
}
|
|
|
|
// 工会Boos战结算通知
|
|
func (this *GuildGve) Rpc_ModuleGuildBossSettlement(ctx context.Context, req *pb.EmptyReq, resp interface{}) (err error) {
|
|
this.Debug("Rpc_ModuleGuildBossSettlement 工会Boos战结算通知 !")
|
|
this.modelRank.raceSettlement()
|
|
return
|
|
}
|
|
|
|
// 红点
|
|
func (this *GuildGve) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
|
|
var (
|
|
member *pb.DBGuildMember
|
|
err error
|
|
)
|
|
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
|
|
if member, err = this.modelGuildMember.inquireGuildMember(session.GetUserId()); err != nil {
|
|
return
|
|
}
|
|
for _, v := range rid {
|
|
switch v {
|
|
case comm.Reddot15301:
|
|
reddot[comm.Reddot26101] = &pb.ReddotItem{
|
|
Rid: int32(comm.Reddot26101),
|
|
Activated: true,
|
|
Progress: member.Boosticket,
|
|
}
|
|
break
|
|
}
|
|
}
|
|
return
|
|
}
|