This commit is contained in:
liwei1dao 2024-01-23 13:57:19 +08:00
commit 7114425f0a
6 changed files with 273 additions and 54 deletions

View File

@ -36,6 +36,13 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
})
return
}
func (p *ModelHero) cloneTags(tags map[int32]int32) map[int32]int32 {
cloneTags := make(map[int32]int32)
for k, v := range tags {
cloneTags[k] = v
}
return cloneTags
}
// 计算英雄战力
func (this *ModelHero) calFigthValue(hero *pb.DBHero) (addValue int32, err error) {
@ -50,7 +57,18 @@ func (this *ModelHero) calFigthValue(hero *pb.DBHero) (addValue int32, err error
skillStar *cfg.GameFightingSkillStarData
)
tmpHero = new(pb.DBHero)
//tmpHero = this.copyPoint(hero)
*tmpHero = *hero // 克隆一个对象
// tmpHero.Property = make(map[int32]int32)
// tmpHero.AddProperty = make(map[int32]int32)
// tmpHero.JuexProperty = make(map[int32]int32)
// tmpHero.HoroscopeProperty = make(map[int32]int32)
// tmpHero.TalentProperty = make(map[int32]int32)
tmpHero.Property = this.cloneTags(hero.Property)
tmpHero.AddProperty = this.cloneTags(hero.AddProperty)
tmpHero.JuexProperty = this.cloneTags(hero.JuexProperty)
tmpHero.HoroscopeProperty = this.cloneTags(hero.HoroscopeProperty)
tmpHero.TalentProperty = this.cloneTags(hero.TalentProperty)
preValue = hero.Fightvalue
if heroCfg, err = this.module.configure.GetHeroConfig(tmpHero.HeroID); err != nil {
return

View File

@ -3,6 +3,7 @@ package plunder
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
)
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PlunderGetListReq) (errdata *pb.ErrorData) {
@ -12,14 +13,15 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PlunderGetL
// 获取基本信息
func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListReq) (errdata *pb.ErrorData) {
var (
err error
list *pb.DBPlunder
land *pb.DBPlunderLand
err error
list *pb.DBPlunder
land *pb.DBPlunderLand
update map[string]interface{}
)
if errdata = this.GetListCheck(session, req); errdata != nil {
return
}
update = make(map[string]interface{})
if list, err = this.module.modelPlunder.getPlunderData(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
@ -49,9 +51,17 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
if len(list.Source) == 0 {
list.Source, err = this.module.modelPlunder.refreshGoodsInfo()
list.Setout = []int32{}
this.module.modelPlunder.changePlunderData(session.GetUserId(), map[string]interface{}{
"source": list.Source,
})
update["setout"] = list.Setout
}
// 校验解锁的是否到期
for _, v := range list.Line {
if v.Closetime > 0 && v.Closetime < configure.Now().Unix() {
v.Closetime = -1
update["line"] = list.Line
}
}
if len(update) > 0 {
this.module.modelPlunder.changePlunderData(session.GetUserId(), update)
}
session.SendMsg(string(this.module.GetType()), "getlist", &pb.PlunderGetListResp{
List: list,

View File

@ -0,0 +1,59 @@
package plunder
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
)
func (this *apiComp) UnlockCheck(session comm.IUserSession, req *pb.PlunderUnlockReq) (errdata *pb.ErrorData) {
return
}
// 获取基本信息
func (this *apiComp) Unlock(session comm.IUserSession, req *pb.PlunderUnlockReq) (errdata *pb.ErrorData) {
var (
err error
list *pb.DBPlunder
)
if errdata = this.UnlockCheck(session, req); errdata != nil {
return
}
if list, err = this.module.modelPlunder.getPlunderData(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Message: err.Error(),
}
return
}
if int32(len(list.Line)) >= req.Pos {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
return
}
if list.Line[req.Pos].Closetime != -1 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_PlundeUnlock,
Title: pb.ErrorCode_PlundeUnlock.ToString(),
}
return
}
// 校验数据够不够
globalConf := this.module.ModuleTools.GetGlobalConf()
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{globalConf.PlunderPvpCollegeNum}, true); errdata != nil {
return
}
list.Line[req.Pos].Closetime = configure.Now().Unix() + int64(globalConf.PlunderPvpCollegeTime)*24*3600
this.module.modelPlunder.changePlunderData(session.GetUserId(), map[string]interface{}{
"line": list.Line,
})
session.SendMsg(string(this.module.GetType()), "unlock", &pb.PlunderUnlockResp{
Line: list.Line,
})
return
}

