no message

This commit is contained in:
sk 2024-09-25 17:58:16 +08:00
parent 867df580b5
commit f28377dd05
14 changed files with 98 additions and 1617 deletions

View File

@ -361,47 +361,6 @@ func (this *CSLoginHandler) Process(s *netlib.Session, packetid int, data interf
return nil
}
type CSCustomServicePacketFactory struct {
}
type CSCustomServiceHandler struct {
}
func (this *CSCustomServicePacketFactory) CreatePacket() interface{} {
pack := &login_proto.CSCustomService{}
return pack
}
func (this *CSCustomServiceHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSCustomService Process recv ", data)
if _, ok := data.(*login_proto.CSCustomService); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSCustomServiceHandler p == nil")
return nil
}
var Url string
var customType int32
flag := int32(0)
platform := PlatformMgrSingleton.GetPlatform(p.Platform)
if platform != nil {
Url = platform.ServiceUrl
customType = platform.CustomType
if platform.ServiceFlag {
flag = 1
}
}
pack := &login_proto.SCCustomService{
Url: proto.String(Url),
OpenFlag: proto.Int32(flag),
CustomType: proto.Int32(customType),
}
p.SendToClient(int(login_proto.LoginPacketID_PACKET_SC_CUSTOMSERVICE), pack)
logger.Logger.Trace("SCCustomService:", pack)
}
return nil
}
type CSPlatFormPacketFactory struct {
}
@ -673,9 +632,6 @@ func init() {
//登录
common.RegisterHandler(int(login_proto.LoginPacketID_PACKET_CS_LOGIN), &CSLoginHandler{})
netlib.RegisterFactory(int(login_proto.LoginPacketID_PACKET_CS_LOGIN), &CSLoginPacketFactory{})
//客服地址
common.RegisterHandler(int(login_proto.LoginPacketID_PACKET_CS_CUSTOMSERVICE), &CSCustomServiceHandler{})
netlib.RegisterFactory(int(login_proto.LoginPacketID_PACKET_CS_CUSTOMSERVICE), &CSCustomServicePacketFactory{})
//平台配置信息
common.RegisterHandler(int(login_proto.LoginPacketID_PACKET_CS_PLATFORMCFG), &CSPlatFormHandler{})
netlib.RegisterFactory(int(login_proto.LoginPacketID_PACKET_CS_PLATFORMCFG), &CSPlatFormPacketFactory{})

View File

@ -36,7 +36,7 @@ func (this *CSRoleInfoHandler) Process(s *netlib.Session, packetid int, data int
if platform == nil {
return nil
}
roleInfos := PetMgrSington.GetRoleInfos(p)
roleInfos := ModelMgrSingleton.GetRoleInfos(p)
pack := &pets.SCRoleInfo{
Infos: roleInfos,
}
@ -71,7 +71,7 @@ func (this *CSPetInfoHandler) Process(s *netlib.Session, packetid int, data inte
return nil
}
petInfos := PetMgrSington.GetPetInfos(p)
petInfos := ModelMgrSingleton.GetPetInfos(p)
pack := &pets.SCPetInfo{
Infos: petInfos,
}
@ -122,21 +122,21 @@ func (this *CSRisingStarHandler) Process(s *netlib.Session, packetid int, data i
}
if msg.RisingModId == 0 {
logger.Logger.Warn("CSRisingStarHandler UseModId:", msg.RisingModId)
SendInfoRole(pets.OpResultCode_OPRC_Error, PetMgrSington.GetRoleInfo(p, msg.RisingModId))
SendInfoRole(pets.OpResultCode_OPRC_Error, ModelMgrSingleton.GetRoleInfo(p, msg.RisingModId))
return nil
}
if msg.RisingType == 0 {
roleInfo := PetMgrSington.GetIntroductionByModId(msg.RisingModId)
roleInfo := ModelMgrSingleton.GetIntroductionByModId(msg.RisingModId)
if roleInfo == nil {
SendInfoRole(pets.OpResultCode_OPRC_Error, PetMgrSington.GetRoleInfo(p, msg.RisingModId))
SendInfoRole(pets.OpResultCode_OPRC_Error, ModelMgrSingleton.GetRoleInfo(p, msg.RisingModId))
return nil
}
if roleInfo.MaxLevel == p.Roles.ModUnlock[msg.RisingModId] {
logger.Logger.Trace("人物已经达到最大等级")
SendInfoRole(pets.OpResultCode_OPRC_Error, PetMgrSington.GetRoleInfo(p, msg.RisingModId))
SendInfoRole(pets.OpResultCode_OPRC_Error, ModelMgrSingleton.GetRoleInfo(p, msg.RisingModId))
return nil
}
role := PetMgrSington.GetRoleInfo(p, msg.RisingModId)
role := ModelMgrSingleton.GetRoleInfo(p, msg.RisingModId)
if role != nil {
if role.HaveAmount < role.Amount {
logger.Logger.Trace("人物碎片道具数量不够", role.HaveAmount, role.Amount)
@ -170,21 +170,21 @@ func (this *CSRisingStarHandler) Process(s *netlib.Session, packetid int, data i
FriendMgrSington.UpdateInfo(p.Platform, p.SnId)
p.dirty = true
//人物
SendInfoRole(pets.OpResultCode_OPRC_Sucess, PetMgrSington.GetRoleInfo(p, msg.RisingModId))
SendInfoRole(pets.OpResultCode_OPRC_Sucess, ModelMgrSingleton.GetRoleInfo(p, msg.RisingModId))
}
} else if msg.RisingType == 1 {
petInfo := PetMgrSington.GetIntroductionByModId(msg.RisingModId)
petInfo := ModelMgrSingleton.GetIntroductionByModId(msg.RisingModId)
if petInfo == nil {
SendInfoPet(pets.OpResultCode_OPRC_Error, PetMgrSington.GetPetInfo(p, msg.RisingModId))
SendInfoPet(pets.OpResultCode_OPRC_Error, ModelMgrSingleton.GetPetInfo(p, msg.RisingModId))
return nil
}
if petInfo.MaxLevel == p.Pets.ModUnlock[msg.RisingModId] {
logger.Logger.Trace("宠物已经达到最大等级")
SendInfoPet(pets.OpResultCode_OPRC_Error, PetMgrSington.GetPetInfo(p, msg.RisingModId))
SendInfoPet(pets.OpResultCode_OPRC_Error, ModelMgrSingleton.GetPetInfo(p, msg.RisingModId))
return nil
}
pet := PetMgrSington.GetPetInfo(p, msg.RisingModId)
pet := ModelMgrSingleton.GetPetInfo(p, msg.RisingModId)
if pet != nil {
if pet.HaveAmount < pet.Amount {
logger.Logger.Trace("宠物碎片道具数量不够", pet.HaveAmount, pet.Amount)
@ -216,7 +216,7 @@ func (this *CSRisingStarHandler) Process(s *netlib.Session, packetid int, data i
FriendMgrSington.UpdateInfo(p.Platform, p.SnId)
p.dirty = true
//宠物
SendInfoPet(pets.OpResultCode_OPRC_Sucess, PetMgrSington.GetPetInfo(p, msg.RisingModId))
SendInfoPet(pets.OpResultCode_OPRC_Sucess, ModelMgrSingleton.GetPetInfo(p, msg.RisingModId))
}
}
}
@ -321,7 +321,7 @@ func (this *CSRolePetUnlockHandler) Process(s *netlib.Session, packetid int, dat
}
if msg.UseModType == 0 {
if _, ok1 := p.Roles.ModUnlock[msg.UseModId]; !ok1 {
roleInfo := PetMgrSington.GetRoleInfo(p, msg.UseModId)
roleInfo := ModelMgrSingleton.GetRoleInfo(p, msg.UseModId)
if roleInfo != nil {
item := BagMgrSingleton.GetItem(p.SnId, roleInfo.Fragment)
if item != nil && item.ItemNum >= int64(roleInfo.Amount) {
@ -349,14 +349,14 @@ func (this *CSRolePetUnlockHandler) Process(s *netlib.Session, packetid int, dat
FriendMgrSington.UpdateInfo(p.Platform, p.SnId)
p.dirty = true
logger.Logger.Trace("解锁人物", msg.UseModId)
SendMsg(pets.OpResultCode_OPRC_Sucess, PetMgrSington.GetRoleInfo(p, msg.UseModId), nil)
SendMsg(pets.OpResultCode_OPRC_Sucess, ModelMgrSingleton.GetRoleInfo(p, msg.UseModId), nil)
return nil
}
}
}
} else if msg.UseModType == 1 {
if _, ok1 := p.Pets.ModUnlock[msg.UseModId]; !ok1 {
petInfo := PetMgrSington.GetPetInfo(p, msg.UseModId)
petInfo := ModelMgrSingleton.GetPetInfo(p, msg.UseModId)
if petInfo != nil {
item := BagMgrSingleton.GetItem(p.SnId, petInfo.Fragment)
if item != nil && item.ItemNum >= int64(petInfo.Amount) {
@ -384,7 +384,7 @@ func (this *CSRolePetUnlockHandler) Process(s *netlib.Session, packetid int, dat
FriendMgrSington.UpdateInfo(p.Platform, p.SnId)
p.dirty = true
logger.Logger.Trace("解锁宠物", msg.UseModId)
SendMsg(pets.OpResultCode_OPRC_Sucess, nil, PetMgrSington.GetPetInfo(p, msg.UseModId))
SendMsg(pets.OpResultCode_OPRC_Sucess, nil, ModelMgrSingleton.GetPetInfo(p, msg.UseModId))
return nil
}
}
@ -493,7 +493,7 @@ func CSSkinInfo(s *netlib.Session, packetid int, data interface{}, sid int64) er
return nil
}
pack := &pets.SCSkinInfo{
Infos: PetMgrSington.GetSkinInfos(p),
Infos: ModelMgrSingleton.GetSkinInfos(p),
}
p.SendToClient(int(pets.PetsPacketID_PACKET_SC_SKIN_INFO), pack)
logger.Logger.Tracef("SCSkinInfo: %v", pack)
@ -530,7 +530,7 @@ func CSSkinUse(s *netlib.Session, packetid int, data interface{}, sid int64) err
}
// 已解锁的
info := PetMgrSington.GetSkinInfo(p, msg.GetId())
info := ModelMgrSingleton.GetSkinInfo(p, msg.GetId())
if !info.GetIsUnlock() {
logger.Logger.Errorf("CSSkinUse unlock")
pack.RetCode = pets.OpResultCode_OPRC_Unlock
@ -567,7 +567,7 @@ func CSSkinUpgrade(s *netlib.Session, packetid int, data interface{}, sid int64)
}
// 是否已经解锁
info := PetMgrSington.GetSkinInfo(p, msg.GetId())
info := ModelMgrSingleton.GetSkinInfo(p, msg.GetId())
if !info.GetIsUnlock() {
logger.Logger.Errorf("CSSkinUpgrade not unlock")
send()
@ -611,7 +611,7 @@ func CSSkinUpgrade(s *netlib.Session, packetid int, data interface{}, sid int64)
}
p.Skin.ModUnlock[msg.GetId()] = info.GetLevel() + 1
pack.RetCode = pets.OpResultCode_OPRC_Sucess
pack.Info = PetMgrSington.GetSkinInfo(p, msg.GetId())
pack.Info = ModelMgrSingleton.GetSkinInfo(p, msg.GetId())
send()
// 任务加成变更
@ -627,7 +627,7 @@ func SkinUnLock(p *Player, id int32) (*pets.SkinInfo, pets.OpResultCode) {
return nil, pets.OpResultCode_OPRC_Error
}
info := PetMgrSington.GetSkinInfo(p, id)
info := ModelMgrSingleton.GetSkinInfo(p, id)
if info.GetIsUnlock() {
return nil, pets.OpResultCode_OPRC_Error
}
@ -673,7 +673,7 @@ func SkinUnLock(p *Player, id int32) (*pets.SkinInfo, pets.OpResultCode) {
pack := &pets.SCSkinUnLock{
Id: id,
RetCode: pets.OpResultCode_OPRC_Sucess,
Info: PetMgrSington.GetSkinInfo(p, id),
Info: ModelMgrSingleton.GetSkinInfo(p, id),
}
p.SendToClient(int(pets.PetsPacketID_PACKET_SC_SKIN_UNLOCK), pack)
logger.Logger.Tracef("SCSkinUnlock: %v", pack)

View File

@ -2229,7 +2229,7 @@ func CSQueryPlayer(s *netlib.Session, packetid int, data interface{}, sid int64)
Id: id,
Level: level,
}
roleData := PetMgrSington.GetIntroductionByModId(id)
roleData := ModelMgrSingleton.GetIntroductionByModId(id)
if roleData != nil {
role.Name = roleData.Name
}
@ -2244,7 +2244,7 @@ func CSQueryPlayer(s *netlib.Session, packetid int, data interface{}, sid int64)
Id: id,
Level: level,
}
petData := PetMgrSington.GetIntroductionByModId(id)
petData := ModelMgrSingleton.GetIntroductionByModId(id)
if petData != nil {
pet.Name = petData.Name
}

View File

@ -624,7 +624,6 @@ func (this *CSPMCmdHandler) Process(s *netlib.Session, packetid int, data interf
p.CoinPayTotal += int64(coin)
p.dirty = true
p.AddCoin(coin, 0, common.GainWay_ByPMCmd, p.GetName(), cmd)
p.ReportSystemGiveEvent(int32(coin), common.GainWay_ByPMCmd, true)
p.SendDiffData()
}
}

View File

@ -1,113 +0,0 @@
package main
import (
"time"
"mongo.games.com/goserver/core/module"
)
const ACT_LOGGER = "actmgr"
var ActMgrSington = &ActMgr{
ConfigByPlateform: make(map[string]*ActGivePlateformConfig),
}
// config --------------------------------------------------------
type ActGiveConfig struct {
Tag int32 //赠与类型
IsStop int32 //是否阻止 1阻止 0放开
NeedFlow int32 //需要流水的倍数 0 不计算 其他计算
}
type ActGivePlateformConfig struct {
ActInfo map[string]*ActGiveConfig //奖励信息
findInfo map[int32]*ActGiveConfig //奖励信息
Platform string //平台
}
type ActMgr struct {
ConfigByPlateform map[string]*ActGivePlateformConfig
LastTicket int64
}
func (this *ActMgr) AddGiveConfig(actComeConfig *ActGivePlateformConfig, plateFrom string) {
actComeConfig.findInfo = make(map[int32]*ActGiveConfig)
for _, v := range actComeConfig.ActInfo {
actComeConfig.findInfo[v.Tag] = v
}
this.ConfigByPlateform[plateFrom] = actComeConfig
this.OnConfigChanged(actComeConfig)
}
func (this *ActMgr) RemovePlateFormConfig(plateFrom string) {
_, ok := this.ConfigByPlateform[plateFrom]
if ok {
delete(this.ConfigByPlateform, plateFrom)
}
}
func (this *ActMgr) GetIsNeedGive(plateFrom string, tag int32) bool {
info := this.GetGiveConfig(plateFrom)
if info == nil {
return true
}
if v, ok := info.findInfo[tag]; ok {
if v.IsStop == 1 {
return false
}
}
return true
}
func (this *ActMgr) GetExchangeFlow(plateFrom string, tag int32) int32 {
info := this.GetGiveConfig(plateFrom)
if info == nil {
return 0
}
if v, ok := info.findInfo[tag]; ok {
return v.NeedFlow
}
return 0
}
func (this *ActMgr) GetGiveConfig(plateForm string) *ActGivePlateformConfig {
plateFormConfig, ok := this.ConfigByPlateform[plateForm]
if ok {
return plateFormConfig
}
return nil
}
func (this *ActMgr) OnConfigChanged(actComeConfig *ActGivePlateformConfig) {
}
// //////////////////////////////////////////////////////////////////
// / Module Implement [beg]
// //////////////////////////////////////////////////////////////////
func (this *ActMgr) ModuleName() string {
return "ActMgr"
}
func (this *ActMgr) Init() {
this.LastTicket = time.Now().Unix()
if this.ConfigByPlateform == nil {
this.ConfigByPlateform = make(map[string]*ActGivePlateformConfig)
}
}
func (this *ActMgr) Update() {
}
func (this *ActMgr) Shutdown() {
module.UnregisteModule(this)
}
func init() {
module.RegisteModule(ActMgrSington, time.Minute, 0)
}

View File

@ -79,7 +79,7 @@ func init() {
Num: param.ItemNum,
})
case common.ItemIDPetSkill:
PetMgrSington.CheckShowRed(p)
ModelMgrSingleton.CheckShowRed(p)
case common.ItemIDPermit, common.ItemIDLong:
var permitScore, long int64
@ -101,7 +101,7 @@ func init() {
switch itemData.GetType() {
case common.ItemTypeSkinChip:
PetMgrSington.CheckSkinRed(p)
ModelMgrSingleton.CheckSkinRed(p)
}
}

View File

@ -55,8 +55,6 @@ func init() {
etcd.Register(etcd.ETCDKEY_BLACKLIST_PREFIX, BlackInfoApi{}, handlerEvent)
// 代理
etcd.Register(etcd.ETCDKEY_PROMOTER_PREFIX, PromoterConfig{}, handlerEvent)
// 赠送
etcd.Register(etcd.ETCDKEY_ACT_GIVE_PREFIX, ActGivePlateformConfig{}, handlerEvent)
// 7日签到
etcd.Register(etcd.ETCDKEY_ACT_7SIGN, webapi.Welfare7SignDateList{}, platformConfigEvent)
// 转盘
@ -442,18 +440,6 @@ func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *c
}
}
case equalFunc(etcd.ETCDKEY_ACT_GIVE_PREFIX):
var config *ActGivePlateformConfig
if data != nil {
config = data.(*ActGivePlateformConfig)
}
if config == nil {
return
}
if isInit || event.Type == clientv3.EventTypePut {
ActMgrSington.AddGiveConfig(config, config.Platform)
}
case equalFunc(etcd.ETCDKEY_MatchAudience):
switch event.Type {
case clientv3.EventTypePut:

View File

@ -1,13 +1,9 @@
package main
import (
"time"
"mongo.games.com/goserver/core/module"
"mongo.games.com/game/common"
"mongo.games.com/game/model"
hall_proto "mongo.games.com/game/protocol/gamehall"
"mongo.games.com/game/protocol/gamehall"
"mongo.games.com/game/protocol/pets"
"mongo.games.com/game/srvdata"
)
@ -17,13 +13,12 @@ const (
ItemConsume //消耗
)
var PetMgrSington = &PetMgr{
//RPInfos: make(map[int32]*RoleAndPetInfo),
}
var ModelMgrSingleton = &ModelMgr{}
type PetMgr struct {
type ModelMgr struct {
//RPInfos map[int32]*RoleAndPetInfo
}
type RoleAndPetInfo struct {
ModId int32 //模型id
Name string //名字
@ -32,12 +27,9 @@ type RoleAndPetInfo struct {
MaxLevel int32 //最大等级
}
func (this *PetMgr) ModuleName() string {
return "PetMgr"
}
// 人物
func (this *PetMgr) GetRoleInfos(p *Player) []*pets.RoleInfo {
func (this *ModelMgr) GetRoleInfos(p *Player) []*pets.RoleInfo {
rolesInfo := srvdata.RolePetMgrSington.Roles
if rolesInfo != nil {
var newRoles = make([]*pets.RoleInfo, 0)
@ -89,7 +81,8 @@ func (this *PetMgr) GetRoleInfos(p *Player) []*pets.RoleInfo {
}
return nil
}
func (this *PetMgr) GetRoleInfo(p *Player, modId int32) *pets.RoleInfo {
func (this *ModelMgr) GetRoleInfo(p *Player, modId int32) *pets.RoleInfo {
level := p.Roles.ModUnlock[modId]
roleInfo := srvdata.RolePetMgrSington.GetRoleByRoleIdAndLevel(modId, level)
if roleInfo != nil {
@ -130,9 +123,9 @@ func (this *PetMgr) GetRoleInfo(p *Player, modId int32) *pets.RoleInfo {
return nil
}
// ////////////////////////////////////////////////////////////////////////
// 宠物
func (this *PetMgr) GetPetInfos(p *Player) []*pets.PetInfo {
func (this *ModelMgr) GetPetInfos(p *Player) []*pets.PetInfo {
petsInfo := srvdata.RolePetMgrSington.Pets
if petsInfo != nil {
var newPets = make([]*pets.PetInfo, 0)
@ -195,7 +188,8 @@ func (this *PetMgr) GetPetInfos(p *Player) []*pets.PetInfo {
}
return nil
}
func (this *PetMgr) GetPetInfo(p *Player, modId int32) *pets.PetInfo {
func (this *ModelMgr) GetPetInfo(p *Player, modId int32) *pets.PetInfo {
level := p.Pets.ModUnlock[modId]
petInfo := srvdata.RolePetMgrSington.GetPetByPetIdAndLevel(modId, level)
if petInfo != nil {
@ -247,7 +241,8 @@ func (this *PetMgr) GetPetInfo(p *Player, modId int32) *pets.PetInfo {
}
// 皮肤
func (this *PetMgr) GetSkinInfos(p *Player) []*pets.SkinInfo {
func (this *ModelMgr) GetSkinInfos(p *Player) []*pets.SkinInfo {
var ret []*pets.SkinInfo
for _, v := range PlatformMgrSingleton.GetConfig(p.Platform).SkinConfig.GetItems() {
ret = append(ret, this.GetSkinInfo(p, v.GetId()))
@ -255,7 +250,7 @@ func (this *PetMgr) GetSkinInfos(p *Player) []*pets.SkinInfo {
return ret
}
func (this *PetMgr) GetSkinInfo(p *Player, id int32) *pets.SkinInfo {
func (this *ModelMgr) GetSkinInfo(p *Player, id int32) *pets.SkinInfo {
cfg := PlatformMgrSingleton.GetSkinInfo(p.Platform, id)
if cfg == nil {
return nil
@ -336,7 +331,8 @@ func (this *PetMgr) GetSkinInfo(p *Player, id int32) *pets.SkinInfo {
return ret
}
func (this *PetMgr) CheckSkinRed(p *Player) {
// CheckSkinRed 皮肤红点
func (this *ModelMgr) CheckSkinRed(p *Player) {
if p == nil || p.IsRob {
return
}
@ -356,12 +352,12 @@ func (this *PetMgr) CheckSkinRed(p *Player) {
}
}
if ok && len(info.GetCost()) > 0 {
p.SendShowRed(hall_proto.ShowRedCode_Skin, v.Id, 1)
p.SendShowRed(gamehall.ShowRedCode_Skin, v.Id, 1)
continue
}
// vip等级解锁
if info.GetUnLockType() == common.SkinGetVip && p.VIP >= info.GetNeedVip() {
p.SendShowRed(hall_proto.ShowRedCode_Skin, v.Id, 1)
p.SendShowRed(gamehall.ShowRedCode_Skin, v.Id, 1)
continue
}
}
@ -376,15 +372,16 @@ func (this *PetMgr) CheckSkinRed(p *Player) {
}
}
if ok && len(info.GetCost()) > 0 {
p.SendShowRed(hall_proto.ShowRedCode_Skin, v.Id, 1)
p.SendShowRed(gamehall.ShowRedCode_Skin, v.Id, 1)
continue
}
}
}
}
// 商品人物总加成 人物功能变动需要修改
func (this *PetMgr) GetShopAward(shopInfo *model.ShopInfo, p *Player) (award, roleId int32) {
// GetShopAward 角色加成
// 商品人物加成,角色id 人物功能变动需要修改
func (this *ModelMgr) GetShopAward(shopInfo *model.ShopInfo, p *Player) (award, roleId int32) {
if shopInfo.Ad > 0 && shopInfo.Type == ShopTypeCoin {
id, add := srvdata.RolePetMgrSington.GetRoleAdd(p.PlayerData, common.RoleAddADV)
award += add
@ -404,15 +401,18 @@ func (this *PetMgr) GetShopAward(shopInfo *model.ShopInfo, p *Player) (award, ro
return award, roleId
}
// GetAwardPetByWelf 宠物加成
// 宠物加成 宠物功能变动需要修改
func (this *PetMgr) GetAwardPetByWelf(p *Player) (award int64) {
func (this *ModelMgr) GetAwardPetByWelf(p *Player) (award int64) {
petChick := this.GetPetInfo(p, 1000001)
if petChick != nil && petChick.Level > 0 {
award = int64(petChick.Award)
}
return
}
func (this *PetMgr) GetIntroductionByModId(modId int32) *RoleAndPetInfo {
// GetIntroductionByModId 模型介绍
func (this *ModelMgr) GetIntroductionByModId(modId int32) *RoleAndPetInfo {
mod := srvdata.PBDB_Game_IntroductionMgr.GetData(modId)
if mod == nil {
return &RoleAndPetInfo{}
@ -425,7 +425,10 @@ func (this *PetMgr) GetIntroductionByModId(modId int32) *RoleAndPetInfo {
MaxLevel: mod.LevelMax,
}
}
func (this *PetMgr) CheckShowRed(p *Player) {
// CheckShowRed 检查红点
// 人物,宠物,宠物技能
func (this *ModelMgr) CheckShowRed(p *Player) {
if p == nil || p.IsRob {
return
}
@ -517,26 +520,9 @@ func (this *PetMgr) CheckShowRed(p *Player) {
}
if roleRed {
p.SendShowRed(hall_proto.ShowRedCode_Role, 0, 1)
p.SendShowRed(gamehall.ShowRedCode_Role, 0, 1)
}
if petRed {
p.SendShowRed(hall_proto.ShowRedCode_Pet, 0, 1)
p.SendShowRed(gamehall.ShowRedCode_Pet, 0, 1)
}
}
//////////////////////////////////
func (this *PetMgr) Init() {
}
func (this *PetMgr) Update() {
}
func (this *PetMgr) Shutdown() {
module.UnregisteModule(this)
}
func init() {
module.RegisteModule(PetMgrSington, time.Second, 0)
}

View File

@ -48,15 +48,12 @@ type ClubConfig struct {
GiveCoinRate []int64 //会长充值额外赠送比例
}
type Platform struct {
Id int32 // 平台ID
IdStr string // 字符id
Id int32 // 平台ID,数值
IdStr string // 字符id,字符串
Name string // 平台名称
Isolated bool // 是否孤立(别的平台看不到)
Disable bool // 是否禁用
dirty bool //
ServiceUrl string //客服地址
BindOption int32 //绑定选项
ServiceFlag bool //客服标记 是否支持浏览器跳转 false否 true是
UpgradeAccountGiveCoin int32 //升级账号奖励金币
NewAccountGiveCoin int32 //新账号奖励金币
PerBankNoLimitAccount int32 //同一银行卡号绑定用户数量限制

View File

@ -124,9 +124,7 @@ func (pm *PlatformMgr) UpsertPlatform(name string, isolated, disable bool, id in
p.Id = id
p.Name = name
p.IdStr = pltId
p.ServiceUrl = url
p.BindOption = bindOption
p.ServiceFlag = serviceFlag
p.CustomType = customType
p.UpgradeAccountGiveCoin = upgradeAccountGiveCoin
p.NewAccountGiveCoin = newAccountGiveCoin

View File

@ -33,7 +33,6 @@ import (
playerproto "mongo.games.com/game/protocol/player"
"mongo.games.com/game/protocol/rankmatch"
serverproto "mongo.games.com/game/protocol/server"
shopproto "mongo.games.com/game/protocol/shop"
"mongo.games.com/game/srvdata"
"mongo.games.com/game/worldsrv/internal"
)
@ -443,9 +442,9 @@ func (this *Player) CheckShowRed() {
//商城红点
ShopMgrSington.ShopCheckShowRed(this)
//数据依赖于背包数据 放入加载背包数据之后执行
PetMgrSington.CheckShowRed(this)
ModelMgrSingleton.CheckShowRed(this)
// 皮肤红点
PetMgrSington.CheckSkinRed(this)
ModelMgrSingleton.CheckSkinRed(this)
//福利红点
WelfareMgrSington.WelfareShowRed(this)
// 排行赛红点
@ -1097,7 +1096,6 @@ func (this *Player) GetMessageAttach(id string) {
attachMsg, ok := data.(*model.Message)
if ok && attachMsg != nil {
msg.AttachState = model.MSGATTACHSTATE_GOT
notifyClient := true
var remark string
var gainWay int32 = common.GainWay_MessageAttach
@ -1150,15 +1148,12 @@ func (this *Player) GetMessageAttach(id string) {
case model.MSGTYPE_GOLDCOMERANK:
remark = "财神降临奖励"
gainWay = common.GainWay_GoldCome
notifyClient = false
case model.MSGTYPE_RANDCOIN:
remark = "红包雨"
gainWay = common.GainWay_OnlineRandCoin
notifyClient = false
case model.MSGTYPE_REBATE:
remark = "流水返利"
gainWay = common.GainWay_RebateTask
notifyClient = false
//邮件领取 添加日志
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertRebateLog(this.Platform, &model.Rebate{
@ -1184,10 +1179,8 @@ func (this *Player) GetMessageAttach(id string) {
//dirtyCoin = msg.Coin
case model.MSGTYPE_MATCH_SIGNUPFEE:
gainWay = common.GainWay_MatchBreakBack
notifyClient = false
case model.MSGTYPE_MATCH_TICKETREWARD:
gainWay = common.GainWay_MatchSystemSupply
notifyClient = false
this.TicketTotal += msg.Ticket
case model.MSGTYPE_MATCH_SHOPEXCHANGE:
remark = "积分商城兑换"
@ -1206,12 +1199,6 @@ func (this *Player) GetMessageAttach(id string) {
}
if msg.Coin > 0 {
this.AddCoin(msg.Coin, 0, gainWay, msg.Id.Hex(), remark)
//俱乐部获取不算系统赠送
if msg.MType != model.MSGTYPE_ClubGet {
this.ReportSystemGiveEvent(int32(msg.Coin), gainWay, notifyClient) //邮件附件算是系统赠送
} else { //俱乐部获取算充值
this.AddCoinGiveLog(msg.Coin, 0, 0, gainWay, model.COINGIVETYPE_PAY, "club", "club")
}
this.AddPayCoinLog(msg.Coin, model.PayCoinLogType_Coin, "mail")
if msg.Oper == 0 { //系统赠送
if !this.IsRob {
@ -2953,97 +2940,6 @@ func (this *Player) ReportBindAlipayEvent() {
//}
}
func (this *Player) AddCoinGiveLog(payCoin, giveCoin int64, coinType, logType, recType int32, remark, oper string) {
plt := PlatformMgrSingleton.GetPlatform(this.Platform)
curVer := int32(0)
if plt != nil {
curVer = plt.ExchangeVer
}
log := model.NewCoinGiveLogEx(this.SnId, this.Name, payCoin, giveCoin, coinType, logType, this.PromoterTree,
recType, curVer, this.Platform, this.Channel, this.BeUnderAgentCode, remark, oper, this.PackageID, 0, 0)
if log != nil {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
err := model.InsertGiveCoinLog(log)
if err == nil {
if this.LastExchangeOrder != "" && this.TotalConvertibleFlow > 0 {
err = model.UpdateGiveCoinLastFlow(log.Platform, this.LastExchangeOrder, this.TotalConvertibleFlow)
}
}
return err
}), task.CompleteNotifyWrapper(func(ud interface{}, t task.Task) {
if ud == nil {
//清空流水更新id
this.TotalConvertibleFlow = 0
this.LastExchangeOrder = log.LogId.Hex()
}
}), "UpdateGiveCoinLastFlow").StartByGroupFixExecutor(log.Platform, "UpdateGiveCoinLastFlow")
}
}
func ReportSystemGiveEvent(pd *model.PlayerData, amount, tag int32, notifyClient bool) {
//系统赠送
if !pd.IsRob {
//插入本地表
if amount > 0 {
if ActMgrSington.GetIsNeedGive(pd.Platform, tag) {
plt := PlatformMgrSingleton.GetPlatform(pd.Platform)
curVer := int32(0)
if plt != nil {
curVer = plt.ExchangeVer
}
log := model.NewCoinGiveLogEx(pd.SnId, pd.Name, 0, int64(amount), 0, tag, pd.PromoterTree,
model.COINGIVETYPE_SYSTEM, curVer, pd.Platform, pd.Channel, pd.BeUnderAgentCode, "",
"system", pd.PackageID, 0, 0)
if log != nil {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
err := model.InsertGiveCoinLog(log)
if err == nil {
if pd.LastExchangeOrder != "" && pd.TotalConvertibleFlow > 0 {
err = model.UpdateGiveCoinLastFlow(log.Platform, pd.LastExchangeOrder, pd.TotalConvertibleFlow)
}
}
return err
}), task.CompleteNotifyWrapper(func(ud interface{}, t task.Task) {
if ud == nil {
//清空流水更新id
pd.TotalConvertibleFlow = 0
pd.LastExchangeOrder = log.LogId.Hex()
player := PlayerMgrSington.GetPlayerBySnId(pd.SnId)
if player == nil {
//需要回写数据库
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
model.UpdatePlayerExchageFlowAndOrder(pd.Platform, pd.SnId, 0, pd.LastExchangeOrder)
return nil
}), nil, "UpdatePlayerExchageFlowAndOrder").StartByGroupFixExecutor(log.Platform, pd.AccountId)
}
}
}), "UpdateGiveCoinLastFlow").StartByGroupFixExecutor(log.Platform, "UpdateGiveCoinLastFlow")
}
}
if notifyClient {
player := PlayerMgrSington.GetPlayerBySnId(pd.SnId)
if player != nil {
//通知客户端
sendPack := &shopproto.SCNotifyGiveCoinInfo{
GiveCoin: proto.Int64(int64(amount)),
GiveTag: proto.Int32(tag),
}
proto.SetDefaults(sendPack)
player.SendToClient(int(shopproto.SPacketID_SHOP_SC_GIVECOIN_INFO), sendPack)
}
}
}
}
}
func (this *Player) ReportSystemGiveEvent(amount, tag int32, notifyClient bool) {
ReportSystemGiveEvent(this.PlayerData, amount, tag, notifyClient)
}
// 破产事件
func (this *Player) ReportBankRuptcy(gameid, gamemode, gamefreeid int32) {
//if !this.IsRob {
@ -3695,7 +3591,7 @@ func (this *Player) GetVIPLevel() int32 {
//玩家VIP升级
this.SCVIPInfo()
if b {
PetMgrSington.CheckSkinRed(this)
ModelMgrSingleton.CheckSkinRed(this)
}
return this.VIP
}

View File

@ -223,7 +223,7 @@ func (this *ShopMgr) GetShopInfo(shopId int32, p *Player) *model.ShopInfo {
}
}
}
award, roleId := PetMgrSington.GetShopAward(shopInfo, p)
award, roleId := ModelMgrSingleton.GetShopAward(shopInfo, p)
firstBuy := false
if shopInfo.FirstSwitch {
firstBuy = !slices.Contains(p.ShopID, int(shopInfo.Id))
@ -312,7 +312,7 @@ func (this *ShopMgr) GetShopInfos(p *Player, nowLocation int) []*shop.ShopInfo {
ItemNum: i2.ItemNum,
})
}
award, roleId := PetMgrSington.GetShopAward(shopInfo, p)
award, roleId := ModelMgrSingleton.GetShopAward(shopInfo, p)
firstBuy := false
if shopInfo.FirstSwitch {
firstBuy = !slices.Contains(p.ShopID, int(shopInfo.Id))
@ -384,7 +384,7 @@ func (this *ShopMgr) GetShopInfos(p *Player, nowLocation int) []*shop.ShopInfo {
ItemNum: i2.ItemNum,
})
}
award, roleId := PetMgrSington.GetShopAward(shopInfo, p)
award, roleId := ModelMgrSingleton.GetShopAward(shopInfo, p)
firstBuy := false
if shopInfo.FirstSwitch {
firstBuy = !slices.Contains(p.ShopID, int(shopInfo.Id))
@ -649,7 +649,7 @@ func (this *ShopMgr) GetAmountFinal(p *Player, shopId, vipShopId int32) int64 {
switch shopInfo.Type {
case ShopTypeCoin:
var addCoin int64
award, _ := PetMgrSington.GetShopAward(shopInfo, p)
award, _ := ModelMgrSingleton.GetShopAward(shopInfo, p)
if award > 0 {
addCoin = int64(float64(addTotal) * float64(award) / 100.0)
}

File diff suppressed because it is too large Load Diff

View File

@ -67,13 +67,13 @@ func (this *WelfareMgr) GetReliefFund(p *Player, isVideo bool) {
var add int64
coin := int64(sdata.Get) // 增加金币
p.WelfData.ReliefFundTimes += 1
award := PetMgrSington.GetAwardPetByWelf(p)
award := ModelMgrSingleton.GetAwardPetByWelf(p)
if award > 0 {
if isVideo { // 双倍领取,蝶女视频加成
gainWay = common.GainWay_ReliefFund2
rate = 2
add = int64(float64(coin*award*2) / 100.0)
roleGirl := PetMgrSington.GetRoleInfo(p, 2000001)
roleGirl := ModelMgrSingleton.GetRoleInfo(p, 2000001)
if roleGirl != nil && roleGirl.Level > 0 {
//蝶女加成
add += int64(float64(coin*int64(roleGirl.Award)*2) / 100.0)
@ -491,7 +491,7 @@ func (this *WelfareMgr) GetTurnplteVideo(p *Player) {
for _, d := range drawdates {
coin := d.Grade * 2
if d.Type == 1 { // 蝶女金币加成
roleGirl := PetMgrSington.GetRoleInfo(p, 2000001)
roleGirl := ModelMgrSingleton.GetRoleInfo(p, 2000001)
if roleGirl != nil && roleGirl.Level > 0 {
coin = int32(float64(coin) * float64(100+roleGirl.Award) / 100.0)
}
@ -545,7 +545,7 @@ func DrawWelfareDate(dates []*webapi_proto.WelfareDate, p *Player, gainWay int32
coin := int64(v.Grade)
add := int64(0)
if isVideo {
roleGirl := PetMgrSington.GetRoleInfo(p, 2000001)
roleGirl := ModelMgrSingleton.GetRoleInfo(p, 2000001)
if roleGirl != nil && roleGirl.Level > 0 /*|| !role.IsUsing*/ {
//蝶女加成
add = int64(float64(coin) * float64(roleGirl.Award) * 2 / 100.0)