|
|
@ -1691,7 +1691,8 @@ func (this *WelfareMgr) PigbankGetInfo(p *Player) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankPropArr(p.Platform)
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
return PropItem.PropValue
|
|
|
|
return PropItem.PropValue
|
|
|
@ -1734,7 +1735,8 @@ func (this *WelfareMgr) PigbankGetInfo(p *Player) {
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
DayBuyMaxCnt := fGetPropValue("DayBuyMaxCnt")
|
|
|
|
DayBuyMaxCnt := fGetPropValue("DayBuyMaxCnt")
|
|
|
|
for _, data := range srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr() {
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankDiamondArr(p.Platform)
|
|
|
|
|
|
|
|
for _, data := range pool {
|
|
|
|
if data == nil {
|
|
|
|
if data == nil {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1748,7 +1750,10 @@ func (this *WelfareMgr) PigbankGetInfo(p *Player) {
|
|
|
|
bankInfo.DayBuyMaxCnt = DayBuyMaxCnt
|
|
|
|
bankInfo.DayBuyMaxCnt = DayBuyMaxCnt
|
|
|
|
bankInfo.Price = int64(data.CoinPrice)
|
|
|
|
bankInfo.Price = int64(data.CoinPrice)
|
|
|
|
bankInfo.BankMaxCoin = int64(data.MaxGold)
|
|
|
|
bankInfo.BankMaxCoin = int64(data.MaxGold)
|
|
|
|
bankInfo.GoldExc = data.GoldExc
|
|
|
|
|
|
|
|
|
|
|
|
for _, v := range data.GoldExc {
|
|
|
|
|
|
|
|
bankInfo.GoldExc[int64(v.ItemId)] = v.ItemNum
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if takeRecorcd, exist := p.WelfData.PigBank.TakeRecord[data.Id]; exist {
|
|
|
|
if takeRecorcd, exist := p.WelfData.PigBank.TakeRecord[data.Id]; exist {
|
|
|
|
bankInfo.TakeCoin = takeRecorcd
|
|
|
|
bankInfo.TakeCoin = takeRecorcd
|
|
|
@ -1775,7 +1780,8 @@ func (this *WelfareMgr) PigbankTakeCoin(p *Player) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankPropArr(p.Platform)
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
return PropItem.PropValue
|
|
|
|
return PropItem.PropValue
|
|
|
@ -1804,7 +1810,8 @@ func (this *WelfareMgr) PigbankTakeCoin(p *Player) {
|
|
|
|
p.WelfData.PigBank.TakeRecord = make(map[int32]int64, 8)
|
|
|
|
p.WelfData.PigBank.TakeRecord = make(map[int32]int64, 8)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankDiamondArr(p.Platform)
|
|
|
|
infoData := pool[0]
|
|
|
|
infoData := pool[0]
|
|
|
|
for _, data := range pool {
|
|
|
|
for _, data := range pool {
|
|
|
|
if data == nil {
|
|
|
|
if data == nil {
|
|
|
@ -1817,7 +1824,7 @@ func (this *WelfareMgr) PigbankTakeCoin(p *Player) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BankMaxCoin := int64(0)
|
|
|
|
BankMaxCoin := int64(0)
|
|
|
|
for _, data := range srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr() {
|
|
|
|
for _, data := range pool {
|
|
|
|
if data == nil {
|
|
|
|
if data == nil {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1871,13 +1878,17 @@ func (this *WelfareMgr) PigbankTakeCoin(p *Player) {
|
|
|
|
|
|
|
|
|
|
|
|
p.AddCoin(p.WelfData.PigBank.BankCoin, 0, common.GainWay_PigrankGainCoin, "sys", "存钱罐领取金币")
|
|
|
|
p.AddCoin(p.WelfData.PigBank.BankCoin, 0, common.GainWay_PigrankGainCoin, "sys", "存钱罐领取金币")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if p.WelfData.PigBank.TakeRecord != nil {
|
|
|
|
|
|
|
|
p.WelfData.PigBank.TakeRecord[infoData.Id] = p.WelfData.PigBank.BankCoin
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if infoData.GoldExc != nil {
|
|
|
|
if infoData.GoldExc != nil {
|
|
|
|
// 发放奖励道具
|
|
|
|
// 发放奖励道具
|
|
|
|
var items []*model.Item
|
|
|
|
var items []*model.Item
|
|
|
|
for k, v := range infoData.GoldExc {
|
|
|
|
for _, v := range infoData.GoldExc {
|
|
|
|
items = append(items, &model.Item{
|
|
|
|
items = append(items, &model.Item{
|
|
|
|
ItemId: int32(k),
|
|
|
|
ItemId: int32(v.ItemId),
|
|
|
|
ItemNum: v,
|
|
|
|
ItemNum: v.ItemNum,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BagMgrSingleton.AddItems(&model.AddItemParam{
|
|
|
|
BagMgrSingleton.AddItems(&model.AddItemParam{
|
|
|
@ -1898,11 +1909,8 @@ func (this *WelfareMgr) PigbankTakeCoin(p *Player) {
|
|
|
|
p.WelfData.PigBank.TakeTimes++
|
|
|
|
p.WelfData.PigBank.TakeTimes++
|
|
|
|
p.WelfData.PigBank.DayBuyTimes++
|
|
|
|
p.WelfData.PigBank.DayBuyTimes++
|
|
|
|
|
|
|
|
|
|
|
|
if p.WelfData.PigBank.TakeRecord != nil {
|
|
|
|
|
|
|
|
p.WelfData.PigBank.TakeRecord[infoData.Id] = p.WelfData.PigBank.BankCoin
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pack.TakeTimes = p.WelfData.PigBank.DayBuyTimes
|
|
|
|
pack.TakeTimes = p.WelfData.PigBank.DayBuyTimes
|
|
|
|
|
|
|
|
|
|
|
|
logger.Logger.Tracef("PigbankTakeCoin snid: %v pack: %v", p.SnId, pack)
|
|
|
|
logger.Logger.Tracef("PigbankTakeCoin snid: %v pack: %v", p.SnId, pack)
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCPigbankTakeCoin), pack)
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCPigbankTakeCoin), pack)
|
|
|
|
mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_CoinPigBank, 1))
|
|
|
|
mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_CoinPigBank, 1))
|
|
|
@ -1930,7 +1938,8 @@ func (this *WelfareMgr) DiamondBankGetInfo(p *Player) {
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankPropArr(p.Platform)
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
return PropItem.PropValue
|
|
|
|
return PropItem.PropValue
|
|
|
@ -1939,7 +1948,8 @@ func (this *WelfareMgr) DiamondBankGetInfo(p *Player) {
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankDiamondArr(p.Platform)
|
|
|
|
//infoData := pool[0]
|
|
|
|
//infoData := pool[0]
|
|
|
|
if p.WelfData.DiamondBank == nil {
|
|
|
|
if p.WelfData.DiamondBank == nil {
|
|
|
|
p.WelfData.DiamondBank = &model.DiamondBankData{
|
|
|
|
p.WelfData.DiamondBank = &model.DiamondBankData{
|
|
|
@ -1967,7 +1977,9 @@ func (this *WelfareMgr) DiamondBankGetInfo(p *Player) {
|
|
|
|
bankInfo.Price = int64(data.DiamondPrice)
|
|
|
|
bankInfo.Price = int64(data.DiamondPrice)
|
|
|
|
bankInfo.NowPrice = int64(data.DiamondNowPrice)
|
|
|
|
bankInfo.NowPrice = int64(data.DiamondNowPrice)
|
|
|
|
bankInfo.ShopId = data.DiamondId
|
|
|
|
bankInfo.ShopId = data.DiamondId
|
|
|
|
bankInfo.DiamondExc = data.DiamondExc
|
|
|
|
for _, v := range data.GoldExc {
|
|
|
|
|
|
|
|
bankInfo.DiamondExc[int64(v.ItemId)] = v.ItemNum
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if takeRecorcd, exist := p.WelfData.DiamondBank.TakeRecord[data.Id]; exist {
|
|
|
|
if takeRecorcd, exist := p.WelfData.DiamondBank.TakeRecord[data.Id]; exist {
|
|
|
|
bankInfo.TakeDiamond = float64(takeRecorcd)
|
|
|
|
bankInfo.TakeDiamond = float64(takeRecorcd)
|
|
|
@ -1988,12 +2000,13 @@ func (this *WelfareMgr) DiamondBankGetInfo(p *Player) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DiamondBankTakeCoin 钻石存钱罐领取钻石
|
|
|
|
// DiamondBankTakeCoin 钻石存钱罐领取钻石
|
|
|
|
func (this *WelfareMgr) DiamondBankTakeCoin(p *Player) {
|
|
|
|
func (this *WelfareMgr) DiamondBankTakeCoin(p *Player) (retItemArr []*model.Item) {
|
|
|
|
pack := &welfare.SCDiamondBankTakeDiamond{
|
|
|
|
pack := &welfare.SCDiamondBankTakeDiamond{
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankDiamondArr(p.Platform)
|
|
|
|
infoData := pool[0]
|
|
|
|
infoData := pool[0]
|
|
|
|
for _, data := range pool {
|
|
|
|
for _, data := range pool {
|
|
|
|
if p.WelfData.DiamondBank.DayBuyTimes+1 >= data.BuyCountMin && p.WelfData.DiamondBank.DayBuyTimes+1 <= data.BuyCountMax {
|
|
|
|
if p.WelfData.DiamondBank.DayBuyTimes+1 >= data.BuyCountMin && p.WelfData.DiamondBank.DayBuyTimes+1 <= data.BuyCountMax {
|
|
|
@ -2029,12 +2042,18 @@ func (this *WelfareMgr) DiamondBankTakeCoin(p *Player) {
|
|
|
|
// 发放奖励道具
|
|
|
|
// 发放奖励道具
|
|
|
|
if infoData.DiamondExc != nil {
|
|
|
|
if infoData.DiamondExc != nil {
|
|
|
|
var items []*model.Item
|
|
|
|
var items []*model.Item
|
|
|
|
for k, v := range infoData.DiamondExc {
|
|
|
|
for _, v := range infoData.DiamondExc {
|
|
|
|
items = append(items, &model.Item{
|
|
|
|
items = append(items, &model.Item{
|
|
|
|
ItemId: int32(k),
|
|
|
|
ItemId: v.ItemId,
|
|
|
|
ItemNum: v,
|
|
|
|
ItemNum: v.ItemNum,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retItemArr = append(retItemArr, &model.Item{
|
|
|
|
|
|
|
|
ItemId: v.ItemId,
|
|
|
|
|
|
|
|
ItemNum: v.ItemNum,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BagMgrSingleton.AddItems(&model.AddItemParam{
|
|
|
|
BagMgrSingleton.AddItems(&model.AddItemParam{
|
|
|
|
Platform: p.Platform,
|
|
|
|
Platform: p.Platform,
|
|
|
|
SnId: p.SnId,
|
|
|
|
SnId: p.SnId,
|
|
|
@ -2069,6 +2088,8 @@ func (this *WelfareMgr) DiamondBankTakeCoin(p *Player) {
|
|
|
|
logger.Logger.Tracef("DiamondBankTakeCoin snid: %v pack: %v", p.SnId, pack)
|
|
|
|
logger.Logger.Tracef("DiamondBankTakeCoin snid: %v pack: %v", p.SnId, pack)
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCDiamondBankTakeDiamond), pack)
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCDiamondBankTakeDiamond), pack)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return retItemArr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新钻石存储罐数据
|
|
|
|
// 更新钻石存储罐数据
|
|
|
@ -2078,7 +2099,8 @@ func (this *WelfareMgr) UpdateDiamondBankData(p *Player, coinNum int64, isWin bo
|
|
|
|
p.WelfData.DiamondBank = &model.DiamondBankData{}
|
|
|
|
p.WelfData.DiamondBank = &model.DiamondBankData{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
fGetPropValue := func(propName string) int32 {
|
|
|
|
pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_Pigbank_PropMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankPropArr(p.Platform)
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
for _, PropItem := range pool {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
if PropItem.PorpName == propName {
|
|
|
|
return PropItem.PropValue
|
|
|
|
return PropItem.PropValue
|
|
|
@ -2101,7 +2123,8 @@ func (this *WelfareMgr) UpdateDiamondBankData(p *Player, coinNum int64, isWin bo
|
|
|
|
//保留小数点后4位
|
|
|
|
//保留小数点后4位
|
|
|
|
addDiamond = math.Round(addDiamond*10000) / 10000
|
|
|
|
addDiamond = math.Round(addDiamond*10000) / 10000
|
|
|
|
p.WelfData.DiamondBank.BankDiamond += addDiamond
|
|
|
|
p.WelfData.DiamondBank.BankDiamond += addDiamond
|
|
|
|
pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
//pool := srvdata.PBDB_PigBank_DiamondMgr.Datas.GetArr()
|
|
|
|
|
|
|
|
pool := PlatformMgrSingleton.GetPigBankDiamondArr(p.Platform)
|
|
|
|
infoData := pool[0]
|
|
|
|
infoData := pool[0]
|
|
|
|
for _, data := range pool {
|
|
|
|
for _, data := range pool {
|
|
|
|
if p.WelfData.DiamondBank.DayBuyTimes+1 >= data.BuyCountMin && p.WelfData.DiamondBank.DayBuyTimes+1 <= data.BuyCountMax {
|
|
|
|
if p.WelfData.DiamondBank.DayBuyTimes+1 >= data.BuyCountMin && p.WelfData.DiamondBank.DayBuyTimes+1 <= data.BuyCountMax {
|
|
|
|