xdh
2018-10-25 6366979426fccd97c0cb0bd384ada3a8b9843a24
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -62,9 +62,9 @@
import PlayerActivity
import PlayerTeHui
import FBCommon
import HighLadderTube
import PlayerBindJadeWheel
import BossHurtMng
import PlayerAction
import PlayerWishingWell
import PlayerAttrFruit
import PlayerSuccess
import PlayerDienstgrad
@@ -102,11 +102,13 @@
import PlayerTJG
import GameLogic_XMZZ
import GameLogic_SealDemon
import PlayerFlashSale
import PlayerFlashGiftbag
import PlayerCostRebate
import PlayerSpringSale
import PlayerFairyCeremony
import ChNetSendPack
import FamilyRobBoss
import PyGameData
import PlayerCoin
import PlayerGeTui
@@ -236,6 +238,7 @@
    curPlayer.SetDict(ChConfig.Def_PlayerKey_LoadMapIsLogin, 1)
    #通知时间
    Sync_PyServerDataTimeToClient(curPlayer)
    Sync_OpenServerDay(curPlayer)
    #通知玩家基本信息
    curPlayer.Sync_ClientPlayerLogin()
    
@@ -427,7 +430,7 @@
    # 古神禁地
    GameLogic_GodArea.GodAreaOnLogin(curPlayer)
#    # 采集NPC次数通知
#    NPCCommon.SyncCollNPCTime(curPlayer)
    NPCCommon.SyncCollNPCTime(curPlayer)
#        
#    # 特惠活动
#    PlayerTeHui.PlayerLogin_TeHui(curPlayer)
@@ -488,7 +491,8 @@
    PlayerSpringSale.OnPlayerLogin(curPlayer)
    #限时礼包
    PlayerFlashGiftbag.OnPlayerLogin(curPlayer)
    #限时抢购
    PlayerFlashSale.OnPlayerLogin(curPlayer)
#    # 消费VIP
#    PlayerCostVIP.CostVIPOnLogin(curPlayer, tick)
#    
@@ -538,6 +542,12 @@
    GameFuncComm.DoFuncOpenLogic(curPlayer)
    # 神兽
    PlayerDogz.OnPlayerLogin(curPlayer)
    # 骑宠
    FamilyRobBoss.OnPlayerLogin(curPlayer)
    # 绑玉转盘
    PlayerBindJadeWheel.OnLogin(curPlayer)
    # 许愿池
    PlayerWishingWell.OnLogin(curPlayer)
    # 上线查询一次充值订单
    curPlayer.SendDBQueryRecharge()
    
@@ -546,7 +556,10 @@
    tjgTime = PlayerTJG.GetTJGTime(curPlayer)
    if tjgTime:
        curPlayer.SendGameServerRefreshState(IPY_GameWorld.CDBPlayerRefresh_HappyPoint, tjgTime)
    # 如果被禁言的,上线同步前端
    if curPlayer.GetGMForbidenTalk():
        curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ForbidenTalk, curPlayer.GetGMForbidenTalk(), False)
    return
@@ -1842,6 +1855,7 @@
    curMap = GameWorld.GetMap()
    #校验客户端时间
    if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, clientWorldTick, client_StartX, client_StartY):
        curPlayer.Sync_ClientTick()
        return
    
    #移动点检查
@@ -3475,8 +3489,14 @@
        return
    
    mapID = curPlayer.GetMapID()
    activityLineID = 0 # 活动线, 默认1线
    activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
    if mapID in activityMapLineDict:
        activityLineID = max(0, activityMapLineDict[mapID] - 1)
    mapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 1)
    if mapID in mapLineDict and changLineID >= mapLineDict[mapID]:
    if changLineID != activityLineID and mapID in mapLineDict and changLineID >= mapLineDict[mapID]:
        GameWorld.ErrLog("该地图没有开放此线路,无法手动切换!mapID=%s,changLineID=%s,maxLine=%s" 
                         % (mapID, changLineID, mapLineDict[mapID]), curPlayer.GetID())
        return
@@ -3659,6 +3679,7 @@
    rebornTime = GetRebronTime(curPlayer, playerRebornType)    
    #冷却时间到了
    if not CanRebornByTimeOver(curPlayer, rebornTime):
        PlayerControl.NotifyCode(curPlayer, 'RebornCD')
        return False
    
    isFBReborn = False
@@ -4371,16 +4392,6 @@
        PlayerControl.NotifyCode(curPlayer, "04BBF813-7A30-47A8-927DE1ACCC4F378E")
        return
#===============================================================================
#    isFreedomTransBuff = SkillCommon.GetPlayerBuffBySkillTypeID(curPlayer, ShareDefine.Def_FreedomTransBuffID)
#    if not PlayerControl.IsPlayerInFight(curPlayer):
#
#        if (transportType == ChConfig.Def_Transport_Type_BigMap) or (not isFreedomTransBuff):
#            #传送支付处理
#
#            if not PayForTransport(curPlayer, transportType, isAutoBuy):
#                return
#===============================================================================
    #是任务传送,VIP等级不够,且传送符不足,不处理
    if transportType == ChConfig.Def_Transport_Type_Mission and \
       not TransportVipLvRestrict(curPlayer, transportType) and \
