一些接口不提供对外使用方法
This commit is contained in:
parent
b242723fa5
commit
d87f822e2f
@ -48,8 +48,6 @@ type (
|
|||||||
//查询用户卡片数量
|
//查询用户卡片数量
|
||||||
QueryHeroAmount(uId string, heroCfgId string) (amount uint32)
|
QueryHeroAmount(uId string, heroCfgId string) (amount uint32)
|
||||||
|
|
||||||
//创建指定数量
|
|
||||||
CreateRepeatHero(session IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode)
|
|
||||||
// 批量创建英雄
|
// 批量创建英雄
|
||||||
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode)
|
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode)
|
||||||
// 获取英雄
|
// 获取英雄
|
||||||
|
@ -276,12 +276,33 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
update["totalcount"] = heroRecord.Totalcount
|
update["totalcount"] = heroRecord.Totalcount
|
||||||
update["daycount"] = heroRecord.Daycount
|
update["daycount"] = heroRecord.Daycount
|
||||||
this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update)
|
this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update)
|
||||||
|
szNewCards := make([]*cfg.Gameatn, 0)
|
||||||
for _, heroId := range szCards {
|
for _, heroId := range szCards {
|
||||||
|
bFind := false
|
||||||
_mapAddHero[heroId]++
|
_mapAddHero[heroId]++
|
||||||
|
for _, v := range szNewCards {
|
||||||
|
if v.T == heroId {
|
||||||
|
v.N++
|
||||||
|
bFind = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
_, code = this.module.CreateRepeatHeros(session, _mapAddHero, true)
|
}
|
||||||
|
if !bFind {
|
||||||
|
res := &cfg.Gameatn{
|
||||||
|
A: "hero",
|
||||||
|
T: heroId,
|
||||||
|
N: 1,
|
||||||
|
}
|
||||||
|
szNewCards = append(szNewCards, res)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获得新卡
|
||||||
|
|
||||||
|
if code = this.module.DispenseRes(session, szNewCards, true); code != pb.ErrorCode_Success {
|
||||||
|
|
||||||
|
this.module.Errorf("err:%v,create heros:%v,uid,%s", code, szNewCards, session.GetUserId())
|
||||||
|
code = pb.ErrorCode_HeroCreate // 创建新英雄失败
|
||||||
|
}
|
||||||
///英雄招募 【玩家名称】在招募中获得了【英雄名称】!
|
///英雄招募 【玩家名称】在招募中获得了【英雄名称】!
|
||||||
this.module.SendChatMsg(session, _mapAddHero, szCards)
|
this.module.SendChatMsg(session, _mapAddHero, szCards)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package hero
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@ -74,12 +75,14 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获得新卡
|
// 获得新卡
|
||||||
var new map[string]int32
|
res := &cfg.Gameatn{
|
||||||
new = make(map[string]int32)
|
A: "hero",
|
||||||
new[conf.Hero] = 1
|
T: conf.Hero,
|
||||||
if _, err := this.module.CreateRepeatHeros(session, new, false); err != pb.ErrorCode_Success {
|
N: 1,
|
||||||
|
}
|
||||||
|
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, false); code != pb.ErrorCode_Success {
|
||||||
|
|
||||||
this.module.Errorf("err:%v,create hero:%s,uid,%ss", err, conf.Hero, session.GetUserId())
|
this.module.Errorf("err:%v,create hero:%s,uid,%ss", code, conf.Hero, session.GetUserId())
|
||||||
code = pb.ErrorCode_HeroCreate // 创建新英雄失败
|
code = pb.ErrorCode_HeroCreate // 创建新英雄失败
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
||||||
|
@ -76,7 +76,7 @@ func (this *Hero) Start() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建单个叠加英雄
|
//创建单个叠加英雄
|
||||||
func (this *Hero) CreateRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) {
|
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) {
|
||||||
var err error
|
var err error
|
||||||
hero, err = this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num)
|
hero, err = this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -272,7 +272,7 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
|
|||||||
if num == 0 { // 数量为0 不做处理
|
if num == 0 { // 数量为0 不做处理
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if hero, code = this.CreateRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
if hero, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
||||||
this.Errorf("create hero %s failed", heroCfgId)
|
this.Errorf("create hero %s failed", heroCfgId)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user