Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
394dfde6b1
@ -57,8 +57,8 @@
|
|||||||
"isani": 0,
|
"isani": 0,
|
||||||
"star": 0,
|
"star": 0,
|
||||||
"race": 0,
|
"race": 0,
|
||||||
"img": "wp_icon_0001",
|
"img": "wp_icon_10002",
|
||||||
"ico": "wp_icon_0001",
|
"ico": "wp_icon_10002",
|
||||||
"intr": {
|
"intr": {
|
||||||
"key": "itemdesc_10002",
|
"key": "itemdesc_10002",
|
||||||
"text": "一块测试功能的石头,他可能是某个不能使用的活动道具"
|
"text": "一块测试功能的石头,他可能是某个不能使用的活动道具"
|
||||||
@ -288,13 +288,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "1",
|
"id": "10009",
|
||||||
"name": {
|
"name": {
|
||||||
"key": "itemname_1",
|
"key": "itemname_10009",
|
||||||
"text": "宝箱自选"
|
"text": "被封印的魔法书"
|
||||||
},
|
},
|
||||||
"usetype": 4,
|
"usetype": 2,
|
||||||
"color": 4,
|
"color": 6,
|
||||||
"bagtype": 1,
|
"bagtype": 1,
|
||||||
"index": 9,
|
"index": 9,
|
||||||
"special_type": 0,
|
"special_type": 0,
|
||||||
@ -309,11 +309,11 @@
|
|||||||
"isani": 0,
|
"isani": 0,
|
||||||
"star": 0,
|
"star": 0,
|
||||||
"race": 0,
|
"race": 0,
|
||||||
"img": "wp_icon_0001",
|
"img": "wp_icon_10009",
|
||||||
"ico": "wp_icon_0001",
|
"ico": "wp_icon_10009",
|
||||||
"intr": {
|
"intr": {
|
||||||
"key": "itemdesc_1",
|
"key": "itemdesc_10009",
|
||||||
"text": "可以在以下道具中选择任选1个"
|
"text": "这本魔法书被强大的魔法封印了,通过第9999关后可以开启"
|
||||||
},
|
},
|
||||||
"sale": [
|
"sale": [
|
||||||
{
|
{
|
||||||
@ -324,13 +324,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "2",
|
"id": "10010",
|
||||||
"name": {
|
"name": {
|
||||||
"key": "itemname_2",
|
"key": "itemname_10010",
|
||||||
"text": "金币"
|
"text": "古代硬币"
|
||||||
},
|
},
|
||||||
"usetype": 4,
|
"usetype": 2,
|
||||||
"color": 3,
|
"color": 5,
|
||||||
"bagtype": 1,
|
"bagtype": 1,
|
||||||
"index": 10,
|
"index": 10,
|
||||||
"special_type": 0,
|
"special_type": 0,
|
||||||
@ -340,16 +340,232 @@
|
|||||||
"synthetize_num": 0,
|
"synthetize_num": 0,
|
||||||
"access": 0,
|
"access": 0,
|
||||||
"use_skip": 0,
|
"use_skip": 0,
|
||||||
"upper_limit": 99999999,
|
"upper_limit": 999,
|
||||||
"uselv": 0,
|
"uselv": 0,
|
||||||
"isani": 0,
|
"isani": 0,
|
||||||
"star": 0,
|
"star": 0,
|
||||||
"race": 0,
|
"race": 0,
|
||||||
"img": "wp_icon_0002",
|
"img": "wp_icon_10010",
|
||||||
"ico": "wp_icon_0002",
|
"ico": "wp_icon_10010",
|
||||||
"intr": {
|
"intr": {
|
||||||
"key": "itemdesc_2",
|
"key": "itemdesc_10010",
|
||||||
"text": "货币"
|
"text": "似乎是某个失落文明的货币,暂时只有纪念意义"
|
||||||
|
},
|
||||||
|
"sale": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "gold",
|
||||||
|
"n": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "10011",
|
||||||
|
"name": {
|
||||||
|
"key": "itemname_10011",
|
||||||
|
"text": "坏掉的钟表"
|
||||||
|
},
|
||||||
|
"usetype": 2,
|
||||||
|
"color": 3,
|
||||||
|
"bagtype": 1,
|
||||||
|
"index": 11,
|
||||||
|
"special_type": 0,
|
||||||
|
"time": 0,
|
||||||
|
"effects": "",
|
||||||
|
"box_id": 0,
|
||||||
|
"synthetize_num": 0,
|
||||||
|
"access": 0,
|
||||||
|
"use_skip": 0,
|
||||||
|
"upper_limit": 999,
|
||||||
|
"uselv": 0,
|
||||||
|
"isani": 0,
|
||||||
|
"star": 0,
|
||||||
|
"race": 0,
|
||||||
|
"img": "wp_icon_10011",
|
||||||
|
"ico": "wp_icon_10011",
|
||||||
|
"intr": {
|
||||||
|
"key": "itemdesc_10011",
|
||||||
|
"text": "表针一动不动,也许有人可以修好它。"
|
||||||
|
},
|
||||||
|
"sale": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "gold",
|
||||||
|
"n": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "10012",
|
||||||
|
"name": {
|
||||||
|
"key": "itemname_10012",
|
||||||
|
"text": "木材"
|
||||||
|
},
|
||||||
|
"usetype": 2,
|
||||||
|
"color": 2,
|
||||||
|
"bagtype": 1,
|
||||||
|
"index": 12,
|
||||||
|
"special_type": 0,
|
||||||
|
"time": 0,
|
||||||
|
"effects": "",
|
||||||
|
"box_id": 0,
|
||||||
|
"synthetize_num": 0,
|
||||||
|
"access": 0,
|
||||||
|
"use_skip": 0,
|
||||||
|
"upper_limit": 999,
|
||||||
|
"uselv": 0,
|
||||||
|
"isani": 0,
|
||||||
|
"star": 0,
|
||||||
|
"race": 0,
|
||||||
|
"img": "wp_icon_10012",
|
||||||
|
"ico": "wp_icon_10012",
|
||||||
|
"intr": {
|
||||||
|
"key": "itemdesc_10012",
|
||||||
|
"text": "精致的木材,散发着淡淡的香气"
|
||||||
|
},
|
||||||
|
"sale": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "gold",
|
||||||
|
"n": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "10013",
|
||||||
|
"name": {
|
||||||
|
"key": "itemname_10013",
|
||||||
|
"text": "四叶草"
|
||||||
|
},
|
||||||
|
"usetype": 2,
|
||||||
|
"color": 4,
|
||||||
|
"bagtype": 1,
|
||||||
|
"index": 13,
|
||||||
|
"special_type": 0,
|
||||||
|
"time": 0,
|
||||||
|
"effects": "",
|
||||||
|
"box_id": 0,
|
||||||
|
"synthetize_num": 0,
|
||||||
|
"access": 0,
|
||||||
|
"use_skip": 0,
|
||||||
|
"upper_limit": 999,
|
||||||
|
"uselv": 0,
|
||||||
|
"isani": 0,
|
||||||
|
"star": 0,
|
||||||
|
"race": 0,
|
||||||
|
"img": "wp_icon_10013",
|
||||||
|
"ico": "wp_icon_10013",
|
||||||
|
"intr": {
|
||||||
|
"key": "itemdesc_10013",
|
||||||
|
"text": "把它放在背包里会带来好运"
|
||||||
|
},
|
||||||
|
"sale": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "gold",
|
||||||
|
"n": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "10014",
|
||||||
|
"name": {
|
||||||
|
"key": "itemname_10014",
|
||||||
|
"text": "冒险家勋章"
|
||||||
|
},
|
||||||
|
"usetype": 2,
|
||||||
|
"color": 6,
|
||||||
|
"bagtype": 1,
|
||||||
|
"index": 14,
|
||||||
|
"special_type": 0,
|
||||||
|
"time": 0,
|
||||||
|
"effects": "",
|
||||||
|
"box_id": 0,
|
||||||
|
"synthetize_num": 0,
|
||||||
|
"access": 0,
|
||||||
|
"use_skip": 0,
|
||||||
|
"upper_limit": 999,
|
||||||
|
"uselv": 0,
|
||||||
|
"isani": 0,
|
||||||
|
"star": 0,
|
||||||
|
"race": 0,
|
||||||
|
"img": "wp_icon_10014",
|
||||||
|
"ico": "wp_icon_10014",
|
||||||
|
"intr": {
|
||||||
|
"key": "itemdesc_10014",
|
||||||
|
"text": "你登录了游戏就是冒险家,就会获得这个勋章"
|
||||||
|
},
|
||||||
|
"sale": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "gold",
|
||||||
|
"n": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "10015",
|
||||||
|
"name": {
|
||||||
|
"key": "itemname_10015",
|
||||||
|
"text": "猫猫护身符"
|
||||||
|
},
|
||||||
|
"usetype": 2,
|
||||||
|
"color": 5,
|
||||||
|
"bagtype": 1,
|
||||||
|
"index": 15,
|
||||||
|
"special_type": 0,
|
||||||
|
"time": 0,
|
||||||
|
"effects": "",
|
||||||
|
"box_id": 0,
|
||||||
|
"synthetize_num": 0,
|
||||||
|
"access": 0,
|
||||||
|
"use_skip": 0,
|
||||||
|
"upper_limit": 999,
|
||||||
|
"uselv": 0,
|
||||||
|
"isani": 0,
|
||||||
|
"star": 0,
|
||||||
|
"race": 0,
|
||||||
|
"img": "wp_icon_10015",
|
||||||
|
"ico": "wp_icon_10015",
|
||||||
|
"intr": {
|
||||||
|
"key": "itemdesc_10015",
|
||||||
|
"text": "比幸运草更幸运"
|
||||||
|
},
|
||||||
|
"sale": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "gold",
|
||||||
|
"n": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "10016",
|
||||||
|
"name": {
|
||||||
|
"key": "itemname_10016",
|
||||||
|
"text": "人造钻石"
|
||||||
|
},
|
||||||
|
"usetype": 2,
|
||||||
|
"color": 3,
|
||||||
|
"bagtype": 1,
|
||||||
|
"index": 16,
|
||||||
|
"special_type": 0,
|
||||||
|
"time": 0,
|
||||||
|
"effects": "",
|
||||||
|
"box_id": 0,
|
||||||
|
"synthetize_num": 0,
|
||||||
|
"access": 0,
|
||||||
|
"use_skip": 0,
|
||||||
|
"upper_limit": 999,
|
||||||
|
"uselv": 0,
|
||||||
|
"isani": 0,
|
||||||
|
"star": 0,
|
||||||
|
"race": 0,
|
||||||
|
"img": "wp_icon_10016",
|
||||||
|
"ico": "wp_icon_10016",
|
||||||
|
"intr": {
|
||||||
|
"key": "itemdesc_10016",
|
||||||
|
"text": "钻石是人造的,所以不能用来买商城的商品"
|
||||||
},
|
},
|
||||||
"sale": [
|
"sale": [
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,9 @@ var (
|
|||||||
subType: task.TaskSubTypeList,
|
subType: task.TaskSubTypeList,
|
||||||
req: &pb.TaskListReq{
|
req: &pb.TaskListReq{
|
||||||
//设置任务类型
|
//设置任务类型
|
||||||
TaskTag: int32(comm.TASK_DAILY), //每天任务
|
// TaskTag: int32(comm.TASK_DAILY), //每天任务
|
||||||
// TaskTag: int32(comm.TASK_WEEKLY), //周任务
|
// TaskTag: int32(comm.TASK_WEEKLY), //周任务
|
||||||
// TaskTag: int32(comm.TASK_ACHIEVE),
|
TaskTag: int32(comm.TASK_ACHIEVE),
|
||||||
// TaskTag: int32(comm.TASK_STRATEGY),
|
// TaskTag: int32(comm.TASK_STRATEGY),
|
||||||
},
|
},
|
||||||
rsp: &pb.TaskListResp{},
|
rsp: &pb.TaskListResp{},
|
||||||
@ -39,8 +39,8 @@ var (
|
|||||||
mainType: string(comm.ModuleTask),
|
mainType: string(comm.ModuleTask),
|
||||||
subType: task.TaskSubTypeReceive,
|
subType: task.TaskSubTypeReceive,
|
||||||
req: &pb.TaskReceiveReq{
|
req: &pb.TaskReceiveReq{
|
||||||
TaskTag: int32(comm.TASK_DAILY),
|
TaskTag: int32(comm.TASK_ACHIEVE),
|
||||||
Id: "62dfee653be162da508224a4",
|
Id: "62e0d79d7eefc9f4ef5803e3",
|
||||||
},
|
},
|
||||||
rsp: &pb.TaskReceiveResp{},
|
rsp: &pb.TaskReceiveResp{},
|
||||||
// enabled: true,
|
// enabled: true,
|
||||||
@ -65,7 +65,7 @@ var (
|
|||||||
}
|
}
|
||||||
fmt.Printf("玩家活跃度 :%v \n", out.Active)
|
fmt.Printf("玩家活跃度 :%v \n", out.Active)
|
||||||
},
|
},
|
||||||
enabled: true,
|
// enabled: true,
|
||||||
}, {
|
}, {
|
||||||
desc: "活跃度领取",
|
desc: "活跃度领取",
|
||||||
mainType: string(comm.ModuleTask),
|
mainType: string(comm.ModuleTask),
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) GetSpecifiedCheck(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (code pb.ErrorCode) {
|
func (this *apiComp) GetSpecifiedCheck(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (code pb.ErrorCode) {
|
||||||
if req.HeroCoinfigID == "" {
|
if req.HeroCoinfigID == "" && req.Star <= 6 && req.Lv <= 6*comm.HeroStarLvRatio {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -18,7 +18,7 @@ func (this *apiComp) GetSpecifiedCheck(session comm.IUserSession, req *pb.HeroGe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 英雄锁定
|
/// 获取指定星级或等级的英雄 GM 协议
|
||||||
func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
|
|
||||||
code = this.GetSpecifiedCheck(session, req) // check
|
code = this.GetSpecifiedCheck(session, req) // check
|
||||||
@ -26,10 +26,11 @@ func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpec
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
hero, err := this.module.modelHero.createOneHero(session.GetUserId(), req.HeroCoinfigID)
|
hero, err := this.module.modelHero.createOneHero(session.GetUserId(), req.HeroCoinfigID)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
hero.Lv = req.Lv
|
code = pb.ErrorCode_HeroNoExist
|
||||||
hero.Star = req.Star
|
|
||||||
}
|
}
|
||||||
|
hero.Lv = req.Lv
|
||||||
|
hero.Star = req.Star
|
||||||
_heroMap := map[string]interface{}{
|
_heroMap := map[string]interface{}{
|
||||||
"lv": hero.Lv,
|
"lv": hero.Lv,
|
||||||
"star": hero.Star,
|
"star": hero.Star,
|
||||||
|
@ -98,6 +98,7 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId string) (hero *pb.DBH
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 克隆一个英雄
|
||||||
func (this *ModelHero) CloneNewHero(hero *pb.DBHero) (newHero *pb.DBHero) {
|
func (this *ModelHero) CloneNewHero(hero *pb.DBHero) (newHero *pb.DBHero) {
|
||||||
temp := *hero
|
temp := *hero
|
||||||
newHero = &temp
|
newHero = &temp
|
||||||
@ -133,7 +134,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//叠加英雄 count叠加数量
|
// 该方法适用创建初始英雄 叠加英雄 count叠加数量
|
||||||
func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count int32) (hero *pb.DBHero, err error) {
|
func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count int32) (hero *pb.DBHero, err error) {
|
||||||
heroes := this.moduleHero.modelHero.getHeroList(uid)
|
heroes := this.moduleHero.modelHero.getHeroList(uid)
|
||||||
if len(heroes) == 0 {
|
if len(heroes) == 0 {
|
||||||
@ -208,7 +209,7 @@ func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取一个英雄
|
//获取一个英雄(参数唯一objID)
|
||||||
func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
||||||
hero := &pb.DBHero{}
|
hero := &pb.DBHero{}
|
||||||
err := this.moduleHero.modelHero.GetListObj(uid, heroId, hero)
|
err := this.moduleHero.modelHero.GetListObj(uid, heroId, hero)
|
||||||
@ -248,14 +249,6 @@ func (this *ModelHero) consumeHeroCard(uid string, hero *pb.DBHero, count int32)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新英雄数据
|
|
||||||
// func (this *ModelHero) modifyHeroData(uid, heroId string, data map[string]interface{}) error {
|
|
||||||
// if len(data) == 0 {
|
|
||||||
// return fmt.Errorf("params len is 0")
|
|
||||||
// }
|
|
||||||
// return this.moduleHero.modelHero.ChangeList(uid, heroId, data)
|
|
||||||
// }
|
|
||||||
|
|
||||||
//获取玩家的英雄列表
|
//获取玩家的英雄列表
|
||||||
func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
|
func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
|
||||||
heroes := make([]*pb.DBHero, 0)
|
heroes := make([]*pb.DBHero, 0)
|
||||||
@ -309,42 +302,26 @@ func (this *ModelHero) setEquipment(hero *pb.DBHero) (newHero *pb.DBHero, err er
|
|||||||
if len(hero.EquipID) == 0 {
|
if len(hero.EquipID) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var (
|
|
||||||
curSameCount int32
|
|
||||||
)
|
|
||||||
update := make(map[string]interface{})
|
update := make(map[string]interface{})
|
||||||
if hero.IsOverlying && hero.SameCount > 1 {
|
if hero.IsOverlying && hero.SameCount > 1 {
|
||||||
curSameCount = hero.SameCount - 1
|
// 克隆一个新的
|
||||||
|
hero.SameCount -= 1
|
||||||
|
newHero = this.CloneNewHero(hero)
|
||||||
|
|
||||||
hero.SameCount = 1
|
hero.SameCount = 1
|
||||||
hero.IsOverlying = false
|
hero.IsOverlying = false
|
||||||
update["suiteId"] = hero.SuiteId
|
|
||||||
update["suiteExtId"] = hero.SuiteExtId
|
|
||||||
update["equipID"] = hero.EquipID
|
|
||||||
update["isoverlying"] = false
|
update["isoverlying"] = false
|
||||||
|
|
||||||
update["sameCount"] = 1
|
update["sameCount"] = 1
|
||||||
if err = this.ChangeList(hero.Uid, hero.Id, update); err != nil {
|
}
|
||||||
this.moduleHero.Errorf("%v", err)
|
// 修改装备属性 并更新
|
||||||
return
|
update["suiteId"] = hero.SuiteId
|
||||||
}
|
update["suiteExtId"] = hero.SuiteExtId
|
||||||
//创建新卡
|
update["equipID"] = hero.EquipID
|
||||||
|
|
||||||
newHero = this.CloneNewHero(hero)
|
if err = this.ChangeList(hero.Uid, hero.Id, update); err != nil {
|
||||||
newHero.EquipID = make([]string, 6)
|
this.moduleHero.Errorf("%v", err)
|
||||||
newHero.IsOverlying = true
|
return
|
||||||
newHero.SameCount = curSameCount
|
|
||||||
update1 := make(map[string]interface{})
|
|
||||||
update["equipID"] = newHero.EquipID
|
|
||||||
update1["sameCount"] = curSameCount
|
|
||||||
update1["isoverlying"] = true
|
|
||||||
|
|
||||||
this.ChangeList(newHero.Uid, newHero.Id, update1)
|
|
||||||
} else {
|
|
||||||
update["equipID"] = hero.EquipID
|
|
||||||
update["isoverlying"] = false
|
|
||||||
update["suiteId"] = hero.SuiteId
|
|
||||||
update["suiteExtId"] = hero.SuiteExtId
|
|
||||||
this.ChangeList(hero.Uid, hero.Id, update)
|
|
||||||
}
|
}
|
||||||
// 打印
|
// 打印
|
||||||
for _, v := range hero.EquipID {
|
for _, v := range hero.EquipID {
|
||||||
@ -353,12 +330,16 @@ func (this *ModelHero) setEquipment(hero *pb.DBHero) (newHero *pb.DBHero, err er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//合并属性即属性值累加
|
//合并属性即属性值累加 (data 额外加的属性)
|
||||||
func (this *ModelHero) mergeMainProperty(uid string, hero *pb.DBHero, data map[string]int32) (err error) {
|
func (this *ModelHero) mergeMainProperty(uid string, hero *pb.DBHero, data map[string]int32) (err error) {
|
||||||
|
for k, v := range hero.Property {
|
||||||
|
if v1, ok := data[k]; ok {
|
||||||
|
v += v1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hero.Property = data
|
|
||||||
if err = this.ChangeList(uid, hero.Id, map[string]interface{}{
|
if err = this.ChangeList(uid, hero.Id, map[string]interface{}{
|
||||||
"property": data,
|
"property": hero.Property,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
this.moduleHero.Errorf("mergeMainProperty err %v", err)
|
this.moduleHero.Errorf("mergeMainProperty err %v", err)
|
||||||
}
|
}
|
||||||
@ -457,7 +438,6 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
|||||||
comm.Atk: int32(math.Floor(atk)),
|
comm.Atk: int32(math.Floor(atk)),
|
||||||
comm.Def: int32(math.Floor(def)),
|
comm.Def: int32(math.Floor(def)),
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//重新计算英雄属性
|
//重新计算英雄属性
|
||||||
@ -525,18 +505,9 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if hero.SameCount > 1 { //有堆叠的情况
|
||||||
curCount := hero.SameCount - 1
|
hero.SameCount -= 1
|
||||||
if curCount != 0 { // 有叠加的情况
|
newhero = this.CloneNewHero(hero) // 克隆一个新的
|
||||||
// 克隆一个英雄
|
|
||||||
newhero = this.CloneNewHero(hero)
|
|
||||||
update := map[string]interface{}{
|
|
||||||
"sameCount": curCount,
|
|
||||||
}
|
|
||||||
newhero.SameCount = curCount
|
|
||||||
if err := this.ChangeList(uid, newhero.Id, update); err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update["lv"] = curLv
|
update["lv"] = curLv
|
||||||
@ -552,9 +523,6 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
|
|||||||
if err := this.ChangeList(uid, hero.Id, update); err != nil {
|
if err := this.ChangeList(uid, hero.Id, update); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
code = pb.ErrorCode_HeroNoExist
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -91,9 +91,7 @@ func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, eq
|
|||||||
|
|
||||||
//英雄列表
|
//英雄列表
|
||||||
func (this *Hero) GetHeroList(uid string) []*pb.DBHero {
|
func (this *Hero) GetHeroList(uid string) []*pb.DBHero {
|
||||||
heroes := this.modelHero.getHeroList(uid)
|
return this.modelHero.getHeroList(uid)
|
||||||
|
|
||||||
return heroes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询英雄数量
|
//查询英雄数量
|
||||||
@ -109,10 +107,7 @@ func (this *Hero) QueryHeroAmount(uId string, heroCfgId string) (amount uint32)
|
|||||||
|
|
||||||
// 删除指定卡牌
|
// 删除指定卡牌
|
||||||
func (this *Hero) DelCard(udi string, hero *pb.DBHero, amount int32) (code pb.ErrorCode) {
|
func (this *Hero) DelCard(udi string, hero *pb.DBHero, amount int32) (code pb.ErrorCode) {
|
||||||
var (
|
err := this.modelHero.consumeHeroCard(udi, hero, amount)
|
||||||
err error
|
|
||||||
)
|
|
||||||
err = this.modelHero.consumeHeroCard(udi, hero, amount)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
|
@ -48,23 +48,27 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新活跃度
|
if conf.Active > 0 {
|
||||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
//更新活跃度
|
||||||
if err != nil {
|
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
||||||
code = pb.ErrorCode_DBError
|
if err != nil {
|
||||||
return
|
|
||||||
}
|
|
||||||
if ue != nil {
|
|
||||||
update := make(map[string]interface{})
|
|
||||||
if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY {
|
|
||||||
update["activeday"] = ue.Activeday + conf.Active
|
|
||||||
} else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
|
||||||
update["activeweek"] = ue.Activeweek + conf.Active
|
|
||||||
}
|
|
||||||
if err = this.moduleTask.ModuleUser.ChanageUserExpand(session.GetUserId(), update); err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if ue != nil {
|
||||||
|
update := make(map[string]interface{})
|
||||||
|
if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY {
|
||||||
|
update["activeday"] = ue.Activeday + conf.Active
|
||||||
|
} else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
||||||
|
update["activeweek"] = ue.Activeweek + conf.Active
|
||||||
|
}
|
||||||
|
if len(update) > 0 {
|
||||||
|
if err = this.moduleTask.ModuleUser.ChanageUserExpand(session.GetUserId(), update); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//奖励
|
//奖励
|
||||||
|
@ -83,6 +83,8 @@ func (this *User) QueryAttributeValue(uid string, attr string) (value int32) {
|
|||||||
return user.Gold
|
return user.Gold
|
||||||
case comm.ResExp:
|
case comm.ResExp:
|
||||||
return user.Exp
|
return user.Exp
|
||||||
|
case comm.ResDiamond:
|
||||||
|
return user.Diamond
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -148,29 +150,10 @@ func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add
|
|||||||
log.Errorf("AddAttributeValue err:%v", err)
|
log.Errorf("AddAttributeValue err:%v", err)
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
data := &pb.UserResChangePush{}
|
|
||||||
var _cache = &pb.CacheUser{}
|
if bPush { //推送玩家账号信息变化消息
|
||||||
err := this.modelUser.MCompModel.Get(session.GetUserId(), _cache)
|
session.SendMsg(string(this.GetType()), "reschange", _change)
|
||||||
if err != nil {
|
|
||||||
this.SendMsgToUser(string(this.GetType()), "reschange", data, _cache)
|
|
||||||
}
|
}
|
||||||
if bPush {
|
|
||||||
this.UserChangePush(session, _change) // 推送玩家数据变化
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//推送玩家账号信息变化消息
|
|
||||||
func (this *User) UserChangePush(session comm.IUserSession, resChange *pb.UserResChangePush) (err error) {
|
|
||||||
|
|
||||||
session.SendMsg(string(this.GetType()), "reschange", resChange)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置record
|
|
||||||
func (this *User) GetUserRecordData(uid string, typeValue int32, parmare int32) (value int32, err error) {
|
|
||||||
//pb.DBUserRecord
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user