记录注册ip
This commit is contained in:
parent
16fc31fbb0
commit
64577b5f2a
|
@ -13,6 +13,45 @@ import (
|
||||||
"mongo.games.com/game/protocol/webapi"
|
"mongo.games.com/game/protocol/webapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func HandleWGUpdateSkin(session *netlib.Session, packetId int, data interface{}) error {
|
||||||
|
logger.Logger.Trace("receive WGUpdateSkin")
|
||||||
|
msg, ok := data.(*server.WGUpdateSkin)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
|
||||||
|
if p == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
p.Skin.ModId = msg.GetId()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func HandleWGBuyRecTimeItem(session *netlib.Session, packetId int, data interface{}) error {
|
||||||
|
logger.Logger.Trace("receive WGBuyRecTimeItem")
|
||||||
|
if msg, ok := data.(*server.WGBuyRecTimeItem); ok {
|
||||||
|
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
|
||||||
|
if p != nil {
|
||||||
|
p.UpdateBuyRecTimeItem(msg.ExpireTime, msg.Diamond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}) error {
|
||||||
|
logger.Logger.Trace("receive WGPlayerLeaveGame")
|
||||||
|
if msg, ok := data.(*server.WGPlayerLeave); ok {
|
||||||
|
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
|
||||||
|
if p != nil {
|
||||||
|
scene := p.GetScene()
|
||||||
|
if scene != nil {
|
||||||
|
scene.PlayerLeave(p, common.PlayerLeaveReason_DropLine, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
//创建场景
|
//创建场景
|
||||||
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.PacketFactoryWrapper(func() interface{} {
|
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.PacketFactoryWrapper(func() interface{} {
|
||||||
|
@ -544,42 +583,3 @@ func init() {
|
||||||
// 修改皮肤
|
// 修改皮肤
|
||||||
netlib.Register(int(server.SSPacketID_PACKET_WG_UpdateSkin), server.WGUpdateSkin{}, HandleWGUpdateSkin)
|
netlib.Register(int(server.SSPacketID_PACKET_WG_UpdateSkin), server.WGUpdateSkin{}, HandleWGUpdateSkin)
|
||||||
}
|
}
|
||||||
|
|
||||||
func HandleWGUpdateSkin(session *netlib.Session, packetId int, data interface{}) error {
|
|
||||||
logger.Logger.Trace("receive WGUpdateSkin")
|
|
||||||
msg, ok := data.(*server.WGUpdateSkin)
|
|
||||||
if !ok {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
|
|
||||||
if p == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
p.Skin.ModId = msg.GetId()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func HandleWGBuyRecTimeItem(session *netlib.Session, packetId int, data interface{}) error {
|
|
||||||
logger.Logger.Trace("receive WGBuyRecTimeItem")
|
|
||||||
if msg, ok := data.(*server.WGBuyRecTimeItem); ok {
|
|
||||||
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
|
|
||||||
if p != nil {
|
|
||||||
p.UpdateBuyRecTimeItem(msg.ExpireTime, msg.Diamond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}) error {
|
|
||||||
logger.Logger.Trace("receive WGPlayerLeaveGame")
|
|
||||||
if msg, ok := data.(*server.WGPlayerLeave); ok {
|
|
||||||
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
|
|
||||||
if p != nil {
|
|
||||||
scene := p.GetScene()
|
|
||||||
if scene != nil {
|
|
||||||
scene.PlayerLeave(p, common.PlayerLeaveReason_DropLine, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -795,6 +795,9 @@ func (this *PlayerData) UpdateParams(params string) *PlayerParams {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if common.IsValidIP(pp.Ip) {
|
if common.IsValidIP(pp.Ip) {
|
||||||
this.Ip = pp.Ip
|
this.Ip = pp.Ip
|
||||||
|
if this.RegIp == "" {
|
||||||
|
this.RegIp = pp.Ip
|
||||||
|
}
|
||||||
} else if common.IsValidIP(this.RegIp) {
|
} else if common.IsValidIP(this.RegIp) {
|
||||||
this.Ip = this.RegIp
|
this.Ip = this.RegIp
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue