添加时效类道具功能
This commit is contained in:
parent
ebd1653b86
commit
1efb19dce6
|
@ -604,14 +604,15 @@ const (
|
|||
|
||||
// 道具ID
|
||||
const (
|
||||
ItemIDCoin = 100001 // 金币对应的itemId
|
||||
ItemIDDiamond = 100002 // 钻石对应的itemId
|
||||
ItemIDMoneyPond = 100003 // 玩家金币池对应物品Id
|
||||
ItemIDVipExp = 100005 // VIP经验对应的物品Id
|
||||
ItemIDPhoneScore = 100006 // 手机抽奖积分
|
||||
ItemIDWeekScore = 100004 // 周活跃积分
|
||||
ItemIDGiftBox = 50001 // 碎片礼盒
|
||||
ItemIDCollectBox = 50002 // 集卡礼盒
|
||||
ItemIDCoin = 100001 // 金币对应的itemId
|
||||
ItemIDDiamond = 100002 // 钻石对应的itemId
|
||||
ItemIDMoneyPond = 100003 // 玩家金币池对应物品Id
|
||||
ItemIDVipExp = 100005 // VIP经验对应的物品Id
|
||||
ItemIDPhoneScore = 100006 // 手机抽奖积分
|
||||
ItemIDWeekScore = 100004 // 周活跃积分
|
||||
ItemIDGiftBox = 50001 // 碎片礼盒
|
||||
ItemIDCollectBox = 50002 // 集卡礼盒
|
||||
ItemTienlenRecord = 60001 // tienlen记牌器
|
||||
)
|
||||
|
||||
func ToItemId(id int32) int32 {
|
||||
|
@ -638,6 +639,7 @@ const (
|
|||
ItemTypeVipExp = 10 //VIP经验
|
||||
ItemTypeShopScore = 11 //积分
|
||||
ItemTypeInteract = 12 // 互动表情
|
||||
ItemTypeExpireTime = 15 // 时效类道具
|
||||
)
|
||||
|
||||
func GetKeyNoviceGameId(gameId int) string {
|
||||
|
|
|
@ -148,7 +148,7 @@ func init() {
|
|||
p.Pos = int(msg.GetPos())
|
||||
p.MatchParams = msg.GetMatchParams()
|
||||
for id, num := range msg.Items {
|
||||
p.Items[id] = num
|
||||
p.Items[id].ItemNum = num
|
||||
}
|
||||
for k, v := range msg.RankScore {
|
||||
p.RankScore[k] = v
|
||||
|
|
|
@ -117,7 +117,7 @@ type Player struct {
|
|||
BlackLevel int32 //todo 使用WBLevel
|
||||
SingleAdjust *model.PlayerSingleAdjust
|
||||
IsLocal bool //是否本地player
|
||||
Items map[int32]int64 //背包数据
|
||||
Items map[int32]*Item //背包数据
|
||||
MatchParams []int32 //比赛参数 排名、段位、假snid、假角色
|
||||
MatchRobotGrades []MatchRobotGrade
|
||||
TestLog []string // 调试日志
|
||||
|
@ -129,6 +129,12 @@ type MatchRobotGrade struct {
|
|||
Grade int32
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
ItemNum int64 // 物品数量
|
||||
ObtainTime int64 // 获取的时间
|
||||
ExpireTime int64 // 有效期截止时间
|
||||
}
|
||||
|
||||
func NewPlayer(sid int64, data []byte, ws, gs *netlib.Session) *Player {
|
||||
p := &Player{
|
||||
sid: sid,
|
||||
|
@ -141,7 +147,7 @@ func NewPlayer(sid int64, data []byte, ws, gs *netlib.Session) *Player {
|
|||
cparams: make(map[string]string), //平台登陆数据
|
||||
Iparams: make(map[int]int64), //整形参数
|
||||
sparams: make(map[int]string), //字符参数
|
||||
Items: make(map[int32]int64),
|
||||
Items: make(map[int32]*Item),
|
||||
RankScore: make(map[int32]int64),
|
||||
}
|
||||
|
||||
|
@ -448,7 +454,7 @@ func (this *Player) AddCoin(num int64, gainWay int32, syncFlag int, oper, remark
|
|||
return
|
||||
}
|
||||
this.Coin += num
|
||||
this.Items[common.ItemIDCoin] = this.Coin
|
||||
this.Items[common.ItemIDCoin].ItemNum = this.Coin
|
||||
if this.scene != nil {
|
||||
if !this.IsRob && !this.scene.Testing { //机器人log排除掉
|
||||
log := model.NewCoinLogEx(&model.CoinLogParam{
|
||||
|
@ -532,7 +538,7 @@ func (this *Player) AddCoinAsync(num int64, gainWay int32, notifyC, broadcast bo
|
|||
return
|
||||
}
|
||||
this.Coin += num
|
||||
this.Items[common.ItemIDCoin] = this.Coin
|
||||
this.Items[common.ItemIDCoin].ItemNum = this.Coin
|
||||
if this.scene != nil {
|
||||
if !this.IsRob && !this.scene.Testing && writeLog { //机器人log排除掉
|
||||
log := model.NewCoinLogEx(&model.CoinLogParam{
|
||||
|
|
|
@ -639,9 +639,9 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
|
|||
}
|
||||
}
|
||||
|
||||
pack.Items = make(map[int32]int64)
|
||||
for id, num := range p.Items {
|
||||
pack.Items[id] = num
|
||||
pack.Items = make(map[int32]*server.ItemParam)
|
||||
for id, item := range p.Items {
|
||||
pack.Items[id].ItemNum = item.ItemNum
|
||||
}
|
||||
pack.RankScore = make(map[int32]int64)
|
||||
for k, v := range p.RankScore {
|
||||
|
@ -2343,7 +2343,7 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
|
|||
num = rand.Int31n(drop.MaxAmount-drop.MinAmount+1) + drop.MinAmount
|
||||
}
|
||||
|
||||
p.Items[drop.ItemId] += int64(num)
|
||||
p.Items[drop.ItemId].ItemNum += int64(num)
|
||||
realDrop[drop.ItemId] = num
|
||||
}
|
||||
} else {
|
||||
|
@ -2391,7 +2391,7 @@ func (this *Scene) DropCollectBox(p *Player) {
|
|||
pack.Items = make(map[int32]int32)
|
||||
itemData := srvdata.PBDB_GameItemMgr.GetData(common.ItemIDCollectBox)
|
||||
if itemData != nil {
|
||||
p.Items[itemData.Id] = p.Items[itemData.Id] + 1
|
||||
p.Items[itemData.Id].ItemNum = p.Items[itemData.Id].ItemNum + 1
|
||||
pack.Items = map[int32]int32{itemData.Id: 1}
|
||||
remark := fmt.Sprintf("游戏掉落%v", itemData.Id)
|
||||
//logType 0获得 1消耗
|
||||
|
|
|
@ -460,8 +460,8 @@ func CreatePlayerData(p *base.Player) *chesstitians.ChesstitiansPlayerData {
|
|||
}
|
||||
if p.Items != nil {
|
||||
pd.Items = make(map[int32]int32)
|
||||
for id, num := range p.Items {
|
||||
pd.Items[id] = int32(num)
|
||||
for id, item := range p.Items {
|
||||
pd.Items[id] = int32(item.ItemNum)
|
||||
}
|
||||
}
|
||||
if len(p.MatchParams) > 0 {
|
||||
|
|
|
@ -352,9 +352,9 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
|
|||
itemId := item[0]
|
||||
itemNum := item[1]
|
||||
//获取背包道具数量
|
||||
num, ok := player.Items[item[0]]
|
||||
if !ok || num < int64(item[1]) {
|
||||
fishlogger.Errorf("道具数量不在 itemId = %v,itemNum = %v,背包数量 = %v", item[0], item[1], num)
|
||||
playerItem, ok := player.Items[item[0]]
|
||||
if !ok || playerItem.ItemNum < int64(item[1]) {
|
||||
fishlogger.Errorf("道具数量不在 itemId = %v,itemNum = %v,背包数量 = %v", item[0], item[1], playerItem.ItemNum)
|
||||
//判断其他消耗其他物品
|
||||
otherItem := skillTemp.OtherConsumer
|
||||
otherItemId := otherItem[0]
|
||||
|
@ -378,18 +378,18 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
|
|||
}
|
||||
player.Diamond -= int64(otherItemNum)
|
||||
} else {
|
||||
if player.Items[otherItemId] < int64(otherItemNum) {
|
||||
if player.Items[otherItemId].ItemNum < int64(otherItemNum) {
|
||||
fishlogger.Tracef("转换物品是其他物品时,物品数量不足!")
|
||||
pack.Result = 1
|
||||
pack.Status = fishing_proto.SCFishSkillUseResp_TOOL_LIMIT
|
||||
player.SendToClient(int(fishing_proto.FIPacketID_FISHING_SC_SKILLUSERESP), pack)
|
||||
return nil
|
||||
}
|
||||
player.Items[otherItemId] = player.Items[otherItemId] - int64(otherItemNum)
|
||||
player.Items[otherItemId].ItemNum = player.Items[otherItemId].ItemNum - int64(otherItemNum)
|
||||
}
|
||||
fishlogger.Tracef("玩家使用技能当前道具不足 转化物品消耗 skillid = %v,snid = %v,otherItemId = %v,otherItemNum = %v", skillId, player.SnId, otherItemId, otherItemNum)
|
||||
} else {
|
||||
player.Items[itemId] = player.Items[itemId] - int64(itemNum)
|
||||
player.Items[itemId].ItemNum = player.Items[itemId].ItemNum - int64(itemNum)
|
||||
//记录道具消耗日志
|
||||
fishlogger.Tracef("玩家使用技能,消耗道具!snod = %v, skill = %v,itemId =%v,itemNum = %v", player.SnId, skillId, itemId, itemNum)
|
||||
}
|
||||
|
|
|
@ -374,8 +374,8 @@ func TienLenCreatePlayerData(p *base.Player, rankScore int64) *tienlen.TienLenPl
|
|||
}
|
||||
if p.Items != nil {
|
||||
pd.Items = make(map[int32]int32)
|
||||
for id, num := range p.Items {
|
||||
pd.Items[id] = int32(num)
|
||||
for id, item := range p.Items {
|
||||
pd.Items[id] = int32(item.ItemNum)
|
||||
}
|
||||
}
|
||||
if len(p.MatchParams) > 0 {
|
||||
|
|
|
@ -18,7 +18,8 @@ type BagInfo struct {
|
|||
type Item struct {
|
||||
ItemId int32 // 物品ID
|
||||
ItemNum int64 // 物品数量
|
||||
ObtainTime int64 //获取的时间
|
||||
ObtainTime int64 // 获取的时间
|
||||
ExpireTime int64 // 截止时间
|
||||
}
|
||||
type GetBagInfoArgs struct {
|
||||
Plt string
|
||||
|
|
|
@ -20,7 +20,7 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
//操作结果
|
||||
// 操作结果
|
||||
type OpResultCode int32
|
||||
|
||||
const (
|
||||
|
@ -145,7 +145,7 @@ func (SPacketID) EnumDescriptor() ([]byte, []int) {
|
|||
return file_bag_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
//物品信息 后续精简
|
||||
// 物品信息 后续精简
|
||||
type ItemInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -168,6 +168,7 @@ type ItemInfo struct {
|
|||
// string Location = 14; // 跳转页面
|
||||
// string Describe = 15; // 道具描述
|
||||
ObtainTime int64 `protobuf:"varint,3,opt,name=ObtainTime,proto3" json:"ObtainTime,omitempty"` //获取的时间
|
||||
ExpireTime int64 `protobuf:"varint,4,opt,name=ExpireTime,proto3" json:"ExpireTime,omitempty"` //有效期截止时间
|
||||
}
|
||||
|
||||
func (x *ItemInfo) Reset() {
|
||||
|
@ -223,7 +224,14 @@ func (x *ItemInfo) GetObtainTime() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_ALL_BAG_INFO
|
||||
func (x *ItemInfo) GetExpireTime() int64 {
|
||||
if x != nil {
|
||||
return x.ExpireTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// PACKET_ALL_BAG_INFO
|
||||
type CSBagInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -279,7 +287,7 @@ func (x *CSBagInfo) GetTp() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_ALL_BAG_INFO
|
||||
// PACKET_ALL_BAG_INFO
|
||||
type SCBagInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -343,7 +351,7 @@ func (x *SCBagInfo) GetBagNumMax() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_ALL_BAG_USE
|
||||
// PACKET_ALL_BAG_USE
|
||||
type CSUpBagInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -431,7 +439,7 @@ func (x *CSUpBagInfo) GetShowId() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_ALL_BAG_USE
|
||||
// PACKET_ALL_BAG_USE
|
||||
type SCUpBagInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -521,7 +529,7 @@ func (x *SCUpBagInfo) GetInfos() []*ItemInfo {
|
|||
return nil
|
||||
}
|
||||
|
||||
//PACKET_SC_SYNCBAGDATA
|
||||
// PACKET_SC_SYNCBAGDATA
|
||||
type SCSyncBagData struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -905,12 +913,14 @@ var File_bag_proto protoreflect.FileDescriptor
|
|||
|
||||
var file_bag_proto_rawDesc = []byte{
|
||||
0x0a, 0x09, 0x62, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x62, 0x61, 0x67,
|
||||
0x22, 0x5c, 0x0a, 0x08, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x22, 0x7c, 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, 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, 0x12, 0x1e,
|
||||
0x0a, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3d,
|
||||
0x28, 0x03, 0x52, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e,
|
||||
0x0a, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3d,
|
||||
0x0a, 0x09, 0x43, 0x53, 0x42, 0x61, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x4e,
|
||||
0x6f, 0x77, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x0b, 0x4e, 0x6f, 0x77, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a,
|
||||
|
|
|
@ -41,6 +41,7 @@ message ItemInfo{
|
|||
// string Location = 14; // 跳转页面
|
||||
// string Describe = 15; // 道具描述
|
||||
int64 ObtainTime = 3; //获取的时间
|
||||
int64 ExpireTime = 4; //有效期截止时间
|
||||
}
|
||||
|
||||
//PACKET_ALL_BAG_INFO
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -202,6 +202,13 @@ message GWDestroyScene {
|
|||
message WGGraceDestroyScene {
|
||||
repeated int32 Ids = 1;
|
||||
}
|
||||
|
||||
message ItemParam {
|
||||
int64 ItemNum = 1; // 物品数量
|
||||
int64 ObtainTime = 2; //获取的时间
|
||||
int64 ExpireTime = 3; //有效期截止时间
|
||||
}
|
||||
|
||||
message RebateTask {
|
||||
bool RebateSwitch = 1; //返利开关
|
||||
repeated string RebateGameCfg = 2; //已打开的游戏配置 gameid+gamemode
|
||||
|
@ -264,7 +271,7 @@ message GWPlayerLeave{
|
|||
int32 LostTimes = 12; //输局
|
||||
int64 TotalConvertibleFlow = 13; //流水
|
||||
int64 ValidCacheBetTotal = 14; //有效下注缓存
|
||||
map<int32, int64> Items = 15;
|
||||
map<int32, ItemParam> Items = 15;
|
||||
int32 MatchId = 16;//比赛场id
|
||||
int64 CurIsWin = 17;//本局是否赢 负数:输 0:平局 正数:赢
|
||||
map<int32, int32> MatchRobotGrades = 18;//比赛数据
|
||||
|
|
|
@ -20,7 +20,7 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
//操作结果
|
||||
// 操作结果
|
||||
type OpResultCode int32
|
||||
|
||||
const (
|
||||
|
@ -199,7 +199,7 @@ func (SPacketID) EnumDescriptor() ([]byte, []int) {
|
|||
return file_shop_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
//商品信息
|
||||
// 商品信息
|
||||
type ShopInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -491,7 +491,7 @@ func (x *ShopInfo) GetAmountFinal() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_CS_SHOP_INFO
|
||||
// PACKET_CS_SHOP_INFO
|
||||
type CSShopInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -539,7 +539,7 @@ func (x *CSShopInfo) GetNowLocation() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SC_SHOP_INFO
|
||||
// PACKET_SC_SHOP_INFO
|
||||
type SCShopInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -587,7 +587,7 @@ func (x *SCShopInfo) GetInfos() []*ShopInfo {
|
|||
return nil
|
||||
}
|
||||
|
||||
//PACKET_CS_SHOP_ADLOOKED
|
||||
// PACKET_CS_SHOP_ADLOOKED
|
||||
type CSAdLooked struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -651,7 +651,7 @@ func (x *CSAdLooked) GetPosition() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SC_SHOP_ADLOOKED
|
||||
// PACKET_SC_SHOP_ADLOOKED
|
||||
type SCAdLooked struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -707,7 +707,7 @@ func (x *SCAdLooked) GetShopInfo() *ShopInfo {
|
|||
return nil
|
||||
}
|
||||
|
||||
//PACKET_CS_SHOP_VCPAYSHOP
|
||||
// PACKET_CS_SHOP_VCPAYSHOP
|
||||
type CSVCPayShop struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -779,7 +779,7 @@ func (x *CSVCPayShop) GetPosition() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SC_SHOP_VCPAYSHOP
|
||||
// PACKET_SC_SHOP_VCPAYSHOP
|
||||
type SCVCPayShop struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -906,8 +906,8 @@ func (x *SCNotifyGiveCoinInfo) GetGiveTag() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//商城兑换记录
|
||||
//PACKET_CS_SHOP_EXCHANGERECORD
|
||||
// 商城兑换记录
|
||||
// PACKET_CS_SHOP_EXCHANGERECORD
|
||||
type CSShopExchangeRecord struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1066,7 +1066,7 @@ func (x *ShopExchangeRecord) GetGoodsId() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SC_SHOP_EXCHANGERECORD
|
||||
// PACKET_SC_SHOP_EXCHANGERECORD
|
||||
type SCShopExchangeRecord struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1138,8 +1138,8 @@ func (x *SCShopExchangeRecord) GetInfos() []*ShopExchangeRecord {
|
|||
return nil
|
||||
}
|
||||
|
||||
//商城兑换
|
||||
//PACKET_CS_SHOP_EXCHANGERECORD
|
||||
// 商城兑换
|
||||
// PACKET_CS_SHOP_EXCHANGERECORD
|
||||
type CSShopExchange struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1290,7 +1290,7 @@ func (x *SCShopExchange) GetOrderId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
//PACKET_CS_SHOP_EXCHANGELIST
|
||||
// PACKET_CS_SHOP_EXCHANGELIST
|
||||
type CSShopExchangeList struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1574,7 +1574,7 @@ func (x *SCShopExchangeList) GetInfos() []*ShopExchangeInfo {
|
|||
return nil
|
||||
}
|
||||
|
||||
//PACKET_CSPAYINFO
|
||||
// PACKET_CSPAYINFO
|
||||
type CSPayInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1662,7 +1662,7 @@ func (x *CSPayInfo) GetExchangeNum() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SCPAYINFO
|
||||
// PACKET_SCPAYINFO
|
||||
type SCPayInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1718,7 +1718,7 @@ func (x *SCPayInfo) GetUrl() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
//PACKET_CSGETPAYINFOLIST
|
||||
// PACKET_CSGETPAYINFOLIST
|
||||
type CSGetPayInfoList struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1771,8 +1771,9 @@ type ItemInfo struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ItemId int32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId,omitempty"`
|
||||
ItemNum int64 `protobuf:"varint,2,opt,name=ItemNum,proto3" json:"ItemNum,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"`
|
||||
ExpireTime int64 `protobuf:"varint,3,opt,name=ExpireTime,proto3" json:"ExpireTime,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ItemInfo) Reset() {
|
||||
|
@ -1821,6 +1822,13 @@ func (x *ItemInfo) GetItemNum() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (x *ItemInfo) GetExpireTime() int64 {
|
||||
if x != nil {
|
||||
return x.ExpireTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PayInfoList struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1916,7 +1924,7 @@ func (x *PayInfoList) GetTs() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SCGETPAYINFOLIST
|
||||
// PACKET_SCGETPAYINFOLIST
|
||||
type SCGetPayInfoList struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1964,8 +1972,8 @@ func (x *SCGetPayInfoList) GetInfo() []*PayInfoList {
|
|||
return nil
|
||||
}
|
||||
|
||||
//玩家添加地址
|
||||
//PACKET_CSPLAYERADDR
|
||||
// 玩家添加地址
|
||||
// PACKET_CSPLAYERADDR
|
||||
type CSPlayerAddr struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -2029,7 +2037,7 @@ func (x *CSPlayerAddr) GetId() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SCPLAYEADDRS
|
||||
// PACKET_SCPLAYEADDRS
|
||||
type SCGetPlayerAddrs struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -2132,8 +2140,8 @@ func (x *AddrData) GetAddr() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
//VIP商城刷新物品
|
||||
//PACKET_CS_UPDATE_VIP_SHOP
|
||||
// VIP商城刷新物品
|
||||
// PACKET_CS_UPDATE_VIP_SHOP
|
||||
type CSUpdateVipShop struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -2172,8 +2180,8 @@ func (*CSUpdateVipShop) Descriptor() ([]byte, []int) {
|
|||
return file_shop_proto_rawDescGZIP(), []int{26}
|
||||
}
|
||||
|
||||
//VIP商城刷新物品返回
|
||||
//PACKET_SC_UPDATE_VIP_SHOP
|
||||
// VIP商城刷新物品返回
|
||||
// PACKET_SC_UPDATE_VIP_SHOP
|
||||
type SCUpdateVipShop struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -2431,10 +2439,12 @@ var file_shop_proto_rawDesc = []byte{
|
|||
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,
|
||||
0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x54, 0x79,
|
||||
0x70, 0x65, 0x22, 0x3c, 0x0a, 0x08, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16,
|
||||
0x70, 0x65, 0x22, 0x5c, 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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
|
|
|
@ -208,6 +208,7 @@ message CSGetPayInfoList{
|
|||
message ItemInfo{
|
||||
int32 ItemId = 1;
|
||||
int64 ItemNum = 2;
|
||||
int64 ExpireTime = 3;
|
||||
}
|
||||
message PayInfoList{
|
||||
string OrderId = 1;
|
||||
|
|
|
@ -20,7 +20,7 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
//操作结果
|
||||
// 操作结果
|
||||
type OpResultCode int32
|
||||
|
||||
const (
|
||||
|
@ -70,7 +70,7 @@ func (OpResultCode) EnumDescriptor() ([]byte, []int) {
|
|||
return file_tienlen_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
//tienlen
|
||||
// tienlen
|
||||
type TienLenPacketID int32
|
||||
|
||||
const (
|
||||
|
@ -162,7 +162,7 @@ func (TienLenPacketID) EnumDescriptor() ([]byte, []int) {
|
|||
return file_tienlen_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
//玩家信息
|
||||
// 玩家信息
|
||||
type TienLenPlayerData struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -473,7 +473,7 @@ func (x *LastDelCard) GetCards() []int32 {
|
|||
return nil
|
||||
}
|
||||
|
||||
//房间信息
|
||||
// 房间信息
|
||||
type SCTienLenRoomInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -731,7 +731,7 @@ func (x *SCTienLenRoomInfo) GetOutCardRecord() []int32 {
|
|||
return nil
|
||||
}
|
||||
|
||||
//房间状态更新
|
||||
// 房间状态更新
|
||||
type SCTienLenRoomState struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -787,7 +787,7 @@ func (x *SCTienLenRoomState) GetParams() []int64 {
|
|||
return nil
|
||||
}
|
||||
|
||||
//玩家操作
|
||||
// 玩家操作
|
||||
type CSTienLenPlayerOp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -914,7 +914,7 @@ func (x *SCTienLenPlayerOp) GetOpRetCode() OpResultCode {
|
|||
return OpResultCode_OPRC_Sucess
|
||||
}
|
||||
|
||||
//玩家进入
|
||||
// 玩家进入
|
||||
type SCTienLenPlayerEnter struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -962,7 +962,7 @@ func (x *SCTienLenPlayerEnter) GetData() *TienLenPlayerData {
|
|||
return nil
|
||||
}
|
||||
|
||||
//玩家离开
|
||||
// 玩家离开
|
||||
type SCTienLenPlayerLeave struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1081,7 +1081,7 @@ func (x *AddItem) GetScore() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//结算结果
|
||||
// 结算结果
|
||||
type TienLenPlayerGameBilled struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1248,7 +1248,7 @@ func (x *SCTienLenGameBilled) GetDatas() []*TienLenPlayerGameBilled {
|
|||
return nil
|
||||
}
|
||||
|
||||
//小结算结果(炸的分)
|
||||
// 小结算结果(炸的分)
|
||||
type SCTienLenSmallGameBilled struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1336,7 +1336,7 @@ func (x *SCTienLenSmallGameBilled) GetLoseCoin() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//发牌
|
||||
// 发牌
|
||||
type SCTienLenCard struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1384,7 +1384,7 @@ func (x *SCTienLenCard) GetCards() []int32 {
|
|||
return nil
|
||||
}
|
||||
|
||||
//测试数据
|
||||
// 测试数据
|
||||
type SCTienLenCardTest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1598,7 +1598,7 @@ func (x *SCTienLenUpdateMasterSnid) GetMasterSnid() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SCTienLenUpdateAudienceNum
|
||||
// PACKET_SCTienLenUpdateAudienceNum
|
||||
type SCTienLenUpdateAudienceNum struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1901,7 +1901,7 @@ func (x *SCTienLenAIData) GetIsWin() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
//PACKET_SCTienLenFirstOpPos
|
||||
// PACKET_SCTienLenFirstOpPos
|
||||
type SCTienLenFirstOpPos struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1949,7 +1949,7 @@ func (x *SCTienLenFirstOpPos) GetPos() int32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SCTienLenThinkLongCnt
|
||||
// PACKET_SCTienLenThinkLongCnt
|
||||
type SCTienLenPlayerThinkLongCnt struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
|
|
@ -52,7 +52,7 @@ message TienLenPlayerData {
|
|||
int64 CurRoundTotalBet = 17;//本轮押注已押的金币
|
||||
int64 GameCoin = 18; //游戏内带入的金币
|
||||
int32 RoleId = 19; //使用中的角色id
|
||||
map<int32,int32>Items = 20;
|
||||
map<int32,Item>Items = 20;
|
||||
int32 MatchRankId = 21;
|
||||
int32 Lv = 22;
|
||||
int32 CopySnid = 23;//比赛场机器人假snid
|
||||
|
|
|
@ -47,11 +47,16 @@ func (this *CSBagInfoHandler) Process(s *netlib.Session, packetid int, data inte
|
|||
if bagInfo != nil {
|
||||
for _, v := range bagInfo.BagItem {
|
||||
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
|
||||
if v.ExpireTime < time.Now().Unix() {
|
||||
continue
|
||||
}
|
||||
|
||||
if item != nil && v.ItemNum > 0 && (tp <= 0 || item.GetType() == tp) /*&& (nowLocation == -1 || (nowLocation < len(item.ShowLocation) && item.ShowLocation[nowLocation] == 1))*/ {
|
||||
pack.Infos = append(pack.Infos, &bag.ItemInfo{
|
||||
ItemId: v.ItemId,
|
||||
ItemNum: v.ItemNum,
|
||||
ObtainTime: v.ObtainTime,
|
||||
ExpireTime: v.ExpireTime,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -167,6 +172,7 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
|||
ItemId: v.ItemId,
|
||||
ItemNum: v.ItemNum,
|
||||
ObtainTime: v.ObtainTime,
|
||||
ExpireTime: v.ExpireTime,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +200,7 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
|||
ItemId: int32(k),
|
||||
ItemNum: vv,
|
||||
ObtainTime: ts,
|
||||
ExpireTime: items[int32(k)].ExpireTime,
|
||||
}
|
||||
} else {
|
||||
item.ItemNum += vv
|
||||
|
@ -228,6 +235,7 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
|||
ItemId: int32(k),
|
||||
ItemNum: vv,
|
||||
ObtainTime: ts,
|
||||
ExpireTime: items[int32(k)].ExpireTime,
|
||||
}
|
||||
} else {
|
||||
item.ItemNum += vv
|
||||
|
|
|
@ -155,11 +155,11 @@ func init() {
|
|||
items := msg.GetItems()
|
||||
if items != nil {
|
||||
for _, dbItem := range dbItemArr {
|
||||
if itemNum, exist := items[dbItem.Id]; exist {
|
||||
if item, exist := items[dbItem.Id]; exist {
|
||||
oldItem := BagMgrSingleton.GetItem(p.SnId, dbItem.Id)
|
||||
diffNum := int64(itemNum)
|
||||
diffNum := int64(item.ItemNum)
|
||||
if oldItem != nil {
|
||||
diffNum = int64(itemNum) - oldItem.ItemNum
|
||||
diffNum = int64(item.ItemNum) - oldItem.ItemNum
|
||||
}
|
||||
if diffNum != 0 {
|
||||
item := &Item{
|
||||
|
|
|
@ -50,6 +50,7 @@ type Item struct {
|
|||
//Describe string // 道具描述
|
||||
//数据库数据
|
||||
ObtainTime int64 //获取的时间
|
||||
ExpireTime int64 //截止到期时间
|
||||
}
|
||||
|
||||
type BagInfo struct {
|
||||
|
@ -79,6 +80,8 @@ func (this *BagMgr) GetBagInfo(snid int32) *BagInfo {
|
|||
if v, exist := this.PlayerBag[snid]; exist {
|
||||
return v
|
||||
}
|
||||
|
||||
this.RefreshExpireItem(snid)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -89,6 +92,8 @@ func (this *BagMgr) GetItem(snid, itemId int32) *Item {
|
|||
return nil
|
||||
}
|
||||
|
||||
this.RefreshExpireItem(snid)
|
||||
|
||||
item := &Item{
|
||||
ItemId: itemId,
|
||||
}
|
||||
|
@ -210,12 +215,17 @@ func (this *BagMgr) AddJybBagInfo(p *Player, addItems []*Item, add int64, gainWa
|
|||
|
||||
changeItems = append(changeItems, v.ItemId)
|
||||
if itm, exist := newBagInfo.BagItem[v.ItemId]; exist {
|
||||
itm.ItemNum += v.ItemNum
|
||||
if common.ItemTypeExpireTime == item.Type {
|
||||
itm.ExpireTime += int64(item.Time * 3600)
|
||||
} else {
|
||||
itm.ItemNum += v.ItemNum
|
||||
}
|
||||
} else {
|
||||
newBagInfo.BagItem[v.ItemId] = &Item{
|
||||
ItemId: item.Id, // 物品id
|
||||
ItemNum: v.ItemNum, // 数量
|
||||
ObtainTime: time.Now().Unix(),
|
||||
ExpireTime: time.Now().Unix() + int64(item.Time*3600),
|
||||
}
|
||||
}
|
||||
if v.ItemId == common.ItemIDWeekScore && v.ItemNum != 0 {
|
||||
|
@ -246,6 +256,10 @@ func (this *BagMgr) SaleItem(p *Player, itemId int32, num int64) bool {
|
|||
|
||||
// SalePlayerItem 出售道具,减少玩家道具数量
|
||||
func (this *BagMgr) SalePlayerItem(p *Player, item *Item, num int64) bool {
|
||||
if num < 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
item.ItemNum -= num
|
||||
p.dirty = true
|
||||
this.SyncBagData(p.SnId, item.ItemId)
|
||||
|
@ -335,6 +349,7 @@ func (this *BagMgr) VerifyUpJybInfo(p *Player, args *model.VerifyUpJybInfoArgs)
|
|||
ItemId: v.ItemId, // 物品id
|
||||
ItemNum: v.ItemNum, // 数量
|
||||
ObtainTime: time.Now().Unix(),
|
||||
ExpireTime: v.ExpireTime,
|
||||
})
|
||||
}
|
||||
if _, code := this.AddJybBagInfo(p, items, 0, common.GainWay_ActJybAward, "system", "礼包码兑换"); code != bag.OpResultCode_OPRC_Sucess { //TODO 添加失败 要回退礼包
|
||||
|
@ -426,6 +441,7 @@ func (this *BagMgr) SyncBagData(snid int32, changeItemIds ...int32) {
|
|||
//Location: itemInfo.Location,
|
||||
//Describe: itemInfo.Describe,
|
||||
ObtainTime: itemInfo.ObtainTime,
|
||||
ExpireTime: itemInfo.ExpireTime,
|
||||
})
|
||||
if itemInfo.ItemId == VCard {
|
||||
FriendMgrSington.UpdateInfo(p.Platform, p.SnId)
|
||||
|
@ -435,6 +451,24 @@ func (this *BagMgr) SyncBagData(snid int32, changeItemIds ...int32) {
|
|||
p.SyncBagData(itemInfos)
|
||||
}
|
||||
|
||||
// 刷新时效类道具
|
||||
func (this *BagMgr) RefreshExpireItem(snid int32) {
|
||||
bagInfo := BagMgrSingleton.GetBagInfo(snid)
|
||||
if bagInfo != nil {
|
||||
for k, bi := range bagInfo.BagItem {
|
||||
itemcfg := srvdata.PBDB_GameItemMgr.GetData(bi.ItemId)
|
||||
if itemcfg != nil {
|
||||
// 去掉时限到期的道具
|
||||
if itemcfg.Type == common.ItemTypeExpireTime {
|
||||
if bi.ExpireTime < time.Now().Unix() {
|
||||
delete(bagInfo.BagItem, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *BagMgr) Update() {
|
||||
}
|
||||
|
||||
|
@ -471,13 +505,22 @@ func (this *BagMgr) Callback(player any, ret *internal.PlayerLoadReplay) {
|
|||
BagItem: make(map[int32]*Item),
|
||||
}
|
||||
for k, bi := range bagInfo.BagItem {
|
||||
item := srvdata.PBDB_GameItemMgr.GetData(bi.ItemId)
|
||||
if item != nil {
|
||||
itemcfg := srvdata.PBDB_GameItemMgr.GetData(bi.ItemId)
|
||||
if itemcfg != nil {
|
||||
if bi.ItemNum > 0 {
|
||||
|
||||
// 去掉时限到期的道具
|
||||
if itemcfg.Type == common.ItemTypeExpireTime {
|
||||
if bi.ExpireTime < time.Now().Unix() {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
newBagInfo.BagItem[k] = &Item{
|
||||
ItemId: bi.ItemId,
|
||||
ItemNum: bi.ItemNum,
|
||||
ObtainTime: bi.ObtainTime,
|
||||
ExpireTime: bi.ExpireTime,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -531,7 +574,7 @@ func (this *BagMgr) Save(platform string, snid int32, isSync, force bool) {
|
|||
Platform: bagInfo.Platform,
|
||||
}
|
||||
for _, v := range bagInfo.BagItem {
|
||||
biMap.BagItem = append(biMap.BagItem, &Item{ItemId: v.ItemId, ItemNum: v.ItemNum, ObtainTime: v.ObtainTime})
|
||||
biMap.BagItem = append(biMap.BagItem, &Item{ItemId: v.ItemId, ItemNum: v.ItemNum, ObtainTime: v.ObtainTime, ExpireTime: v.ExpireTime})
|
||||
}
|
||||
|
||||
var err error
|
||||
|
@ -542,7 +585,7 @@ func (this *BagMgr) Save(platform string, snid int32, isSync, force bool) {
|
|||
BagItem: make(map[int32]*model.Item),
|
||||
}
|
||||
for _, v := range biMap.BagItem {
|
||||
newBagInfo.BagItem[v.ItemId] = &model.Item{ItemId: v.ItemId, ItemNum: v.ItemNum, ObtainTime: v.ObtainTime}
|
||||
newBagInfo.BagItem[v.ItemId] = &model.Item{ItemId: v.ItemId, ItemNum: v.ItemNum, ObtainTime: v.ObtainTime, ExpireTime: v.ExpireTime}
|
||||
}
|
||||
err = model.UpBagItem(newBagInfo)
|
||||
}
|
||||
|
|
|
@ -1326,6 +1326,7 @@ func (this *Player) GetMessageAttachs(ids []string) {
|
|||
ItemId: msg.Params[i], // 物品id
|
||||
ItemNum: int64(msg.Params[i+1]), // 数量
|
||||
ObtainTime: time.Now().Unix(),
|
||||
ExpireTime: time.Now().Unix() + int64(msg.Params[i+1])*3600,
|
||||
})
|
||||
}
|
||||
if _, code := BagMgrSingleton.AddJybBagInfo(this, items, 0, gainWay, "mail", remark); code != bag.OpResultCode_OPRC_Sucess { // 领取失败
|
||||
|
|
|
@ -590,7 +590,7 @@ func (this *ShopMgr) PayAway(shopInfo *model.ShopInfo, p *Player, vipShopId, pos
|
|||
}
|
||||
case ShopTypeItem:
|
||||
//增加道具
|
||||
item := &Item{ItemId: shopInfo.ItemId, ItemNum: addTotal, ObtainTime: time.Now().Unix()}
|
||||
item := &Item{ItemId: shopInfo.ItemId, ItemNum: addTotal, ObtainTime: time.Now().Unix(), ExpireTime: 0}
|
||||
BagMgrSingleton.AddJybBagInfo(p, []*Item{item}, 0, common.GainWay_Shop_Buy, "system", shopName)
|
||||
data := srvdata.PBDB_GameItemMgr.GetData(item.ItemId)
|
||||
if data != nil {
|
||||
|
@ -685,7 +685,7 @@ func (this *ShopMgr) GetAmountFinal(p *Player, shopId, vipShopId int32) int64 {
|
|||
func (this *ShopMgr) ShopAddItem(shopInfo *model.ShopInfo, p *Player) {
|
||||
if shopInfo.AddItemInfo != nil {
|
||||
for _, info := range shopInfo.AddItemInfo {
|
||||
item := &Item{ItemId: info.ItemId, ItemNum: info.ItemNum, ObtainTime: time.Now().Unix()}
|
||||
item := &Item{ItemId: info.ItemId, ItemNum: info.ItemNum, ObtainTime: time.Now().Unix(), ExpireTime: time.Now().Unix() + info.ExpireTime*3600}
|
||||
BagMgrSingleton.AddJybBagInfo(p, []*Item{item}, 0, common.GainWay_Shop_Buy, "system", shopInfo.Name)
|
||||
data := srvdata.PBDB_GameItemMgr.GetData(item.ItemId)
|
||||
if data != nil {
|
||||
|
|
Loading…
Reference in New Issue