View File

@ -87,7 +87,7 @@ const (
ChatType_ItemShare ChatType = 5 //道具分享
ChatType_Parkour ChatType = 6 //捕羊大赛邀请
ChatType_Questionnaire ChatType = 7 //问答分享
ChatType_XxlRoom ChatType = 8 //三消房间分享类型
ChatType_XxlRoom ChatType = 8 // 三消房间分享类型
)
// Enum value maps for ChatType.

View File

@ -479,6 +479,7 @@ const (
ErrorCode_PlundeNormalShip ErrorCode = 5405 //普通船不能被掠夺
ErrorCode_PlundeShipCDIng ErrorCode = 5406 //掠夺cd中
ErrorCode_PlundeShipRunning ErrorCode = 5407 //运输中
ErrorCode_PlundeUnlock ErrorCode = 5408 //已解锁
)
// Enum value maps for ErrorCode.
@ -893,6 +894,7 @@ var (
5405: "PlundeNormalShip",
5406: "PlundeShipCDIng",
5407: "PlundeShipRunning",
5408: "PlundeUnlock",
}
ErrorCode_value = map[string]int32{
"Success": 0,
@ -1304,6 +1306,7 @@ var (
"PlundeNormalShip": 5405,
"PlundeShipCDIng": 5406,
"PlundeShipRunning": 5407,
"PlundeUnlock": 5408,
}
)
@ -1338,7 +1341,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
var file_errorcode_proto_rawDesc = []byte{
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2a, 0xa1, 0x4c, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x6f, 0x2a, 0xb4, 0x4c, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10,
0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76,
@ -1948,8 +1951,9 @@ var file_errorcode_proto_rawDesc = []byte{
0x53, 0x68, 0x69, 0x70, 0x10, 0x9d, 0x2a, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x6c, 0x75, 0x6e, 0x64,
0x65, 0x53, 0x68, 0x69, 0x70, 0x43, 0x44, 0x49, 0x6e, 0x67, 0x10, 0x9e, 0x2a, 0x12, 0x16, 0x0a,
0x11, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x53, 0x68, 0x69, 0x70, 0x52, 0x75, 0x6e, 0x6e, 0x69,
0x6e, 0x67, 0x10, 0x9f, 0x2a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6e, 0x67, 0x10, 0x9f, 0x2a, 0x12, 0x11, 0x0a, 0x0c, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x55,
0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x10, 0xa0, 0x2a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -930,6 +930,101 @@ func (x *PlunderChangePush) GetShip() map[string]*ShipData {
return nil
}
// 解锁
type PlunderUnlockReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Pos int32 `protobuf:"varint,1,opt,name=pos,proto3" json:"pos"` //
}
func (x *PlunderUnlockReq) Reset() {
*x = PlunderUnlockReq{}
if protoimpl.UnsafeEnabled {
mi := &file_plunder_plunder_msg_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PlunderUnlockReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PlunderUnlockReq) ProtoMessage() {}
func (x *PlunderUnlockReq) ProtoReflect() protoreflect.Message {
mi := &file_plunder_plunder_msg_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PlunderUnlockReq.ProtoReflect.Descriptor instead.
func (*PlunderUnlockReq) Descriptor() ([]byte, []int) {
return file_plunder_plunder_msg_proto_rawDescGZIP(), []int{17}
}
func (x *PlunderUnlockReq) GetPos() int32 {
if x != nil {
return x.Pos
}
return 0
}
type PlunderUnlockResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Line []*TransportLine `protobuf:"bytes,1,rep,name=line,proto3" json:"line"` // 运输队列
}
func (x *PlunderUnlockResp) Reset() {
*x = PlunderUnlockResp{}
if protoimpl.UnsafeEnabled {
mi := &file_plunder_plunder_msg_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PlunderUnlockResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PlunderUnlockResp) ProtoMessage() {}
func (x *PlunderUnlockResp) ProtoReflect() protoreflect.Message {
mi := &file_plunder_plunder_msg_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PlunderUnlockResp.ProtoReflect.Descriptor instead.
func (*PlunderUnlockResp) Descriptor() ([]byte, []int) {
return file_plunder_plunder_msg_proto_rawDescGZIP(), []int{18}
}
func (x *PlunderUnlockResp) GetLine() []*TransportLine {
if x != nil {
return x.Line
}
return nil
}
var File_plunder_plunder_msg_proto protoreflect.FileDescriptor
var file_plunder_plunder_msg_proto_rawDesc = []byte{
@ -1045,8 +1140,14 @@ var file_plunder_plunder_msg_proto_rawDesc = []byte{
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x1f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09,
0x2e, 0x53, 0x68, 0x69, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x3a, 0x02, 0x38, 0x01, 0x22, 0x24, 0x0a, 0x10, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x55,
0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x22, 0x37, 0x0a, 0x11, 0x50, 0x6c,
0x75, 0x6e, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12,
0x22, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x6c,
0x69, 0x6e, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
@ -1061,7 +1162,7 @@ func file_plunder_plunder_msg_proto_rawDescGZIP() []byte {
return file_plunder_plunder_msg_proto_rawDescData
}
var file_plunder_plunder_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_plunder_plunder_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
var file_plunder_plunder_msg_proto_goTypes = []interface{}{
(*PlunderGetListReq)(nil), // 0: PlunderGetListReq
(*PlunderGetListResp)(nil), // 1: PlunderGetListResp
@ -1080,47 +1181,50 @@ var file_plunder_plunder_msg_proto_goTypes = []interface{}{
(*PlunderClientTagReq)(nil), // 14: PlunderClientTagReq
(*PlunderClientTagResp)(nil), // 15: PlunderClientTagResp
(*PlunderChangePush)(nil), // 16: PlunderChangePush
nil, // 17: PlunderChallengeOverResp.ShipEntry
nil, // 18: PlunderChallengeOverResp.HeroexpEntry
nil, // 19: PlunderReachResp.ShipEntry
nil, // 20: PlunderClientTagResp.ShipEntry
nil, // 21: PlunderChangePush.ShipEntry
(*DBPlunder)(nil), // 22: DBPlunder
(*DBPlunderLand)(nil), // 23: DBPlunderLand
(*BattleFormation)(nil), // 24: BattleFormation
(*BattleInfo)(nil), // 25: BattleInfo
(*BattleReport)(nil), // 26: BattleReport
(*TransportLine)(nil), // 27: TransportLine
(*UserAtno)(nil), // 28: UserAtno
(*ShipData)(nil), // 29: ShipData
(*PlunderUnlockReq)(nil), // 17: PlunderUnlockReq
(*PlunderUnlockResp)(nil), // 18: PlunderUnlockResp
nil, // 19: PlunderChallengeOverResp.ShipEntry
nil, // 20: PlunderChallengeOverResp.HeroexpEntry
nil, // 21: PlunderReachResp.ShipEntry
nil, // 22: PlunderClientTagResp.ShipEntry
nil, // 23: PlunderChangePush.ShipEntry
(*DBPlunder)(nil), // 24: DBPlunder
(*DBPlunderLand)(nil), // 25: DBPlunderLand
(*BattleFormation)(nil), // 26: BattleFormation
(*BattleInfo)(nil), // 27: BattleInfo
(*BattleReport)(nil), // 28: BattleReport
(*TransportLine)(nil), // 29: TransportLine
(*UserAtno)(nil), // 30: UserAtno
(*ShipData)(nil), // 31: ShipData
}
var file_plunder_plunder_msg_proto_depIdxs = []int32{
22, // 0: PlunderGetListResp.list:type_name -> DBPlunder
23, // 1: PlunderGetListResp.land:type_name -> DBPlunderLand
24, // 2: PlunderChallengeReq.battle:type_name -> BattleFormation
25, // 3: PlunderChallengeResp.info:type_name -> BattleInfo
26, // 4: PlunderChallengeOverReq.report:type_name -> BattleReport
27, // 5: PlunderChallengeOverResp.line:type_name -> TransportLine
17, // 6: PlunderChallengeOverResp.ship:type_name -> PlunderChallengeOverResp.ShipEntry
28, // 7: PlunderChallengeOverResp.atno:type_name -> UserAtno
18, // 8: PlunderChallengeOverResp.heroexp:type_name -> PlunderChallengeOverResp.HeroexpEntry
24, // 9: PlunderPvpChallengeReq.battle:type_name -> BattleFormation
25, // 10: PlunderPvpChallengeResp.info:type_name -> BattleInfo
26, // 11: PlunderPvpChallengeOverReq.report:type_name -> BattleReport
28, // 12: PlunderPvpChallengeOverResp.atno:type_name -> UserAtno
27, // 13: PlunderReachResp.line:type_name -> TransportLine
19, // 14: PlunderReachResp.ship:type_name -> PlunderReachResp.ShipEntry
20, // 15: PlunderClientTagResp.ship:type_name -> PlunderClientTagResp.ShipEntry
21, // 16: PlunderChangePush.ship:type_name -> PlunderChangePush.ShipEntry
29, // 17: PlunderChallengeOverResp.ShipEntry.value:type_name -> ShipData
29, // 18: PlunderReachResp.ShipEntry.value:type_name -> ShipData
29, // 19: PlunderClientTagResp.ShipEntry.value:type_name -> ShipData
29, // 20: PlunderChangePush.ShipEntry.value:type_name -> ShipData
21, // [21:21] is the sub-list for method output_type
21, // [21:21] is the sub-list for method input_type
21, // [21:21] is the sub-list for extension type_name
21, // [21:21] is the sub-list for extension extendee
0, // [0:21] is the sub-list for field type_name
24, // 0: PlunderGetListResp.list:type_name -> DBPlunder
25, // 1: PlunderGetListResp.land:type_name -> DBPlunderLand
26, // 2: PlunderChallengeReq.battle:type_name -> BattleFormation
27, // 3: PlunderChallengeResp.info:type_name -> BattleInfo
28, // 4: PlunderChallengeOverReq.report:type_name -> BattleReport
29, // 5: PlunderChallengeOverResp.line:type_name -> TransportLine
19, // 6: PlunderChallengeOverResp.ship:type_name -> PlunderChallengeOverResp.ShipEntry
30, // 7: PlunderChallengeOverResp.atno:type_name -> UserAtno
20, // 8: PlunderChallengeOverResp.heroexp:type_name -> PlunderChallengeOverResp.HeroexpEntry
26, // 9: PlunderPvpChallengeReq.battle:type_name -> BattleFormation
27, // 10: PlunderPvpChallengeResp.info:type_name -> BattleInfo
28, // 11: PlunderPvpChallengeOverReq.report:type_name -> BattleReport
30, // 12: PlunderPvpChallengeOverResp.atno:type_name -> UserAtno
29, // 13: PlunderReachResp.line:type_name -> TransportLine
21, // 14: PlunderReachResp.ship:type_name -> PlunderReachResp.ShipEntry
22, // 15: PlunderClientTagResp.ship:type_name -> PlunderClientTagResp.ShipEntry
23, // 16: PlunderChangePush.ship:type_name -> PlunderChangePush.ShipEntry
29, // 17: PlunderUnlockResp.line:type_name -> TransportLine
31, // 18: PlunderChallengeOverResp.ShipEntry.value:type_name -> ShipData
31, // 19: PlunderReachResp.ShipEntry.value:type_name -> ShipData
31, // 20: PlunderClientTagResp.ShipEntry.value:type_name -> ShipData
31, // 21: PlunderChangePush.ShipEntry.value:type_name -> ShipData
22, // [22:22] is the sub-list for method output_type
22, // [22:22] is the sub-list for method input_type
22, // [22:22] is the sub-list for extension type_name
22, // [22:22] is the sub-list for extension extendee
0, // [0:22] is the sub-list for field type_name
}
func init() { file_plunder_plunder_msg_proto_init() }
@ -1336,6 +1440,30 @@ func file_plunder_plunder_msg_proto_init() {
return nil
}
}
file_plunder_plunder_msg_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PlunderUnlockReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_plunder_plunder_msg_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PlunderUnlockResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -1343,7 +1471,7 @@ func file_plunder_plunder_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_plunder_plunder_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 22,
NumMessages: 24,
NumExtensions: 0,
NumServices: 0,
},