Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
1bf7d2d64d
@ -65,9 +65,9 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
PropertyHp int32 = 1 //生命
|
||||
PropertyAtk int32 = 2 //攻击
|
||||
PropertyDef int32 = 3 //防御
|
||||
PropertyHp string = "hp" //生命
|
||||
PropertyAtk string = "atk" //攻击
|
||||
PropertyDef string = "def" //防御
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -93,24 +93,13 @@ func (this *UserSession) UnBind() (err error) {
|
||||
|
||||
//向用户发送消息
|
||||
func (this *UserSession) SendMsg(mainType, subType string, msg proto.Message) (err error) {
|
||||
log.Debugf("SendMsg to SessionId:[%s] UserId:[%s] Data: %v", this.UserId, msg)
|
||||
log.Debugf("SendMsg to UserId:[%s] Data: %v", this.UserId, msg)
|
||||
data, _ := anypb.New(msg)
|
||||
this.msgqueue = append(this.msgqueue, &pb.UserMessage{
|
||||
MainType: mainType,
|
||||
SubType: subType,
|
||||
Data: data,
|
||||
})
|
||||
// reply := &pb.RPCMessageReply{}
|
||||
// data, _ := anypb.New(msg)
|
||||
// log.Debugf("SendMsg to SessionId:[%s] UserId:[%s] Data: %v", this.UserId, msg)
|
||||
// if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentSendMsg), &pb.AgentSendMessageReq{
|
||||
// UserSessionId: this.SessionId,
|
||||
// MainType: mainType,
|
||||
// SubType: subType,
|
||||
// Data: data,
|
||||
// }, reply); err != nil {
|
||||
// log.Errorf("SendMsg:%s UserSession:%s UserId:%s err:%v", mainType, this.SessionId, this.UserId, err)
|
||||
// }
|
||||
return
|
||||
}
|
||||
|
||||
@ -120,7 +109,7 @@ func (this *UserSession) Close() (err error) {
|
||||
if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentSendMsg), &pb.AgentCloseeReq{
|
||||
UserSessionId: this.SessionId,
|
||||
}, reply); err != nil {
|
||||
log.Errorf("Close UserSession:%s UserId:%d err:%v", this.SessionId, this.UserId, err)
|
||||
log.Errorf("Close UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -136,6 +136,10 @@ func (this *Redis) HMGet(key string, v interface{}, fields ...string) (err error
|
||||
this.client.Process(this.getContext(), cmd)
|
||||
var _result map[string]string
|
||||
if _result, err = cmd.Result(); err == nil {
|
||||
if len(_result) == 0 {
|
||||
err = redis.Nil
|
||||
return
|
||||
}
|
||||
err = this.decode.DecoderMapString(_result, v)
|
||||
}
|
||||
return
|
||||
|
@ -12,6 +12,10 @@ func (this *Redis) Lindex(key string, v interface{}) (err error) {
|
||||
this.client.Process(this.getContext(), cmd)
|
||||
var _result string
|
||||
if _result, err = cmd.Result(); err == nil {
|
||||
if len(_result) == 0 {
|
||||
err = redis.Nil
|
||||
return
|
||||
}
|
||||
err = this.decode.DecoderString(_result, v)
|
||||
}
|
||||
return
|
||||
|
@ -68,6 +68,9 @@ func (this *Redis) HGetAll(key string, v interface{}) (err error) {
|
||||
this.client.Process(this.getContext(), cmd)
|
||||
var _result map[string]string
|
||||
if _result, err = cmd.Result(); err == nil {
|
||||
if len(_result) == 0 {
|
||||
return redis.Nil
|
||||
}
|
||||
err = this.decode.DecoderMapString(_result, v)
|
||||
}
|
||||
return
|
||||
|
@ -307,17 +307,10 @@ func (this *Decoder) DecoderMapString(data map[string]string, v interface{}) err
|
||||
}
|
||||
if value, ok := data[name]; ok {
|
||||
v := reflect.New(fieldInfo.Type).Elem()
|
||||
if fieldInfo.Type.Kind() != reflect.Ptr {
|
||||
if err := this.DecoderString(value, v.Addr().Interface()); err != nil {
|
||||
return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err)
|
||||
}
|
||||
elem.FieldByName(fieldInfo.Name).Set(v)
|
||||
} else {
|
||||
if err := this.DecoderString(value, v); err != nil {
|
||||
return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err)
|
||||
}
|
||||
elem.FieldByName(fieldInfo.Name).Set(v)
|
||||
if err := this.DecoderString(value, v.Addr().Interface()); err != nil {
|
||||
return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err)
|
||||
}
|
||||
elem.FieldByName(fieldInfo.Name).Set(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,12 @@ func (this *apiComp) Equip(session comm.IUserSession, agrs map[string]interface{
|
||||
hero *pb.DBHero
|
||||
)
|
||||
|
||||
defer func() {
|
||||
if code == pb.ErrorCode_Success {
|
||||
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: equipments})
|
||||
}
|
||||
}()
|
||||
|
||||
confs = agrs["conf"].([]*cfg.Game_equipData)
|
||||
equipments = agrs["equipment"].([]*pb.DB_Equipment)
|
||||
updatequipment = make([]*pb.DB_Equipment, 0)
|
||||
|
@ -51,17 +51,18 @@ func (this *apiComp) UpgradeCheck(session comm.IUserSession, req *pb.EquipmentUp
|
||||
///英雄挂在装备
|
||||
func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interface{}, req *pb.EquipmentUpgradeReq) (code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
conf *cfg.Game_equipData
|
||||
intensify *cfg.Game_equipIntensifyData
|
||||
equipment *pb.DB_Equipment
|
||||
hero *pb.DBHero
|
||||
equipments []*pb.DB_Equipment
|
||||
issucc bool
|
||||
err error
|
||||
conf *cfg.Game_equipData
|
||||
intensify *cfg.Game_equipIntensifyData
|
||||
equipment *pb.DB_Equipment
|
||||
modifyequipments []*pb.DB_Equipment
|
||||
hero *pb.DBHero
|
||||
equipments []*pb.DB_Equipment
|
||||
issucc bool
|
||||
)
|
||||
defer func() {
|
||||
if code == pb.ErrorCode_Success {
|
||||
session.SendMsg(string(this.module.GetType()), "", &pb.EquipmentUpgradeResp{})
|
||||
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
|
||||
}
|
||||
}()
|
||||
conf = agrs["conf"].(*cfg.Game_equipData)
|
||||
@ -78,10 +79,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
|
||||
}
|
||||
}
|
||||
if issucc {
|
||||
if code = this.module.CheckConsumeRes(session.GetUserId(), intensify.Need); err != nil {
|
||||
if code = this.module.CheckConsumeRes(session.GetUserId(), intensify.Need); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
modifyequipments = make([]*pb.DB_Equipment, 0)
|
||||
//叠加装备 拆分处理
|
||||
if equipment.IsInitialState && equipment.OverlayNum > 1 {
|
||||
equipment.OverlayNum--
|
||||
@ -93,10 +94,12 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
modifyequipments = append(modifyequipments, equipment)
|
||||
equipment = CloneEquipment(equipment)
|
||||
equipment.Id = primitive.NewObjectID().Hex()
|
||||
equipment.IsInitialState = false
|
||||
equipment.OverlayNum = 1
|
||||
modifyequipments = append(modifyequipments, equipment)
|
||||
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
log.Errorf("Upgrade err:%v", err)
|
||||
@ -109,6 +112,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
|
||||
}
|
||||
} else {
|
||||
equipment.IsInitialState = false
|
||||
modifyequipments = append(modifyequipments, equipment)
|
||||
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
log.Errorf("Upgrade err:%v", err)
|
||||
|
@ -26,6 +26,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
this.ModuleCompBase.Init(service, module, comp, options)
|
||||
this.LoadConfigure(game_equip, cfg.NewGame_equip)
|
||||
this.LoadConfigure(equip_attrlibrary, cfg.NewGame_equipAttrlibrary)
|
||||
this.LoadConfigure(equip_intensify, cfg.NewGame_equipIntensify)
|
||||
this.LoadConfigure(equip_suit, cfg.NewGame_equipSuit)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ func (this *modelEquipmentComp) newEquipment(uid string, conf *cfg.Game_equipDat
|
||||
func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equip *cfg.Game_equipData, intensify *cfg.Game_equipIntensifyData) (err error) {
|
||||
equipment.Lv++
|
||||
equipment.MainEntry.Lv++
|
||||
equipment.MainEntry.Value += equipment.MainEntry.Value * (intensify.Bonus / 1000.0)
|
||||
equipment.MainEntry.Value += int32(float64(equipment.MainEntry.Value) * float64(intensify.Bonus) / 1000.0)
|
||||
if !intensify.Activation { //不触发副词条变化
|
||||
return
|
||||
}
|
||||
@ -227,7 +227,7 @@ func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equ
|
||||
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(equipment.AdverbEntry[index].Id); err != nil {
|
||||
return
|
||||
}
|
||||
equipment.AdverbEntry[index].Value += attrlibrary.Addition[equipment.AdverbEntry[index].Lv-1] / 1000.0 * attrlibrary.Attrvar
|
||||
equipment.AdverbEntry[index].Value += int32(float64(attrlibrary.Addition[equipment.AdverbEntry[index].Lv-1]) / 1000.0 * float64(attrlibrary.Attrvar))
|
||||
equipment.AdverbEntry[index].Lv++
|
||||
}
|
||||
return
|
||||
|
@ -63,9 +63,14 @@ func (this *Equipment) OnInstallComp() {
|
||||
|
||||
//IEquipment-------------------------------------------------------------------------------------------------------------------------------
|
||||
//查询武器信息
|
||||
func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string, Id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) {
|
||||
func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string, id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) {
|
||||
var err error
|
||||
if equipment, err = this.modelEquipment.QueryUserEquipmentsById(uid, Id); err != nil {
|
||||
if uid == "" || id == "" {
|
||||
log.Errorf("请求参数错误 uid:%s Id:%s", uid, id)
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
if equipment, err = this.modelEquipment.QueryUserEquipmentsById(uid, id); err != nil {
|
||||
if err == redis.Nil {
|
||||
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||
} else {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package equipment_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego"
|
||||
@ -9,6 +10,9 @@ import (
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules/equipment"
|
||||
"go_dreamfactory/modules/hero"
|
||||
"go_dreamfactory/modules/items"
|
||||
"go_dreamfactory/modules/user"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/services"
|
||||
"go_dreamfactory/sys/cache"
|
||||
"go_dreamfactory/sys/configure"
|
||||
@ -16,6 +20,8 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
)
|
||||
|
||||
func newService(ops ...rpcx.Option) core.IService {
|
||||
@ -66,13 +72,32 @@ func TestMain(m *testing.M) {
|
||||
lego.Run(service, //运行模块
|
||||
module,
|
||||
hero.NewModule(),
|
||||
user.NewModule(),
|
||||
items.NewModule(),
|
||||
)
|
||||
}()
|
||||
time.Sleep(time.Second * 3)
|
||||
defer os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test_Module(t *testing.T) {
|
||||
//测试协议 查询武器
|
||||
func Test_Modules_EquipmentGetListReq(t *testing.T) {
|
||||
data, _ := ptypes.MarshalAny(&pb.EquipmentGetListReq{})
|
||||
reply := &pb.RPCMessageReply{}
|
||||
s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "equipment", SubType: "getlist", Message: data}, reply)
|
||||
log.Debugf("Test_Modules_Proro reply:%v", reply)
|
||||
}
|
||||
|
||||
//测试协议 武器升级
|
||||
func Test_Modules_EquipmentUpgradeReq(t *testing.T) {
|
||||
data, _ := ptypes.MarshalAny(&pb.EquipmentUpgradeReq{EquipmentId: "62bd82860863ffbf2eb67f3a"})
|
||||
reply := &pb.RPCMessageReply{}
|
||||
s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "equipment", SubType: "upgrade", Message: data}, reply)
|
||||
log.Debugf("Test_Modules_Proro reply:%v", reply)
|
||||
}
|
||||
|
||||
//添加武器测试
|
||||
func Test_Module_AddNewEquipments(t *testing.T) {
|
||||
code := module.AddNewEquipments(&comm.ModuleCallSource{
|
||||
Module: "Test",
|
||||
FuncName: "Test_Module",
|
||||
@ -80,3 +105,13 @@ func Test_Module(t *testing.T) {
|
||||
}, "0_62b16dda909b2f8faeff788d", map[int32]uint32{10001: 1})
|
||||
log.Debugf("Test_Module Code:%d", code)
|
||||
}
|
||||
|
||||
//查询武器信息
|
||||
func Test_Module_QueryEquipment(t *testing.T) {
|
||||
equipment, code := module.QueryEquipment(&comm.ModuleCallSource{
|
||||
Module: "Test",
|
||||
FuncName: "Test_Module",
|
||||
Describe: "摸底测试",
|
||||
}, "0_62b16dda909b2f8faeff788d", "62bd82860863ffbf2eb67f3a")
|
||||
log.Debugf("Test_Module equipment:%v code:%d", equipment, code)
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ func (this *apiComp) Resonance(session comm.IUserSession, agrs map[string]interf
|
||||
_heroMap := map[string]interface{}{
|
||||
"resonateNum": _hero.ResonateNum + resonConfig.Energy,
|
||||
}
|
||||
err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err != nil {
|
||||
log.Errorf("update hero skill failed:%v", err)
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, agrs map[string]i
|
||||
"Energy": _hero.Energy,
|
||||
}
|
||||
|
||||
err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err != nil {
|
||||
log.Errorf("update hero skill failed:%v", err)
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, agrs map[stri
|
||||
"Energy": _hero.Energy,
|
||||
}
|
||||
|
||||
err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
log.Errorf("update hero skill failed:%v", err)
|
||||
|
@ -126,7 +126,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[strin
|
||||
_heroMap := map[string]interface{}{
|
||||
"normalSkill": _hero.NormalSkill,
|
||||
}
|
||||
err = this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
err = this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err != nil {
|
||||
log.Errorf("update hero skill failed:%v", err)
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string
|
||||
"star": _hero.Star,
|
||||
}
|
||||
// 保存数据
|
||||
err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap)
|
||||
err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
log.Errorf("update hero skill failed:%v", err)
|
||||
|
@ -95,6 +95,6 @@ func TestModify(t *testing.T) {
|
||||
"lv": 2,
|
||||
"exp": 1000,
|
||||
}
|
||||
err := module.modelHero.modifyHero("u1", "62b534bebf4745d4117acabe", data)
|
||||
err := module.modelHero.modifyHeroData("u1", "62b534bebf4745d4117acabe", data)
|
||||
fmt.Printf("%v ", err)
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero {
|
||||
Skins: []int32{},
|
||||
EquipID: make([]string, 6), //初始装备
|
||||
SameCount: 1, //默认叠加数量
|
||||
AddProperty: make(map[int32]int32),
|
||||
AddProperty: make(map[string]int32),
|
||||
Energy: make(map[int32]int32),
|
||||
Property: make(map[int32]int32),
|
||||
Property: make(map[string]int32),
|
||||
}
|
||||
return newHero
|
||||
}
|
||||
@ -94,7 +94,7 @@ func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
|
||||
data := map[string]interface{}{
|
||||
"sameCount": h.SameCount, //叠加数
|
||||
}
|
||||
if err := this.modifyHero(uid, h.Id, data); err != nil {
|
||||
if err := this.modifyHeroData(uid, h.Id, data); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
@ -130,7 +130,7 @@ func (this *ModelHero) consumeOneHeroCard(uid, heroId string, count int32) (err
|
||||
}
|
||||
|
||||
//更新英雄数据
|
||||
func (this *ModelHero) modifyHero(uid, heroId string, data map[string]interface{}) error {
|
||||
func (this *ModelHero) modifyHeroData(uid, heroId string, data map[string]interface{}) error {
|
||||
return this.moduleHero.modelHero.ChangeList(uid, heroId, data)
|
||||
}
|
||||
|
||||
@ -155,25 +155,21 @@ func (this *ModelHero) setEquipment(uid, heroId string, equipIds []string) pb.Er
|
||||
return pb.ErrorCode_Success
|
||||
}
|
||||
|
||||
//指定英雄升级
|
||||
func (this *ModelHero) levelUp(uid string, heroId int32) error {
|
||||
var heroes []*pb.DBHero
|
||||
err := this.moduleHero.modelHero.GetList(uid, heroes)
|
||||
if err != nil {
|
||||
log.Errorf("levelUp err:%v", err)
|
||||
return err
|
||||
//合并属性即属性值累加
|
||||
func (this *ModelHero) mergeProperty(uid, heroId string, data map[string]int32) {
|
||||
hero := this.getOneHero(uid, heroId)
|
||||
if hero == nil {
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//升星
|
||||
func (this *ModelHero) starUp() {
|
||||
|
||||
hero.Property[comm.PropertyHp] += data[comm.PropertyHp]
|
||||
hero.Property[comm.PropertyAtk] += data[comm.PropertyAtk]
|
||||
hero.Property[comm.PropertyDef] += data[comm.PropertyDef]
|
||||
}
|
||||
|
||||
//属性计算 - 暂时放在modelHero里实现
|
||||
//英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数
|
||||
func (this *ModelHero) PropertyCompute(uid, heroId string) map[int32]int32 {
|
||||
func (this *ModelHero) PropertyCompute(uid, heroId string) map[string]int32 {
|
||||
hero := this.getOneHero(uid, heroId)
|
||||
if hero == nil {
|
||||
return nil
|
||||
@ -209,16 +205,22 @@ func (this *ModelHero) PropertyCompute(uid, heroId string) map[int32]int32 {
|
||||
return nil
|
||||
}
|
||||
|
||||
exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v", lvGrow.Hp, heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp)
|
||||
curHp := hero.Property[comm.PropertyHp]
|
||||
exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v",
|
||||
(curHp + lvGrow.Hp), heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp)
|
||||
hp, _ := mengine.ParseAndExec(exprHp)
|
||||
|
||||
exprAtk := fmt.Sprintf("%v +%v * %v/1000 + %v * %v", lvGrow.Atk, heroLvCfg.Atk, lvGrow.Atkgrow, heroStarCfg.Atk, stargrowCfg.StarupAtk)
|
||||
curAtk := hero.Property[comm.PropertyAtk]
|
||||
exprAtk := fmt.Sprintf("%v +%v * %v/1000 + %v * %v",
|
||||
(curAtk + lvGrow.Atk), heroLvCfg.Atk, lvGrow.Atkgrow, heroStarCfg.Atk, stargrowCfg.StarupAtk)
|
||||
atk, _ := mengine.ParseAndExec(exprAtk)
|
||||
|
||||
exprDef := fmt.Sprintf("%v +%v * %v/1000 + %v * %v", lvGrow.Def, heroLvCfg.Def, lvGrow.Defgrow, heroStarCfg.Def, stargrowCfg.StarupDef)
|
||||
curDef := hero.Property[comm.PropertyDef]
|
||||
exprDef := fmt.Sprintf("%v +%v * %v/1000 + %v * %v",
|
||||
(curDef + lvGrow.Def), heroLvCfg.Def, lvGrow.Defgrow, heroStarCfg.Def, stargrowCfg.StarupDef)
|
||||
def, _ := mengine.ParseAndExec(exprDef)
|
||||
|
||||
return map[int32]int32{
|
||||
return map[string]int32{
|
||||
comm.PropertyHp: int32(math.Floor(hp)),
|
||||
comm.PropertyAtk: int32(math.Floor(atk)),
|
||||
comm.PropertyDef: int32(math.Floor(def)),
|
||||
|
@ -82,6 +82,7 @@ func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (co
|
||||
for _, v := range equip {
|
||||
equipIds = append(equipIds, v.Id)
|
||||
}
|
||||
|
||||
return this.modelHero.setEquipment(hero.Uid, hero.Id, equipIds)
|
||||
}
|
||||
|
||||
@ -155,7 +156,7 @@ func (this *Hero) AddCardExp(uid string, heroId string, exp int32) (code pb.Erro
|
||||
"exp": curExp,
|
||||
}
|
||||
|
||||
if err := this.modelHero.modifyHero(uid, heroId, update); err != nil {
|
||||
if err := this.modelHero.modifyHeroData(uid, heroId, update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
} // 修改英雄数据
|
||||
} else {
|
||||
|
@ -89,15 +89,18 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p
|
||||
hero comm.IHero //英雄模块
|
||||
// equipment comm.IEquipment //装备模块
|
||||
)
|
||||
if module, err = this.service.GetModule(comm.ModuleUser); err == nil {
|
||||
if module, err = this.service.GetModule(comm.ModuleUser); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
user = module.(comm.IUser)
|
||||
if module, err = this.service.GetModule(comm.ModuleItems); err == nil {
|
||||
if module, err = this.service.GetModule(comm.ModuleItems); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
items = module.(comm.IItems)
|
||||
if module, err = this.service.GetModule(comm.ModuleHero); err == nil {
|
||||
if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
hero = module.(comm.IHero)
|
||||
@ -179,19 +182,23 @@ func (this *ModuleBase) DispenseRes(uid string, res []*cfg.Game_atn) (code pb.Er
|
||||
hero comm.IHero //英雄模块
|
||||
equipment comm.IEquipment //装备模块
|
||||
)
|
||||
if module, err = this.service.GetModule(comm.ModuleUser); err == nil {
|
||||
if module, err = this.service.GetModule(comm.ModuleUser); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
user = module.(comm.IUser)
|
||||
if module, err = this.service.GetModule(comm.ModuleItems); err == nil {
|
||||
if module, err = this.service.GetModule(comm.ModuleItems); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
items = module.(comm.IItems)
|
||||
if module, err = this.service.GetModule(comm.ModuleHero); err == nil {
|
||||
if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
hero = module.(comm.IHero)
|
||||
if module, err = this.service.GetModule(comm.ModuleEquipment); err == nil {
|
||||
if module, err = this.service.GetModule(comm.ModuleEquipment); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
equipment = module.(comm.IEquipment)
|
||||
|
@ -47,12 +47,14 @@ func (this *User) GetHeroList(uid string) []*pb.DBHero {
|
||||
//查询用户属性值 例如 金币 经验
|
||||
func (this *User) QueryAttributeValue(uid string, attr string) (value int32) {
|
||||
user := this.modelUser.getUser(uid)
|
||||
if user == nil {
|
||||
return
|
||||
}
|
||||
switch attr {
|
||||
case comm.ResGold:
|
||||
return user.Gold
|
||||
case comm.ResExp:
|
||||
return user.Exp
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -168,6 +168,8 @@ type EquipmentEquipResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Equipments []*DB_Equipment `protobuf:"bytes,1,rep,name=Equipments,proto3" json:"Equipments"` //挂在装备列表
|
||||
}
|
||||
|
||||
func (x *EquipmentEquipResp) Reset() {
|
||||
@ -202,6 +204,13 @@ func (*EquipmentEquipResp) Descriptor() ([]byte, []int) {
|
||||
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *EquipmentEquipResp) GetEquipments() []*DB_Equipment {
|
||||
if x != nil {
|
||||
return x.Equipments
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//装备升级
|
||||
type EquipmentUpgradeReq struct {
|
||||
state protoimpl.MessageState
|
||||
@ -255,6 +264,9 @@ type EquipmentUpgradeResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsSucc bool `protobuf:"varint,1,opt,name=IsSucc,proto3" json:"IsSucc"`
|
||||
Equipment []*DB_Equipment `protobuf:"bytes,2,rep,name=Equipment,proto3" json:"Equipment"` //由于装备可以叠加 升级后会创建一个新的装备出来 所以可能影响两个装备
|
||||
}
|
||||
|
||||
func (x *EquipmentUpgradeResp) Reset() {
|
||||
@ -289,6 +301,20 @@ func (*EquipmentUpgradeResp) Descriptor() ([]byte, []int) {
|
||||
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *EquipmentUpgradeResp) GetIsSucc() bool {
|
||||
if x != nil {
|
||||
return x.IsSucc
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *EquipmentUpgradeResp) GetEquipment() []*DB_Equipment {
|
||||
if x != nil {
|
||||
return x.Equipment
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_equipment_equipment_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_equipment_equipment_msg_proto_rawDesc = []byte{
|
||||
@ -307,14 +333,21 @@ var file_equipment_equipment_msg_proto_rawDesc = []byte{
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x49, 0x64,
|
||||
0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x49, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x45,
|
||||
0x71, 0x75, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x22, 0x37, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69,
|
||||
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12,
|
||||
0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49,
|
||||
0x64, 0x22, 0x16, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70,
|
||||
0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x49, 0x64, 0x22, 0x43, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x45,
|
||||
0x71, 0x75, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x45, 0x71, 0x75, 0x69,
|
||||
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44,
|
||||
0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x45, 0x71, 0x75,
|
||||
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x37, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x20,
|
||||
0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64,
|
||||
0x22, 0x5b, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67,
|
||||
0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x73, 0x53, 0x75,
|
||||
0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63,
|
||||
0x12, 0x2b, 0x0a, 0x09, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65,
|
||||
0x6e, 0x74, 0x52, 0x09, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -341,11 +374,13 @@ var file_equipment_equipment_msg_proto_goTypes = []interface{}{
|
||||
}
|
||||
var file_equipment_equipment_msg_proto_depIdxs = []int32{
|
||||
6, // 0: EquipmentGetListResp.Equipments:type_name -> DB_Equipment
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
6, // 1: EquipmentEquipResp.Equipments:type_name -> DB_Equipment
|
||||
6, // 2: EquipmentUpgradeResp.Equipment:type_name -> DB_Equipment
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_equipment_equipment_msg_proto_init() }
|
||||
|
@ -80,30 +80,30 @@ type DBHero struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"`
|
||||
HeroID int32 `protobuf:"varint,3,opt,name=heroID,proto3" json:"heroID" bson:"heroID"` // 英雄的配置表ID
|
||||
Star int32 `protobuf:"varint,4,opt,name=star,proto3" json:"star"` // 英雄星级
|
||||
Lv int32 `protobuf:"varint,5,opt,name=lv,proto3" json:"lv"` // 英雄等级
|
||||
Exp int32 `protobuf:"varint,6,opt,name=exp,proto3" json:"exp"` // 英雄经验
|
||||
JuexingLv int32 `protobuf:"varint,7,opt,name=juexingLv,proto3" json:"juexingLv" bson:"juexingLv"` //觉醒等级
|
||||
CaptainSkill int32 `protobuf:"varint,8,opt,name=captainSkill,proto3" json:"captainSkill" bson:"captainSkill"` //队长技能
|
||||
NormalSkill []*SkillData `protobuf:"bytes,9,rep,name=normalSkill,proto3" json:"normalSkill" bson:"normalSkill"` //普通技能
|
||||
Property map[int32]int32 `protobuf:"bytes,10,rep,name=property,proto3" json:"property" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 属性相关
|
||||
AddProperty map[int32]int32 `protobuf:"bytes,11,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"addProperty"` //附加属性相关
|
||||
Formation int32 `protobuf:"varint,12,opt,name=formation,proto3" json:"formation"` // 阵型类型
|
||||
CardType int32 `protobuf:"varint,13,opt,name=cardType,proto3" json:"cardType" bson:"cardType"` //卡片类型(升星卡、经验卡、技能升级卡)
|
||||
CurSkin int32 `protobuf:"varint,14,opt,name=curSkin,proto3" json:"curSkin" bson:"curSkin"` //当前装备的皮肤ID
|
||||
Skins []int32 `protobuf:"varint,15,rep,packed,name=skins,proto3" json:"skins"` // 所有皮肤ID
|
||||
Block bool `protobuf:"varint,16,opt,name=block,proto3" json:"block"` // 锁定
|
||||
EquipID []string `protobuf:"bytes,17,rep,name=equipID,proto3" json:"equipID" bson:"equipID"` //装备 objID
|
||||
ResonateNum int32 `protobuf:"varint,18,opt,name=resonateNum,proto3" json:"resonateNum" bson:"resonateNum"` //共鸣次数
|
||||
DistributionResonate int32 `protobuf:"varint,19,opt,name=distributionResonate,proto3" json:"distributionResonate" bson:"distributionResonate"` //分配的共鸣能量
|
||||
Energy map[int32]int32 `protobuf:"bytes,20,rep,name=energy,proto3" json:"energy" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // @go_tags(`bson:"energy"`)能量分配到哪里
|
||||
SameCount int32 `protobuf:"varint,21,opt,name=sameCount,proto3" json:"sameCount" bson:"sameCount"` // 卡片叠加数量
|
||||
SuiteId int32 `protobuf:"varint,22,opt,name=suiteId,proto3" json:"suiteId" bson:"suiteId"` // 套装Id
|
||||
SuiteExtId int32 `protobuf:"varint,23,opt,name=suiteExtId,proto3" json:"suiteExtId"` // go_tags(`bson:"suiteExtId"`) 扩展套装Id
|
||||
IsOverlying bool `protobuf:"varint,24,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"`
|
||||
HeroID int32 `protobuf:"varint,3,opt,name=heroID,proto3" json:"heroID" bson:"heroID"` // 英雄的配置表ID
|
||||
Star int32 `protobuf:"varint,4,opt,name=star,proto3" json:"star"` // 英雄星级
|
||||
Lv int32 `protobuf:"varint,5,opt,name=lv,proto3" json:"lv"` // 英雄等级
|
||||
Exp int32 `protobuf:"varint,6,opt,name=exp,proto3" json:"exp"` // 英雄经验
|
||||
JuexingLv int32 `protobuf:"varint,7,opt,name=juexingLv,proto3" json:"juexingLv" bson:"juexingLv"` //觉醒等级
|
||||
CaptainSkill int32 `protobuf:"varint,8,opt,name=captainSkill,proto3" json:"captainSkill" bson:"captainSkill"` //队长技能
|
||||
NormalSkill []*SkillData `protobuf:"bytes,9,rep,name=normalSkill,proto3" json:"normalSkill" bson:"normalSkill"` //普通技能
|
||||
Property map[string]int32 `protobuf:"bytes,10,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 属性相关
|
||||
AddProperty map[string]int32 `protobuf:"bytes,11,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"addProperty"` //附加属性相关
|
||||
Formation int32 `protobuf:"varint,12,opt,name=formation,proto3" json:"formation"` // 阵型类型
|
||||
CardType int32 `protobuf:"varint,13,opt,name=cardType,proto3" json:"cardType" bson:"cardType"` //卡片类型(升星卡、经验卡、技能升级卡)
|
||||
CurSkin int32 `protobuf:"varint,14,opt,name=curSkin,proto3" json:"curSkin" bson:"curSkin"` //当前装备的皮肤ID
|
||||
Skins []int32 `protobuf:"varint,15,rep,packed,name=skins,proto3" json:"skins"` // 所有皮肤ID
|
||||
Block bool `protobuf:"varint,16,opt,name=block,proto3" json:"block"` // 锁定
|
||||
EquipID []string `protobuf:"bytes,17,rep,name=equipID,proto3" json:"equipID" bson:"equipID"` //装备 objID
|
||||
ResonateNum int32 `protobuf:"varint,18,opt,name=resonateNum,proto3" json:"resonateNum" bson:"resonateNum"` //共鸣次数
|
||||
DistributionResonate int32 `protobuf:"varint,19,opt,name=distributionResonate,proto3" json:"distributionResonate" bson:"distributionResonate"` //分配的共鸣能量
|
||||
Energy map[int32]int32 `protobuf:"bytes,20,rep,name=energy,proto3" json:"energy" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // @go_tags(`bson:"energy"`)能量分配到哪里
|
||||
SameCount int32 `protobuf:"varint,21,opt,name=sameCount,proto3" json:"sameCount" bson:"sameCount"` // 卡片叠加数量
|
||||
SuiteId int32 `protobuf:"varint,22,opt,name=suiteId,proto3" json:"suiteId" bson:"suiteId"` // 套装Id
|
||||
SuiteExtId int32 `protobuf:"varint,23,opt,name=suiteExtId,proto3" json:"suiteExtId"` // go_tags(`bson:"suiteExtId"`) 扩展套装Id
|
||||
IsOverlying bool `protobuf:"varint,24,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true
|
||||
}
|
||||
|
||||
func (x *DBHero) Reset() {
|
||||
@ -201,14 +201,14 @@ func (x *DBHero) GetNormalSkill() []*SkillData {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBHero) GetProperty() map[int32]int32 {
|
||||
func (x *DBHero) GetProperty() map[string]int32 {
|
||||
if x != nil {
|
||||
return x.Property
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBHero) GetAddProperty() map[int32]int32 {
|
||||
func (x *DBHero) GetAddProperty() map[string]int32 {
|
||||
if x != nil {
|
||||
return x.AddProperty
|
||||
}
|
||||
@ -363,11 +363,11 @@ var file_hero_hero_db_proto_rawDesc = []byte{
|
||||
0x69, 0x6e, 0x67, 0x18, 0x18, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x4f, 0x76, 0x65,
|
||||
0x72, 0x6c, 0x79, 0x69, 0x6e, 0x67, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
|
||||
0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
|
||||
0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
|
@ -1177,9 +1177,9 @@ type HeroProperty struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
HeroId string `protobuf:"bytes,1,opt,name=heroId,proto3" json:"heroId"` //英雄唯一ID
|
||||
Property map[int32]int32 `protobuf:"bytes,2,rep,name=property,proto3" json:"property" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //基础属性
|
||||
AddProperty map[int32]int32 `protobuf:"bytes,3,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //附加属性
|
||||
HeroId string `protobuf:"bytes,1,opt,name=heroId,proto3" json:"heroId"` //英雄唯一ID
|
||||
Property map[string]int32 `protobuf:"bytes,2,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //基础属性
|
||||
AddProperty map[string]int32 `protobuf:"bytes,3,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //附加属性
|
||||
}
|
||||
|
||||
func (x *HeroProperty) Reset() {
|
||||
@ -1221,14 +1221,14 @@ func (x *HeroProperty) GetHeroId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HeroProperty) GetProperty() map[int32]int32 {
|
||||
func (x *HeroProperty) GetProperty() map[string]int32 {
|
||||
if x != nil {
|
||||
return x.Property
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *HeroProperty) GetAddProperty() map[int32]int32 {
|
||||
func (x *HeroProperty) GetAddProperty() map[string]int32 {
|
||||
if x != nil {
|
||||
return x.AddProperty
|
||||
}
|
||||
@ -1346,11 +1346,11 @@ var file_hero_hero_msg_proto_rawDesc = []byte{
|
||||
0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x50,
|
||||
0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65,
|
||||
0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65,
|
||||
0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
|
@ -19,7 +19,7 @@ message EquipmentEquipReq{
|
||||
|
||||
//装备挂在到英雄上 回应
|
||||
message EquipmentEquipResp{
|
||||
|
||||
repeated DB_Equipment Equipments = 1; //挂在装备列表
|
||||
}
|
||||
|
||||
//装备升级
|
||||
@ -29,5 +29,6 @@ message EquipmentUpgradeReq{
|
||||
|
||||
//装备升级 回应
|
||||
message EquipmentUpgradeResp{
|
||||
|
||||
bool IsSucc = 1;
|
||||
repeated DB_Equipment Equipment = 2; //由于装备可以叠加 升级后会创建一个新的装备出来 所以可能影响两个装备
|
||||
}
|
@ -16,8 +16,8 @@ message DBHero {
|
||||
int32 juexingLv = 7; //@go_tags(`bson:"juexingLv"`) 觉醒等级
|
||||
int32 captainSkill = 8; //@go_tags(`bson:"captainSkill"`) 队长技能
|
||||
repeated SkillData normalSkill = 9; //@go_tags(`bson:"normalSkill"`) 普通技能
|
||||
map<int32, int32> property = 10; // 属性相关
|
||||
map<int32, int32> addProperty =
|
||||
map<string, int32> property = 10; // 属性相关
|
||||
map<string, int32> addProperty =
|
||||
11; //@go_tags(`bson:"addProperty"`) 附加属性相关
|
||||
int32 formation = 12; // 阵型类型
|
||||
int32 cardType =
|
||||
|
@ -97,7 +97,7 @@ message HeroResonanceUseEnergyResp {
|
||||
|
||||
// 觉醒
|
||||
message HeroAwakenReq {
|
||||
string heroObjID = 1; // 英雄对象ID
|
||||
string heroObjID = 1; // 英雄对象ID
|
||||
}
|
||||
|
||||
// 觉醒返回
|
||||
@ -112,7 +112,7 @@ message HeroChoukaResp { repeated DBHero heroes = 1; }
|
||||
|
||||
//英雄属性推送
|
||||
message HeroProperty {
|
||||
string heroId = 1; //英雄唯一ID
|
||||
map<int32, int32> property = 2; //基础属性
|
||||
map<int32, int32> addProperty = 3; //附加属性
|
||||
string heroId = 1; //英雄唯一ID
|
||||
map<string, int32> property = 2; //基础属性
|
||||
map<string, int32> addProperty = 3; //附加属性
|
||||
}
|
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"go_dreamfactory/modules/equipment"
|
||||
"go_dreamfactory/modules/friend"
|
||||
"go_dreamfactory/modules/hero"
|
||||
"go_dreamfactory/modules/items"
|
||||
@ -42,8 +43,8 @@ func main() {
|
||||
mail.NewModule(),
|
||||
friend.NewModule(),
|
||||
hero.NewModule(),
|
||||
equipment.NewModule(),
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
func NewService(ops ...rpcx.Option) core.IService {
|
||||
|
Loading…
Reference in New Issue
Block a user