训龙养成新增属性 六合塔领奖

This commit is contained in:
meixiongfeng 2024-01-12 15:34:36 +08:00
parent b746c06746
commit 59f996ddfc
11 changed files with 226 additions and 44 deletions

View File

@ -40509,7 +40509,9 @@
1200
],
"FollowSK": [],
"SucFollowSK": [],
"SucFollowSK": [
225002319
],
"FailFollowSK": [],
"MustHit": false,
"DpsRevisiType": 0,
@ -40638,9 +40640,7 @@
2
],
"FollowSK": [],
"SucFollowSK": [
225002319
],
"SucFollowSK": [],
"FailFollowSK": [],
"MustHit": false,
"DpsRevisiType": 0,
@ -72688,7 +72688,7 @@
"TriggerAnim": "",
"Type": 12,
"Argu": [
100
300
],
"FollowSK": [],
"SucFollowSK": [],

View File

@ -32415,12 +32415,13 @@
"ChildSkill": {
"Id": [
225002211,
225002213,
225002215
]
},
"passSkill": [
225002212
225002211,
225002212,
225002215
],
"Desc": {
"key": "skill_skill_atk_Desc_125002211_1",

View File

@ -148,6 +148,7 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
dragon.Property["energyrecover"] = c.Energyrecover
dragon.Property["caddtime"] = c.Caddtime
dragon.Property["csubtime"] = c.Csubtime
dragon.Property["offsetspeed"] = c.Offsetspeed
update["property"] = dragon.Property // 更新属性
}
// 升阶后重置养成属性次数

View File

@ -118,6 +118,8 @@ func (this *ModelDragon) CreateDragon(session comm.IUserSession, dragons map[str
dragon.Property["energyrecover"] = c.Energyrecover
dragon.Property["caddtime"] = c.Caddtime
dragon.Property["csubtime"] = c.Csubtime
dragon.Property["offsetspeed"] = c.Offsetspeed
dragon.Property["offsetspeed"] = c.Offsetspeed
}
}

View File

@ -98,6 +98,7 @@ func (this *Dragon) CreateRobotDragon(dragonid string, lv int32) (dragon *pb.DBD
// dragon.Property["itemsprint"] = c.Itemsprint
dragon.Property["caddtime"] = c.Caddtime
dragon.Property["csubtime"] = c.Csubtime
dragon.Property["offsetspeed"] = c.Offsetspeed
}
return
}
@ -179,6 +180,7 @@ func (this *Dragon) GMModifyDragonLv(uid string, cid string, lv int32) (dragon *
dragon.Property["energyrecover"] = c.Energyrecover
dragon.Property["caddtime"] = c.Caddtime
dragon.Property["csubtime"] = c.Csubtime
dragon.Property["offsetspeed"] = c.Offsetspeed
update["property"] = dragon.Property
}
}

View File

@ -168,6 +168,34 @@ func Test_Main(t *testing.T) {
szByte []byte
)
szByte = make([]byte, 0)
//010 2
// 1<<2
var star1, star2, star3 int32
var rst int32
rst = 1
for i := 0; i < 3; i++ {
star1 = 1 << i
if rst&star1 == star1 {
star3++
}
}
star1 = 1 << 0
//star2 = 1 << 1
star3 = 1 << 2 // 101
rst |= star1
rst |= star2
rst |= star3
//rst = star1 ^ star2 ^ star3 // 三星
//rst = star1 ^ star2 // 2星
rst ^= star1
rst ^= star2
rst ^= star2
// 校验星
b1 := (rst&star1 == star1)
b2 := (rst&star2 == star2)
b3 := (rst&star3 == star3)
fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
fmt.Printf("%v,%v,%v,%d", b1, b2, b3, rst)
//szByte = append(szByte, 8)
fmt.Printf("%v,%s", szByte, string(szByte))
@ -254,23 +282,6 @@ func Test_Main(t *testing.T) {
}
defer trace.Stop()
var star1, star2, star3 int32
var rst int32
star1 = 1 << 0
star2 = 1 << 1
star3 = 1 << 2
//rst = star1 ^ star2 ^ star3 // 三星
//rst = star1 ^ star2 // 2星
rst ^= star1
rst ^= star2
rst ^= star2
// 校验星
b1 := (rst&star1 == star1)
b2 := (rst&star2 == star2)
b3 := (rst&star3 == star3)
fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
fmt.Printf("%v,%v,%v,%d", b1, b2, b3, rst)
var list []int32
var list2 []int32
list = []int32{1, 2, 3, 4, 5, 6, 7, 8, 9}

