This commit is contained in:
liwei 2023-07-11 10:25:42 +08:00
commit 70c2816242
15 changed files with 85 additions and 65 deletions

View File

@ -1,8 +1,6 @@
[
{
"key": 1,
"moneystart": -1,
"moneyend": 10000,
"key": 1000,
"reward": [
{
"a": "attr",
@ -12,9 +10,7 @@
]
},
{
"key": 2,
"moneystart": 10000,
"moneyend": 20000,
"key": 2000,
"reward": [
{
"a": "attr",
@ -24,9 +20,7 @@
]
},
{
"key": 3,
"moneystart": 20000,
"moneyend": 30000,
"key": 3000,
"reward": [
{
"a": "attr",
@ -36,9 +30,7 @@
]
},
{
"key": 4,
"moneystart": 30000,
"moneyend": 50000,
"key": 4000,
"reward": [
{
"a": "attr",
@ -48,9 +40,7 @@
]
},
{
"key": 5,
"moneystart": 50000,
"moneyend": -1,
"key": 5000,
"reward": [
{
"a": "attr",
@ -58,5 +48,15 @@
"n": 9999
}
]
},
{
"key": 0,
"reward": [
{
"a": "attr",
"t": "gold",
"n": 10
}
]
}
]

View File

@ -208,6 +208,19 @@ func (this *configureComp) GetCaravanReward() (reward []*cfg.GameCaravanRewardDa
return
}
func (this *configureComp) GetCaravanMoreReward() (reward []*cfg.Gameatn) {
if v, err := this.GetConfigure(game_caravan_reward); err == nil {
if configure, ok := v.(*cfg.GameCaravanReward); ok {
if configure.Get(0) != nil {
return configure.Get(0).Reward
}
}
} else {
log.Errorf("get GetCaravanInitCity conf err:%v", err)
}
return
}
func (this *configureComp) GetCaravanRank(index int32) (reward *cfg.GameCaravanRankData, err error) {
var (
v interface{}

View File

@ -388,6 +388,13 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E
}
}
}
var maxKey int32
for _, v := range this.configure.GetCaravanReward() {
if v.Key > maxKey {
maxKey = v.Key
}
}
moreReard := this.configure.GetCaravanMoreReward() // 超过部分
// 发送虚拟币奖励
if _data, err := this.modelCaravan.DB.Find(comm.TableUser, bson.M{"merchantmoney": bson.M{"$gt": comm.CaravanMerchantmoney}}); err == nil {
for _data.Next(context.TODO()) {
@ -395,32 +402,20 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E
if err = _data.Decode(temp); err == nil {
for _, v := range this.configure.GetCaravanReward() {
s := v.Moneystart
e := v.Moneyend
more := false
if e == -1 {
e = math.MaxInt32
more = true
}
if s < temp.Merchantmoney && e <= temp.Merchantmoney {
var res []*cfg.Gameatn
if more { // 超过的部分
r := this.ModuleTools.GetGlobalConf().BusinessMaxintReward
m := this.ModuleTools.GetGlobalConf().BusinessMaxint
n := (temp.Merchantmoney - s) / m
atn := &cfg.Gameatn{
A: r.A,
T: r.T,
N: r.N * n,
}
res = append(res, atn)
if maxKey <= temp.Merchantmoney {
var res []*cfg.Gameatn
for _, v := range moreReard {
if v.N == 0 {
continue
}
res = append(res, v.Reward...)
this.mail.SendMailByUID(temp.Uid, "CaravanRewards", v.Reward, []string{})
atn := &cfg.Gameatn{
A: v.A,
T: v.T,
N: v.N * (temp.Merchantmoney - maxKey),
}
res = append(res, atn)
}
this.mail.SendMailByUID(temp.Uid, "CaravanRewards", res, []string{})
}
}
}

View File

@ -90,10 +90,13 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
// 将目标从好友列表中移除
friendIds := utils.Deletex(self.FriendIds, req.FriendId)
// 将好友从申请列表移除
applyIds := utils.Deletex(self.ApplyIds, req.FriendId)
//更新
err = this.module.modelFriend.Change(self.Uid, map[string]interface{}{
"blackIds": self.BlackIds,
"friendIds": friendIds,
"applyIds": applyIds,
})
if err != nil {
errdata = &pb.ErrorData{

View File

@ -110,6 +110,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e
}
if err = this.module.modelFriend.Change(target.Uid, map[string]interface{}{
"friendIds": target.FriendIds,
"applyIds": target.ApplyIds,
}); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,

View File

@ -96,8 +96,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty))
if hunting.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励
hunting.BossTime[key] = req.Report.Costtime
mapData["bossTime"] = hunting.BossTime
//hunting.BossTime[key] = req.Report.Costtime
//mapData["bossTime"] = hunting.BossTime
if errdata = this.module.DispenseRes(session, cfgHunting.Firstprize, true); errdata != nil {
return
}
@ -110,7 +110,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
}
}
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
if hunting.BossTime[key] > req.Report.Costtime {
if hunting.BossTime[key] == 0 || hunting.BossTime[key] > req.Report.Costtime {
hunting.BossTime[key] = req.Report.Costtime
mapData["bossTime"] = hunting.BossTime // 更新时间
this.module.CheckRank(session.GetUserId(), req.BossType, req.Difficulty, req.Report)

View File

@ -69,8 +69,8 @@ func (this *apiComp) CallengeRace(session comm.IUserSession, req *pb.PagodaChall
if _, ok := pagoda.Race[conf.Restriction]; !ok {
if conf.Floors == 1 {
pagoda.Race[conf.Restriction] = &pb.RaceData{
Race: conf.Restriction,
Buf: []int32{},
Race: conf.Restriction,
Rtime: configure.Now().Unix(),
Defeat: 0,
Endtime: 0,

View File

@ -74,7 +74,6 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
if conf.Floors == 1 {
race.Race[conf.Restriction] = &pb.RaceData{
Race: conf.Restriction,
Buf: []int32{},
Rtime: configure.Now().Unix(),
Defeat: 0,
Endtime: 0,
@ -128,7 +127,7 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
}
race.Race[conf.Restriction].Curfloor += 1
race.Race[conf.Restriction].Buf = conf.Gaineffect
mapData["race"] = race.Race
errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)

View File

@ -46,8 +46,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
configure.RegisterConfigure(game_circulate, cfg.NewGameCirculate, this.LoadCirculate)
this.GetPagodaRaceConfById(11000027)
this.GetPagodaCirculateConf(0, 25)
return
}

View File

@ -55,7 +55,7 @@ func (this *apiComp) SeasonRank(session comm.IUserSession, req *pb.VikingSeasonR
}
}
dbModel := db.NewDBModel(comm.TableVikingRank, 0, conn)
dbModel := db.NewDBModel(comm.TableVikingSRank, 0, conn)
pipe = conn.Redis.RedisPipe(context.TODO())
rd = pipe.ZRevRange("vSeasonRank"+strconv.Itoa(int(req.BoosType)), 0, comm.MaxRankList)

View File

@ -83,7 +83,7 @@ func (this *Viking) Start() (err error) {
}
this.battle = module.(comm.IBattle)
this.CheckCurSeasonData()
return
}
@ -234,11 +234,13 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err
// 检查当前赛季是在本服还是在跨服
func (this *Viking) CheckCurSeasonData() (bLocal bool, endSeasonTime int64) {
var subTime int64
var oneSeason int64
openTime := this.service.GetOpentime().Unix()
this.Debugf("%d", openTime)
// 获取第一个赛季结束的时间
endSeasonTime = utils.GetTodayZeroTime(openTime) //+ int64((6-d)*3600*24)
this.Debugf("%d", endSeasonTime)
oneSeason = utils.GetTodayZeroTime(openTime) //+ int64((6-d)*3600*24)
this.Debugf("%d", oneSeason)
var c int32
if Continued%Cycle == 0 {
@ -247,11 +249,18 @@ func (this *Viking) CheckCurSeasonData() (bLocal bool, endSeasonTime int64) {
c = Continued/Cycle + 1
}
if configure.Now().Unix() > oneSeason {
subTime = configure.Now().Unix() - oneSeason
subTime = subTime/(14*3600*24) + 1
}
// 只需判断当前时间是否大于第c个赛季即可
endSeasonTime = oneSeason
endSeasonTime += 14 * 3600 * 24 * int64(c)
if endSeasonTime <= configure.Now().Unix() {
endSeasonTime = oneSeason + subTime*14*3600*24
return false, endSeasonTime
}
endSeasonTime = oneSeason + subTime*14*3600*24
return true, endSeasonTime
}

View File

@ -312,12 +312,12 @@ type RaceData struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Race int32 `protobuf:"varint,1,opt,name=race,proto3" json:"race"` // 阵营ID 0:循环塔 1: 阵营1
Buf []int32 `protobuf:"varint,2,rep,packed,name=buf,proto3" json:"buf"`
Rtime int64 `protobuf:"varint,3,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 客户端不用
Defeat int32 `protobuf:"varint,4,opt,name=defeat,proto3" json:"defeat"` // 今日战胜的次数
Endtime int64 `protobuf:"varint,5,opt,name=endtime,proto3" json:"endtime"` //剩余倒计时
Curfloor int32 `protobuf:"varint,6,opt,name=curfloor,proto3" json:"curfloor"` //当前层数
Race int32 `protobuf:"varint,1,opt,name=race,proto3" json:"race"` // 阵营ID 0:循环塔 1: 阵营1
Buf int32 `protobuf:"varint,2,opt,name=buf,proto3" json:"buf"` //赛季子技能buff
Rtime int64 `protobuf:"varint,3,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 客户端不用
Defeat int32 `protobuf:"varint,4,opt,name=defeat,proto3" json:"defeat"` // 今日战胜的次数
Endtime int64 `protobuf:"varint,5,opt,name=endtime,proto3" json:"endtime"` //剩余倒计时
Curfloor int32 `protobuf:"varint,6,opt,name=curfloor,proto3" json:"curfloor"` //当前层数
}
func (x *RaceData) Reset() {
@ -359,11 +359,11 @@ func (x *RaceData) GetRace() int32 {
return 0
}
func (x *RaceData) GetBuf() []int32 {
func (x *RaceData) GetBuf() int32 {
if x != nil {
return x.Buf
}
return nil
return 0
}
func (x *RaceData) GetRtime() int64 {
@ -450,7 +450,7 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x94, 0x01, 0x0a, 0x08, 0x52, 0x61, 0x63, 0x65, 0x44,
0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x04, 0x72, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x75, 0x66, 0x18, 0x02,
0x20, 0x03, 0x28, 0x05, 0x52, 0x03, 0x62, 0x75, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x62, 0x75, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69,
0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x12,
0x16, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x65, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x64, 0x65, 0x66, 0x65, 0x61, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x74, 0x69,

View File

@ -33,6 +33,7 @@ type GameCaravanCityData struct {
Ortalk int32
Sptalk int32
Buytalk int32
Weitalk int32
Cityeventpro int32
Cityevent int32
}
@ -131,6 +132,7 @@ func (_v *GameCaravanCityData)Deserialize(_buf map[string]interface{}) (err erro
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ortalk"].(float64); !_ok_ { err = errors.New("ortalk error"); return }; _v.Ortalk = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["sptalk"].(float64); !_ok_ { err = errors.New("sptalk error"); return }; _v.Sptalk = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buytalk"].(float64); !_ok_ { err = errors.New("buytalk error"); return }; _v.Buytalk = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["weitalk"].(float64); !_ok_ { err = errors.New("weitalk error"); return }; _v.Weitalk = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cityeventpro"].(float64); !_ok_ { err = errors.New("cityeventpro error"); return }; _v.Cityeventpro = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cityevent"].(float64); !_ok_ { err = errors.New("cityevent error"); return }; _v.Cityevent = int32(_tempNum_) }
return

View File

@ -12,8 +12,6 @@ import "errors"
type GameCaravanRewardData struct {
Key int32
Moneystart int32
Moneyend int32
Reward []*Gameatn
}
@ -25,8 +23,6 @@ func (*GameCaravanRewardData) GetTypeId() int32 {
func (_v *GameCaravanRewardData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["moneystart"].(float64); !_ok_ { err = errors.New("moneystart error"); return }; _v.Moneystart = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["moneyend"].(float64); !_ok_ { err = errors.New("moneyend error"); return }; _v.Moneyend = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool

View File

@ -213,6 +213,7 @@ type GameGlobalData struct {
BusinessBag int32
BusinessRewardday int32
BusinessRenovatething int32
BusinessChange float32
FavorabilityLikes int32
FavorabilityDislikes int32
BuzkashiTime int32
@ -240,6 +241,7 @@ type GameGlobalData struct {
MrylReward []*Gameatn
OverexpReward *Gameatn
Voucher *Gameatn
Passlvmax int32
}
const TypeId_GameGlobalData = 477542761
@ -880,6 +882,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["business_bag"].(float64); !_ok_ { err = errors.New("business_bag error"); return }; _v.BusinessBag = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["business_rewardday"].(float64); !_ok_ { err = errors.New("business_rewardday error"); return }; _v.BusinessRewardday = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["business_renovatething"].(float64); !_ok_ { err = errors.New("business_renovatething error"); return }; _v.BusinessRenovatething = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["business_change"].(float64); !_ok_ { err = errors.New("business_change error"); return }; _v.BusinessChange = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["favorability_likes"].(float64); !_ok_ { err = errors.New("favorability_likes error"); return }; _v.FavorabilityLikes = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["favorability_dislikes"].(float64); !_ok_ { err = errors.New("favorability_dislikes error"); return }; _v.FavorabilityDislikes = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_time"].(float64); !_ok_ { err = errors.New("buzkashi_time error"); return }; _v.BuzkashiTime = int32(_tempNum_) }
@ -985,6 +988,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["overexp_reward"].(map[string]interface{}); !_ok_ { err = errors.New("overexp_reward error"); return }; if _v.OverexpReward, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["voucher"].(map[string]interface{}); !_ok_ { err = errors.New("voucher error"); return }; if _v.Voucher, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["passlvmax"].(float64); !_ok_ { err = errors.New("passlvmax error"); return }; _v.Passlvmax = int32(_tempNum_) }
return
}