三消优化
This commit is contained in:
parent
3f06003852
commit
97b1328fa4
@ -210,8 +210,6 @@ type (
|
|||||||
ChangeUserMoonLv(session IUserSession, lv int32) (errdata *pb.ErrorData)
|
ChangeUserMoonLv(session IUserSession, lv int32) (errdata *pb.ErrorData)
|
||||||
//GM创号
|
//GM创号
|
||||||
GMCreatePlayer(session IUserSession, req *pb.UserCreateReq) (errdata *pb.ErrorData)
|
GMCreatePlayer(session IUserSession, req *pb.UserCreateReq) (errdata *pb.ErrorData)
|
||||||
// 清除玩家赛季积分 ---需要清除
|
|
||||||
CleanUserConsumeexp(session IUserSession) (err error)
|
|
||||||
}
|
}
|
||||||
//武器模块
|
//武器模块
|
||||||
IEquipment interface {
|
IEquipment interface {
|
||||||
|
@ -68,7 +68,7 @@ func (this *apiComp) CreateRoom(session comm.IUserSession, req *pb.EntertainCrea
|
|||||||
p1 := &pb.PlayerData{
|
p1 := &pb.PlayerData{
|
||||||
Userinfo: comm.GetUserBaseInfo(user),
|
Userinfo: comm.GetUserBaseInfo(user),
|
||||||
Cardid: req.Idcard,
|
Cardid: req.Idcard,
|
||||||
Consumeexp: user.Consumeexp,
|
//Consumeexp: user.Consumeexp,
|
||||||
}
|
}
|
||||||
if room, err = this.module.gameMgr.CreateMasterRoom(p1); err != nil {
|
if room, err = this.module.gameMgr.CreateMasterRoom(p1); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
|
@ -33,10 +33,10 @@ func (this *apiComp) Reward(session comm.IUserSession, req *pb.EntertainRewardRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
//user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if conf, err := this.module.configure.GetGameConsumeintegralReward(req.Key); err == nil {
|
if conf, err := this.module.configure.GetGameConsumeintegralReward(req.Key); err == nil {
|
||||||
if user.Consumeexp < conf.Key {
|
if list.Consumeexp < conf.Key {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserRepeadReward,
|
Code: pb.ErrorCode_UserRepeadReward,
|
||||||
Title: pb.ErrorCode_UserRepeadReward.ToString(),
|
Title: pb.ErrorCode_UserRepeadReward.ToString(),
|
||||||
|
@ -66,7 +66,7 @@ func (this *apiComp) JoinRoom(session comm.IUserSession, req *pb.EntertainJoinRo
|
|||||||
p := &pb.PlayerData{
|
p := &pb.PlayerData{
|
||||||
Userinfo: comm.GetUserBaseInfo(user),
|
Userinfo: comm.GetUserBaseInfo(user),
|
||||||
Cardid: req.Idcard,
|
Cardid: req.Idcard,
|
||||||
Consumeexp: user.Consumeexp,
|
//Consumeexp: user.Consumeexp,
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = this.module.gameMgr.JoinMasterRoom(req.Roomid, p); err != nil {
|
if _, err = this.module.gameMgr.JoinMasterRoom(req.Roomid, p); err != nil {
|
||||||
|
@ -85,7 +85,7 @@ func (this *apiComp) Match(session comm.IUserSession, req *pb.EntertainMatchReq)
|
|||||||
this.module.match.MatchReq(&pb.DBXXLMatch{
|
this.module.match.MatchReq(&pb.DBXXLMatch{
|
||||||
Userinfo: comm.GetUserBaseInfo(user),
|
Userinfo: comm.GetUserBaseInfo(user),
|
||||||
Cardid: req.Idcard,
|
Cardid: req.Idcard,
|
||||||
Consumeexp: user.Consumeexp,
|
Consumeexp: list.Consumeexp,
|
||||||
Skill: mySkill,
|
Skill: mySkill,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -583,19 +583,21 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
if list, err = this.module.model.getEntertainmList(winner.Userinfo.Uid); err == nil {
|
if list, err = this.module.model.getEntertainmList(winner.Userinfo.Uid); err == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if user, err := this.module.ModuleUser.GetUser(winner.Userinfo.Uid); err == nil {
|
if conf, err := this.module.configure.GetGameConsumeintegral(list.Consumeexp); err == nil {
|
||||||
if conf, err := this.module.configure.GetGameConsumeintegral(user.Consumeexp); err == nil {
|
for _, v := range conf.Rewards {
|
||||||
res = append(res, conf.Rewards...)
|
|
||||||
for _, v := range res {
|
|
||||||
if v.A == "attr" && v.T == "consumeexp" {
|
if v.A == "attr" && v.T == "consumeexp" {
|
||||||
this.player2.Consumeexp += v.N
|
|
||||||
list.Consumeexp += v.N
|
list.Consumeexp += v.N
|
||||||
update["consumeexp"] = list.Consumeexp
|
update["consumeexp"] = list.Consumeexp
|
||||||
|
winner.Consumeexp = list.Consumeexp
|
||||||
|
} else {
|
||||||
|
res = append(res, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], res, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.szSession[winindex].Push()
|
this.szSession[winindex].Push()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 修改连胜
|
// 修改连胜
|
||||||
list.Liansheng += 1
|
list.Liansheng += 1
|
||||||
@ -609,7 +611,6 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
}
|
}
|
||||||
list.Box = append(list.Box, box)
|
list.Box = append(list.Box, box)
|
||||||
update["box"] = list.Box
|
update["box"] = list.Box
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -617,9 +618,8 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
}
|
}
|
||||||
if lostPlayer.Userinfo.Uid != "999" {
|
if lostPlayer.Userinfo.Uid != "999" {
|
||||||
if conf, err := this.module.configure.GetGameConsumeHero(lostPlayer.Cardid); err == nil {
|
if conf, err := this.module.configure.GetGameConsumeHero(lostPlayer.Cardid); err == nil {
|
||||||
|
|
||||||
if list, err := this.module.model.getEntertainmList(lostPlayer.Userinfo.Uid); err == nil {
|
|
||||||
update := map[string]interface{}{}
|
update := map[string]interface{}{}
|
||||||
|
if list, err := this.module.model.getEntertainmList(lostPlayer.Userinfo.Uid); err == nil {
|
||||||
if list.Liansheng != 0 {
|
if list.Liansheng != 0 {
|
||||||
list.Liansheng = 0 // 修改连胜
|
list.Liansheng = 0 // 修改连胜
|
||||||
update["liansheng"] = list.Liansheng
|
update["liansheng"] = list.Liansheng
|
||||||
@ -631,6 +631,18 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
update["card"] = list.Card
|
update["card"] = list.Card
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if conf, err := this.module.configure.GetGameConsumeintegral(list.Consumeexp); err == nil { // 战败扣除积分
|
||||||
|
for _, v := range conf.Rewards {
|
||||||
|
if v.A == "attr" && v.T == "consumeexp" {
|
||||||
|
list.Consumeexp -= v.N
|
||||||
|
if list.Consumeexp <= 0 {
|
||||||
|
list.Consumeexp = 0
|
||||||
|
}
|
||||||
|
lostPlayer.Consumeexp = list.Consumeexp
|
||||||
|
update["consumeexp"] = list.Consumeexp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if len(update) > 0 {
|
if len(update) > 0 {
|
||||||
this.module.model.modifyEntertainmList(lostPlayer.Userinfo.Uid, update)
|
this.module.model.modifyEntertainmList(lostPlayer.Userinfo.Uid, update)
|
||||||
}
|
}
|
||||||
|
@ -173,14 +173,7 @@ func (this *MapData) CheckSpecialElemChange(oldId, newId int32, color int32) (bS
|
|||||||
}
|
}
|
||||||
var energy int32
|
var energy int32
|
||||||
var curScore int32
|
var curScore int32
|
||||||
for id := range x {
|
|
||||||
if this.Plat[id].Color == color {
|
|
||||||
energy++
|
|
||||||
}
|
|
||||||
curScore += this.Plat[id].Score
|
|
||||||
this.Plat[id] = &pb.GirdeData{}
|
|
||||||
this.operElem = append(this.operElem, int32(id))
|
|
||||||
}
|
|
||||||
for id := range x {
|
for id := range x {
|
||||||
if this.Plat[id].Color == color {
|
if this.Plat[id].Color == color {
|
||||||
energy++
|
energy++
|
||||||
@ -190,7 +183,6 @@ func (this *MapData) CheckSpecialElemChange(oldId, newId int32, color int32) (bS
|
|||||||
this.operElem = append(this.operElem, int32(id))
|
this.operElem = append(this.operElem, int32(id))
|
||||||
}
|
}
|
||||||
if this.DropGirde() {
|
if this.DropGirde() {
|
||||||
|
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.GetPalatData(),
|
Data: this.GetPalatData(),
|
||||||
CurSocre: curScore,
|
CurSocre: curScore,
|
||||||
@ -1283,17 +1275,41 @@ func (this *MapData) SpecialElem(id int, s int32) (x map[int]struct{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
|
func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
|
||||||
|
var energy int32
|
||||||
|
var curScore int32
|
||||||
|
if this.Plat[curid].Special == 0 {
|
||||||
|
if this.Plat[curid].Color == color {
|
||||||
|
energy++
|
||||||
|
}
|
||||||
|
curScore = this.Plat[curid].Score
|
||||||
this.Plat[curid] = &pb.GirdeData{}
|
this.Plat[curid] = &pb.GirdeData{}
|
||||||
if this.DropGirde() {
|
if this.DropGirde() {
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.GetPalatData(),
|
Data: this.GetPalatData(),
|
||||||
CurSocre: 0,
|
CurSocre: curScore,
|
||||||
CurEnergy: 0,
|
CurEnergy: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
sz, _ := this.CheckMap(color, false)
|
sz, _ := this.CheckMap(color, false)
|
||||||
szMap = append(szMap, sz...)
|
szMap = append(szMap, sz...)
|
||||||
|
} else {
|
||||||
|
x := this.SpecialElem(int(curid), this.Plat[curid].Special)
|
||||||
|
for id := range x {
|
||||||
|
if this.Plat[id].Color == color {
|
||||||
|
energy++
|
||||||
|
}
|
||||||
|
curScore += this.Plat[id].Score
|
||||||
|
this.Plat[id] = &pb.GirdeData{}
|
||||||
|
this.operElem = append(this.operElem, int32(id))
|
||||||
|
}
|
||||||
|
if this.DropGirde() {
|
||||||
|
szMap = append(szMap, &pb.MapData{
|
||||||
|
Data: this.GetPalatData(),
|
||||||
|
CurSocre: curScore,
|
||||||
|
CurEnergy: energy,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,39 +353,6 @@ func (this *ModelUser) CleanUserMerchantmoney(session comm.IUserSession) (err er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelUser) CleanUserConsumeexp(session comm.IUserSession) (err error) {
|
|
||||||
var (
|
|
||||||
model *db.DBModel
|
|
||||||
update map[string]interface{}
|
|
||||||
uid string
|
|
||||||
)
|
|
||||||
|
|
||||||
uid = session.GetUserId()
|
|
||||||
user := &pb.DBUser{}
|
|
||||||
update = make(map[string]interface{}, 0)
|
|
||||||
update["consumeexp"] = 0
|
|
||||||
|
|
||||||
if db.IsCross() {
|
|
||||||
if model, err = this.module.GetDBModelByUid(uid, this.TableName); err == nil {
|
|
||||||
if err := this.Get(uid, user); err == nil {
|
|
||||||
err = model.Change(uid, update)
|
|
||||||
} else {
|
|
||||||
this.module.Errorf("err:%v", err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.module.Errorln(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if err := this.Get(uid, user); err == nil {
|
|
||||||
err = this.Change(uid, update)
|
|
||||||
} else {
|
|
||||||
this.module.Errorf("err:%v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
///资源自动恢复
|
///资源自动恢复
|
||||||
func (this *ModelUser) ResAutoReplies(session comm.IUserSession, resreplies map[int32]int64) {
|
func (this *ModelUser) ResAutoReplies(session comm.IUserSession, resreplies map[int32]int64) {
|
||||||
var (
|
var (
|
||||||
|
@ -527,7 +527,7 @@ func (this *User) change(session comm.IUserSession, attrs map[string]int32) (atn
|
|||||||
Integral: user.Integral,
|
Integral: user.Integral,
|
||||||
Profit: user.Profit,
|
Profit: user.Profit,
|
||||||
Deposit: user.Deposit,
|
Deposit: user.Deposit,
|
||||||
Consumeexp: user.Consumeexp,
|
|
||||||
Consumemoney: user.Consumemoney,
|
Consumemoney: user.Consumemoney,
|
||||||
}
|
}
|
||||||
atno = make([]*pb.UserAtno, 0, len(attrs))
|
atno = make([]*pb.UserAtno, 0, len(attrs))
|
||||||
@ -1517,6 +1517,3 @@ func (this *User) GMCreatePlayer(session comm.IUserSession, req *pb.UserCreateRe
|
|||||||
errdata = this.api.Create(session, req)
|
errdata = this.api.Create(session, req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *User) CleanUserConsumeexp(session comm.IUserSession) (err error) {
|
|
||||||
return this.modelUser.CleanUserConsumeexp(session)
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user