View File

@ -29,7 +29,6 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
award []*cfg.Gameatn
changExp map[string]int32
costTime int32 // 耗时
star int32 // 当前星级
new bool // 是否首次挑战
)
changExp = make(map[string]int32, 0)
@ -69,18 +68,23 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
}
return
}
costTime = req.Report.Costtime
if _, ok := list.Data[conf.Floors]; !ok {
if list.Maxfloor+1 == conf.Floors {
list.Data[conf.Floors] = &pb.RaceData{
Consttime: costTime,
Star: star,
Star: req.Star,
}
if req.Star > 0 {
list.Maxfloor = conf.Floors
mapData["maxfloor"] = list.Maxfloor
}
new = true
}
}
list.Data[conf.Floors].Star = req.Star
list.Battlecount += 1
mapData["data"] = list.Data
mapData["battlecount"] = list.Battlecount

View File

@ -0,0 +1,103 @@
package pagoda
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
//参数校验
func (this *apiComp) RaceRewardCheck(session comm.IUserSession, req *pb.PagodaRaceRewardReq) (errdata *pb.ErrorData) {
return
}
// 六合塔奖励
func (this *apiComp) RaceReward(session comm.IUserSession, req *pb.PagodaRaceRewardReq) (errdata *pb.ErrorData) {
var (
atno []*pb.UserAtno
list *pb.DBPagodaRace
err error
szConf []*cfg.GameSixDirectionsRewardData
res []*cfg.Gameatn
totalStar int32
floors []int32
curStr int32
)
if errdata = this.RaceRewardCheck(session, req); errdata != nil {
return // 参数校验失败直接返回
}
if list, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
szConf = this.module.configure.GetSixDirectionsConf(req.Groud)
if len(szConf) == 0 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("conf not fount:%d", req.Groud),
}
return
}
floors = this.module.configure.GetSixDirectionsGroudConf(req.Groud)
if len(floors) == 0 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("conf not fount:%d", req.Groud),
}
return
} // 1 2 3
for _, v := range floors {
if d, ok := list.Data[v]; ok {
curStr = 0
star1 := 0
for i := 0; i < 3; i++ {
star1 = 1 << i
if int(d.Star)&star1 == star1 {
curStr++
}
}
totalStar += curStr
}
}
for _, v := range szConf {
if list.Reward[req.Groud] < v.Starnum {
list.Reward[req.Groud] = v.Starnum
res = append(res, v.Reward...)
}
}
if len(res) == 0 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_UserNoReward,
Title: pb.ErrorCode_UserNoReward.ToString(),
Message: fmt.Sprintf("UserNoReward:%d", req.Groud),
}
return
}
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
return
}
mapData := make(map[string]interface{}, 0)
mapData["reward"] = list.Reward
errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), "racereward", &pb.PagodaRaceRewardResp{
Data: list,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "PagodaRaceRewardReq", atno)
})
return
}

View File

@ -18,6 +18,7 @@ const (
game_pagodataskreward = "game_pagodataskreward.json"
game_circulate = "game_circulate.json"
game_sixdirections = "game_sixdirections.json"
game_sixdirectionsreward = "game_sixdirectionsreward.json"
)
///配置管理基础组件
@ -29,6 +30,8 @@ type configureComp struct {
_mapFloor map[int32]int32 // key 页签 value 层数
_mapRace map[int32]*cfg.GameCirculateData // 阵营塔
circulate []int32
_mapSixReward map[int32][]*cfg.GameSixDirectionsRewardData // 六合塔奖励
}
//组件初始化接口
@ -40,10 +43,12 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
game_pagoda: cfg.NewGamePagoda,
game_circulate: cfg.NewGameCirculate,
game_sixdirections: cfg.NewGameSixDirections,
//game_sixdirectionsreward: cfg.NewGameSixDirectionsReward,
})
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
configure.RegisterConfigure(game_circulate, cfg.NewGameCirculate, this.LoadCirculate)
configure.RegisterConfigure(game_sixdirectionsreward, cfg.NewGameSixDirectionsReward, this.LoadSixDirections)
return
}
@ -229,3 +234,45 @@ func (this *configureComp) GetSixPagodaConf(id int32) (data *cfg.GameSixDirectio
err = comm.NewNotFoundConfErr(moduleName, game_sixdirections, id)
return
}
func (this *configureComp) LoadSixDirections() {
_m := make(map[int32][]*cfg.GameSixDirectionsRewardData, 0)
if v, err := this.GetConfigure(game_sixdirectionsreward); err == nil {
if configure, ok := v.(*cfg.GameSixDirectionsReward); ok {
for _, v1 := range configure.GetDataList() {
_m[v1.Boxid] = append(_m[v1.Boxid], v1)
}
}
}
this.hlock.Lock()
this._mapSixReward = make(map[int32][]*cfg.GameSixDirectionsRewardData)
this._mapSixReward = _m
this.hlock.Unlock()
return
}
// 奖励组
func (this *configureComp) GetSixDirectionsGroudConf(groud int32) (sz []int32) {
var (
v interface{}
err error
)
if v, err = this.GetConfigure(game_sixdirections); err == nil {
if configure, ok := v.(*cfg.GameSixDirections); ok {
for _, v := range configure.GetDataList() {
if v.Groud == groud {
sz = append(sz, v.Floors)
}
}
}
}
return
}
func (this *configureComp) GetSixDirectionsConf(boxid int32) (conf []*cfg.GameSixDirectionsRewardData) {
this.hlock.RLock()
conf, _ = this._mapSixReward[boxid]
this.hlock.RUnlock()
return
}

