This commit is contained in:
meixiongfeng 2023-08-02 18:54:12 +08:00
commit a8b6ffd38d
6 changed files with 91 additions and 14 deletions

View File

@ -581,7 +581,7 @@ const (
Reddot26201 ReddotType = 26201 // 今日剩余训练次数x Reddot26201 ReddotType = 26201 // 今日剩余训练次数x
//云朵签到 //云朵签到
Reddot27101 ReddotType = 27101 // 签到进度 Reddot27101 ReddotType = 27101 // 签到进度
//巨怪商队跑商 //巨怪商队跑商 前端处理
Reddot28101 ReddotType = 28101 // 剩余车票 Reddot28101 ReddotType = 28101 // 剩余车票
//种族塔 //种族塔
Reddot29101 ReddotType = 29101 // 今日剩余可挑战关卡x Reddot29101 ReddotType = 29101 // 今日剩余可挑战关卡x

View File

@ -154,6 +154,7 @@ type (
//玩家 //玩家
IUser interface { IUser interface {
IGetReddot
//获取本服用户数据 //获取本服用户数据
GetUser(uid string) *pb.DBUser GetUser(uid string) *pb.DBUser
//获取用户回话 //获取用户回话
@ -491,6 +492,7 @@ type (
} }
//练功房 //练功房
IPractice interface { IPractice interface {
IGetReddot
ITaskComplete ITaskComplete
IOpenCmdNotice IOpenCmdNotice
//添加武馆资源 //添加武馆资源

View File

@ -257,6 +257,7 @@ func (this *modelEquipmentComp) newEquipment(uid string, conf *cfg.GameEquipData
sattr []*cfg.GameEquipAttrlibrarySData sattr []*cfg.GameEquipAttrlibrarySData
equipatt *cfg.GameEquipAttributeData equipatt *cfg.GameEquipAttributeData
weight []int32 weight []int32
index int32
total int64 total int64
maxindex int maxindex int
satterNum int32 satterNum int32
@ -274,13 +275,19 @@ func (this *modelEquipmentComp) newEquipment(uid string, conf *cfg.GameEquipData
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
weight = make([]int32, len(mattr))
for i, v := range mattr {
weight[i] = v.Probability
}
index = comm.GetRandW(weight)
equipment.MainEntry = &pb.EquipmentAttributeEntry{ equipment.MainEntry = &pb.EquipmentAttributeEntry{
Id: mattr[0].Key, Id: mattr[index].Key,
Libraryid: mattr[0].Libraryid, Libraryid: mattr[index].Libraryid,
Lv: 1, Lv: 1,
AttrName: mattr[0].Attrkey, AttrName: mattr[index].Attrkey,
Value: mattr[0].Attrvar, Value: mattr[index].Attrvar,
BaseValue: mattr[0].Attrvar, BaseValue: mattr[index].Attrvar,
} }
if sattr, err = this.module.configure.GetEquipmentAttrlibraryConfigureById(conf.Addlibrary); err != nil || len(mattr) == 0 { if sattr, err = this.module.configure.GetEquipmentAttrlibraryConfigureById(conf.Addlibrary); err != nil || len(mattr) == 0 {
return return
@ -454,6 +461,8 @@ func (this *modelEquipmentComp) newMaxEquipment(uid string, conf *cfg.GameEquipD
var ( var (
mattr []*cfg.GameEquipAttrlibrarySData mattr []*cfg.GameEquipAttrlibrarySData
sattr []*cfg.GameEquipAttrlibrarySData sattr []*cfg.GameEquipAttrlibrarySData
weight []int32
index int32
equipatt *cfg.GameEquipAttributeData equipatt *cfg.GameEquipAttributeData
intensify *cfg.GameEquipIntensifyData intensify *cfg.GameEquipIntensifyData
satterNum int32 satterNum int32
@ -477,13 +486,18 @@ func (this *modelEquipmentComp) newMaxEquipment(uid string, conf *cfg.GameEquipD
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
weight = make([]int32, len(mattr))
for i, v := range mattr {
weight[i] = v.Probability
}
index = comm.GetRandW(weight)
equipment.MainEntry = &pb.EquipmentAttributeEntry{ equipment.MainEntry = &pb.EquipmentAttributeEntry{
Id: mattr[0].Key, Id: mattr[index].Key,
Libraryid: mattr[0].Libraryid, Libraryid: mattr[index].Libraryid,
Lv: intensify.Level + 1, Lv: intensify.Level + 1,
AttrName: mattr[0].Attrkey, AttrName: mattr[index].Attrkey,
Value: mattr[0].Attrvar, Value: mattr[index].Attrvar,
BaseValue: mattr[0].Attrvar, BaseValue: mattr[index].Attrvar,
} }
equipment.MainEntry.Value = equipment.MainEntry.BaseValue + int32(math.Floor(float64(equipment.MainEntry.BaseValue*intensify.Bonus)/1000.0)) equipment.MainEntry.Value = equipment.MainEntry.BaseValue + int32(math.Floor(float64(equipment.MainEntry.BaseValue*intensify.Bonus)/1000.0))
if sattr, err = this.module.configure.GetEquipmentAttrlibraryConfigureById(conf.Addlibrary); err != nil || len(mattr) == 0 { if sattr, err = this.module.configure.GetEquipmentAttrlibraryConfigureById(conf.Addlibrary); err != nil || len(mattr) == 0 {

View File

@ -28,6 +28,13 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq)
comm.Reddot10301) { comm.Reddot10301) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
//每日任务
for k, v := range this.module.dailytask.Reddot(session,
comm.Reddot25101) {
reddot[int32(k)] = v
}
//主线 //主线
for k, v := range this.module.mline.Reddot(session, comm.Reddot24101) { for k, v := range this.module.mline.Reddot(session, comm.Reddot24101) {
reddot[int32(k)] = v reddot[int32(k)] = v
@ -40,17 +47,34 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq)
) { ) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
//武馆
for k, v := range this.module.practice.Reddot(session,
comm.Reddot26101,
comm.Reddot26201,
) {
reddot[int32(k)] = v
}
//竞技场 //竞技场
for k, v := range this.module.arena.Reddot(session, comm.Reddot22102) { for k, v := range this.module.arena.Reddot(session, comm.Reddot22102) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
//用户
for k, v := range this.module.ModuleUser.Reddot(session, comm.Reddot27101) {
reddot[int32(k)] = v
}
for k, v := range this.module.friend.Reddot(session, comm.Reddot21101) { for k, v := range this.module.friend.Reddot(session, comm.Reddot21101) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
for k, v := range this.module.gourmet.Reddot(session, comm.Reddot23101) { for k, v := range this.module.gourmet.Reddot(session, comm.Reddot23101) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
for k, v := range this.module.pagoda.Reddot(session, comm.Reddot6) { for k, v := range this.module.pagoda.Reddot(session,
comm.Reddot6,
comm.Reddot29101,
) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot17) { for k, v := range this.module.horoscope.Reddot(session, comm.Reddot17) {

View File

@ -29,6 +29,7 @@ type Reddot struct {
pagoda comm.IPagoda pagoda comm.IPagoda
horoscope comm.IHoroscope horoscope comm.IHoroscope
arena comm.IArena //竞技场 arena comm.IArena //竞技场
practice comm.IPractice //武馆
dailytask comm.IDailytask //每日任务 dailytask comm.IDailytask //每日任务
friend comm.IFriend friend comm.IFriend
gourmet comm.IGourmet gourmet comm.IGourmet
@ -79,6 +80,12 @@ func (this *Reddot) Start() (err error) {
return return
} }
this.arena = module.(comm.IArena) this.arena = module.(comm.IArena)
if module, err = this.service.GetModule(comm.ModulePractice); err != nil {
return
}
this.practice = module.(comm.IPractice)
if module, err = this.service.GetModule(comm.ModuleGourmet); err != nil { if module, err = this.service.GetModule(comm.ModuleGourmet); err != nil {
return return
} }

View File

@ -1173,3 +1173,33 @@ func (this *User) RemainingPS(uid string) (ps int32) {
func (this *User) AddUserProfit(uid string, score int64) error { func (this *User) AddUserProfit(uid string, score int64) error {
return this.modelUser.AddUserProfit(uid, score) return this.modelUser.AddUserProfit(uid, score)
} }
// 查询每日红点信息
func (this *User) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
var (
info *pb.DBSign
progress int32
err error
)
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
if info, err = this.modelSign.GetUserSign(session.GetUserId()); err != nil {
this.Errorln(err)
return
}
for _, v := range rid {
switch v {
case comm.Reddot27101:
if info.Puzzle[info.Day] == 1 {
progress = 1
}
reddot[comm.Reddot27101] = &pb.ReddotItem{
Rid: int32(comm.Reddot27101),
Activated: true,
Progress: progress,
Total: 1,
}
break
}
}
return
}