no message

This commit is contained in:
sk 2024-09-19 14:13:22 +08:00
parent 6161d2da1c
commit ecb9c17920
4 changed files with 617 additions and 673 deletions

View File

@ -22,6 +22,7 @@ const (
TransType_MatchSceneChange = 1013
TransType_MiniGameAddCoin = 1014
TransType_ServerCtrl = 1015
TranType_AddItem = 1016 // 道具修改
)
type M2GWebTrascate struct {

View File

@ -1691,15 +1691,15 @@ func (this *CSPlayerVIPBuyPacketFactory) CreatePacket() interface{} {
func (this *CSPlayerVIPBuyHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSVIPBuy Process recv ", data)
if msg, ok := data.(*player_proto.CSVIPBuy); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSPlayerVIPBuyHandler p == nil")
return nil
}
p.SCVIPBuy(int64(msg.GetMoney()))
}
//if msg, ok := data.(*player_proto.CSVIPBuy); ok {
// p := PlayerMgrSington.GetPlayer(sid)
// if p == nil {
// logger.Logger.Warn("CSPlayerVIPBuyHandler p == nil")
// return nil
// }
//
// p.SCVIPBuy(int64(msg.GetMoney()))
//}
return nil
}
@ -1723,7 +1723,6 @@ func (this *CSPlayerVIPInfoHandler) Process(s *netlib.Session, packetid int, dat
return nil
}
p.GetVIPLevel()
p.SCVIPInfo()
}
return nil
}

View File

