hxp
2019-03-26 5ad2bd52bfbdf91a93ecf3a6c98c5e578edabb2b
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -636,21 +636,12 @@
    GameLogic_GodArea.GodAreaOnLogin(curPlayer)
#    # 采集NPC次数通知
    NPCCommon.SyncCollNPCTime(curPlayer)
#
#    # 特惠活动
#    PlayerTeHui.PlayerLogin_TeHui(curPlayer)
#
#    # 自定义商店
#    ShopItemManage.DoOnLogin(curPlayer)
#    
#    # 每日活跃度
    PlayerActivity.OnLogin(curPlayer)
#    
#    # 副本进入时间
    FBCommon.FBOnLogin(curPlayer)
#
#    #天梯竞技场
#    HighLadderTube.OnLogin(curPlayer)
#    
#    #世界等级
    PlayerWorldAverageLv.OnLogin(curPlayer)
@@ -1590,9 +1581,6 @@
    #防止玩家读取地图时未触发OnDay,读取地图后再次验证(2009.9.11)
    PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)
    
    #特惠活动事件
    #PlayerTeHui.PlayerLoadMapOK(curPlayer)
    #设置阵营
    if curPlayer.GetFaction() != ChConfig.CampType_Neutral \
                and FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) not in ChConfig.Def_MapID_NeedCamp:
@@ -1739,80 +1727,67 @@
#@return 返回值无意义
#@remarks //03 01 加属性点#tagCAddPoint
def AddPoint(index, tick):
    GameWorld.GetPsycoFunc(__Func_AddPoint)(index, tick)
    return
##//03 01 加属性点#tagCAddPoint
#@param index 玩家索引
#@param tick 时间戳
#@return 返回值无意义
#@remarks //03 01 加属性点#tagCAddPoint
def __Func_AddPoint(index, tick):
#// B2 06 玩家加点 #tagCMAddPoint
#
#struct    tagCMAddPoint
#{
#    tagHead         Head;
#    BYTE        PointAttrIDCount;    // 加点属性ID个数
#    BYTE        PointAttrIDList[PointAttrIDCount];    // 加点属性ID列表
#    WORD        PointValueList[PointAttrIDCount];    // 加点属性ID对应的点数列表
#};
def OnAddPoint(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerControl = PlayerControl.PlayerControl(curPlayer)
    #JobQuotiety = PlayerControl.JobQuotiety
    pointAttrIDList = clientData.PointAttrIDList
    pointValueList = clientData.PointValueList
    if not pointAttrIDList or not pointValueList or len(pointAttrIDList) != len(pointValueList):
        return
    needTotalPoint = 0
    for i, attrID in enumerate(pointAttrIDList):
        if not IpyGameDataPY.GetIpyGameData("RolePoint", attrID):
            return
        needTotalPoint += pointValueList[i]
    curFreePoint = curPlayer.GetFreePoint()
    #job = curPlayer.GetJob()
    recvAddPoint = IPY_GameWorld.IPY_CAddPoint()
    addValue = recvAddPoint.GetPoint()
    #检验是否能够加点
    if addValue < 1 or addValue > curFreePoint:
        #检验不通过, 返回
        #GameWorld.ErrLog("(%s,%s)检验是否能够加点,检验不通过, 返回"%(addValue,curFreePoint) , curPlayer.GetPlayerID())
    if needTotalPoint > curFreePoint:
        GameWorld.DebugLog("剩余点数不足! curFreePoint(%s) < needTotalPoint(%s)" % (curFreePoint, needTotalPoint))
        return
    
    #封包加点类型
    addPointType = recvAddPoint.GetType()
    #加点
    if addPointType == ShareDefine.Def_Effect_STR:
        curPlayer.SetBaseSTR(addValue + curPlayer.GetBaseSTR())
    curPlayer.SetFreePoint(curFreePoint - needTotalPoint)
    for i, attrID in enumerate(pointAttrIDList):
        addPoint = pointValueList[i]
        curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
        updPoint = curPoint + addPoint
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AddPointValue % attrID, updPoint)
        GameWorld.DebugLog("玩家加点: attrID=%s,curPoint=%s,addPoint=%s,updPoint=%s" % (attrID, curPoint, addPoint, updPoint))
        
    elif addPointType == ShareDefine.Def_Effect_PNE:
        curPlayer.SetBasePNE(addValue + curPlayer.GetBasePNE())
    elif addPointType == ShareDefine.Def_Effect_PHY:
        curPlayer.SetBasePHY(addValue + curPlayer.GetBasePHY())
    elif addPointType == ShareDefine.Def_Effect_CON:
        curPlayer.SetBaseCON(addValue + curPlayer.GetBaseCON())
    else:
        #异常超出边界
        GameWorld.ErrLog("AddPoint GetTypeErr = %s" % (addPointType) , curPlayer.GetID())
        return
    curPlayer.SetFreePoint(curFreePoint - addValue)
    DataRecordPack.DR_Freepoint(curPlayer, "AddPoint", curFreePoint, {"AddPointType":addPointType})
    playerControl.RefreshPlayerAttrState()
    NotifyPlayerBasePoint(curPlayer, pointAttrIDList)
    playerControl = PlayerControl.PlayerControl(curPlayer)
    playerControl.RefreshPlayerAttrState()
    return
def NotifyPlayerBasePoint(curPlayer):
    #上线通知基础属性点
    notifyList = []
    notifyBasePointDict = {
                 IPY_GameWorld.CDBPlayerRefresh_BaseSTR:'BaseSTR',
                 IPY_GameWorld.CDBPlayerRefresh_BasePHY:'BasePHY',
                 IPY_GameWorld.CDBPlayerRefresh_BaseCON:'BaseCON',
                 IPY_GameWorld.CDBPlayerRefresh_BasePNE:'BasePNE',
                }
    for refreshType, keyStr in notifyBasePointDict.items():
        notifyStruct = ChPyNetSendPack.tagRefreshType()
        notifyStruct.RefreshType = refreshType
        notifyStruct.Value = getattr(curPlayer, 'Get%s'%keyStr)()
        notifyList.append(notifyStruct)
def NotifyPlayerBasePoint(curPlayer, syncAttrIDList=[]):
    # 通知基础属性点,已分配的自由点数
    if not syncAttrIDList:
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        syncAttrIDList = [ipyDataMgr.GetRolePointByIndex(index).GetAttrID() for index in xrange(ipyDataMgr.GetRolePointCount())]
        
    #属性组合包 通知自己
    sendPack = ChPyNetSendPack.tagObjInfoListRefresh()
    sendPack.Clear()
    sendPack.ObjID = curPlayer.GetID()
    sendPack.ObjType = curPlayer.GetGameObjType()
    sendPack.Count = len(notifyList)
    sendPack.RefreshType = notifyList
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    pointAttrIDList = []
    pointValueList = []
    for attrID in syncAttrIDList:
        curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
        pointAttrIDList.append(attrID)
        pointValueList.append(curPoint)
    pointInfo = ChPyNetSendPack.tagMCRolePointInfo()
    pointInfo.PointAttrIDList = pointAttrIDList
    pointInfo.PointValueList = pointValueList
    pointInfo.PointAttrIDCount = len(pointAttrIDList)
    NetPackCommon.SendFakePack(curPlayer, pointInfo)
    return
#===============================================================================