View File

@ -1272,6 +1272,7 @@ type PagodaRaceRewardResp struct {
unknownFields protoimpl.UnknownFields
Data *DBPagodaRace `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
Reward []*UserAtno `protobuf:"bytes,2,rep,name=reward,proto3" json:"reward"`
}
func (x *PagodaRaceRewardResp) Reset() {
@ -1313,6 +1314,13 @@ func (x *PagodaRaceRewardResp) GetData() *DBPagodaRace {
return nil
}
func (x *PagodaRaceRewardResp) GetReward() []*UserAtno {
if x != nil {
return x.Reward
}
return nil
}
var File_pagoda_pagoda_msg_proto protoreflect.FileDescriptor
var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
@ -1432,12 +1440,14 @@ var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x50, 0x61,
0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x63, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65,
0x71, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x64, 0x22, 0x39, 0x0a, 0x14, 0x50, 0x61, 0x67, 0x6f, 0x64,
0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x64, 0x22, 0x5c, 0x0a, 0x14, 0x50, 0x61, 0x67, 0x6f, 0x64,
0x61, 0x52, 0x61, 0x63, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x63, 0x65, 0x52, 0x04, 0x64, 0x61,
0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x74, 0x61, 0x12, 0x21, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x06, 0x72,
0x65, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1516,11 +1526,12 @@ var file_pagoda_pagoda_msg_proto_depIdxs = []int32{
35, // 20: PagodaGetRaceResp.data:type_name -> DBPagodaRace
36, // 21: PagodaCrossRaceRankListResp.ranks:type_name -> DBRaceRank
35, // 22: PagodaRaceRewardResp.data:type_name -> DBPagodaRace
23, // [23:23] is the sub-list for method output_type
23, // [23:23] is the sub-list for method input_type
23, // [23:23] is the sub-list for extension type_name
23, // [23:23] is the sub-list for extension extendee
0, // [0:23] is the sub-list for field type_name
29, // 23: PagodaRaceRewardResp.reward:type_name -> UserAtno
24, // [24:24] is the sub-list for method output_type
24, // [24:24] is the sub-list for method input_type
24, // [24:24] is the sub-list for extension type_name
24, // [24:24] is the sub-list for extension extendee
0, // [0:24] is the sub-list for field type_name
}
func init() { file_pagoda_pagoda_msg_proto_init() }

View File

@ -33,7 +33,7 @@ type GameBuzkashiMountData struct {
Csubtime int32
Energyrecover int32
Maxenergy int32
Offsetspeed float32
Offsetspeed int32
}
const TypeId_GameBuzkashiMountData = 1598069936
@ -78,7 +78,7 @@ func (_v *GameBuzkashiMountData)Deserialize(_buf map[string]interface{}) (err er
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["csubtime"].(float64); !_ok_ { err = errors.New("csubtime error"); return }; _v.Csubtime = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["energyrecover"].(float64); !_ok_ { err = errors.New("energyrecover error"); return }; _v.Energyrecover = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["maxenergy"].(float64); !_ok_ { err = errors.New("maxenergy error"); return }; _v.Maxenergy = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["offsetspeed"].(float64); !_ok_ { err = errors.New("offsetspeed error"); return }; _v.Offsetspeed = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["offsetspeed"].(float64); !_ok_ { err = errors.New("offsetspeed error"); return }; _v.Offsetspeed = int32(_tempNum_) }
return
}