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 (
|
const (
|
||||||
PropertyHp int32 = 1 //生命
|
PropertyHp string = "hp" //生命
|
||||||
PropertyAtk int32 = 2 //攻击
|
PropertyAtk string = "atk" //攻击
|
||||||
PropertyDef int32 = 3 //防御
|
PropertyDef string = "def" //防御
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -93,24 +93,13 @@ func (this *UserSession) UnBind() (err error) {
|
|||||||
|
|
||||||
//向用户发送消息
|
//向用户发送消息
|
||||||
func (this *UserSession) SendMsg(mainType, subType string, msg proto.Message) (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)
|
data, _ := anypb.New(msg)
|
||||||
this.msgqueue = append(this.msgqueue, &pb.UserMessage{
|
this.msgqueue = append(this.msgqueue, &pb.UserMessage{
|
||||||
MainType: mainType,
|
MainType: mainType,
|
||||||
SubType: subType,
|
SubType: subType,
|
||||||
Data: data,
|
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
|
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{
|
if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentSendMsg), &pb.AgentCloseeReq{
|
||||||
UserSessionId: this.SessionId,
|
UserSessionId: this.SessionId,
|
||||||
}, reply); err != nil {
|
}, 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
|
return
|
||||||
}
|
}
|
||||||
|
@ -136,6 +136,10 @@ func (this *Redis) HMGet(key string, v interface{}, fields ...string) (err error
|
|||||||
this.client.Process(this.getContext(), cmd)
|
this.client.Process(this.getContext(), cmd)
|
||||||
var _result map[string]string
|
var _result map[string]string
|
||||||
if _result, err = cmd.Result(); err == nil {
|
if _result, err = cmd.Result(); err == nil {
|
||||||
|
if len(_result) == 0 {
|
||||||
|
err = redis.Nil
|
||||||
|
return
|
||||||
|
}
|
||||||
err = this.decode.DecoderMapString(_result, v)
|
err = this.decode.DecoderMapString(_result, v)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -12,6 +12,10 @@ func (this *Redis) Lindex(key string, v interface{}) (err error) {
|
|||||||
this.client.Process(this.getContext(), cmd)
|
this.client.Process(this.getContext(), cmd)
|
||||||
var _result string
|
var _result string
|
||||||
if _result, err = cmd.Result(); err == nil {
|
if _result, err = cmd.Result(); err == nil {
|
||||||
|
if len(_result) == 0 {
|
||||||
|
err = redis.Nil
|
||||||
|
return
|
||||||
|
}
|
||||||
err = this.decode.DecoderString(_result, v)
|
err = this.decode.DecoderString(_result, v)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -68,6 +68,9 @@ func (this *Redis) HGetAll(key string, v interface{}) (err error) {
|
|||||||
this.client.Process(this.getContext(), cmd)
|
this.client.Process(this.getContext(), cmd)
|
||||||
var _result map[string]string
|
var _result map[string]string
|
||||||
if _result, err = cmd.Result(); err == nil {
|
if _result, err = cmd.Result(); err == nil {
|
||||||
|
if len(_result) == 0 {
|
||||||
|
return redis.Nil
|
||||||
|
}
|
||||||
err = this.decode.DecoderMapString(_result, v)
|
err = this.decode.DecoderMapString(_result, v)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -307,17 +307,10 @@ func (this *Decoder) DecoderMapString(data map[string]string, v interface{}) err
|
|||||||
}
|
}
|
||||||
if value, ok := data[name]; ok {
|
if value, ok := data[name]; ok {
|
||||||
v := reflect.New(fieldInfo.Type).Elem()
|
v := reflect.New(fieldInfo.Type).Elem()
|
||||||
if fieldInfo.Type.Kind() != reflect.Ptr {
|
|
||||||
if err := this.DecoderString(value, v.Addr().Interface()); err != nil {
|
if err := this.DecoderString(value, v.Addr().Interface()); err != nil {
|
||||||
return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err)
|
return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err)
|
||||||
}
|
}
|
||||||
elem.FieldByName(fieldInfo.Name).Set(v)
|
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,12 @@ func (this *apiComp) Equip(session comm.IUserSession, agrs map[string]interface{
|
|||||||
hero *pb.DBHero
|
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)
|
confs = agrs["conf"].([]*cfg.Game_equipData)
|
||||||
equipments = agrs["equipment"].([]*pb.DB_Equipment)
|
equipments = agrs["equipment"].([]*pb.DB_Equipment)
|
||||||
updatequipment = make([]*pb.DB_Equipment, 0)
|
updatequipment = make([]*pb.DB_Equipment, 0)
|
||||||
|
@ -55,13 +55,14 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
|
|||||||
conf *cfg.Game_equipData
|
conf *cfg.Game_equipData
|
||||||
intensify *cfg.Game_equipIntensifyData
|
intensify *cfg.Game_equipIntensifyData
|
||||||
equipment *pb.DB_Equipment
|
equipment *pb.DB_Equipment
|
||||||
|
modifyequipments []*pb.DB_Equipment
|
||||||
hero *pb.DBHero
|
hero *pb.DBHero
|
||||||
equipments []*pb.DB_Equipment
|
equipments []*pb.DB_Equipment
|
||||||
issucc bool
|
issucc bool
|
||||||
)
|
)
|
||||||
defer func() {
|
defer func() {
|
||||||
if code == pb.ErrorCode_Success {
|
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)
|
conf = agrs["conf"].(*cfg.Game_equipData)
|
||||||
@ -78,10 +79,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if issucc {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
modifyequipments = make([]*pb.DB_Equipment, 0)
|
||||||
//叠加装备 拆分处理
|
//叠加装备 拆分处理
|
||||||
if equipment.IsInitialState && equipment.OverlayNum > 1 {
|
if equipment.IsInitialState && equipment.OverlayNum > 1 {
|
||||||
equipment.OverlayNum--
|
equipment.OverlayNum--
|
||||||
@ -93,10 +94,12 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
|
|||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
modifyequipments = append(modifyequipments, equipment)
|
||||||
equipment = CloneEquipment(equipment)
|
equipment = CloneEquipment(equipment)
|
||||||
equipment.Id = primitive.NewObjectID().Hex()
|
equipment.Id = primitive.NewObjectID().Hex()
|
||||||
equipment.IsInitialState = false
|
equipment.IsInitialState = false
|
||||||
equipment.OverlayNum = 1
|
equipment.OverlayNum = 1
|
||||||
|
modifyequipments = append(modifyequipments, equipment)
|
||||||
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
log.Errorf("Upgrade err:%v", err)
|
log.Errorf("Upgrade err:%v", err)
|
||||||
@ -109,6 +112,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
equipment.IsInitialState = false
|
equipment.IsInitialState = false
|
||||||
|
modifyequipments = append(modifyequipments, equipment)
|
||||||
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
log.Errorf("Upgrade err:%v", err)
|
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.ModuleCompBase.Init(service, module, comp, options)
|
||||||
this.LoadConfigure(game_equip, cfg.NewGame_equip)
|
this.LoadConfigure(game_equip, cfg.NewGame_equip)
|
||||||
this.LoadConfigure(equip_attrlibrary, cfg.NewGame_equipAttrlibrary)
|
this.LoadConfigure(equip_attrlibrary, cfg.NewGame_equipAttrlibrary)
|
||||||
|
this.LoadConfigure(equip_intensify, cfg.NewGame_equipIntensify)
|
||||||
|
this.LoadConfigure(equip_suit, cfg.NewGame_equipSuit)
|
||||||
return
|
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) {
|
func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equip *cfg.Game_equipData, intensify *cfg.Game_equipIntensifyData) (err error) {
|
||||||
equipment.Lv++
|
equipment.Lv++
|
||||||
equipment.MainEntry.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 { //不触发副词条变化
|
if !intensify.Activation { //不触发副词条变化
|
||||||
return
|
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 {
|
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(equipment.AdverbEntry[index].Id); err != nil {
|
||||||
return
|
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++
|
equipment.AdverbEntry[index].Lv++
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -63,9 +63,14 @@ func (this *Equipment) OnInstallComp() {
|
|||||||
|
|
||||||
//IEquipment-------------------------------------------------------------------------------------------------------------------------------
|
//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
|
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 {
|
if err == redis.Nil {
|
||||||
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package equipment_test
|
package equipment_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego"
|
"go_dreamfactory/lego"
|
||||||
@ -9,6 +10,9 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules/equipment"
|
"go_dreamfactory/modules/equipment"
|
||||||
"go_dreamfactory/modules/hero"
|
"go_dreamfactory/modules/hero"
|
||||||
|
"go_dreamfactory/modules/items"
|
||||||
|
"go_dreamfactory/modules/user"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/services"
|
"go_dreamfactory/services"
|
||||||
"go_dreamfactory/sys/cache"
|
"go_dreamfactory/sys/cache"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
@ -16,6 +20,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/ptypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newService(ops ...rpcx.Option) core.IService {
|
func newService(ops ...rpcx.Option) core.IService {
|
||||||
@ -66,13 +72,32 @@ func TestMain(m *testing.M) {
|
|||||||
lego.Run(service, //运行模块
|
lego.Run(service, //运行模块
|
||||||
module,
|
module,
|
||||||
hero.NewModule(),
|
hero.NewModule(),
|
||||||
|
user.NewModule(),
|
||||||
|
items.NewModule(),
|
||||||
)
|
)
|
||||||
}()
|
}()
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
defer os.Exit(m.Run())
|
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{
|
code := module.AddNewEquipments(&comm.ModuleCallSource{
|
||||||
Module: "Test",
|
Module: "Test",
|
||||||
FuncName: "Test_Module",
|
FuncName: "Test_Module",
|
||||||
@ -80,3 +105,13 @@ func Test_Module(t *testing.T) {
|
|||||||
}, "0_62b16dda909b2f8faeff788d", map[int32]uint32{10001: 1})
|
}, "0_62b16dda909b2f8faeff788d", map[int32]uint32{10001: 1})
|
||||||
log.Debugf("Test_Module Code:%d", code)
|
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{}{
|
_heroMap := map[string]interface{}{
|
||||||
"resonateNum": _hero.ResonateNum + resonConfig.Energy,
|
"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 {
|
if err != nil {
|
||||||
log.Errorf("update hero skill failed:%v", err)
|
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,
|
"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 {
|
if err != nil {
|
||||||
log.Errorf("update hero skill failed:%v", err)
|
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,
|
"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 {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
log.Errorf("update hero skill failed:%v", err)
|
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{}{
|
_heroMap := map[string]interface{}{
|
||||||
"normalSkill": _hero.NormalSkill,
|
"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 {
|
if err != nil {
|
||||||
log.Errorf("update hero skill failed:%v", err)
|
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,
|
"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 {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
log.Errorf("update hero skill failed:%v", err)
|
log.Errorf("update hero skill failed:%v", err)
|
||||||
|
@ -95,6 +95,6 @@ func TestModify(t *testing.T) {
|
|||||||
"lv": 2,
|
"lv": 2,
|
||||||
"exp": 1000,
|
"exp": 1000,
|
||||||
}
|
}
|
||||||
err := module.modelHero.modifyHero("u1", "62b534bebf4745d4117acabe", data)
|
err := module.modelHero.modifyHeroData("u1", "62b534bebf4745d4117acabe", data)
|
||||||
fmt.Printf("%v ", err)
|
fmt.Printf("%v ", err)
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,9 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero {
|
|||||||
Skins: []int32{},
|
Skins: []int32{},
|
||||||
EquipID: make([]string, 6), //初始装备
|
EquipID: make([]string, 6), //初始装备
|
||||||
SameCount: 1, //默认叠加数量
|
SameCount: 1, //默认叠加数量
|
||||||
AddProperty: make(map[int32]int32),
|
AddProperty: make(map[string]int32),
|
||||||
Energy: make(map[int32]int32),
|
Energy: make(map[int32]int32),
|
||||||
Property: make(map[int32]int32),
|
Property: make(map[string]int32),
|
||||||
}
|
}
|
||||||
return newHero
|
return newHero
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
|
|||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"sameCount": h.SameCount, //叠加数
|
"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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
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
|
return pb.ErrorCode_Success
|
||||||
}
|
}
|
||||||
|
|
||||||
//指定英雄升级
|
//合并属性即属性值累加
|
||||||
func (this *ModelHero) levelUp(uid string, heroId int32) error {
|
func (this *ModelHero) mergeProperty(uid, heroId string, data map[string]int32) {
|
||||||
var heroes []*pb.DBHero
|
hero := this.getOneHero(uid, heroId)
|
||||||
err := this.moduleHero.modelHero.GetList(uid, heroes)
|
if hero == nil {
|
||||||
if err != nil {
|
return
|
||||||
log.Errorf("levelUp err:%v", err)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
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里实现
|
//属性计算 - 暂时放在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)
|
hero := this.getOneHero(uid, heroId)
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
return nil
|
return nil
|
||||||
@ -209,16 +205,22 @@ func (this *ModelHero) PropertyCompute(uid, heroId string) map[int32]int32 {
|
|||||||
return nil
|
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)
|
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)
|
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)
|
def, _ := mengine.ParseAndExec(exprDef)
|
||||||
|
|
||||||
return map[int32]int32{
|
return map[string]int32{
|
||||||
comm.PropertyHp: int32(math.Floor(hp)),
|
comm.PropertyHp: int32(math.Floor(hp)),
|
||||||
comm.PropertyAtk: int32(math.Floor(atk)),
|
comm.PropertyAtk: int32(math.Floor(atk)),
|
||||||
comm.PropertyDef: int32(math.Floor(def)),
|
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 {
|
for _, v := range equip {
|
||||||
equipIds = append(equipIds, v.Id)
|
equipIds = append(equipIds, v.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.modelHero.setEquipment(hero.Uid, hero.Id, equipIds)
|
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,
|
"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
|
code = pb.ErrorCode_DBError
|
||||||
} // 修改英雄数据
|
} // 修改英雄数据
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,15 +89,18 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p
|
|||||||
hero comm.IHero //英雄模块
|
hero comm.IHero //英雄模块
|
||||||
// equipment comm.IEquipment //装备模块
|
// 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
|
return
|
||||||
}
|
}
|
||||||
user = module.(comm.IUser)
|
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
|
return
|
||||||
}
|
}
|
||||||
items = module.(comm.IItems)
|
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
|
return
|
||||||
}
|
}
|
||||||
hero = module.(comm.IHero)
|
hero = module.(comm.IHero)
|
||||||
@ -179,19 +182,23 @@ func (this *ModuleBase) DispenseRes(uid string, res []*cfg.Game_atn) (code pb.Er
|
|||||||
hero comm.IHero //英雄模块
|
hero comm.IHero //英雄模块
|
||||||
equipment comm.IEquipment //装备模块
|
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
|
return
|
||||||
}
|
}
|
||||||
user = module.(comm.IUser)
|
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
|
return
|
||||||
}
|
}
|
||||||
items = module.(comm.IItems)
|
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
|
return
|
||||||
}
|
}
|
||||||
hero = module.(comm.IHero)
|
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
|
return
|
||||||
}
|
}
|
||||||
equipment = module.(comm.IEquipment)
|
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) {
|
func (this *User) QueryAttributeValue(uid string, attr string) (value int32) {
|
||||||
user := this.modelUser.getUser(uid)
|
user := this.modelUser.getUser(uid)
|
||||||
|
if user == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
switch attr {
|
switch attr {
|
||||||
case comm.ResGold:
|
case comm.ResGold:
|
||||||
return user.Gold
|
return user.Gold
|
||||||
case comm.ResExp:
|
case comm.ResExp:
|
||||||
return user.Exp
|
return user.Exp
|
||||||
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,8 @@ type EquipmentEquipResp struct {
|
|||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Equipments []*DB_Equipment `protobuf:"bytes,1,rep,name=Equipments,proto3" json:"Equipments"` //挂在装备列表
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EquipmentEquipResp) Reset() {
|
func (x *EquipmentEquipResp) Reset() {
|
||||||
@ -202,6 +204,13 @@ func (*EquipmentEquipResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{3}
|
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 {
|
type EquipmentUpgradeReq struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@ -255,6 +264,9 @@ type EquipmentUpgradeResp struct {
|
|||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
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() {
|
func (x *EquipmentUpgradeResp) Reset() {
|
||||||
@ -289,6 +301,20 @@ func (*EquipmentUpgradeResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{5}
|
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 protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_equipment_equipment_msg_proto_rawDesc = []byte{
|
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,
|
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,
|
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,
|
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,
|
0x49, 0x64, 0x22, 0x43, 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,
|
0x71, 0x75, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x45, 0x71, 0x75, 0x69,
|
||||||
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12,
|
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44,
|
||||||
0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01,
|
0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x45, 0x71, 0x75,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49,
|
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x37, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70,
|
||||||
0x64, 0x22, 0x16, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70,
|
0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x20,
|
||||||
0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
var (
|
||||||
@ -341,11 +374,13 @@ var file_equipment_equipment_msg_proto_goTypes = []interface{}{
|
|||||||
}
|
}
|
||||||
var file_equipment_equipment_msg_proto_depIdxs = []int32{
|
var file_equipment_equipment_msg_proto_depIdxs = []int32{
|
||||||
6, // 0: EquipmentGetListResp.Equipments:type_name -> DB_Equipment
|
6, // 0: EquipmentGetListResp.Equipments:type_name -> DB_Equipment
|
||||||
1, // [1:1] is the sub-list for method output_type
|
6, // 1: EquipmentEquipResp.Equipments:type_name -> DB_Equipment
|
||||||
1, // [1:1] is the sub-list for method input_type
|
6, // 2: EquipmentUpgradeResp.Equipment:type_name -> DB_Equipment
|
||||||
1, // [1:1] is the sub-list for extension type_name
|
3, // [3:3] is the sub-list for method output_type
|
||||||
1, // [1:1] is the sub-list for extension extendee
|
3, // [3:3] is the sub-list for method input_type
|
||||||
0, // [0:1] is the sub-list for field type_name
|
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() }
|
func init() { file_equipment_equipment_msg_proto_init() }
|
||||||
|
@ -89,8 +89,8 @@ type DBHero struct {
|
|||||||
JuexingLv int32 `protobuf:"varint,7,opt,name=juexingLv,proto3" json:"juexingLv" bson:"juexingLv"` //觉醒等级
|
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"` //队长技能
|
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"` //普通技能
|
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"` // 属性相关
|
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[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"` //附加属性相关
|
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"` // 阵型类型
|
Formation int32 `protobuf:"varint,12,opt,name=formation,proto3" json:"formation"` // 阵型类型
|
||||||
CardType int32 `protobuf:"varint,13,opt,name=cardType,proto3" json:"cardType" bson:"cardType"` //卡片类型(升星卡、经验卡、技能升级卡)
|
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
|
CurSkin int32 `protobuf:"varint,14,opt,name=curSkin,proto3" json:"curSkin" bson:"curSkin"` //当前装备的皮肤ID
|
||||||
@ -201,14 +201,14 @@ func (x *DBHero) GetNormalSkill() []*SkillData {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBHero) GetProperty() map[int32]int32 {
|
func (x *DBHero) GetProperty() map[string]int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Property
|
return x.Property
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBHero) GetAddProperty() map[int32]int32 {
|
func (x *DBHero) GetAddProperty() map[string]int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.AddProperty
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
|
@ -1178,8 +1178,8 @@ type HeroProperty struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
HeroId string `protobuf:"bytes,1,opt,name=heroId,proto3" json:"heroId"` //英雄唯一ID
|
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"` //基础属性
|
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[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"` //附加属性
|
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() {
|
func (x *HeroProperty) Reset() {
|
||||||
@ -1221,14 +1221,14 @@ func (x *HeroProperty) GetHeroId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HeroProperty) GetProperty() map[int32]int32 {
|
func (x *HeroProperty) GetProperty() map[string]int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Property
|
return x.Property
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HeroProperty) GetAddProperty() map[int32]int32 {
|
func (x *HeroProperty) GetAddProperty() map[string]int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.AddProperty
|
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,
|
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, 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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
@ -19,7 +19,7 @@ message EquipmentEquipReq{
|
|||||||
|
|
||||||
//装备挂在到英雄上 回应
|
//装备挂在到英雄上 回应
|
||||||
message EquipmentEquipResp{
|
message EquipmentEquipResp{
|
||||||
|
repeated DB_Equipment Equipments = 1; //挂在装备列表
|
||||||
}
|
}
|
||||||
|
|
||||||
//装备升级
|
//装备升级
|
||||||
@ -29,5 +29,6 @@ message EquipmentUpgradeReq{
|
|||||||
|
|
||||||
//装备升级 回应
|
//装备升级 回应
|
||||||
message EquipmentUpgradeResp{
|
message EquipmentUpgradeResp{
|
||||||
|
bool IsSucc = 1;
|
||||||
|
repeated DB_Equipment Equipment = 2; //由于装备可以叠加 升级后会创建一个新的装备出来 所以可能影响两个装备
|
||||||
}
|
}
|
@ -16,8 +16,8 @@ message DBHero {
|
|||||||
int32 juexingLv = 7; //@go_tags(`bson:"juexingLv"`) 觉醒等级
|
int32 juexingLv = 7; //@go_tags(`bson:"juexingLv"`) 觉醒等级
|
||||||
int32 captainSkill = 8; //@go_tags(`bson:"captainSkill"`) 队长技能
|
int32 captainSkill = 8; //@go_tags(`bson:"captainSkill"`) 队长技能
|
||||||
repeated SkillData normalSkill = 9; //@go_tags(`bson:"normalSkill"`) 普通技能
|
repeated SkillData normalSkill = 9; //@go_tags(`bson:"normalSkill"`) 普通技能
|
||||||
map<int32, int32> property = 10; // 属性相关
|
map<string, int32> property = 10; // 属性相关
|
||||||
map<int32, int32> addProperty =
|
map<string, int32> addProperty =
|
||||||
11; //@go_tags(`bson:"addProperty"`) 附加属性相关
|
11; //@go_tags(`bson:"addProperty"`) 附加属性相关
|
||||||
int32 formation = 12; // 阵型类型
|
int32 formation = 12; // 阵型类型
|
||||||
int32 cardType =
|
int32 cardType =
|
||||||
|
@ -113,6 +113,6 @@ message HeroChoukaResp { repeated DBHero heroes = 1; }
|
|||||||
//英雄属性推送
|
//英雄属性推送
|
||||||
message HeroProperty {
|
message HeroProperty {
|
||||||
string heroId = 1; //英雄唯一ID
|
string heroId = 1; //英雄唯一ID
|
||||||
map<int32, int32> property = 2; //基础属性
|
map<string, int32> property = 2; //基础属性
|
||||||
map<int32, int32> addProperty = 3; //附加属性
|
map<string, int32> addProperty = 3; //附加属性
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"go_dreamfactory/modules/equipment"
|
||||||
"go_dreamfactory/modules/friend"
|
"go_dreamfactory/modules/friend"
|
||||||
"go_dreamfactory/modules/hero"
|
"go_dreamfactory/modules/hero"
|
||||||
"go_dreamfactory/modules/items"
|
"go_dreamfactory/modules/items"
|
||||||
@ -42,8 +43,8 @@ func main() {
|
|||||||
mail.NewModule(),
|
mail.NewModule(),
|
||||||
friend.NewModule(),
|
friend.NewModule(),
|
||||||
hero.NewModule(),
|
hero.NewModule(),
|
||||||
|
equipment.NewModule(),
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewService(ops ...rpcx.Option) core.IService {
|
func NewService(ops ...rpcx.Option) core.IService {
|
||||||
|
Loading…
Reference in New Issue
Block a user