上传宝箱优化
This commit is contained in:
parent
6d1cf50250
commit
6eaa05b3cf
62
bin/json/game_combatbox.json
Normal file
62
bin/json/game_combatbox.json
Normal file
@ -0,0 +1,62 @@
|
||||
[
|
||||
{
|
||||
"id": 10001,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10002,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10003,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10004,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10005,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10006,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10007,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10008,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10009,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10010,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10011,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10012,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10013,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10014,
|
||||
"drop": 1001
|
||||
},
|
||||
{
|
||||
"id": 10015,
|
||||
"drop": 1001
|
||||
}
|
||||
]
|
@ -19,6 +19,7 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (cod
|
||||
var (
|
||||
info *pb.DBCombatUser
|
||||
level *cfg.GameCombatLevelData
|
||||
box *cfg.GameCombatBoxData
|
||||
atns []*pb.UserAssets
|
||||
err error
|
||||
)
|
||||
@ -34,6 +35,10 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (cod
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
if box, err = this.module.configure.getGameCombatbox(req.Drop); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
for _, v := range info.Passdrop {
|
||||
if v == req.Drop {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
@ -46,7 +51,8 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (cod
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
reward := this.module.configure.GetDropReward(req.Drop)
|
||||
|
||||
reward := this.module.configure.GetDropReward(box.Drop)
|
||||
this.module.DispenseRes(session, reward, true)
|
||||
atns = make([]*pb.UserAssets, len(reward))
|
||||
for i, v := range reward {
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
const (
|
||||
game_combatlevel = "game_combatlevel.json"
|
||||
game_combatmanster = "game_combatmanster.json"
|
||||
game_combatbox = "game_combatbox.json"
|
||||
)
|
||||
|
||||
///背包配置管理组件
|
||||
@ -24,6 +25,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
this.module = module.(*Combat)
|
||||
this.LoadConfigure(game_combatlevel, cfg.NewGameCombatLevel)
|
||||
this.LoadConfigure(game_combatmanster, cfg.NewGameCombatManster)
|
||||
this.LoadConfigure(game_combatbox, cfg.NewGameCombatBox)
|
||||
return
|
||||
}
|
||||
|
||||
@ -60,3 +62,20 @@ func (this *configureComp) getGameCombatManster(mid int32) (result *cfg.GameComb
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//查询管卡表
|
||||
func (this *configureComp) getGameCombatbox(id int32) (result *cfg.GameCombatBoxData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_combatbox); err != nil {
|
||||
this.module.Errorln(err)
|
||||
} else {
|
||||
if result, ok = v.(*cfg.GameCombatBox).GetDataMap()[id]; !ok {
|
||||
err = fmt.Errorf("on found getGameCombatbox:%d", id)
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
42
sys/configure/structs/Game.CombatBox.go
Normal file
42
sys/configure/structs/Game.CombatBox.go
Normal 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 GameCombatBox struct {
|
||||
_dataMap map[int32]*GameCombatBoxData
|
||||
_dataList []*GameCombatBoxData
|
||||
}
|
||||
|
||||
func NewGameCombatBox(_buf []map[string]interface{}) (*GameCombatBox, error) {
|
||||
_dataList := make([]*GameCombatBoxData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GameCombatBoxData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGameCombatBoxData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Id] = _v
|
||||
}
|
||||
}
|
||||
return &GameCombatBox{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GameCombatBox) GetDataMap() map[int32]*GameCombatBoxData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GameCombatBox) GetDataList() []*GameCombatBoxData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GameCombatBox) Get(key int32) *GameCombatBoxData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
37
sys/configure/structs/Game.CombatBoxData.go
Normal file
37
sys/configure/structs/Game.CombatBoxData.go
Normal file
@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 GameCombatBoxData struct {
|
||||
Id int32
|
||||
Drop int32
|
||||
}
|
||||
|
||||
const TypeId_GameCombatBoxData = 2090812805
|
||||
|
||||
func (*GameCombatBoxData) GetTypeId() int32 {
|
||||
return 2090812805
|
||||
}
|
||||
|
||||
func (_v *GameCombatBoxData)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["drop"].(float64); !_ok_ { err = errors.New("drop error"); return }; _v.Drop = int32(_tempNum_) }
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGameCombatBoxData(_buf map[string]interface{}) (*GameCombatBoxData, error) {
|
||||
v := &GameCombatBoxData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user