This commit is contained in:
liwei 2023-07-26 15:15:34 +08:00
commit 47b5bf4c3c
8 changed files with 222 additions and 249 deletions

View File

@ -0,0 +1,7 @@
[
{
"BossId": 28110501,
"FriendlyBuffGroup": 300002,
"EnemyBuffGroup": 300001
}
]

View File

@ -28,7 +28,7 @@ type configureComp struct {
hlock sync.RWMutex
// stronestage
stage map[int64]*cfg.GameStoneStageData
szStage map[int32]int32 // k 关卡ID v 层数
// buff
buff map[int32]map[int32]struct{} // key buff 类型 value buffid
// 房间随机
@ -93,6 +93,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
// sz[144004312] = struct{}{}
// sz[124006311] = struct{}{}
// this.GetBuffGroupDataByLottery(100001, 1, sz)
this.CheckStage()
return
}
@ -152,7 +154,7 @@ func (this *configureComp) GetEventLotterConfById(id int32) (data *cfg.GameEvent
}
// 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
func (this *configureComp) GetEventGroupDataByLottery(lotteryId int32) (buff []int32) {
func (this *configureComp) GetEventGroupDataByLottery(lotteryId int32) (event []int32) {
if _, ok := this._lotteryType1E[lotteryId]; !ok {
if _, ok := this._lotteryType2E[lotteryId]; !ok {
@ -200,7 +202,7 @@ func (this *configureComp) GetEventGroupDataByLottery(lotteryId int32) (buff []i
}
index := comm.GetRandW(szW)
_data := this.GetEventLotterConfById(szID[index])
buff = append(buff, _data.EventID)
event = append(event, _data.EventID)
}
return
} else if this.StypeE[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比)
@ -212,7 +214,7 @@ func (this *configureComp) GetEventGroupDataByLottery(lotteryId int32) (buff []i
}
//fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v)
if wt >= comm.GetRandNum(0, 1000) { // 命中
buff = append(buff, _data.EventID)
event = append(event, _data.EventID)
}
}
}
@ -253,7 +255,7 @@ func (this *configureComp) GetEventGroupDataByLottery(lotteryId int32) (buff []i
}
index := comm.GetRandW(szW)
_data := this.GetEventLotterConfById(szID[index])
buff = append(buff, _data.EventID)
event = append(event, _data.EventID)
}
} else if this.StypeE[key] == 2 {
for _, v := range this._groupType2E[key] {
@ -263,7 +265,7 @@ func (this *configureComp) GetEventGroupDataByLottery(lotteryId int32) (buff []i
wt = _data.EventWt
}
if wt >= comm.GetRandNum(0, 1000) { // 命中
buff = append(buff, _data.EventID)
event = append(event, _data.EventID)
}
}
}
@ -332,7 +334,7 @@ func (this *configureComp) GetRoomLotterConfById(id int32) (data *cfg.GameRoomlo
}
// 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (buff []int32) {
func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (rooms []int32) {
if _, ok := this._lotteryType1R[lotteryId]; !ok {
if _, ok := this._lotteryType2R[lotteryId]; !ok {
@ -380,7 +382,7 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (buff []in
}
index := comm.GetRandW(szW)
_data := this.GetRoomLotterConfById(szID[index])
buff = append(buff, _data.RoomID)
rooms = append(rooms, _data.RoomID)
}
return
} else if this.StypeR[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比)
@ -392,7 +394,7 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (buff []in
}
//fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v)
if wt >= comm.GetRandNum(0, 1000) { // 命中
buff = append(buff, _data.RoomID)
rooms = append(rooms, _data.RoomID)
}
}
}
@ -433,7 +435,7 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (buff []in
}
index := comm.GetRandW(szW)
_data := this.GetRoomLotterConfById(szID[index])
buff = append(buff, _data.RoomID)
rooms = append(rooms, _data.RoomID)
}
} else if this.StypeR[key] == 2 {
for _, v := range this._groupType2R[key] {
@ -443,7 +445,7 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (buff []in
wt = _data.RoomWt
}
if wt >= comm.GetRandNum(0, 1000) { // 命中
buff = append(buff, _data.RoomID)
rooms = append(rooms, _data.RoomID)
}
}
}
@ -575,9 +577,11 @@ func (this *configureComp) LoadGameStoneStage() {
this.hlock.Lock()
defer this.hlock.Unlock()
this.stage = make(map[int64]*cfg.GameStoneStageData, 0)
this.szStage = make(map[int32]int32, 0)
for _, v := range configure.GetDataList() {
key := int64(v.StageId)<<16 + int64(v.RoomId)
this.stage[key] = v
this.szStage[v.StageId]++
}
}
}
@ -613,3 +617,32 @@ func (this *configureComp) LoadGameStoneBuff() {
func (this *configureComp) GetGameStoneBuff(addType int32) (m map[int32]struct{}) {
return this.buff[addType]
}
func (this *configureComp) CheckStage() {
var (
boosEvent map[int32]int32 // key stageid value rommid
)
boosEvent = make(map[int32]int32, 0)
for k, v := range this.szStage {
if c := this.GetStageConfByStageid(k, v-1); c != nil {
// 根据传送门组生成传送门
if rooms := this.GetRoomGroupDataByLottery(c.PortalGroup); len(rooms) > 0 {
boosEvent[k] = rooms[0]
}
}
}
// if v, err := this.GetConfigure(game_stageconf); err == nil {
// if configure, ok := v.(*cfg.GameStoneStage); ok {
// this.hlock.Lock()
// defer this.hlock.Unlock()
// this.stage = make(map[int64]*cfg.GameStoneStageData, 0)
// for _, v := range configure.GetDataList() {
// key := int64(v.StageId)<<16 + int64(v.RoomId)
// this.stage[key] = v
// }
// }
// }
return
}

View File

@ -3,6 +3,7 @@ package stonehenge
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
@ -31,6 +32,15 @@ func (this *MStonehenge) Init(service core.IService, module core.IModule, comp c
})
return
}
func (this *MStonehenge) Start() (err error) {
err = this.MCompModel.Start()
event.RegisterGO(core.Event_ServiceStartEnd, func() {
err = this.loadStoneBoos()
})
return
}
func (this *MStonehenge) GetStonehengeData(uid string) *pb.DBStonehenge {
stone := &pb.DBStonehenge{}
@ -53,3 +63,8 @@ func (this *MStonehenge) ChangeStonehengeData(uid string, update map[string]inte
return this.Change(uid, update)
}
func (this *MStonehenge) loadStoneBoos() (err error) {
return
}

View File

@ -30,112 +30,29 @@ func (*GameStoneBattleData) GetTypeId() int32 {
}
func (_v *GameStoneBattleData)Deserialize(_buf map[string]interface{}) (err error) {
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["BattleStageId"].(float64); !_ok_ {
err = errors.New("BattleStageId error")
return
}
_v.BattleStageId = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["EnemyShowIcon"].(float64); !_ok_ {
err = errors.New("EnemyShowIcon error")
return
}
_v.EnemyShowIcon = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["Atk"].(float64); !_ok_ {
err = errors.New("Atk error")
return
}
_v.Atk = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["Hp"].(float64); !_ok_ {
err = errors.New("Hp error")
return
}
_v.Hp = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["Def"].(float64); !_ok_ {
err = errors.New("Def error")
return
}
_v.Def = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["SpeedValue"].(float64); !_ok_ {
err = errors.New("SpeedValue error")
return
}
_v.SpeedValue = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["EffreValue"].(float64); !_ok_ {
err = errors.New("EffreValue error")
return
}
_v.EffreValue = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["BattleReadyID"].(float64); !_ok_ {
err = errors.New("BattleReadyID error")
return
}
_v.BattleReadyID = int32(_tempNum_)
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BattleStageId"].(float64); !_ok_ { err = errors.New("BattleStageId error"); return }; _v.BattleStageId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["EnemyShowIcon"].(float64); !_ok_ { err = errors.New("EnemyShowIcon error"); return }; _v.EnemyShowIcon = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Atk"].(float64); !_ok_ { err = errors.New("Atk error"); return }; _v.Atk = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Hp"].(float64); !_ok_ { err = errors.New("Hp error"); return }; _v.Hp = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Def"].(float64); !_ok_ { err = errors.New("Def error"); return }; _v.Def = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["SpeedValue"].(float64); !_ok_ { err = errors.New("SpeedValue error"); return }; _v.SpeedValue = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["EffreValue"].(float64); !_ok_ { err = errors.New("EffreValue error"); return }; _v.EffreValue = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BattleReadyID"].(float64); !_ok_ { err = errors.New("BattleReadyID error"); return }; _v.BattleReadyID = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["FormatList"].([]interface{}); !_ok_ {
err = errors.New("FormatList error")
return
}
if _arr_, _ok_ = _buf["FormatList"].([]interface{}); !_ok_ { err = errors.New("FormatList error"); return }
_v.FormatList = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{
var _ok_ bool
var _x_ float64
if _x_, _ok_ = _e_.(float64); !_ok_ {
err = errors.New("_list_v_ error")
return
}
_list_v_ = int32(_x_)
}
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.FormatList = append(_v.FormatList, _list_v_)
}
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["RewardLottery"].(float64); !_ok_ {
err = errors.New("RewardLottery error")
return
}
_v.RewardLottery = int32(_tempNum_)
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["RewardLottery"].(float64); !_ok_ { err = errors.New("RewardLottery error"); return }; _v.RewardLottery = int32(_tempNum_) }
return
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameStoneBoss struct {
_dataMap map[int32]*GameStoneBossData
_dataList []*GameStoneBossData
}
func NewGameStoneBoss(_buf []map[string]interface{}) (*GameStoneBoss, error) {
_dataList := make([]*GameStoneBossData, 0, len(_buf))
dataMap := make(map[int32]*GameStoneBossData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameStoneBossData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.BossId] = _v
}
}
return &GameStoneBoss{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameStoneBoss) GetDataMap() map[int32]*GameStoneBossData {
return table._dataMap
}
func (table *GameStoneBoss) GetDataList() []*GameStoneBossData {
return table._dataList
}
func (table *GameStoneBoss) Get(key int32) *GameStoneBossData {
return table._dataMap[key]
}

