This commit is contained in:
liwei1dao 2023-05-04 19:13:42 +08:00
commit 29f24d7e0a
6 changed files with 73 additions and 58 deletions

View File

@ -51,7 +51,7 @@
"id": 103, "id": 103,
"PlayType": "Pagoda", "PlayType": "Pagoda",
"HeroCount": 5, "HeroCount": 5,
"readyScene": "scenesfight_role_interface_02", "readyScene": "scenesfight_role_interface_03",
"battleScenes": [ "battleScenes": [
"scenesfight_06" "scenesfight_06"
], ],
@ -243,7 +243,7 @@
"id": 115, "id": 115,
"PlayType": "test", "PlayType": "test",
"HeroCount": 5, "HeroCount": 5,
"readyScene": "scenesfight_role_interface_02", "readyScene": "scenesfight_role_interface_03",
"battleScenes": [ "battleScenes": [
"scenesfight_06" "scenesfight_06"
], ],
@ -275,7 +275,7 @@
"id": 117, "id": 117,
"PlayType": "test", "PlayType": "test",
"HeroCount": 5, "HeroCount": 5,
"readyScene": "scenesfight_role_interface_02", "readyScene": "scenesfight_role_interface_03",
"battleScenes": [ "battleScenes": [
"scenesfight_06" "scenesfight_06"
], ],

View File

@ -9908,5 +9908,36 @@
], ],
"synthetize_deplete": [], "synthetize_deplete": [],
"decompose_deplete": [] "decompose_deplete": []
},
{
"id": "15010101",
"name": {
"key": "weektask_dj_15010101",
"text": "活跃度"
},
"usetype": 15,
"color": 3,
"bagtype": 0,
"index": 1,
"special_type": 0,
"time": 0,
"reddottype": 0,
"effects": "",
"modelName": "",
"box_id": 0,
"synthetize_num": 0,
"access": [
902
],
"use_skip": 902,
"upper_limit": -1,
"img": "dj_my_tj03",
"intr": {
"key": "weektask15010101",
"text": "秘境神水"
},
"sale": [],
"synthetize_deplete": [],
"decompose_deplete": []
} }
] ]

View File

@ -15,8 +15,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
}, },
@ -36,8 +36,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
}, },
@ -57,8 +57,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
}, },
@ -78,8 +78,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
}, },
@ -99,8 +99,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
}, },
@ -120,8 +120,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
}, },
@ -141,8 +141,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
}, },
@ -162,8 +162,8 @@
"reword": [ "reword": [
{ {
"a": "item", "a": "item",
"t": "151001", "t": "14030414",
"n": 1 "n": 40
} }
] ]
} }

View File

@ -20,7 +20,6 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
rsp := &pb.LibraryActivationFetterResp{} rsp := &pb.LibraryActivationFetterResp{}
defer session.SendMsg(string(this.module.GetType()), LibraryActivationFetterResp, rsp)
fetter := this.module.modelLibrary.getOneLibrary(session.GetUserId(), req.Oid) fetter := this.module.modelLibrary.getOneLibrary(session.GetUserId(), req.Oid)
if fetter == nil { if fetter == nil {
code = pb.ErrorCode_LibraryNoData code = pb.ErrorCode_LibraryNoData
@ -31,9 +30,13 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library
return return
} }
fetter.Activation = true fetter.Activation = true
fetter.Fetterlv = 1
mapData := make(map[string]interface{}, 0) mapData := make(map[string]interface{}, 0)
mapData["activation"] = fetter.Activation mapData["activation"] = fetter.Activation
mapData["fetterlv"] = 1
this.module.modelLibrary.modifyLibraryDataByObjId(session.GetUserId(), fetter.Id, mapData)
rsp.Data = fetter rsp.Data = fetter
session.SendMsg(string(this.module.GetType()), LibraryActivationFetterResp, rsp)
return return
} }

View File