@ -34,7 +34,6 @@ import (
"mongo.games.com/game/protocol/rankmatch"
serverproto "mongo.games.com/game/protocol/server"
shopproto "mongo.games.com/game/protocol/shop"
webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata"
"mongo.games.com/game/worldsrv/internal"
)
@ -1110,9 +1109,8 @@ func (this *Player) GetMessageAttach(id string) {
}
return gift
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
attach_msg, ok := data.(*model.Message)
dirtyCoin := int64(0)
if ok && attach_msg != nil {
attachMsg, ok := data.(*model.Message)
if ok && attachMsg != nil {
msg.AttachState = model.MSGATTACHSTATE_GOT
notifyClient := true
var remark string
@ -1157,29 +1155,24 @@ func (this *Player) GetMessageAttach(id string) {
case model.MSGTYPE_ITEM:
remark = "领取道具"
gainWay = common.GainWay_MAIL_MTEM
dirtyCoin = msg.Coin
addItem()
case model.MSGTYPE_IOSINSTALLSTABLE:
remark = "IOS下载稳定版本"
gainWay = common.GainWay_IOSINSTALLSTABLE
dirtyCoin = msg.Coin
case model.MSGTYPE_GIFT:
remark = "礼物"
case model.MSGTYPE_GOLDCOMERANK:
remark = "财神降临奖励"
gainWay = common.GainWay_GoldCome
notifyClient = false
dirtyCoin = msg.Coin
case model.MSGTYPE_RANDCOIN:
remark = "红包雨"
gainWay = common.GainWay_OnlineRandCoin
notifyClient = false
dirtyCoin = msg.Coin
case model.MSGTYPE_REBATE:
remark = "流水返利"
gainWay = common.GainWay_RebateTask
notifyClient = false
dirtyCoin = msg.Coin
//邮件领取 添加日志
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertRebateLog(this.Platform, &model.Rebate{
@ -1227,8 +1220,6 @@ func (this *Player) GetMessageAttach(id string) {
}
if msg.Coin > 0 {
this.AddCoin(msg.Coin, 0, gainWay, msg.Id.Hex(), remark)
//增加泥码
this.AddDirtyCoin(0, dirtyCoin)
//俱乐部获取不算系统赠送
if msg.MType != model.MSGTYPE_ClubGet {
this.ReportSystemGiveEvent(int32(msg.Coin), gainWay, notifyClient) //邮件附件算是系统赠送
@ -1891,45 +1882,6 @@ func (this *Player) AddCoinAsync(num, add int64, gainWay int32, oper, remark str
// }
//}
// 增加泥码
func (this *Player) AddDirtyCoin(paycoin, givecoin int64) {
if this.IsRob {
return
}
//if cfg, ok := ProfitControlMgrSington.GetCfg(this.Platform); ok && cfg != nil && paycoin >= 0 {
// //洗码折算率=(玩家剩余泥码*洗码折算率+期望营收)/(充值额+赠送额+泥码余额)
// this.RecalcuWashingCoinConvRate(cfg.Rate, paycoin, givecoin)
//}
//
//this.DirtyCoin += paycoin + givecoin
//if this.DirtyCoin < 0 {
// this.DirtyCoin = 0
//}
this.dirty = true
}
// 洗码
func (this *Player) WashingCoin(coin int64) int64 {
if this.IsRob {
return 0
}
if coin <= 0 {
return 0
}
//if this.DirtyCoin > coin {
// this.DirtyCoin -= coin
// this.dirty = true
// return coin
//}
//
////剩余多少泥码,清洗多少
//coin = this.DirtyCoin
//this.DirtyCoin = 0
return coin
}
func (this *Player) AddTicket(num int64, gainWay int32, oper, remark string) {
if num == 0 {
return
@ -3497,17 +3449,17 @@ func (this *Player) SendShowRed(showType hallproto.ShowRedCode, showChild, isSho
this.SendToClient(int(hallproto.HallPacketID_PACKET_SC_SHOWRED), pack)
}
func (this *Player) SCVIPBuy(buy int64) {
//buy *= 10000
//this.AddMoneyPayTotal(buy)
//this.GetVIPLevel(0) // 更新下vip等级
pack := &playerproto.SCVIPBuy{
OpRetCode: playerproto.OpResultCode_OPRC_Sucess,
}
pack.TolVipExp, pack.Money = this.GetCurrentVIPExp() // 获取经验会更新vip等级
pack.Vip = this.VIP
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_VIPBUY), pack)
}
//func (this *Player) SCVIPBuy(buy int64) {
// //buy *= 10000
// //this.AddMoneyPayTotal(buy)
// //this.GetVIPLevel(0) // 更新下vip等级
// pack := &playerproto.SCVIPBuy{
// OpRetCode: playerproto.OpResultCode_OPRC_Sucess,
// }
// pack.TolVipExp, pack.Money = this.GetCurrentVIPExp() // 获取经验会更新vip等级
// pack.Vip = this.VIP
// this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_VIPBUY), pack)
//}
func (this *Player) SCVIPInfo() {
if this.IsRob {
@ -3581,7 +3533,7 @@ func (this *Player) SCVIPInfo() {
pack.List = append(pack.List, data)
}
pack.TolVipExp, pack.Money = this.GetCurrentVIPExp(vips)
pack.TolVipExp, pack.Money = this.GetCurrentVIPExp()
pack.Vip = this.VIP
pack.OpRetCode = playerproto.OpResultCode_OPRC_Sucess
}
@ -3710,17 +3662,12 @@ func (this *Player) VIPDraw(id, vip int32) {
// GetCurrentVIPExp 更新vip等级
// 返回当前经验和升级需要经验
func (this *Player) GetCurrentVIPExp(vipcfg ...*webapiproto.VIPcfgDataList) (exp int64, money int64) {
var vips *webapiproto.VIPcfgDataList
if len(vipcfg) == 0 {
vips = VipMgrSington.GetVIPcfg(this.Platform)
} else {
vips = vipcfg[0]
}
func (this *Player) GetCurrentVIPExp() (exp int64, money int64) {
vips := VipMgrSington.GetVIPcfg(this.Platform)
exp = int64(float64(this.MoneyPayTotal) * vips.MoneyRatio)
tolexp := int32(0)
oldVipLevel := this.VIP
if vips != nil && this.MoneyPayTotal != 0 {
if this.MoneyPayTotal != 0 {
allExp := int64(float64(this.MoneyPayTotal) * vips.MoneyRatio)
for _, v := range vips.List {
tolexp = v.VipEx
@ -3737,10 +3684,7 @@ func (this *Player) GetCurrentVIPExp(vipcfg ...*webapiproto.VIPcfgDataList) (exp
money = 0
}
if oldVipLevel != this.VIP {
//玩家VIP升级
this.SCVIPInfo()
PetMgrSington.CheckSkinRed(this)
logger.Logger.Trace("VIP升级")
this.GetVIPLevel()
}
return // 默认
}
@ -3763,15 +3707,16 @@ func (this *Player) GetVIPLevel() int32 {
}
}
}
var b bool
if vip != this.VIP {
this.dirty = true
b = true
//玩家VIP升级
this.SCVIPInfo()
logger.Logger.Trace("VIP升级")
}
this.VIP = vip
//玩家VIP升级
this.SCVIPInfo()
if b {
PetMgrSington.CheckSkinRed(this)
}

File diff suppressed because it is too large Load Diff