道具使用优化

This commit is contained in:
sk 2024-04-19 14:55:10 +08:00
parent 33a087d1d7
commit 3d653d6413
8 changed files with 56 additions and 160 deletions

Binary file not shown.

View File

@ -4319,110 +4319,6 @@
"PlayerWaterRate": 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,
"Name": "十三张四人",

View File

@ -1,5 +1,5 @@
6ж├в├с├ту"║█ю└=
.ь├ы├з├ш├"║█ю└=
Wс├ж├т├у├в├ь├ы├з├ш" ║█─╜Б
]т├у├ы├э├з├ш├с├ж├в├ь"╒█Т
6у├ж├в├с├т├"║█ю└=
.ы├з├шь"║█ю└=
Wь├ы├т├у├в├ш├с├ж├з" ║█─╜Б
]в├ь├ы├з├э├с├т├у├ж├ш"╒█Т

Binary file not shown.

2
public

@ -1 +1 @@
Subproject commit ae18dc99a70e1010bd60bf990e0b3a5505cb37db
Subproject commit b069a50a51c0cdcdc46071062cfb711bc1398cb3

View File

@ -137,7 +137,9 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
case ItemCanUse:
logger.Logger.Trace("道具使用", msg.ItemId)
f := func() {
items := map[int32]*Item{}
var useFunc func()
saleFunc := func() {
// 使用道具,减少道具
BagMgrSingleton.SalePlayerItem(p, item, int64(msg.ItemNum))
BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemConsume, item.ItemId, item.Name, int64(msg.ItemNum), "道具使用")
@ -145,34 +147,17 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
pack.NowItemId = item.ItemId
pack.NowItemNum = item.ItemNum
}
switch item.ItemId {
case common.ItemIDGiftBox:
f()
useFunc := func() {
sum := 0
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
sum += int(v.GetRate())
}
if sum > 0 {
n := 0
i := rand.Intn(sum)
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
n += int(v.GetRate())
if i < n {
var items []*Item
for k, vv := range v.ItemID {
if vv > 0 {
items = append(items, &Item{
ItemId: int32(k),
ItemNum: vv,
ObtainTime: ts,
})
}
gainFunc := func() {
for i := 0; i < int(msg.ItemNum); i++ {
useFunc()
}
if len(items) > 0 {
BagMgrSingleton.AddJybBagInfo(p, items, 0, common.GainWay_ItemUse, "player", "道具使用")
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 {
// 背包变更记录
@ -185,18 +170,46 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
})
}
}
}
switch item.ItemId {
case common.ItemIDGiftBox:
saleFunc()
useFunc = func() {
sum := 0
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
sum += int(v.GetRate())
}
if sum > 0 {
n := 0
i := rand.Intn(sum)
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
n += int(v.GetRate())
if i < n {
for k, vv := range v.ItemID {
if vv > 0 {
item, ok := items[int32(k)]
if !ok {
items[int32(k)] = &Item{
ItemId: int32(k),
ItemNum: vv,
ObtainTime: ts,
}
} else {
item.ItemNum += vv
}
}
}
break
}
}
}
}
for i := 0; i < int(msg.ItemNum); i++ {
useFunc()
}
gainFunc()
case common.ItemIDCollectBox:
f()
useFunc := func() {
saleFunc()
useFunc = func() {
sum := 0
for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() {
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() {
n += int(v.GetRate())
if i < n {
var items []*Item
for k, vv := range v.ItemID {
if vv > 0 {
items = append(items, &Item{
item, ok := items[int32(k)]
if !ok {
items[int32(k)] = &Item{
ItemId: int32(k),
ItemNum: vv,
ObtainTime: ts,
})
}
} else {
item.ItemNum += vv
}
if len(items) > 0 {
BagMgrSingleton.AddJybBagInfo(p, items, 0, common.GainWay_ItemUse, "player", "道具使用")
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
@ -237,9 +239,7 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in
}
}
}
for i := 0; i < int(msg.ItemNum); i++ {
useFunc()
}
gainFunc()
default:
logger.Logger.Warnf("道具使用未定义", msg.ItemId)

Binary file not shown.

Binary file not shown.