上传代码

This commit is contained in:
liwei1dao 2023-03-14 14:19:39 +08:00
parent 56851feaee
commit af0d0517b6
7 changed files with 541 additions and 363 deletions

View File

@ -24,18 +24,18 @@ func (this *apiComp) FriendRomm(session comm.IUserSession, req *pb.PracticeFrien
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
if room.Pillar1.Isunlock { if room.Pillar1.Isunlock == 2 {
maxlv = room.Pillar1.Lv maxlv = room.Pillar1.Lv
} }
if room.Pillar2.Isunlock && maxlv < room.Pillar2.Lv { if room.Pillar2.Isunlock == 2 && maxlv < room.Pillar2.Lv {
maxlv = room.Pillar2.Lv maxlv = room.Pillar2.Lv
} }
if room.Pillar3.Isunlock && maxlv < room.Pillar3.Lv { if room.Pillar3.Isunlock == 2 && maxlv < room.Pillar3.Lv {
maxlv = room.Pillar3.Lv maxlv = room.Pillar3.Lv
} }
if maxlv > 0 && (!room.Pillarf.Isunlock || room.Pillarf.Lv < maxlv) { if maxlv > 0 && (room.Pillarf.Isunlock != 2 || room.Pillarf.Lv < maxlv) {
room.Pillarf.Isunlock = true room.Pillarf.Isunlock = 2
room.Pillarf.Lv = maxlv room.Pillarf.Lv = maxlv
this.module.modelPandata.Change(req.Fuid, map[string]interface{}{ this.module.modelPandata.Change(req.Fuid, map[string]interface{}{
"pillarf": room.Pillarf, "pillarf": room.Pillarf,

View File

@ -51,7 +51,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
filed = "pillarf" filed = "pillarf"
break break
} }
if !pillar.Isunlock { //柱子未解锁 if pillar.Isunlock != 2 { //柱子未解锁
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
} }

View File

@ -0,0 +1,61 @@
package practice
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) UnLockCheck(session comm.IUserSession, req *pb.PracticeUnLockReq) (code pb.ErrorCode) {
return
}
///练功请求 解锁木桩
func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq) (code pb.ErrorCode, data proto.Message) {
var (
err error
room *pb.DBPracticeRoom
pillar *pb.DBPracticePillar
filed string
)
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError
return
}
switch req.Index {
case 1:
pillar = room.Pillar1
filed = "pillar1"
break
case 2:
pillar = room.Pillar2
filed = "pillar2"
break
case 3:
pillar = room.Pillar3
filed = "pillar3"
break
case 4:
pillar = room.Pillarf
filed = "pillarf"
break
}
if pillar.Isunlock != 1 {
code = pb.ErrorCode_ReqParameterError
return
}
pillar.Isunlock = 2
if room.Pillarf.Isunlock == 0 {
room.Pillarf.Isunlock = 2
}
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
filed: pillar,
"pillarf": room.Pillarf,
})
session.SendMsg(string(this.module.GetType()), "unLock", &pb.PracticeUnLockResp{Info: room})
return
}

View File

@ -45,7 +45,7 @@ func (this *modelPandata) queryUserMartialhall(uid string) (result *pb.DBPractic
Knapsack: make(map[string]int32), Knapsack: make(map[string]int32),
Gymaction: 0, Gymaction: 0,
Gymrefresh: 0, Gymrefresh: 0,
Pillar1: &pb.DBPracticePillar{Index: 1, Isunlock: true, Lv: 1}, Pillar1: &pb.DBPracticePillar{Index: 1, Lv: 1},
Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1}, Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1},
Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1}, Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1},
Pillarf: &pb.DBPracticePillar{Index: 4, Lv: 1}, Pillarf: &pb.DBPracticePillar{Index: 4, Lv: 1},

View File