View File

@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameStoneBossData struct {
BossId int32
FriendlyBuffGroup int32
EnemyBuffGroup int32
}
const TypeId_GameStoneBossData = -2103514304
func (*GameStoneBossData) GetTypeId() int32 {
return -2103514304
}
func (_v *GameStoneBossData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BossId"].(float64); !_ok_ { err = errors.New("BossId error"); return }; _v.BossId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["FriendlyBuffGroup"].(float64); !_ok_ { err = errors.New("FriendlyBuffGroup error"); return }; _v.FriendlyBuffGroup = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["EnemyBuffGroup"].(float64); !_ok_ { err = errors.New("EnemyBuffGroup error"); return }; _v.EnemyBuffGroup = int32(_tempNum_) }
return
}
func DeserializeGameStoneBossData(_buf map[string]interface{}) (*GameStoneBossData, error) {
v := &GameStoneBossData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -29,102 +29,15 @@ func (*GameStoneBuffData) GetTypeId() int32 {
}
func (_v *GameStoneBuffData)Deserialize(_buf map[string]interface{}) (err error) {
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["BuffId"].(float64); !_ok_ {
err = errors.New("BuffId error")
return
}
_v.BuffId = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["Type"].(float64); !_ok_ {
err = errors.New("Type error")
return
}
_v.Type = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["SkillId"].(float64); !_ok_ {
err = errors.New("SkillId error")
return
}
_v.SkillId = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["BuffLevel"].(float64); !_ok_ {
err = errors.New("BuffLevel error")
return
}
_v.BuffLevel = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["Quality"].(float64); !_ok_ {
err = errors.New("Quality error")
return
}
_v.Quality = int32(_tempNum_)
}
{
var _ok_ bool
if _v.BuffIcon, _ok_ = _buf["BuffIcon"].(string); !_ok_ {
err = errors.New("BuffIcon error")
return
}
}
{
var _ok_ bool
var __json_text__ map[string]interface{}
if __json_text__, _ok_ = _buf["BuffStory"].(map[string]interface{}); !_ok_ {
err = errors.New("_v.BuffStory error")
return
}
{
var _ok_ bool
if _, _ok_ = __json_text__["key"].(string); !_ok_ {
err = errors.New("key error")
return
}
}
{
var _ok_ bool
if _v.BuffStory, _ok_ = __json_text__["text"].(string); !_ok_ {
err = errors.New("text error")
return
}
}
}
{
var _ok_ bool
var _x_ map[string]interface{}
if _x_, _ok_ = _buf["BuffUpgradeCost"].(map[string]interface{}); !_ok_ {
err = errors.New("BuffUpgradeCost error")
return
}
if _v.BuffUpgradeCost, err = DeserializeGameatn(_x_); err != nil {
return
}
}
{
var _ok_ bool
var _x_ map[string]interface{}
if _x_, _ok_ = _buf["BuffSell"].(map[string]interface{}); !_ok_ {
err = errors.New("BuffSell error")
return
}
if _v.BuffSell, err = DeserializeGameatn(_x_); err != nil {
return
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BuffId"].(float64); !_ok_ { err = errors.New("BuffId error"); return }; _v.BuffId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Type"].(float64); !_ok_ { err = errors.New("Type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["SkillId"].(float64); !_ok_ { err = errors.New("SkillId error"); return }; _v.SkillId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BuffLevel"].(float64); !_ok_ { err = errors.New("BuffLevel error"); return }; _v.BuffLevel = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Quality"].(float64); !_ok_ { err = errors.New("Quality error"); return }; _v.Quality = int32(_tempNum_) }
{ var _ok_ bool; if _v.BuffIcon, _ok_ = _buf["BuffIcon"].(string); !_ok_ { err = errors.New("BuffIcon error"); return } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["BuffStory"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.BuffStory error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.BuffStory, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["BuffUpgradeCost"].(map[string]interface{}); !_ok_ { err = errors.New("BuffUpgradeCost error"); return }; if _v.BuffUpgradeCost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["BuffSell"].(map[string]interface{}); !_ok_ { err = errors.New("BuffSell error"); return }; if _v.BuffSell, err = DeserializeGameatn(_x_); err != nil { return } }
return
}

View File

@ -211,6 +211,7 @@ type Tables struct {
GameSummaryTab *GameGameSummaryTab
GameSummary *GameGameSummary
CompositeAll *GameCompositeAll
StoneBoss *GameStoneBoss
}
func NewTables(loader JsonLoader) (*Tables, error) {
@ -1418,5 +1419,11 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.CompositeAll, err = NewGameCompositeAll(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_stoneboss") ; err != nil {
return nil, err
}
if tables.StoneBoss, err = NewGameStoneBoss(buf) ; err != nil {
return nil, err
}
return tables, nil
}