@ -24,6 +24,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
attenuation map[int32]int32 attenuation map[int32]int32
likeStates int32 // 0 普通食物 1 喜欢 2 不喜欢 likeStates int32 // 0 普通食物 1 喜欢 2 不喜欢
addExp int32 // 获得的经验 addExp int32 // 获得的经验
sCount int32 // 赠送开始次数
) )
attenuation = make(map[int32]int32, 0) attenuation = make(map[int32]int32, 0)
code = this.UseGiftCheck(session, req) code = this.UseGiftCheck(session, req)
@ -37,7 +38,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
return return
} }
_exp := this.module.configure.GetFavorabilityExp(req.Heroid) _exp := this.module.configure.GetFavorabilityExp(_heroObj.Heroid)
if len(_exp) == 0 { if len(_exp) == 0 {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
@ -48,27 +49,28 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
code = pb.ErrorCode_LibraryMaxLv code = pb.ErrorCode_LibraryMaxLv
return return
} }
sCount = _heroObj.Givecount
// 获取当天最大的次数 // 获取当天最大的次数
c := this.module.ModuleTools.GetGlobalConf().FavorabilityAttenuation c := this.module.ModuleTools.GetGlobalConf().FavorabilityAttenuation
maxCoun := c[len(c)-1].K + 1 maxCoun := c[len(c)-1].K + 1
if _heroObj.Givecount+req.Counts > maxCoun { // 当天赠送次数 if sCount+req.Counts > maxCoun { // 当天赠送次数
code = pb.ErrorCode_LibraryGiveMaxCount code = pb.ErrorCode_LibraryGiveMaxCount
return return
} }
last := 1 var last int32 = 1
for iPos, v := range c { for _, v := range c {
for ; last <= iPos; last++ { for ; last <= v.K; last++ {
attenuation[int32(last)] = v.V // 3,1000|6,500|9,250 attenuation[int32(last)] = v.V // 3,1000|6,500|9,250
} }
} }
for i := _heroObj.Givecount; i <= _heroObj.Givecount+req.Counts; i++ { for i := sCount + 1; i <= sCount+req.Counts; i++ {
_heroObj.Givecount += 1
addExp += attenuation[i] addExp += attenuation[i]
} }
// 校验是否是自己喜欢的食物 // 校验是否是自己喜欢的食物
_c := this.module.configure.GetFavorability(req.Heroid, _heroObj.Favorlv) _c := this.module.configure.GetFavorability(_heroObj.Heroid, _heroObj.Favorlv)
if _c != nil { if _c == nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
@ -106,9 +108,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
// 100*1 + 100*0.5 + 100*0.25 addExp *= itemConf.SpecialType
addExp *= itemConf.SpecialType / 1000 _heroObj.Favorexp += addExp / 1000
_heroObj.Favorexp += addExp
// 折算出等级 // 折算出等级
for { for {
@ -116,8 +117,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
_heroObj.Favorexp = 0 _heroObj.Favorexp = 0
break break
} }
if _exp[_heroObj.Favorlv] <= _heroObj.Favorexp { if _exp[_heroObj.Favorlv-1] <= _heroObj.Favorexp {
_heroObj.Favorexp -= _exp[_heroObj.Favorlv] _heroObj.Favorexp -= _exp[_heroObj.Favorlv-1]
_heroObj.Favorlv += 1 _heroObj.Favorlv += 1
upLv++ upLv++
} else { } else {
@ -131,6 +132,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
mapData := make(map[string]interface{}) mapData := make(map[string]interface{})
mapData["favorexp"] = _heroObj.Favorexp mapData["favorexp"] = _heroObj.Favorexp
mapData["favorlv"] = _heroObj.Favorlv mapData["favorlv"] = _heroObj.Favorlv
mapData["givecount"] = _heroObj.Givecount
this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroObj.Id, mapData) this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroObj.Id, mapData)
rsp.Data = _heroObj rsp.Data = _heroObj
session.SendMsg(string(this.module.GetType()), LibraryUseGiftResp, rsp) session.SendMsg(string(this.module.GetType()), LibraryUseGiftResp, rsp)
@ -138,9 +140,9 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
// 任务统计 // 任务统计
//赠送英雄礼物并增加N点好感度 //赠送英雄礼物并增加N点好感度
if upLv > 0 { if upLv > 0 {
this.module.Errorf("英雄好感度等级提升,英雄ID:%s,增加经验:%s,提升的等级:%d", req.Heroid, addExp, upLv) this.module.Errorf("英雄好感度等级提升,英雄ID:%s,增加经验:%s,提升的等级:%d", _heroObj.Heroid, addExp, upLv)
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 修改阵营累计好感度 if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 修改阵营累计好感度
if heroCfg := this.module.configure.GetHeroConfig(req.Heroid); heroCfg != nil { if heroCfg := this.module.configure.GetHeroConfig(_heroObj.Heroid); heroCfg != nil {
rst.Race[heroCfg.Race] += upLv rst.Race[heroCfg.Race] += upLv
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{ this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
"race": rst.Race, "race": rst.Race,

View File

@ -94,7 +94,7 @@ func (this *Library) GetLibraryListByHid(uid string, hid string) *pb.DBLibrary {
func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibrary, fetter []*pb.DBHeroFetter) { func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibrary, fetter []*pb.DBHeroFetter) {
szFid := this.configure.GetHeroFetterID(hid) szFid := this.configure.GetHeroFetterID(hid)
for _, fid := range szFid { for fid := range szFid {
if list := this.GetLibraryListByFid(uid, fid); list == nil { // 没有这条羁绊数据 if list := this.GetLibraryListByFid(uid, fid); list == nil { // 没有这条羁绊数据
tmp := &pb.DBLibrary{ // 创建一条羁绊数据 tmp := &pb.DBLibrary{ // 创建一条羁绊数据
@ -132,27 +132,6 @@ func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibr
return return
} }
//通过羁绊id 创建多个羁绊信息
func (this *Library) CreateLibrary(uid string, fid int32, heroConfId string) (code pb.ErrorCode, obj *pb.DBLibrary) {
obj = &pb.DBLibrary{
Id: primitive.NewObjectID().Hex(),
Uid: uid,
Fid: fid,
Herofetter: map[string]string{},
Prize: map[int32]int32{},
}
conf := this.configure.GetFriendData(fid, 1)
if conf != nil {
if err := this.modelLibrary.createLibrary(uid, obj); err != nil {
code = pb.ErrorCode_DBError
}
obj.Herofetter[heroConfId] = obj.Id
}
return
}
func (this *Library) ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) { func (this *Library) ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) {
err := this.modelFetter.modifyHeroFetterDataByObjId(uid, obj, data) err := this.modelFetter.modifyHeroFetterDataByObjId(uid, obj, data)
if err != nil { if err != nil {