@ -122,7 +122,7 @@ func (this *Practice) AddItems(session comm.IUserSession, items map[string]int32
Knapsack: make(map[string]int32), Knapsack: make(map[string]int32),
Gymaction: 0, Gymaction: 0,
Gymrefresh: 0, Gymrefresh: 0,
Pillar1: &pb.DBPracticePillar{Index: 1, Isunlock: true, Lv: 1}, Pillar1: &pb.DBPracticePillar{Index: 1, Lv: 1},
Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1}, Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1},
Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1}, Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1},
Pillarf: &pb.DBPracticePillar{Index: 4, Lv: 1}, Pillarf: &pb.DBPracticePillar{Index: 4, Lv: 1},
@ -173,41 +173,29 @@ func (this *Practice) TaskComplete(session comm.IUserSession, taskid int32) {
if v.UnlockCondition == taskid { if v.UnlockCondition == taskid {
switch v.Id { switch v.Id {
case 1: case 1:
if !room.Pillar1.Isunlock { if room.Pillar1.Isunlock == 0 {
room.Pillar1.Isunlock = true room.Pillar1.Isunlock = 1
}
if !room.Pillarf.Isunlock {
room.Pillarf.Isunlock = true
} }
this.modelPandata.Change(session.GetUserId(), map[string]interface{}{ this.modelPandata.Change(session.GetUserId(), map[string]interface{}{
"pillar1": room.Pillar1, "pillar1": room.Pillar1,
"pillarf": room.Pillarf,
}) })
this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001") this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001")
break break
case 2: case 2:
if !room.Pillar2.Isunlock { if room.Pillar2.Isunlock == 0 {
room.Pillar2.Isunlock = true room.Pillar2.Isunlock = 1
}
if !room.Pillarf.Isunlock {
room.Pillarf.Isunlock = true
} }
this.modelPandata.Change(session.GetUserId(), map[string]interface{}{ this.modelPandata.Change(session.GetUserId(), map[string]interface{}{
"pillar2": room.Pillar2, "pillar2": room.Pillar2,
"pillarf": room.Pillarf,
}) })
this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001") this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001")
break break
case 3: case 3:
if !room.Pillar3.Isunlock { if room.Pillar3.Isunlock == 0 {
room.Pillar3.Isunlock = true room.Pillar3.Isunlock = 1
}
if !room.Pillarf.Isunlock {
room.Pillarf.Isunlock = true
} }
this.modelPandata.Change(session.GetUserId(), map[string]interface{}{ this.modelPandata.Change(session.GetUserId(), map[string]interface{}{
"pillar3": room.Pillar3, "pillar3": room.Pillar3,
"pillarf": room.Pillarf,
}) })
this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001") this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001")
break break

View File

@ -28,7 +28,7 @@ type DBPracticePillar struct {
Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index"` //柱子下标 Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index"` //柱子下标
Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"` //柱子等级 Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"` //柱子等级
Isunlock bool `protobuf:"varint,3,opt,name=isunlock,proto3" json:"isunlock"` //是否解锁 Isunlock int32 `protobuf:"varint,3,opt,name=isunlock,proto3" json:"isunlock"` //是否解锁 0不能解锁 1可解锁 2已解锁
Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid"` //英雄uid Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid"` //英雄uid
Hero string `protobuf:"bytes,5,opt,name=hero,proto3" json:"hero"` //当前练功英雄 Hero string `protobuf:"bytes,5,opt,name=hero,proto3" json:"hero"` //当前练功英雄
Teacher string `protobuf:"bytes,6,opt,name=teacher,proto3" json:"teacher"` //教习 Teacher string `protobuf:"bytes,6,opt,name=teacher,proto3" json:"teacher"` //教习
@ -84,11 +84,11 @@ func (x *DBPracticePillar) GetLv() int32 {
return 0 return 0
} }
func (x *DBPracticePillar) GetIsunlock() bool { func (x *DBPracticePillar) GetIsunlock() int32 {
if x != nil { if x != nil {
return x.Isunlock return x.Isunlock
} }
return false return 0
} }
func (x *DBPracticePillar) GetUid() string { func (x *DBPracticePillar) GetUid() string {
@ -606,7 +606,7 @@ var file_practice_practice_db_proto_rawDesc = []byte{
0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12,
0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12,
0x1a, 0x0a, 0x08, 0x69, 0x73, 0x75, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x75, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28,
0x08, 0x52, 0x08, 0x69, 0x73, 0x75, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x05, 0x52, 0x08, 0x69, 0x73, 0x75, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x75,
0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a,
0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72,
0x6f, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01,

File diff suppressed because it is too large Load Diff