@@ -4482,12 +4493,6 @@
#  @param transportType 传送类型
#  @return 是否vip等级限制
def TransportVipLvRestrict(curPlayer, transportType):
    #大地图标记传送不能体验无限飞buff功能
    if transportType != ChConfig.Def_Transport_Type_BigMap:
        if SkillCommon.GetPlayerBuffBySkillTypeID(curPlayer, ShareDefine.Def_FreedomTransBuffID):
            #有无限飞buff
            return True
    return PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_FreeTransport)
@@ -4977,6 +4982,10 @@
    # 领取分包下载奖励
    elif rewardType == ChConfig.Def_RewardType_DownLoad:
        GetDownloadAward(curPlayer, dataEx)
    # 领取许愿池奖励
    elif rewardType == ChConfig.Def_RewardType_WishingWell:
        PlayerWishingWell.DoGetWishingAward(curPlayer)
#
#    # 充值豪礼奖励
#    elif rewardType == ShareDefine.Def_RewardType_GoldGift:
@@ -5217,6 +5226,56 @@
    return
## 地图NPC数量查询封包 A2 27 查询地图NPC数量信息 #tagCMQueryNPCCntInfo
#  @param curPlayer
#  @return None
def OnQueryMapNPCCntInfo(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    if not curPlayer:
        return
    # 查询间隔控制
    if not clientData.IsNoTimeLimit:
        if not GameWorld.CheckPlayerTick(curPlayer, ChConfig.TYPE_Player_Tick_QueryMapNPCInfo, tick):
            GameWorld.DebugLog("OnQueryMapNPCCntInfo 查询过于频繁!")
            return
    tagMapID = clientData.MapID
    tagLineID = clientData.LineID
    queryNPCStr = clientData.NPCIDList
    npcIDList = []
    if queryNPCStr:
        try:
            npcIDList = eval(clientData.NPCIDList)
        except BaseException:
            GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s" % clientData.NPCIDList)
            return
        if not isinstance(npcIDList, list):
            GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s is not list!" % str(npcIDList))
            return
    GameWorld.DebugLog("OnQueryMapNPCCntInfo tagMapID=%s,tagLineID=%s,npcIDList=%s"
                       % (tagMapID, tagLineID, str(npcIDList)))
    curMapID = GameWorld.GetMap().GetMapID()
    # 如果是同张地图,直接查询通知
    if curMapID == tagMapID:
        npcInfoDict = NPCCommon.GetNPCCntInfo(npcIDList, tick)
        GameWorld.DebugLog("    同地图查询curMapID=%s,tagLineID=%s,npcInfoDict=%s"
                           % (curMapID, tagLineID, str(npcInfoDict)))
        NPCCommon.SyncNPCCntInfo(curPlayer, tagMapID, npcInfoDict)
    else:
        # 请求GameServer目标地图NPC信息
        sendMsg = "%s" % str([tagMapID, tagLineID, npcIDList])
        curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_NPCCnt, 0,
                                 'NPCCnt', sendMsg, len(sendMsg))
    return
## 跨服赛报名状态
#  @param index 玩家索引
#  @param tick 当前时间
@@ -5261,6 +5320,29 @@
    NetPackCommon.SendFakePack(curPlayer, serverDateTime)
    return
## 通知开服天数
#  @param curPlayer: 玩家实例
#  @return: None
def Sync_OpenServerDay(curPlayer):
    serverTime = GameWorld.GetCurrentTime()
    if not serverTime:
        return
    gw = GameWorld.GetGameWorld()
    packData = ChPyNetSendPack.tagOpenServerDay()
    packData.Clear()
    packData.Day = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
    packData.IsMixServer = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
    packData.MixDay = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_MixServerDay)
    packData.OpenWeekday = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_OpenServerWeekday)
    packData.NowYear = serverTime.year
    packData.NowMonth = serverTime.month
    packData.NowDay = serverTime.day
    packData.NowHour = serverTime.hour
    packData.NowMinute = serverTime.minute
    packData.NowSecond = serverTime.second
    packData.NowMicSecond = serverTime.microsecond
    NetPackCommon.SendFakePack(curPlayer, packData)
    return
#===============================================================================
# //B4 09 玩家移动 # tagCMPyMove
@@ -5354,6 +5436,7 @@
    #校验客户端时间
    if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, sendPack_WorldTick, sendPack_SeverPosX, sendPack_SeverPosY):
        curPlayer.Sync_ClientTick()
        return False
    dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), sendPack_SeverPosX, sendPack_SeverPosY)
@@ -5454,4 +5537,17 @@
    sendPack.Clear()
    sendPack.Record = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DownloadAwardState)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
    return
def NotifyPlayerMove(curPlayer, posX, posY, npcID=0):
    '''通知前端向某个点移动
                这里前端可能需要针对某次移动做额外处理,比如移动到某个点后需要自动战斗等
                所以这里只做通知前端可以向某个点移动,最终移动由前端发起
    '''
    sendPack = ChPyNetSendPack.tagMCNotifyPlayerMove()
    sendPack.Clear()
    sendPack.PosX = posX
    sendPack.PosY = posY
    sendPack.NPCID = npcID
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return