This commit is contained in:
liwei1dao 2023-03-02 14:12:26 +08:00
commit 2043367dd1
10 changed files with 558 additions and 874 deletions

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,17 @@ func (this *MCompConfigure) LoadDropData() {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value)
if value.Condition == 0 {
this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value)
} else {
key := value.Condition
key = value.Dropid*100 + key
this._dropMap[key] = append(this._dropMap[key], value)
for _, v1 := range this._dropMap[value.Dropid] {
this._dropMap[key] = append(this._dropMap[key], v1)
}
}
}
return
}

View File

@ -161,57 +161,6 @@ func (this *configureComp) GetPollByType(poosType string) map[int32][]*cfg.GameD
return this.drawCardCfg[poosType]
}
// 获取英雄强化增加属性配置数据
func (this *configureComp) GetHeroStargrowConfig() (configure *cfg.GameHeroStargrow, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(hero_stargrow); err == nil {
if configure, ok = v.(*cfg.GameHeroStargrow); !ok {
err = fmt.Errorf("%T no is *cfg.GameHero", v)
return
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHero", v)
}
return
}
// 获取英雄升级属性变化相关配置数据
func (this *configureComp) GetHeroLevelgrowConfig() (configure *cfg.GameHeroLevelgrow, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(hero_levelgrow); err == nil {
if configure, ok = v.(*cfg.GameHeroLevelgrow); !ok {
err = fmt.Errorf("%T no is *cfg.GameHeroLevelgrow", v)
return
}
}
return
}
// 获取英雄升级相关配置数据
func (this *configureComp) GetHeroLevelUpConfig() (configure *cfg.GameHeroLevelup, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(hero_levelup); err == nil {
if configure, ok = v.(*cfg.GameHeroLevelup); !ok {
err = fmt.Errorf("%T no is *cfg.GameHeroLevelup", v)
return
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHeroLevelup", v)
}
return
}
func (this *configureComp) GetHeroExpConfig() (configure *cfg.GameHeroExp, err error) {
var (
v interface{}
@ -242,40 +191,6 @@ func (this *configureComp) GetHeroExp(hid string) *cfg.GameHeroExpData {
return nil
}
//英雄等级基础属性
func (this *configureComp) GetHeroLevelup() (configure *cfg.GameHeroLevelup, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(hero_levelup); err != nil {
return
} else {
if configure, ok = v.(*cfg.GameHeroLevelup); !ok {
err = fmt.Errorf("%T no is *cfg.GameHeroLevelup", v)
return
}
}
return
}
//英雄品质系数
func (this *configureComp) GetHeroStargrow() (configure *cfg.GameHeroStargrow, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(hero_stargrow); err != nil {
return
} else {
if configure, ok = v.(*cfg.GameHeroStargrow); !ok {
err = fmt.Errorf("%T no is *cfg.GameHeroStargrow", v)
return
}
}
return
}
//获取英雄配置
func (this *configureComp) GetHeroConfig(heroCfgId string) *cfg.GameHeroData {
if v, err := this.GetConfigure(new_hero); err == nil {
@ -286,61 +201,44 @@ func (this *configureComp) GetHeroConfig(heroCfgId string) *cfg.GameHeroData {
}
}
}
this.module.Errorf("config no is *cfg.GameHero")
this.module.Errorf("config no is *cfg.GameHero heroid :%s", heroCfgId)
return nil
}
//获取英雄星级配置
func (this *configureComp) GetHeroStar(star int32) *cfg.GameHeroStargrowData {
cfg, err := this.GetHeroStargrow()
if err != nil {
return nil
}
if v, ok := cfg.GetDataMap()[star]; ok {
return v
if v, err := this.GetConfigure(hero_stargrow); err == nil {
if configure, ok := v.(*cfg.GameHeroStargrow); ok {
return configure.Get(star)
}
}
this.module.Errorf(" GetHeroStar err : lv:%d", star)
return nil
}
//获取英雄等级配置
func (this *configureComp) GetHeroLv(lv int32) *cfg.GameHeroLevelupData {
cfg, err := this.GetHeroLevelup()
if err != nil {
return nil
}
if v, ok := cfg.GetDataMap()[lv]; ok {
return v
}
return nil
}
// 英雄成长系数
func (this *configureComp) GetHeroLevelgrow() (configure *cfg.GameHeroLevelgrow, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(hero_levelgrow); err != nil {
return
} else {
if configure, ok = v.(*cfg.GameHeroLevelgrow); !ok {
err = fmt.Errorf("%T no is *cfg.GameHeroLevelgrow", v)
return
if v, err := this.GetConfigure(hero_levelup); err == nil {
if configure, ok := v.(*cfg.GameHeroLevelup); ok {
return configure.Get(lv)
}
}
return
this.module.Errorf(" GetHeroLv err : lv:%d", lv)
return nil
}
//英雄成长配置
func (this *configureComp) GetHeroLvgrow(heroId string) *cfg.GameHeroLevelgrowData {
cfg, err := this.GetHeroLevelgrow()
if err != nil {
return nil
}
if v, ok := cfg.GetDataMap()[heroId]; ok {
return v
if v, err := this.GetConfigure(hero_levelgrow); err == nil {
if configure, ok := v.(*cfg.GameHeroLevelgrow); ok {
return configure.Get(heroId)
}
}
return nil
}
@ -494,9 +392,8 @@ func (this *configureComp) GetHeroSkillCost(star int32) (cost []*cfg.Gameatn) {
if configure, ok := v.(*cfg.GameHeroSkill); ok {
return configure.Get(star).Needgold
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHeroExp", v)
}
this.module.Errorf(" GetHeroSkillCost err : star:%d", star)
return
}
@ -507,9 +404,8 @@ func (this *configureComp) GetHeroMaxLv(star int32) int32 {
if configure, ok := v.(*cfg.GameHeroStargrow); ok {
return configure.Get(star).Maxlevel
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHero", v)
}
this.module.Errorf(" GetHeroMaxLv err : star:%d", star)
return 1
}

View File

@ -437,6 +437,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
starCfg := this.moduleHero.configure.GetHeroStar(hero.Star)
starLvfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil {
this.moduleHero.Debugf("hero PropertyCompute Configure Info err:heroid :%s, herolv:=%d,heroStar:%d,", hero.HeroID, hero.Lv, hero.Star)
return
}
var atk = (this.StarAtkAddition(hero.Star) + lvCfg.Atk + float32(growCfg.Atk)) * (growCfg.Atkgrow / 1000.0)

View File

@ -4,7 +4,6 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson/primitive"
"google.golang.org/protobuf/proto"
)
@ -16,22 +15,15 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PagodaGetLi
///获取主线关卡信息
func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq) (code pb.ErrorCode, data proto.Message) {
var (
list *pb.DBPagoda
)
list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId())
if list.Id == "" { // 普通塔
list.Id = primitive.NewObjectID().Hex()
list.Uid = session.GetUserId()
list.PagodaId = 0 // 初始数据0层
list.Type = comm.PagodaType
this.module.modelPagoda.addNewPagoda(session.GetUserId(), list)
} else if list.Complete {
list, _ = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
list, err := this.module.modelPagoda.getPagodaList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
// if list.Complete { // 这个版本不给赛季塔信息
// list, _ = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
// }
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
return

View File

@ -7,6 +7,7 @@ import (
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
@ -30,8 +31,14 @@ func (this *ModelPagoda) Init(service core.IService, module core.IModule, comp c
// 获取爬塔信息
func (this *ModelPagoda) getPagodaList(uid string) (result *pb.DBPagoda, err error) {
result = &pb.DBPagoda{}
if err = this.Get(uid, result); err != nil && err == mgo.MongodbNil {
err = nil
if err = this.Get(uid, result); err != nil && err == mgo.MongodbNil { // 初始一条数据
result.Id = primitive.NewObjectID().Hex()
result.Uid = uid
result.PagodaId = 0 // 初始数据0层
result.Reward = make(map[int32]bool, 0)
result.Type = comm.PagodaType
err = this.module.modelPagoda.addNewPagoda(uid, result)
return
}

View File

@ -150,8 +150,9 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
return
}
} else {
res := this.module.configure.GetDropReward(reelcfg.BasicDrop)
//res := this.module.configure.GetSmithyDropReward(reelcfg.BasicDrop)
// 获取掉落id
newdrop := this.module.modelStove.CheckUnlockSuid(req.ReelId, stove.Data[req.ReelId].Lv, reelcfg.BasicDrop)
res := this.module.configure.GetDropReward(newdrop)
if err, atno := this.module.DispenseAtno(session, res, true); err == pb.ErrorCode_Success {
for _, v := range atno {
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success {

View File

@ -207,8 +207,8 @@ func (this *configureComp) LoadProficileData() {
return
}
func (this *configureComp) GetSmithyProficileData(reelid int32, proficile int32) *cfg.GameSmithyProficiencyData {
return this._mapProficile[int64(reelid<<16)+int64(proficile)]
func (this *configureComp) GetSmithyProficileData(reelid int32, lv int32) *cfg.GameSmithyProficiencyData {
return this._mapProficile[int64(reelid<<16)+int64(lv)]
}
// 获取铁匠铺顾客配置

View File

@ -9,6 +9,7 @@ import (
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"math"
"math/big"
"strconv"
@ -210,3 +211,22 @@ func (this *modelStove) GetRandEquipLv(sz []int32) int32 {
}
return 0
}
func (this *modelStove) CheckUnlockSuid(reelId, lv, dropid int32) int32 {
var index int32
var szDrop []int32
var szLen int32
for index = 1; index <= lv; index++ {
if conf := this.module.configure.GetSmithyProficileData(reelId, index); conf != nil {
if conf.Type == comm.SmithyReelType4 && conf.Value1 != 0 {
szDrop = append(szDrop, conf.Value1)
}
}
}
szLen = int32(len(szDrop))
dropid *= int32(math.Pow(10, float64(szLen)))
for pos, v := range szDrop {
dropid += v * int32(math.Pow(10, float64(pos)))
}
return dropid
}

View File

@ -13,11 +13,10 @@ import "errors"
type GameDropData struct {
Id int32
Dropid int32
Condition int32
Prize []*Gameatn
Star int32
P int32
EnableType int32
Condition int32
}
const TypeId_GameDropData = 1700203957
@ -29,6 +28,7 @@ func (*GameDropData) GetTypeId() int32 {
func (_v *GameDropData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dropid"].(float64); !_ok_ { err = errors.New("dropid error"); return }; _v.Dropid = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["condition"].(float64); !_ok_ { err = errors.New("condition error"); return }; _v.Condition = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
@ -45,8 +45,6 @@ func (_v *GameDropData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["p"].(float64); !_ok_ { err = errors.New("p error"); return }; _v.P = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["enable_type"].(float64); !_ok_ { err = errors.New("enable_type error"); return }; _v.EnableType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["condition"].(float64); !_ok_ { err = errors.New("condition error"); return }; _v.Condition = int32(_tempNum_) }
return
}