Compare commits
6 Commits
3cd2dd06e1
...
0fc4b33aa4
Author | SHA1 | Date |
---|---|---|
|
0fc4b33aa4 | |
|
82486dd427 | |
|
32e8b2f22e | |
|
40966b52cb | |
|
fccb385f79 | |
|
c4bea18f9f |
|
@ -316,6 +316,7 @@ const (
|
|||
GainWayVipGift9 = 105 //vip等级礼包
|
||||
GainWayRoomCost = 106 //房费消耗
|
||||
GainWayRoomGain = 107 //房卡场获得
|
||||
GainWayItemShop = 108 // 交易市场道具交易
|
||||
)
|
||||
|
||||
// 后台选择 金币变化类型 的充值 类型id号起始
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"mongo.games.com/game/protocol/gamehall"
|
||||
"slices"
|
||||
"strconv"
|
||||
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/protocol/gamehall"
|
||||
"mongo.games.com/game/protocol/shop"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
)
|
||||
|
@ -76,7 +77,7 @@ func (this *ShopInfo) GetItems() []ItemInfo {
|
|||
if this.ItemId > 0 {
|
||||
ret = append(ret, ItemInfo{
|
||||
ItemId: this.ItemId,
|
||||
ItemNum: this.Amount,
|
||||
ItemNum: this.AmountFinal,
|
||||
})
|
||||
}
|
||||
for _, v := range this.AddItemInfo {
|
||||
|
@ -425,7 +426,7 @@ func (cm *ConfigMgr) DelRoomConfig(plt string, id int32) {
|
|||
delete(cm.GetConfig(plt).RoomConfig, id)
|
||||
}
|
||||
|
||||
func (cm *ConfigMgr) GetRoomConfig(plt string) *gamehall.SCRoomConfig {
|
||||
func (cm *ConfigMgr) GetRoomConfig(plt string, lastChannel string) *gamehall.SCRoomConfig {
|
||||
pack := &gamehall.SCRoomConfig{}
|
||||
for _, v := range cm.GetConfig(plt).RoomType {
|
||||
if v.GetOn() != common.On {
|
||||
|
@ -436,6 +437,10 @@ func (cm *ConfigMgr) GetRoomConfig(plt string) *gamehall.SCRoomConfig {
|
|||
if vv.GetOn() != common.On {
|
||||
continue
|
||||
}
|
||||
if lastChannel != "" && !slices.Contains(vv.GetOnChannelName(), lastChannel) {
|
||||
continue
|
||||
}
|
||||
|
||||
var cost, reward []*gamehall.ItemInfo
|
||||
for _, item := range vv.GetCost() {
|
||||
cost = append(cost, &gamehall.ItemInfo{
|
||||
|
|
|
@ -1168,7 +1168,7 @@ func CSRoomConfigHandler(s *netlib.Session, packetId int, data interface{}, sid
|
|||
return nil
|
||||
}
|
||||
|
||||
pack := PlatformMgrSingleton.GetRoomConfig(p.Platform)
|
||||
pack := PlatformMgrSingleton.GetRoomConfig(p.Platform, p.LastChannel)
|
||||
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SCRoomConfig), pack)
|
||||
logger.Logger.Tracef("SCRoomConfig: %v", pack)
|
||||
return nil
|
||||
|
@ -1202,18 +1202,36 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
|
|||
send()
|
||||
return nil
|
||||
}
|
||||
if !slices.Contains(cfg.GetOnChannelName(), p.LastChannel) {
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
|
||||
f := func(param []int32) []int32 {
|
||||
if len(param) == 0 {
|
||||
return nil
|
||||
}
|
||||
if param[0] == 0 {
|
||||
return param[1:]
|
||||
}
|
||||
if param[0] > 0 && int(param[0]) < len(param) {
|
||||
return []int32{param[param[0]]}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 场次
|
||||
if !slices.Contains(cfg.GetGameFreeId(), msg.GetGameFreeId()) {
|
||||
if !slices.Contains(f(cfg.GetGameFreeId()), msg.GetGameFreeId()) {
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
// 局数
|
||||
if !slices.Contains(cfg.GetRound(), msg.GetRound()) {
|
||||
if !slices.Contains(f(cfg.GetRound()), msg.GetRound()) {
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
// 玩家数量
|
||||
if !slices.Contains(cfg.GetPlayerNum(), msg.GetPlayerNum()) {
|
||||
if !slices.Contains(f(cfg.GetPlayerNum()), msg.GetPlayerNum()) {
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/protocol/gamehall"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -76,7 +78,34 @@ func (p *PlayerNotify) GetPlayers(tp common.NotifyType) []int32 {
|
|||
// SendToClient 发送消息给客户端
|
||||
// tp 消息类型
|
||||
func (p *PlayerNotify) SendToClient(tp common.NotifyType, packetId int, pack interface{}) {
|
||||
ids := p.GetPlayers(tp)
|
||||
switch tp {
|
||||
case common.NotifyPrivateRoomList:
|
||||
d := pack.(*gamehall.SCGetPrivateRoomList)
|
||||
if len(d.GetDatas()) == 0 {
|
||||
return
|
||||
}
|
||||
scene := SceneMgrSingleton.GetScene(int(d.GetDatas()[0].GetRoomId()))
|
||||
if scene == nil {
|
||||
return
|
||||
}
|
||||
roomConfigId := d.GetDatas()[0].GetRoomConfigId()
|
||||
cfg := PlatformMgrSingleton.GetConfig(scene.limitPlatform.IdStr).RoomConfig[roomConfigId]
|
||||
if cfg == nil {
|
||||
return
|
||||
}
|
||||
|
||||
var ids []int32
|
||||
for _, v := range p.GetPlayers(tp) {
|
||||
player := PlayerMgrSington.GetPlayerBySnId(v)
|
||||
if player == nil {
|
||||
continue
|
||||
}
|
||||
if slices.Contains(cfg.GetOnChannelName(), player.LastChannel) {
|
||||
ids = append(ids, v)
|
||||
}
|
||||
}
|
||||
|
||||
PlayerMgrSington.BroadcastMessageToTarget(ids, packetId, pack)
|
||||
logger.Logger.Tracef("PlayerNotify SendToClient tp:%v ids:%v", tp, ids)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ const (
|
|||
ShopPageGift = 7 //礼包页面
|
||||
ShopPageDiamondBank = 8 //钻石存储罐
|
||||
ShopPagePermit = 9 //赛季通行证
|
||||
ShopPageFangKa = 10 //房卡页面
|
||||
|
||||
ShopPagePhoneScore = 61 //手机积分商城
|
||||
ShopPagePhoneScoreGoogle = 62
|
||||
|
@ -646,6 +647,7 @@ func (this *ShopMgr) GetAmountFinal(p *Player, shopId, vipShopId int32) int64 {
|
|||
}
|
||||
}
|
||||
default:
|
||||
addTotal += addNormal
|
||||
}
|
||||
return addTotal
|
||||
}
|
||||
|
@ -1197,37 +1199,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
|||
var amount [ShopTypeItem]int32
|
||||
var dbShop *model.DbShop
|
||||
if shopInfo, ok := data.(*model.ShopInfo); ok {
|
||||
// 目前现金只能买钻石
|
||||
var addTotal = int64(shopInfo.Amount)
|
||||
added := rand.Int31n(shopInfo.AddArea[1]-shopInfo.AddArea[0]+1) + shopInfo.AddArea[0]
|
||||
costNum := rand.Int31n(shopInfo.CostArea[1]-shopInfo.CostArea[0]+1) + shopInfo.CostArea[0]
|
||||
/* if shopInfo.Page == ShopPageVip {
|
||||
//暂时这样修改 VIP礼包没有现金支付
|
||||
shopData := p.GetVipShopData(shopInfo.Id, 0)
|
||||
if shopData != nil {
|
||||
added = shopData.AddArea
|
||||
costNum = shopData.CostArea
|
||||
}
|
||||
}*/
|
||||
vipAdded := int32(0)
|
||||
if shopInfo.Page == ShopPageDiamond {
|
||||
//vip加成
|
||||
vipAdded = VipMgrSington.GetVipDiamondExtra(p.Platform, p.VIP)
|
||||
logger.Logger.Tracef("商城钻石购买,vip加成 vipAdded = %v", vipAdded)
|
||||
}
|
||||
|
||||
if added > 0 || vipAdded > 0 {
|
||||
addTotal = shopInfo.Amount + int64((float64(shopInfo.Amount)*float64(added+vipAdded))/100.0)
|
||||
}
|
||||
|
||||
// 首充翻倍
|
||||
if shopInfo.FirstSwitch {
|
||||
if !slices.Contains(p.ShopID, int(shopInfo.Id)) {
|
||||
addTotal *= 2
|
||||
}
|
||||
}
|
||||
|
||||
amount[ShopTypeDiamond-1] = int32(addTotal)
|
||||
var itemInfo []model.ItemInfo
|
||||
var webItemInfo []*webapi_proto.ItemInfo
|
||||
for _, info := range shopInfo.GetItems() {
|
||||
|
@ -1241,6 +1213,13 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
|||
})
|
||||
}
|
||||
|
||||
switch shopInfo.Type {
|
||||
case ShopTypeDiamond:
|
||||
amount[ShopTypeDiamond-1] = int32(shopInfo.AmountFinal)
|
||||
default:
|
||||
|
||||
}
|
||||
|
||||
dbShop = this.NewDbShop(p, shopInfo.Page, amount[:], ShopConsumeMoney, costNum,
|
||||
common.GainWay_ShopBuy, itemInfo, shopInfo.Id, shopInfo.Name, 0, remark, []int32{})
|
||||
err := model.InsertDbShopLog(dbShop)
|
||||
|
@ -1249,7 +1228,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
|||
return nil
|
||||
}
|
||||
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, shopInfo.Id, p.Platform, p.PackageID, p.DeviceOS,
|
||||
p.DeviceId, shopInfo.Name, [ShopTypeItem]int32{0, int32(addTotal), 0}, costNum, webItemInfo, "", p.Channel, p.ChannelId)
|
||||
p.DeviceId, shopInfo.Name, [ShopTypeItem]int32{0, int32(shopInfo.AmountFinal), 0}, costNum, webItemInfo, "", p.Channel, p.ChannelId)
|
||||
|
||||
} else if cdata, ok := data.(*ExchangeShopInfo); ok {
|
||||
var info *shop.ExchangeType
|
||||
|
|
Loading…
Reference in New Issue