| | |
| | | import PlayerGoldInvest
|
| | | import PlayerActivity
|
| | | import FBCommon
|
| | | import PlayerBindJadeWheel
|
| | | import BossHurtMng
|
| | | import PlayerWishingWell
|
| | | import PlayerAttrFruit
|
| | |
| | | import PlayerVip
|
| | | import PlayerRefineStove
|
| | | import PassiveBuffEffMng
|
| | | import PlayerDiceEx
|
| | | import GameLogic_XMZZ
|
| | | import PlayerFlashSale
|
| | | import PlayerFlashGiftbag
|
| | |
| | | import IPY_ServerDefine
|
| | | import CommFunc
|
| | | from PyMongoDB import RecvPackToMapDB
|
| | | import PyMongoMain
|
| | | import PlayerTalk
|
| | | import PlayerHero
|
| | | import PlayerOnline
|
| | | import TurnAttack
|
| | |
|
| | | import datetime
|
| | | import time
|
| | |
| | | #刷新人物日期状态
|
| | | #GameWorld.Log('PlayerEventCounter.UpdatePlayerLoginTime')
|
| | | PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)
|
| | | return
|
| | |
|
| | | ##非同一天二次登陆
|
| | | # @param curPlayer 玩家实例
|
| | | # @return None
|
| | | def NoteOtherDayLogin(curPlayer):
|
| | | #记录过或者未登陆过 不记录
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_OtherDayLogin) != 1:
|
| | | return
|
| | | |
| | | logoffTimeStr = curPlayer.GetLogoffTime().strip()
|
| | | loginTimeStr = curPlayer.GetLoginTime().strip()
|
| | | #curTimeStr = GameWorld.GetCurrentDataTimeStr()
|
| | | |
| | | #防范外部逻辑错误,或异常情况
|
| | | if logoffTimeStr in ['', '0'] or loginTimeStr in ['', '0']:
|
| | | return
|
| | | |
| | | logoffTimeDate = GameWorld.GetDateTimeByStr(logoffTimeStr.split()[0], ChConfig.TYPE_Time_Format_Day)
|
| | | |
| | | #同一天不记录
|
| | | if logoffTimeDate == GameWorld.GetDateTimeByStr(loginTimeStr.split()[0], ChConfig.TYPE_Time_Format_Day):
|
| | | return
|
| | | |
| | | #GameWorld.Log("OtherDayLogin offtime = %s" % logoffTimeDate)
|
| | | |
| | | DataRecordPack.DR_OtherDayLogin(curPlayer.GetAccID(), curPlayer.GetIP(), curPlayer)
|
| | | |
| | | #标记为已记录
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_OtherDayLogin, 2)
|
| | | |
| | | return
|
| | |
|
| | | #// A1 20 货币兑换 #tagCMMoneyExchange
|
| | |
| | | def DoPlayerLogin(curPlayer, tick):
|
| | | #这里只做初始化逻辑
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_LoadMapIsLogin, 1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RealLoginOK, 0) # 每次登录重置
|
| | |
|
| | | #通知时间
|
| | | Sync_PyServerDataTimeToClient(curPlayer)
|
| | |
| | | if PlayerControl.GetCrossMapID(curPlayer):
|
| | | PlayerControl.SetCrossMapID(curPlayer, 0)
|
| | |
|
| | | PlayerOnline.OnPlayerLogin(curPlayer)
|
| | | TurnAttack.OnPlayerLogin(curPlayer)
|
| | | SyncGuideState(curPlayer)
|
| | |
|
| | | #上线检查一次装备属性
|
| | |
| | |
|
| | | #通知玩家技能信息
|
| | | __Sync_ClientSkill(curPlayer)
|
| | | #清除国家答题Buff
|
| | | #PlayerExam.DoLogic_ExitExam(curPlayer, tick, needRefresh = False)
|
| | | #清除VIPbuff
|
| | | #BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_VIPExp_SkillTypeID, tick)
|
| | |
|
| | |
| | | PlayerPrestigeSys.OnLogin(curPlayer)
|
| | | #DataRecordPack.DR_PlayerLogin(curPlayer)
|
| | | EventReport.WriteEvent_login(curPlayer)
|
| | | |
| | | |
| | | __FirstLoginOnEnter(curPlayer)
|
| | | |
| | | # 合服首登处理
|
| | | __DoMixServerFirstLogin(curPlayer)
|
| | | PlayerBillboard.BillboardOnLogin(curPlayer)
|
| | |
|
| | | #非同一天二次登陆, 应该放在该函数中的SetLoginTime之后
|
| | | NoteOtherDayLogin(curPlayer)
|
| | | |
| | | #上线时通知脱机挂时被击杀的离线时间
|
| | | __Sync_PlayerOffline(curPlayer, tick)
|
| | |
|
| | |
| | | #---玩家上线, 宠物逻辑处理---
|
| | | PetControl.DoLogic_PetInfo_OnLogin(curPlayer, tick)
|
| | | PlayerPet.OnPlayerPetLogin(curPlayer)
|
| | | |
| | | __FirstLoginOnEnter(curPlayer)
|
| | |
|
| | | #清空玩家万能背包中的任务物品
|
| | | ItemControler.ClearPackEventItem(curPlayer, IPY_GameWorld.rptAnyWhere)
|
| | |
| | | FunctionNPCCommon.ShopItemOnLogin(curPlayer)
|
| | | # 通知设置的被动功法
|
| | | #PassiveBuffEffMng.OnLoginGFPassive(curPlayer)
|
| | | #我要太极
|
| | | PlayerDiceEx.DiceExOnLogin(curPlayer)
|
| | | #仙魔之争
|
| | | GameLogic_XMZZ.OnXMZZLogin(curPlayer)
|
| | | PlayerOnlinePrize.OnPlayerLogin(curPlayer)
|
| | |
| | | PlayerDogz.OnPlayerLogin(curPlayer)
|
| | | # 骑宠
|
| | | FamilyRobBoss.OnPlayerLogin(curPlayer)
|
| | | # 绑玉转盘
|
| | | PlayerBindJadeWheel.OnLogin(curPlayer)
|
| | | # 许愿池
|
| | | PlayerWishingWell.OnLogin(curPlayer)
|
| | | #幸运鉴宝
|
| | |
| | | 该函数为地图最终登录成功才会执行到,以后一些功能类的登录处理建议均写到这里
|
| | | 旧的功能先不动( __DoPlayerLoginServer 函数中的功能),如果有登录相关的bug再考虑是否移动到此函数
|
| | | '''
|
| | | |
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RealLoginOK):
|
| | | #切地图的不处理,切地图的也会触发该函数
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RealLoginOK, 1)
|
| | | GameWorld.Log("MapServer->DoPlayerRealLoginOK", curPlayer.GetPlayerID())
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | pass
|
| | |
|
| | | else:
|
| | | PyMongoMain.GetUserCtrlDB().OnPlayerLogin(curPlayer)
|
| | | PlayerHero.OnPlayerLogin(curPlayer)
|
| | | PlayerMail.OnPlayerLogin(curPlayer)
|
| | | PlayerChatBox.OnPlayerLogin(curPlayer)
|
| | | PlayerFace.OnPlayerLogin(curPlayer)
|
| | |
| | | return
|
| | |
|
| | | def __FirstLoginOnEnter(curPlayer):
|
| | | ## 首登处理,先return
|
| | | return
|
| | | ## 首登处理
|
| | | |
| | | playerID = curPlayer.GetID()
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FirstLogin):
|
| | | return
|
| | |
|
| | | GameWorld.Log('玩家是第一次进入游戏', playerID)
|
| | | # 特殊说明: 如果地图没有完全初始化好,客户端断开或者异常等情况会触发RunGateGameServerMapServerKickOutPlayerNoSave
|
| | |
| | | #---补满血满魔---
|
| | | GameObj.SetHP(curPlayer, GameObj.GetMaxHP(curPlayer))
|
| | | curPlayer.SetMP(curPlayer.GetMaxMP())
|
| | | |
| | | #---给予玩家新手物品---
|
| | |
|
| | | #默认触发一次功能开启
|
| | | if curPlayer.GetLV() == 1:
|
| | |
| | | #玩家默认恶名值
|
| | | curPlayer.SetInfamyValue(ChConfig.Def_FirstLogin_InfamyValue)
|
| | |
|
| | | #标记已登陆过,用于非同一天二次登陆
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_OtherDayLogin, 1)
|
| | | |
| | | #curPlayer.SetDict("ThunderLogin", 1)
|
| | | #记录第一次登陆
|
| | | DataRecordPack.DR_FirstLogin(curPlayer.GetAccID(), curPlayer.GetIP(), curPlayer)
|
| | |
| | | mailList = IpyGameDataPY.GetFuncEvalCfg("MailLVAward", 2)
|
| | | for mailTypeKey, mailItemList in mailList:
|
| | | PlayerControl.SendMailByKey(mailTypeKey, [curPlayer.GetPlayerID()], mailItemList)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FirstLogin, 1)
|
| | | return
|
| | |
|
| | | ## 合服首登处理
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def __DoMixServerFirstLogin(curPlayer):
|
| | | ## 合服首登处理
|
| | | isMixServer = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
|
| | | if not isMixServer:
|
| | | return
|
| | |
| | | if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
|
| | | #副本地图上线切换才加无敌buff
|
| | | SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_LimitSuperBuff, tick)
|
| | | |
| | | #刷新玩家的视野
|
| | | if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or PlayerControl.GetCustomMapID(curPlayer)):
|
| | | GameWorld.DebugLog("===登录本服地图时,处于跨服或自定义场景状态,不刷新视野!", curPlayer.GetPlayerID())
|
| | | |
| | | #卡牌改为0视野 |
| | | if curPlayer.GetSightLevel() != curPlayer.GetID():
|
| | | PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
|
| | | elif not GameWorld.IsCrossServer():
|
| | | realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
|
| | | if realmDifficulty:
|
| | | GameWorld.DebugLog("===登录本服地图时,处于境界难度地图,自动设置难度! realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
|
| | | PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
|
| | | |
| | | if curPlayer.GetSight() != 0:
|
| | | PlayerControl.SetSight(curPlayer, 0)
|
| | | #刷新玩家的视野
|
| | | #if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or PlayerControl.GetCustomMapID(curPlayer)):
|
| | | # GameWorld.DebugLog("===登录本服地图时,处于跨服或自定义场景状态,不刷新视野!", curPlayer.GetPlayerID())
|
| | | # PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
|
| | | #elif not GameWorld.IsCrossServer():
|
| | | # realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
|
| | | # if realmDifficulty:
|
| | | # GameWorld.DebugLog("===登录本服地图时,处于境界难度地图,自动设置难度! realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
|
| | | # PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
|
| | | |
| | | PlayerState.ChangePlayerSigh(curPlayer, tick)
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | |
| | | #初始化寻宝背包
|
| | | PlayerControl.Init_TreasurePack(curPlayer)
|
| | |
|
| | | #初始化英雄背包
|
| | | PlayerControl.Init_HeroPack(curPlayer)
|
| | | |
| | | #初始化神兽物品背包
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzItem)
|
| | | curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptDogzItem))
|
| | |
| | | #将玩家放置在这个地图上
|
| | | curPlayer.InitPos(curPlayer.GetPosX(), curPlayer.GetPosY())
|
| | |
|
| | | #刷新自己的视野
|
| | | if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene)):
|
| | | GameWorld.DebugLog("===本服LoadMapOK时玩家处于跨服或自定义场景状态,不设置可见!", curPlayer.GetPlayerID())
|
| | | #卡牌改为0视野
|
| | | if curPlayer.GetSightLevel() != curPlayer.GetID():
|
| | | PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
|
| | | elif not GameWorld.IsCrossServer():
|
| | | realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
|
| | | if realmDifficulty:
|
| | | GameWorld.DebugLog("===本服LoadMapOK时玩家处于境界难度地图,自动设置难度!realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
|
| | | PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
|
| | | |
| | | if curPlayer.GetSight() != 0:
|
| | | PlayerControl.SetSight(curPlayer, 0)
|
| | | #刷新自己的视野
|
| | | #if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene)):
|
| | | # GameWorld.DebugLog("===本服LoadMapOK时玩家处于跨服或自定义场景状态,不设置可见!", curPlayer.GetPlayerID())
|
| | | # PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
|
| | | #elif not GameWorld.IsCrossServer():
|
| | | # realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
|
| | | # if realmDifficulty:
|
| | | # GameWorld.DebugLog("===本服LoadMapOK时玩家处于境界难度地图,自动设置难度!realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
|
| | | # PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
|
| | | |
| | | curPlayer.RefreshView()
|
| | | curPlayer.SetVisible(True)
|
| | |
|
| | |
| | | def PlayerDisconnect(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_PlayerDisconnect)(index, tick)
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | ##记录新增有效登陆玩家,登陆10分钟以上玩家才算有效
|
| | | # @param curPlayer 玩家实例
|
| | | # @return None
|
| | | def NoteLoginValid(curPlayer):
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LoginValid) == 1:
|
| | | #已记录
|
| | | return
|
| | | |
| | | #计算时间, 当前减去登陆时间
|
| | | diffTime = GameWorld.GetCurrentTime() - GameWorld.GetDateTimeByStr(curPlayer.GetLoginTime().strip())
|
| | | |
| | | #10分钟以上才算有效玩家
|
| | | if diffTime.days == 0 and diffTime.seconds < 10 * 60:
|
| | | return
|
| | | |
| | | DataRecordPack.DR_LoginValid(curPlayer.GetAccID(), curPlayer.GetIP(), curPlayer)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_LoginValid, 1)
|
| | | return
|
| | |
|
| | |
|
| | | ##C++封包触发, 玩家下线
|
| | | #@param index 玩家索引
|
| | |
| | | #下线了,将存储在字典中的真实XP值,设置给玩家,完成通知和存储
|
| | | #curPlayer.SetXP(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue))
|
| | | #######################################################################
|
| | | PlayerOnline.OnPlayerLogoff(curPlayer)
|
| | | #下线逻辑
|
| | | PlayerControl.PlayerLeaveServer(curPlayer, tick)
|
| | |
|
| | |
| | |
|
| | | #流向记录玩家下线
|
| | | DataRecordPack.DR_PlayerDisconnect(curPlayer)
|
| | | |
| | | #记录新增有效登陆玩家
|
| | | NoteLoginValid(curPlayer)
|
| | |
|
| | | #VIP时间
|
| | | #PlayerVip.CalcVIPTimeByTick(curPlayer, tick, False)
|
| | |
| | | # WORD RealmDifficulty; //境界难度 = 1000 + 所选境界等级,如境界13,则发1013
|
| | | #};
|
| | | def OnSelectRealmDifficulty(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | PlayerControl.SetRealmDifficulty(curPlayer, clientData.RealmDifficulty)
|
| | | #curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | #PlayerControl.SetRealmDifficulty(curPlayer, clientData.RealmDifficulty)
|
| | | return
|
| | |
|