道具使用优化
This commit is contained in:
parent
33a087d1d7
commit
3d653d6413
Binary file not shown.
|
|
@ -4319,110 +4319,6 @@
|
||||||
"PlayerWaterRate": 100,
|
"PlayerWaterRate": 100,
|
||||||
"BetWaterRate": 100
|
"BetWaterRate": 100
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Id": 5220006,
|
|
||||||
"Name": "ChessCambodianRobot",
|
|
||||||
"Title": "特级大师",
|
|
||||||
"GameId": 522,
|
|
||||||
"GameRule": 52200,
|
|
||||||
"GameType": 2,
|
|
||||||
"SceneType": 6,
|
|
||||||
"Desc": "0",
|
|
||||||
"ShowType": 3,
|
|
||||||
"ShowId": 44001,
|
|
||||||
"Turn": 47000,
|
|
||||||
"BetDec": "0",
|
|
||||||
"Bot": 1,
|
|
||||||
"Ai": [
|
|
||||||
6
|
|
||||||
],
|
|
||||||
"OtherIntParams": [
|
|
||||||
7465,
|
|
||||||
15640
|
|
||||||
],
|
|
||||||
"ChessScoreParams": [
|
|
||||||
7465,
|
|
||||||
15640
|
|
||||||
],
|
|
||||||
"Jackpot": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"RobotNumRng": [
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"RobotTakeCoin": [
|
|
||||||
80000,
|
|
||||||
500000
|
|
||||||
],
|
|
||||||
"RobotLimitCoin": [
|
|
||||||
1000000,
|
|
||||||
2000000
|
|
||||||
],
|
|
||||||
"SameIpLimit": 1,
|
|
||||||
"GameDif": "522",
|
|
||||||
"GameClass": 1,
|
|
||||||
"PlatformName": "越南棋牌",
|
|
||||||
"MaxBetCoin": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"CreateRoomNum": 1,
|
|
||||||
"MatchTrueMan": -1,
|
|
||||||
"PlayerWaterRate": 100,
|
|
||||||
"BetWaterRate": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Id": 5220007,
|
|
||||||
"Name": "ChessCambodianRobot",
|
|
||||||
"Title": "棋王",
|
|
||||||
"GameId": 522,
|
|
||||||
"GameRule": 52200,
|
|
||||||
"GameType": 2,
|
|
||||||
"SceneType": 7,
|
|
||||||
"Desc": "0",
|
|
||||||
"ShowType": 3,
|
|
||||||
"ShowId": 44001,
|
|
||||||
"Turn": 47000,
|
|
||||||
"BetDec": "0",
|
|
||||||
"Bot": 1,
|
|
||||||
"Ai": [
|
|
||||||
7
|
|
||||||
],
|
|
||||||
"OtherIntParams": [
|
|
||||||
15640,
|
|
||||||
35640
|
|
||||||
],
|
|
||||||
"ChessScoreParams": [
|
|
||||||
15640,
|
|
||||||
35640
|
|
||||||
],
|
|
||||||
"Jackpot": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"RobotNumRng": [
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"RobotTakeCoin": [
|
|
||||||
80000,
|
|
||||||
500000
|
|
||||||
],
|
|
||||||
"RobotLimitCoin": [
|
|
||||||
1000000,
|
|
||||||
2000000
|
|
||||||
],
|
|
||||||
"SameIpLimit": 1,
|
|
||||||
"GameDif": "522",
|
|
||||||
"GameClass": 1,
|
|
||||||
"PlatformName": "越南棋牌",
|
|
||||||
"MaxBetCoin": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"CreateRoomNum": 1,
|
|
||||||
"MatchTrueMan": -1,
|
|
||||||
"PlayerWaterRate": 100,
|
|
||||||
"BetWaterRate": 100
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Id": 2110001,
|
"Id": 2110001,
|
||||||
"Name": "十三张四人",
|
"Name": "十三张四人",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
6ж├в├с├т├у├"║█ю└=
|
6у├ж├в├с├т├"║█ю└=
|
||||||
.ь├ы├з├ш├"║█ю└=
|
.ы├з├ш├ь├"║█ю└=
|
||||||
Wс├ж├т├у├в├ь├ы├з├ш├" ║█─╜Б
|
Wь├ы├т├у├в├ш├с├ж├з├" ║█─╜Б
|
||||||
]т├у├ы├э├з├ш├с├ж├в├ь├"╒█Т
|
]в├ь├ы├з├э├с├т├у├ж├ш├"╒█Т
|
||||||
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
2
public
2
public
|
|
@ -1 +1 @@
|
||||||
Subproject commit ae18dc99a70e1010bd60bf990e0b3a5505cb37db
|
Subproject commit b069a50a51c0cdcdc46071062cfb711bc1398cb3
|
||||||
|
|
@ -137,7 +137,9 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
case ItemCanUse:
|
case ItemCanUse:
|
||||||
logger.Logger.Trace("道具使用", msg.ItemId)
|
logger.Logger.Trace("道具使用", msg.ItemId)
|
||||||
|
|
||||||
f := func() {
|
items := map[int32]*Item{}
|
||||||
|
var useFunc func()
|
||||||
|
saleFunc := func() {
|
||||||
// 使用道具,减少道具
|
// 使用道具,减少道具
|
||||||
BagMgrSingleton.SalePlayerItem(p, item, int64(msg.ItemNum))
|
BagMgrSingleton.SalePlayerItem(p, item, int64(msg.ItemNum))
|
||||||
BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemConsume, item.ItemId, item.Name, int64(msg.ItemNum), "道具使用")
|
BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemConsume, item.ItemId, item.Name, int64(msg.ItemNum), "道具使用")
|
||||||
|
|
@ -145,11 +147,35 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
pack.NowItemId = item.ItemId
|
pack.NowItemId = item.ItemId
|
||||||
pack.NowItemNum = item.ItemNum
|
pack.NowItemNum = item.ItemNum
|
||||||
}
|
}
|
||||||
|
gainFunc := func() {
|
||||||
|
for i := 0; i < int(msg.ItemNum); i++ {
|
||||||
|
useFunc()
|
||||||
|
}
|
||||||
|
if len(items) > 0 {
|
||||||
|
var itemArr []*Item
|
||||||
|
for _, v := range items {
|
||||||
|
itemArr = append(itemArr, v)
|
||||||
|
}
|
||||||
|
BagMgrSingleton.AddJybBagInfo(p, itemArr, 0, common.GainWay_ItemUse, "player", "道具使用")
|
||||||
|
for _, v := range itemArr {
|
||||||
|
data := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
|
||||||
|
if data != nil {
|
||||||
|
// 背包变更记录
|
||||||
|
BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemObtain, v.ItemId, data.Name, v.ItemNum, "碎片礼盒获得")
|
||||||
|
}
|
||||||
|
pack.Infos = append(pack.Infos, &bag.ItemInfo{
|
||||||
|
ItemId: v.ItemId,
|
||||||
|
ItemNum: v.ItemNum,
|
||||||
|
ObtainTime: v.ObtainTime,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch item.ItemId {
|
switch item.ItemId {
|
||||||
case common.ItemIDGiftBox:
|
case common.ItemIDGiftBox:
|
||||||
f()
|
saleFunc()
|
||||||
useFunc := func() {
|
useFunc = func() {
|
||||||
sum := 0
|
sum := 0
|
||||||
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
|
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
|
||||||
sum += int(v.GetRate())
|
sum += int(v.GetRate())
|
||||||
|
|
@ -160,29 +186,18 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
|
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
|
||||||
n += int(v.GetRate())
|
n += int(v.GetRate())
|
||||||
if i < n {
|
if i < n {
|
||||||
var items []*Item
|
|
||||||
for k, vv := range v.ItemID {
|
for k, vv := range v.ItemID {
|
||||||
if vv > 0 {
|
if vv > 0 {
|
||||||
items = append(items, &Item{
|
item, ok := items[int32(k)]
|
||||||
ItemId: int32(k),
|
if !ok {
|
||||||
ItemNum: vv,
|
items[int32(k)] = &Item{
|
||||||
ObtainTime: ts,
|
ItemId: int32(k),
|
||||||
})
|
ItemNum: vv,
|
||||||
}
|
ObtainTime: ts,
|
||||||
}
|
}
|
||||||
if len(items) > 0 {
|
} else {
|
||||||
BagMgrSingleton.AddJybBagInfo(p, items, 0, common.GainWay_ItemUse, "player", "道具使用")
|
item.ItemNum += vv
|
||||||
for _, v := range items {
|
|
||||||
data := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
|
|
||||||
if data != nil {
|
|
||||||
// 背包变更记录
|
|
||||||
BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemObtain, v.ItemId, data.Name, v.ItemNum, "碎片礼盒获得")
|
|
||||||
}
|
}
|
||||||
pack.Infos = append(pack.Infos, &bag.ItemInfo{
|
|
||||||
ItemId: v.ItemId,
|
|
||||||
ItemNum: v.ItemNum,
|
|
||||||
ObtainTime: v.ObtainTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
@ -190,13 +205,11 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := 0; i < int(msg.ItemNum); i++ {
|
gainFunc()
|
||||||
useFunc()
|
|
||||||
}
|
|
||||||
|
|
||||||
case common.ItemIDCollectBox:
|
case common.ItemIDCollectBox:
|
||||||
f()
|
saleFunc()
|
||||||
useFunc := func() {
|
useFunc = func() {
|
||||||
sum := 0
|
sum := 0
|
||||||
for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() {
|
for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() {
|
||||||
sum += int(v.GetRate())
|
sum += int(v.GetRate())
|
||||||
|
|
@ -207,29 +220,18 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() {
|
for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() {
|
||||||
n += int(v.GetRate())
|
n += int(v.GetRate())
|
||||||
if i < n {
|
if i < n {
|
||||||
var items []*Item
|
|
||||||
for k, vv := range v.ItemID {
|
for k, vv := range v.ItemID {
|
||||||
if vv > 0 {
|
if vv > 0 {
|
||||||
items = append(items, &Item{
|
item, ok := items[int32(k)]
|
||||||
ItemId: int32(k),
|
if !ok {
|
||||||
ItemNum: vv,
|
items[int32(k)] = &Item{
|
||||||
ObtainTime: ts,
|
ItemId: int32(k),
|
||||||
})
|
ItemNum: vv,
|
||||||
}
|
ObtainTime: ts,
|
||||||
}
|
}
|
||||||
if len(items) > 0 {
|
} else {
|
||||||
BagMgrSingleton.AddJybBagInfo(p, items, 0, common.GainWay_ItemUse, "player", "道具使用")
|
item.ItemNum += vv
|
||||||
for _, v := range items {
|
|
||||||
data := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
|
|
||||||
if data != nil {
|
|
||||||
// 背包变更记录
|
|
||||||
BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemObtain, v.ItemId, data.Name, v.ItemNum, "集卡礼盒获得")
|
|
||||||
}
|
}
|
||||||
pack.Infos = append(pack.Infos, &bag.ItemInfo{
|
|
||||||
ItemId: v.ItemId,
|
|
||||||
ItemNum: v.ItemNum,
|
|
||||||
ObtainTime: v.ObtainTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
@ -237,9 +239,7 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := 0; i < int(msg.ItemNum); i++ {
|
gainFunc()
|
||||||
useFunc()
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.Logger.Warnf("道具使用未定义", msg.ItemId)
|
logger.Logger.Warnf("道具使用未定义", msg.ItemId)
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue