Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
a8b6ffd38d
@ -581,7 +581,7 @@ const (
|
||||
Reddot26201 ReddotType = 26201 // 今日剩余训练次数:x
|
||||
//云朵签到
|
||||
Reddot27101 ReddotType = 27101 // 签到进度
|
||||
//巨怪商队跑商
|
||||
//巨怪商队跑商 前端处理
|
||||
Reddot28101 ReddotType = 28101 // 剩余车票
|
||||
//种族塔
|
||||
Reddot29101 ReddotType = 29101 // 今日剩余可挑战关卡:x
|
||||
|
@ -154,6 +154,7 @@ type (
|
||||
|
||||
//玩家
|
||||
IUser interface {
|
||||
IGetReddot
|
||||
//获取本服用户数据
|
||||
GetUser(uid string) *pb.DBUser
|
||||
//获取用户回话
|
||||
@ -491,6 +492,7 @@ type (
|
||||
}
|
||||
//练功房
|
||||
IPractice interface {
|
||||
IGetReddot
|
||||
ITaskComplete
|
||||
IOpenCmdNotice
|
||||
//添加武馆资源
|
||||
|
@ -257,6 +257,7 @@ func (this *modelEquipmentComp) newEquipment(uid string, conf *cfg.GameEquipData
|
||||
sattr []*cfg.GameEquipAttrlibrarySData
|
||||
equipatt *cfg.GameEquipAttributeData
|
||||
weight []int32
|
||||
index int32
|
||||
total int64
|
||||
maxindex int
|
||||
satterNum int32
|
||||
@ -274,13 +275,19 @@ func (this *modelEquipmentComp) newEquipment(uid string, conf *cfg.GameEquipData
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
|
||||
weight = make([]int32, len(mattr))
|
||||
for i, v := range mattr {
|
||||
weight[i] = v.Probability
|
||||
}
|
||||
index = comm.GetRandW(weight)
|
||||
equipment.MainEntry = &pb.EquipmentAttributeEntry{
|
||||
Id: mattr[0].Key,
|
||||
Libraryid: mattr[0].Libraryid,
|
||||
Id: mattr[index].Key,
|
||||
Libraryid: mattr[index].Libraryid,
|
||||
Lv: 1,
|
||||
AttrName: mattr[0].Attrkey,
|
||||
Value: mattr[0].Attrvar,
|
||||
BaseValue: mattr[0].Attrvar,
|
||||
AttrName: mattr[index].Attrkey,
|
||||
Value: mattr[index].Attrvar,
|
||||
BaseValue: mattr[index].Attrvar,
|
||||
}
|
||||
if sattr, err = this.module.configure.GetEquipmentAttrlibraryConfigureById(conf.Addlibrary); err != nil || len(mattr) == 0 {
|
||||
return
|
||||
@ -454,6 +461,8 @@ func (this *modelEquipmentComp) newMaxEquipment(uid string, conf *cfg.GameEquipD
|
||||
var (
|
||||
mattr []*cfg.GameEquipAttrlibrarySData
|
||||
sattr []*cfg.GameEquipAttrlibrarySData
|
||||
weight []int32
|
||||
index int32
|
||||
equipatt *cfg.GameEquipAttributeData
|
||||
intensify *cfg.GameEquipIntensifyData
|
||||
satterNum int32
|
||||
@ -477,13 +486,18 @@ func (this *modelEquipmentComp) newMaxEquipment(uid string, conf *cfg.GameEquipD
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
weight = make([]int32, len(mattr))
|
||||
for i, v := range mattr {
|
||||
weight[i] = v.Probability
|
||||
}
|
||||
index = comm.GetRandW(weight)
|
||||
equipment.MainEntry = &pb.EquipmentAttributeEntry{
|
||||
Id: mattr[0].Key,
|
||||
Libraryid: mattr[0].Libraryid,
|
||||
Id: mattr[index].Key,
|
||||
Libraryid: mattr[index].Libraryid,
|
||||
Lv: intensify.Level + 1,
|
||||
AttrName: mattr[0].Attrkey,
|
||||
Value: mattr[0].Attrvar,
|
||||
BaseValue: mattr[0].Attrvar,
|
||||
AttrName: mattr[index].Attrkey,
|
||||
Value: mattr[index].Attrvar,
|
||||
BaseValue: mattr[index].Attrvar,
|
||||
}
|
||||
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 {
|
||||
|
@ -28,6 +28,13 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq)
|
||||
comm.Reddot10301) {
|
||||
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) {
|
||||
reddot[int32(k)] = v
|
||||
@ -40,17 +47,34 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq)
|
||||
) {
|
||||
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) {
|
||||
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) {
|
||||
reddot[int32(k)] = v
|
||||
}
|
||||
for k, v := range this.module.gourmet.Reddot(session, comm.Reddot23101) {
|
||||
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
|
||||
}
|
||||
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot17) {
|
||||
|
@ -29,6 +29,7 @@ type Reddot struct {
|
||||
pagoda comm.IPagoda
|
||||
horoscope comm.IHoroscope
|
||||
arena comm.IArena //竞技场
|
||||
practice comm.IPractice //武馆
|
||||
dailytask comm.IDailytask //每日任务
|
||||
friend comm.IFriend
|
||||
gourmet comm.IGourmet
|
||||
@ -79,6 +80,12 @@ func (this *Reddot) Start() (err error) {
|
||||
return
|
||||
}
|
||||
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 {
|
||||
return
|
||||
}
|
||||
|
@ -1173,3 +1173,33 @@ func (this *User) RemainingPS(uid string) (ps int32) {
|
||||
func (this *User) AddUserProfit(uid string, score int64) error {
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user