道具时限类道具修改

This commit is contained in:
kxdd 2024-04-26 17:46:21 +08:00
parent e2e2a446bf
commit ec0d303cb6
10 changed files with 1330 additions and 175 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1229,8 +1229,7 @@ type ItemParam struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ItemNum int64 `protobuf:"varint,1,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"` // 物品数量 ItemNum int64 `protobuf:"varint,1,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"` // 物品数量
ObtainTime int64 `protobuf:"varint,2,opt,name=ObtainTime,proto3" json:"ObtainTime,omitempty"` //获取的时间 ExpireTime int64 `protobuf:"varint,2,opt,name=ExpireTime,proto3" json:"ExpireTime,omitempty"` //有效期截止时间
ExpireTime int64 `protobuf:"varint,3,opt,name=ExpireTime,proto3" json:"ExpireTime,omitempty"` //有效期截止时间
} }
func (x *ItemParam) Reset() { func (x *ItemParam) Reset() {
@ -1272,13 +1271,6 @@ func (x *ItemParam) GetItemNum() int64 {
return 0 return 0
} }
func (x *ItemParam) GetObtainTime() int64 {
if x != nil {
return x.ObtainTime
}
return 0
}
func (x *ItemParam) GetExpireTime() int64 { func (x *ItemParam) GetExpireTime() int64 {
if x != nil { if x != nil {
return x.ExpireTime return x.ExpireTime
@ -3236,12 +3228,10 @@ func (x *PlayerCtx) GetCoin() int64 {
//该协议废弃掉,统一由 //该协议废弃掉,统一由
//PACKET_GW_SCENEEND //PACKET_GW_SCENEEND
//
//message GWSceneEnd { //message GWSceneEnd {
// int32 GameFreeId = 1; // int32 GameFreeId = 1;
// repeated PlayerCtx Players = 2; // repeated PlayerCtx Players = 2;
//} //}
//
//PACKET_GW_SCFISHRECORD //PACKET_GW_SCFISHRECORD
type FishRecord struct { type FishRecord struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -8802,13 +8792,11 @@ var file_server_proto_rawDesc = []byte{
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x49, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x49, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65,
0x74, 0x65, 0x64, 0x22, 0x27, 0x0a, 0x13, 0x57, 0x47, 0x47, 0x72, 0x61, 0x63, 0x65, 0x44, 0x65, 0x74, 0x65, 0x64, 0x22, 0x27, 0x0a, 0x13, 0x57, 0x47, 0x47, 0x72, 0x61, 0x63, 0x65, 0x44, 0x65,
0x73, 0x74, 0x72, 0x6f, 0x79, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x49, 0x64, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x49, 0x64,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x03, 0x49, 0x64, 0x73, 0x22, 0x65, 0x0a, 0x09, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x03, 0x49, 0x64, 0x73, 0x22, 0x45, 0x0a, 0x09,
0x49, 0x74, 0x65, 0x6d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x74, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x74, 0x65,
0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x49, 0x74, 0x65, 0x6d,
0x4e, 0x75, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x4e, 0x75, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54,
0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54,
0x69, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x0a, 0x52, 0x65, 0x62, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x69, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x0a, 0x52, 0x65, 0x62, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73,
0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x62, 0x61, 0x74, 0x65, 0x53, 0x77, 0x69, 0x74, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x62, 0x61, 0x74, 0x65, 0x53, 0x77, 0x69, 0x74, 0x63,
0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x52, 0x65, 0x62, 0x61, 0x74, 0x65, 0x53, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x52, 0x65, 0x62, 0x61, 0x74, 0x65, 0x53,

View File

@ -205,8 +205,7 @@ message WGGraceDestroyScene {
message ItemParam { message ItemParam {
int64 ItemNum = 1; // int64 ItemNum = 1; //
int64 ObtainTime = 2; // int64 ExpireTime = 2; //
int64 ExpireTime = 3; //
} }
message RebateTask { message RebateTask {

View File

@ -1773,7 +1773,6 @@ type ItemInfo struct {
ItemId int32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId,omitempty"` ItemId int32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId,omitempty"`
ItemNum int64 `protobuf:"varint,2,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"` ItemNum int64 `protobuf:"varint,2,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"`
ExpireTime int64 `protobuf:"varint,3,opt,name=ExpireTime,proto3" json:"ExpireTime,omitempty"`
} }
func (x *ItemInfo) Reset() { func (x *ItemInfo) Reset() {
@ -1822,13 +1821,6 @@ func (x *ItemInfo) GetItemNum() int64 {
return 0 return 0
} }
func (x *ItemInfo) GetExpireTime() int64 {
if x != nil {
return x.ExpireTime
}
return 0
}
type PayInfoList struct { type PayInfoList struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -2439,12 +2431,10 @@ var file_shop_proto_rawDesc = []byte{
0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, 0x22, 0x2a, 0x0a, 0x10, 0x43, 0x53, 0x47, 0x65, 0x74, 0x50, 0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, 0x22, 0x2a, 0x0a, 0x10, 0x43, 0x53, 0x47, 0x65, 0x74, 0x50,
0x61, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x61, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70,
0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x54, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x54, 0x79,
0x70, 0x65, 0x22, 0x5c, 0x0a, 0x08, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x70, 0x65, 0x22, 0x3c, 0x0a, 0x08, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16,
0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75,
0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d,
0x12, 0x1e, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65,
0x22, 0xd3, 0x01, 0x0a, 0x0b, 0x50, 0x61, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xd3, 0x01, 0x0a, 0x0b, 0x50, 0x61, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74,
0x12, 0x18, 0x0a, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x09, 0x52, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f,

View File

@ -208,7 +208,6 @@ message CSGetPayInfoList{
message ItemInfo{ message ItemInfo{
int32 ItemId = 1; int32 ItemId = 1;
int64 ItemNum = 2; int64 ItemNum = 2;
int64 ExpireTime = 3;
} }
message PayInfoList{ message PayInfoList{
string OrderId = 1; string OrderId = 1;

View File

@ -47,7 +47,7 @@ func (this *CSBagInfoHandler) Process(s *netlib.Session, packetid int, data inte
if bagInfo != nil { if bagInfo != nil {
for _, v := range bagInfo.BagItem { for _, v := range bagInfo.BagItem {
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId) item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
if v.ExpireTime < time.Now().Unix() { if item.Type == common.ItemTypeExpireTime && v.ExpireTime < time.Now().Unix() {
continue continue
} }
@ -200,7 +200,6 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
ItemId: int32(k), ItemId: int32(k),
ItemNum: vv, ItemNum: vv,
ObtainTime: ts, ObtainTime: ts,
ExpireTime: items[int32(k)].ExpireTime,
} }
} else { } else {
item.ItemNum += vv item.ItemNum += vv
@ -235,7 +234,6 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
ItemId: int32(k), ItemId: int32(k),
ItemNum: vv, ItemNum: vv,
ObtainTime: ts, ObtainTime: ts,
ExpireTime: items[int32(k)].ExpireTime,
} }
} else { } else {
item.ItemNum += vv item.ItemNum += vv

View File

@ -216,16 +216,26 @@ func (this *BagMgr) AddJybBagInfo(p *Player, addItems []*Item, add int64, gainWa
changeItems = append(changeItems, v.ItemId) changeItems = append(changeItems, v.ItemId)
if itm, exist := newBagInfo.BagItem[v.ItemId]; exist { if itm, exist := newBagInfo.BagItem[v.ItemId]; exist {
if common.ItemTypeExpireTime == item.Type { if common.ItemTypeExpireTime == item.Type {
itm.ExpireTime += int64(item.Time * 3600) itm.ExpireTime += int64(item.Time*3600) * v.ItemNum
itm.ItemNum = 1
} else { } else {
itm.ItemNum += v.ItemNum itm.ItemNum += v.ItemNum
} }
} else {
if common.ItemTypeExpireTime == item.Type {
newBagInfo.BagItem[v.ItemId] = &Item{
ItemId: item.Id, // 物品id
ItemNum: 1, // 数量
ObtainTime: time.Now().Unix(),
ExpireTime: time.Now().Unix() + int64(item.Time*3600)*v.ItemNum,
}
} else { } else {
newBagInfo.BagItem[v.ItemId] = &Item{ newBagInfo.BagItem[v.ItemId] = &Item{
ItemId: item.Id, // 物品id ItemId: item.Id, // 物品id
ItemNum: v.ItemNum, // 数量 ItemNum: v.ItemNum, // 数量
ObtainTime: time.Now().Unix(), ObtainTime: time.Now().Unix(),
ExpireTime: time.Now().Unix() + int64(item.Time*3600), ExpireTime: 0,
}
} }
} }
if v.ItemId == common.ItemIDWeekScore && v.ItemNum != 0 { if v.ItemId == common.ItemIDWeekScore && v.ItemNum != 0 {
@ -349,7 +359,6 @@ func (this *BagMgr) VerifyUpJybInfo(p *Player, args *model.VerifyUpJybInfoArgs)
ItemId: v.ItemId, // 物品id ItemId: v.ItemId, // 物品id
ItemNum: v.ItemNum, // 数量 ItemNum: v.ItemNum, // 数量
ObtainTime: time.Now().Unix(), ObtainTime: time.Now().Unix(),
ExpireTime: v.ExpireTime,
}) })
} }
if _, code := this.AddJybBagInfo(p, items, 0, common.GainWay_ActJybAward, "system", "礼包码兑换"); code != bag.OpResultCode_OPRC_Sucess { //TODO 添加失败 要回退礼包 if _, code := this.AddJybBagInfo(p, items, 0, common.GainWay_ActJybAward, "system", "礼包码兑换"); code != bag.OpResultCode_OPRC_Sucess { //TODO 添加失败 要回退礼包
@ -459,15 +468,13 @@ func (this *BagMgr) RefreshExpireItem(snid int32) {
itemcfg := srvdata.PBDB_GameItemMgr.GetData(bi.ItemId) itemcfg := srvdata.PBDB_GameItemMgr.GetData(bi.ItemId)
if itemcfg != nil { if itemcfg != nil {
// 去掉时限到期的道具 // 去掉时限到期的道具
if itemcfg.Type == common.ItemTypeExpireTime { if itemcfg.Type == common.ItemTypeExpireTime && bi.ExpireTime < time.Now().Unix() {
if bi.ExpireTime < time.Now().Unix() {
delete(bagInfo.BagItem, k) delete(bagInfo.BagItem, k)
} }
} }
} }
} }
} }
}
func (this *BagMgr) Update() { func (this *BagMgr) Update() {
} }

View File

@ -685,7 +685,7 @@ func (this *ShopMgr) GetAmountFinal(p *Player, shopId, vipShopId int32) int64 {
func (this *ShopMgr) ShopAddItem(shopInfo *model.ShopInfo, p *Player) { func (this *ShopMgr) ShopAddItem(shopInfo *model.ShopInfo, p *Player) {
if shopInfo.AddItemInfo != nil { if shopInfo.AddItemInfo != nil {
for _, info := range shopInfo.AddItemInfo { for _, info := range shopInfo.AddItemInfo {
item := &Item{ItemId: info.ItemId, ItemNum: info.ItemNum, ObtainTime: time.Now().Unix(), ExpireTime: time.Now().Unix() + info.ExpireTime*3600} item := &Item{ItemId: info.ItemId, ItemNum: info.ItemNum, ObtainTime: time.Now().Unix()}
BagMgrSingleton.AddJybBagInfo(p, []*Item{item}, 0, common.GainWay_Shop_Buy, "system", shopInfo.Name) BagMgrSingleton.AddJybBagInfo(p, []*Item{item}, 0, common.GainWay_Shop_Buy, "system", shopInfo.Name)
data := srvdata.PBDB_GameItemMgr.GetData(item.ItemId) data := srvdata.PBDB_GameItemMgr.GetData(item.ItemId)
if data != nil { if data != nil {

Binary file not shown.