package sociaty import ( "fmt" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" ) const ( gameSociatyLv = "game_guildlv.json" gameSociatyTask = "game_guildtask.json" gameSociatySign = "game_guildsign.json" gameSociatyActivity = "game_guildactivity.json" gameRdtaskCondi = "game_rdtaskcondi.json" gameSociatyBossTask = "game_guildbosstask.json" gameburiedCond = "game_buriedcondi.json" ) type configureComp struct { modules.MCompConfigure } func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompConfigure.Init(service, module, comp, options) err = this.LoadMultiConfigure(map[string]interface{}{ gameSociatyLv: cfg.NewGameGuildLv, gameSociatyTask: cfg.NewGameGuildTask, gameSociatySign: cfg.NewGameGuildSign, gameSociatyActivity: cfg.NewGameGuildActivity, gameRdtaskCondi: cfg.NewGameRdtaskCondi, gameSociatyBossTask: cfg.NewGameGuildBossTask, gameburiedCond: cfg.NewGameBuriedCondi, }) return } // 等级配置 func (this *configureComp) getSociatyLvCfg() (data *cfg.GameGuildLv, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(gameSociatyLv); err != nil { return } else { if data, ok = v.(*cfg.GameGuildLv); !ok { err = fmt.Errorf("%T no is *cfg.GameGuildLv", v) return } } return } // 签到配置 func (this *configureComp) getSociatySignCfg() (data *cfg.GameGuildSign, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(gameSociatySign); err != nil { return } else { if data, ok = v.(*cfg.GameGuildSign); !ok { err = fmt.Errorf("%T no is *cfg.GameGuildSign", v) return } } return } // 任务配置 func (this *configureComp) getSociatyTaskCfg() (data *cfg.GameGuildTask, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(gameSociatyTask); err != nil { return } else { if data, ok = v.(*cfg.GameGuildTask); !ok { err = fmt.Errorf("%T no is *cfg.GameGuildTask", v) return } } return } // 活跃度配置 func (this *configureComp) getSociatyActivityCfg() (data *cfg.GameGuildActivity, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(gameSociatyActivity); err != nil { return } else { if data, ok = v.(*cfg.GameGuildActivity); !ok { err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v) return } } return } // 任务 func (this *configureComp) getRtaskCondiCfg() (data *cfg.GameRdtaskCondi, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(gameRdtaskCondi); err != nil { return } else { if data, ok = v.(*cfg.GameRdtaskCondi); !ok { err = fmt.Errorf("%T no is *cfg.GameRdtaskCondi", v) return } } return } // 积分任务 func (this *configureComp) getBossTask(taskId int32) *cfg.GameGuildBossTaskData { if v, err := this.GetConfigure(gameSociatyBossTask); err != nil { return nil } else { data, ok := v.(*cfg.GameGuildBossTask) if !ok { err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v) return nil } if v, ok := data.GetDataMap()[taskId]; ok { return v } } return nil } // 积分任务列表 func (this *configureComp) getBossTaskList() []*cfg.GameGuildBossTaskData { if v, err := this.GetConfigure(gameSociatyBossTask); err != nil { return nil } else { data, ok := v.(*cfg.GameGuildBossTask) if !ok { err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v) return nil } return data.GetDataList() } } func (this *configureComp) getBuriedCondCfg() (data *cfg.GameBuriedCondi, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(gameburiedCond); err != nil { return } else { if data, ok = v.(*cfg.GameBuriedCondi); !ok { err = fmt.Errorf("%T is *cfg.GameWorldAll", v) return } } return }