| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Player.PlayerGreatMaster  | 
| #  | 
| # @todo:´óʦϵͳ  | 
| # @author hxp  | 
| # @date 2015-2-27  | 
| # @version 1.8  | 
| #  | 
| # @change: "2015-03-05 11:00" hxp ¸ù¾Ý´óʦµÈ¼¶»ñÈ¡´óʦËùÐèÉý¼¶¾Ñé  | 
| # @change: "2015-03-07 00:00" hxp Ì츳buffË¢ÊôÐÔʱ»úÐÞ¸Ä  | 
| # @change: "2015-03-07 04:10" ljd ±£´æ³É¹¦ÏµÍ³Ìáʾ  | 
| # @change: "2015-05-28 14:00" hxp Ë¢ÊôÐÔÓÅ»¯  | 
| # @change: "2015-07-29 15:20" xdh ´óʦ¸Ä³ÉµÈ¼¶¿ªÆô  | 
| # @change: "2015-08-24 14:40" zqx Ôö¼Ó·ÖÅäxµãÌ츳µã³É¾Í  | 
| # @change: "2016-01-26 15:00" hxp PY±íÖ§³ÖÖØ¶Á  | 
| # @change: "2016-06-02 20:00" hxp ¹¦ÄÜ¿ª·ÅÂß¼ÐÞ¸Ä  | 
| #  | 
| # ÏêϸÃèÊö: ´óʦϵͳ  | 
| #  | 
| #---------------------------------------------------------------------  | 
| #"""Version = 2016-06-02 20:00"""  | 
|   | 
| import GameWorld  | 
| import PyMapTable  | 
| import PlayerControl  | 
| import IPY_GameWorld  | 
| import PlayerBillboard  | 
| import ChPyNetSendPack  | 
| import DataRecordPack  | 
| import NetPackCommon  | 
| import ReadChConfig  | 
| import SkillCommon  | 
| import ShareDefine  | 
| import SkillShell  | 
| import BuffSkill  | 
| import ChConfig  | 
| import PlayerSuccess  | 
| import GameFuncComm  | 
| import IpyGameDataPY  | 
|   | 
| ## ´óʦ¹¦ÄÜÊÇ·ñ¿ªÆô  | 
| #  @param curPlayer  | 
| #  @return  | 
| def IsGreatMasterOpen(curPlayer):  | 
| #    curReinCnt = curPlayer.GetReincarnationLv() # µ±Ç°×ªÉú´ÎÊý  | 
| #    if curReinCnt < 3:  | 
| #        return False  | 
|       | 
|     if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_GreatMaster):  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
| ## Ôö¼Ó´óʦÌ츳µã  | 
| #  @param curPlayer  | 
| #  @return  | 
| def AddGreatMasterSkillPointByLV(curPlayer, addPoint):  | 
|     if not addPoint:  | 
|         return  | 
|     curFreeSkillPoint = GetGreatMasterFreeSkillPoint(curPlayer)  | 
|     #GameWorld.DebugLog("´óʦÌ츳µã£¡curFreeSkillPoint = %s"%curFreeSkillPoint)  | 
|     SetGreatMasterFreeSkillPoint(curPlayer, curFreeSkillPoint + addPoint)  | 
|     Sync_GreatMasterFreeSkillPoint(curPlayer)  | 
|     return  | 
|       | 
|       | 
| ## ×ªÉú´¦Àí  | 
| #  @param curPlayer  | 
| #  @return  | 
| def OnReincarnation(curPlayer):  | 
|     #Èç¹ûÊÇÂú¼¶µÄ£¬Ôò¶àÓà¾Ñé×ªÒÆµ½´óʦ¾Ñé  | 
|     isFullLV = curPlayer.GetLVEx() >= IpyGameDataPY.GetFuncCfg("PlayerMaxLV") # Íæ¼ÒÒÑÂú¼¶  | 
|       | 
|     if not isFullLV:  | 
|         return  | 
|       | 
|     curTotalExp = PlayerControl.GetPlayerTotalExp(curPlayer) # µ±Ç°¾Ñé  | 
|     PlayerControl.SetPlayerTotalExp(curPlayer, 0)  | 
|     AddGreatMasterExp(curPlayer, curTotalExp)  | 
|     return  | 
|   | 
| ## µÇ¼´¦Àí  | 
| #  @param curPlayer  | 
| #  @return  | 
| def MasterOnLogin(curPlayer):  | 
|     if not IsGreatMasterOpen(curPlayer):  | 
|         return  | 
|       | 
|     Sync_GreatMasterExp(curPlayer)  | 
|     Sync_GreatMasterFreeSkillPoint(curPlayer)  | 
|     return  | 
|   | 
| ## »ñÈ¡µ±Ç°´óʦ¾Ñé(²»Ëã¾ÑéµãµÄ)  | 
| def GetCurGreatMasterExp(curPlayer):  | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Master_Exp, 0, ChConfig.Def_PDictType_GreatMaster)  | 
|   | 
| ## ÉèÖõ±Ç°´óʦ¾Ñé(²»Ëã¾ÑéµãµÄ)  | 
| def SetCurGreatMasterExp(curPlayer, value):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Master_Exp, value, ChConfig.Def_PDictType_GreatMaster)  | 
|     return  | 
|   | 
| ## »ñÈ¡µ±Ç°´óʦ¾Ñéµã  | 
| def GetGreatMasterExpPoint(curPlayer):  | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Master_ExpPoint, 0, ChConfig.Def_PDictType_GreatMaster)  | 
|   | 
| ## ÉèÖõ±Ç°´óʦ¾Ñéµã  | 
| def SetGreatMasterExpPoint(curPlayer, value):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Master_ExpPoint, value, ChConfig.Def_PDictType_GreatMaster)  | 
|     return  | 
|   | 
| ## »ñÈ¡µ±Ç°´óʦ×ܾÑé(°üº¬¾Ñéµã)  | 
| def GetTotalGreatMasterExp(curPlayer):  | 
|     masterExp = GetCurGreatMasterExp(curPlayer)  | 
|     masterExpPoint = GetGreatMasterExpPoint(curPlayer)  | 
|     totalMasterExp = masterExpPoint * ChConfig.Def_PerPointValue + masterExp  | 
|     return totalMasterExp  | 
|   | 
| ## ÉèÖõ±Ç°´óʦ×ܾÑé(°üº¬¾Ñéµã)  | 
| def SetTotalGreatMasterExp(curPlayer, totalExp):  | 
|     curExp = totalExp % ChConfig.Def_PerPointValue  | 
|     expPoint = totalExp / ChConfig.Def_PerPointValue  | 
|       | 
|     # ¸üдóʦ¾Ñé¡¢¾Ñéµã  | 
|     SetCurGreatMasterExp(curPlayer, curExp)  | 
|     SetGreatMasterExpPoint(curPlayer, expPoint)  | 
|     #GameWorld.DebugLog("SetTotalGreatMasterExp totalExp=%s,expPoint=%s,curExp=%s"   | 
|     #                   % (totalExp, expPoint, curExp), curPlayer.GetPlayerID())  | 
|     Sync_GreatMasterExp(curPlayer)  | 
|     return  | 
|   | 
| ## »ñÈ¡µ±Ç°Ê£Óà´óʦ¼¼ÄÜµã  | 
| def GetGreatMasterFreeSkillPoint(curPlayer):  | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Master_FreeSkillPoint, 0, ChConfig.Def_PDictType_GreatMaster)  | 
|   | 
| ## ÉèÖõ±Ç°Ê£Óà´óʦ¼¼ÄÜµã  | 
| def SetGreatMasterFreeSkillPoint(curPlayer, value):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Master_FreeSkillPoint, value, ChConfig.Def_PDictType_GreatMaster)  | 
|     return  | 
|   | 
| ## ¸ù¾Ý´óʦµÈ¼¶»ñÈ¡Éý¼¶ËùÐè¾Ñé  | 
| #  @param masterLV: ´óʦµÈ¼¶  | 
| #  @return: -1-ÒÑÂú¼¶; >=0Éý¼¶ËùÐè¾Ñé  | 
| def GetTotalExpByGreatMasterLV(masterLV):  | 
|     masterExpTable = PyMapTable.GetPyMapTable("GreatMasterExp")  | 
|       | 
|     maxMasterLV = masterExpTable.GetRecordCount() - 1  | 
|       | 
|     if masterLV >= maxMasterLV:  | 
|         return -1  | 
|   | 
|     expInfoList = masterExpTable.GetRecordByIndex(masterLV)  | 
|     totalExp = int(expInfoList["Exp"])  | 
|       | 
|     return totalExp  | 
|   | 
| ## Ôö¼Ó´óʦµÈ¼¶¾Ñé  | 
| #  @param curPlayer  | 
| #  @param addExp  | 
| #  @return ÊÇ·ñ³É¹¦  | 
| def AddGreatMasterExp(curPlayer, addExp):  | 
|     # È¡Ïû´óʦµÈ¼¶  | 
|     return  | 
|     if not IsGreatMasterOpen(curPlayer):  | 
|         return False  | 
|       | 
|     #È¡µÃÈËÎﵱǰ¾Ñé  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     masterLV = curPlayer.GetLV2() # ´óʦµÈ¼¶, ´Ó0¼¶¿ªÊ¼  | 
|       | 
|     masterExpTable = PyMapTable.GetPyMapTable("GreatMasterExp")  | 
|       | 
|     maxMasterLV = masterExpTable.GetRecordCount() - 1  | 
|       | 
|     #GameWorld.DebugLog("Ôö¼Ó´óʦµÈ¼¶¾Ñé addExp=%s,masterLV=%s,maxMasterLV=%s"   | 
|     #                   % (addExp, masterLV, maxMasterLV), playerID)  | 
|       | 
|     if masterLV >= maxMasterLV:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_admin_825676")  | 
|         GameWorld.DebugLog("´óʦµÈ¼¶ÒÑÂú¼¶£¡", playerID)  | 
|         return False  | 
|       | 
|     curTotalMasterExp = GetTotalGreatMasterExp(curPlayer) + addExp  | 
|       | 
|     # ÏȼÓÔÙ´¦ÀíÉý¼¶  | 
|     SetTotalGreatMasterExp(curPlayer, curTotalMasterExp)  | 
|       | 
|     expInfoList = masterExpTable.GetRecordByIndex(masterLV)  | 
|     needExp = int(expInfoList["Exp"])  | 
|     if needExp <= 0:  | 
|         GameWorld.ErrLog("´óʦÉý¼¶ËùÐè¾ÑéÅäÖôíÎó£¡masterLV=%s,needExp=%s" % (masterLV, needExp), playerID)  | 
|         return True  | 
|       | 
|     #GameWorld.DebugLog("    expInfoList=%s,needExp=%s,curTotalMasterExp=%s"   | 
|     #                   % (str(expInfoList), needExp, curTotalMasterExp), playerID)  | 
|   | 
|     isLVUP = False  | 
|     while curTotalMasterExp >= needExp:  | 
|         isLVUP = True  | 
|         masterLV += 1  | 
|         curPlayer.SetLV2(masterLV)  | 
|         curTotalMasterExp -= needExp  | 
|         #GameWorld.DebugLog("    ´óʦµÈ¼¶Éý¼¶needExp=%s,nextMasterLV=%s,curTotalMasterExp=%s"   | 
|         #                   % (needExp, masterLV, curTotalMasterExp), playerID)  | 
|           | 
|         # ¸ø´óʦÌ츳µã  | 
|         addSkillPoint = int(expInfoList["AddSkillPoint"])  | 
|         curFreeSkillPoint = GetGreatMasterFreeSkillPoint(curPlayer)  | 
|         SetGreatMasterFreeSkillPoint(curPlayer, curFreeSkillPoint + addSkillPoint)  | 
|           | 
|         # Éý¼¶Á÷Ïò  | 
|         DataRecordPack.DR_PlayerMasterLVChange(curPlayer, curTotalMasterExp)  | 
|           | 
|         # Ñ»·Éý¼¶  | 
|         if masterLV >= maxMasterLV:  | 
|             GameWorld.DebugLog("    Ñ»·Éý¼¶´óʦµÈ¼¶ÒÑÂú¼¶£¡", playerID)  | 
|             break  | 
|           | 
|         expInfoList = masterExpTable.GetRecordByIndex(masterLV)  | 
|         needExp = int(expInfoList["Exp"])  | 
|         if needExp <= 0:  | 
|             GameWorld.DebugLog("    Ñ»·Éý¼¶ÏÂÒ»¼¶¾ÑéΪ0£¡masterLV=%s" % masterLV, playerID)  | 
|             break  | 
|           | 
|     # Éý¼¶´¦Àí  | 
|     if isLVUP:  | 
|         #GameWorld.DebugLog("    ´óʦÉý¼¶´¦Àí£¡", playerID)  | 
|         PlayerBillboard.UpdatePlayerLVBillboard(curPlayer)  | 
|           | 
|         #ÖØË¢ËùÓÐÊôÐÔ  | 
|         PlayerControl.PlayerControl(curPlayer).RefreshAllState()  | 
|           | 
|         #½«ÑªÉèÖÃΪ×î´ó  | 
|         curPlayer.SetHP(curPlayer.GetMaxHP())  | 
|         curPlayer.SetMP(curPlayer.GetMaxMP())  | 
|           | 
|         Sync_GreatMasterFreeSkillPoint(curPlayer)  | 
|           | 
|         # ¸üÐÂÊ£Óà×ܾÑé  | 
|         SetTotalGreatMasterExp(curPlayer, curTotalMasterExp)  | 
|     return True  | 
|   | 
| ## Í¬²½´óʦ¾Ñé  | 
| #  @param curPlayer  | 
| #  @return   | 
| def Sync_GreatMasterExp(curPlayer):  | 
|     masterExpPack = ChPyNetSendPack.tagMCGreatMasterExp()  | 
|     masterExpPack.Clear()  | 
|     masterExpPack.MasterExpPoint = GetGreatMasterExpPoint(curPlayer)  | 
|     masterExpPack.CurMasterEXP = GetCurGreatMasterExp(curPlayer)  | 
|     NetPackCommon.SendFakePack(curPlayer, masterExpPack)  | 
|     return  | 
|   | 
|   | 
| ## Í¬²½´óʦʣÓàÌ츳µã  | 
| #  @param curPlayer  | 
| #  @return   | 
| def Sync_GreatMasterFreeSkillPoint(curPlayer):  | 
|     #PlayerControl.NotifyPlayerDictValue(curPlayer, ChConfig.Def_PDict_Master_FreeSkillPoint)  | 
|     return  | 
|   | 
| #// A5 48 ¶Ò»»´óʦµÈ¼¶¾Ñé #tagCMExchangeMasterEXP  | 
| #  | 
| #struct    tagCMExchangeMasterEXP  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        Multiples;        // 20ÒÚ¾Ñé±¶Êý  | 
| #    DWORD        ExtraExp;    // ¶îÍ⸽¼Ó¾Ñé(²»³¬¹ý20ÒÚ)  | 
| #};  | 
| ## ¶Ò»»´óʦ¾Ñé  | 
| #  @param index: Íæ¼ÒË÷Òý  | 
| #  @param clientData: ·â°ü½á¹¹Ìå  | 
| #  @param tick: Ê±¼ä´Á  | 
| #  @return: None  | 
| def OnExchangeMasterExp(index, clientData, tick):  | 
|       | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     if not IsGreatMasterOpen(curPlayer):  | 
|         GameWorld.ErrLog("´óʦ¹¦ÄÜ먦Æô£¡²»Äܶһ»´óʦµÈ¼¶¾Ñ飡", curPlayer.GetPlayerID())  | 
|         return  | 
|       | 
|     exchangeExp = clientData.Multiples * ChConfig.Def_PerPointValue + clientData.ExtraExp  | 
|     curTotalExp = PlayerControl.GetPlayerTotalExp(curPlayer) # µ±Ç°¾Ñé  | 
|       | 
|     actualExchangeExp = min(curTotalExp, exchangeExp)  | 
|       | 
|     GameWorld.DebugLog("¶Ò»»´óʦµÈ¼¶¾ÑéExchangeExp=%s" % actualExchangeExp, curPlayer.GetPlayerID())  | 
|       | 
|     if actualExchangeExp <= 0:  | 
|         return  | 
|       | 
|     updTotalExp = curTotalExp - actualExchangeExp  | 
|     PlayerControl.SetPlayerTotalExp(curPlayer, updTotalExp)  | 
|     AddGreatMasterExp(curPlayer, actualExchangeExp)  | 
|     return  | 
|   | 
|   | 
| #// A5 49 ´óʦÌ츳¼¼Äܼӵã #tagCMAddMasterSkillPoint  | 
| #  | 
| #struct    tagCMMasterSkillPoint  | 
| #{  | 
| #    tagHead        Head;  | 
| #    DWORD        SkillID;        // Ì츳¼¼ÄÜID  | 
| #    BYTE        AddPoint;        // ¼ÓµÄµãÊý  | 
| #};  | 
| #  | 
| #struct    tagCMAddMasterSkillPoint  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        SkillCnt;        // ±ä¸ü¼¼ÄܸöÊý  | 
| #    tagCMMasterSkillPoint        AddSkillPointList[SkillCnt];    // ¼ÓµÄ¼¼ÄܵãÊýÁÐ±í  | 
| #};   | 
| ## ´óʦÌ츳¼¼ÄÜ¼Óµã  | 
| #  @param index: Íæ¼ÒË÷Òý  | 
| #  @param clientData: ·â°ü½á¹¹Ìå  | 
| #  @param tick: Ê±¼ä´Á  | 
| #  @return: None  | 
| def OnAddMasterSkillPoint(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     needAddSkillPointList = clientData.AddSkillPointList  | 
|       | 
|     if not needAddSkillPointList:  | 
|         return  | 
|       | 
|     reqTotalPointSkillDict = ReadChConfig.GetEvalChConfig("ReqTotalPointSkill")  | 
|     greatMasterSkillDict = ReadChConfig.GetEvalChConfig("GreatMasterSkill")  | 
|     jobType = ChConfig.JOB_TYPE_DICT[curPlayer.GetJob()]  | 
|       | 
|     if jobType not in greatMasterSkillDict:  | 
|         return  | 
|        | 
|     jobMasterSkillDict = greatMasterSkillDict[jobType] # ±¾Ö°ÒµÌ츳ϵ¶ÔÓ¦¼¼ÄÜ  | 
|     reqTotalPointSkillList = reqTotalPointSkillDict.get(jobType, []) # ±¾Ö°ÒµÐèÇó×ÜÌ츳µã¼¼ÄÜ  | 
|       | 
|     skillTypeSeriesDict = {} # ¼¼ÄܶÔÓ¦Ì츳ϵ  | 
|     skillTypeLVDict = {} # ¼¼ÄܶÔÓ¦µÈ¼¶  | 
|     seriesTotalPointDict = {} # Ì츳ϵ¶ÔÓ¦×ܼ¼ÄÜµã  | 
|     allSeriesTotalPoint = 0 # ËùÓÐÌ츳ϵ×ܵãÊý  | 
|       | 
|     # »ã×ÜÌ츳¼¼ÄÜËùÊôÌ츳ϵ  | 
|     for seriesType, skillTypeIDList in jobMasterSkillDict.items():  | 
|         for sTypeID in skillTypeIDList:  | 
|             skillTypeSeriesDict[sTypeID] = seriesType  | 
|               | 
|     skillManager = curPlayer.GetSkillManager()  | 
|       | 
|     # »ñÈ¡Íæ¼ÒĿǰËùÓм¼ÄÜ  | 
|     for i in range(skillManager.GetSkillCount()):  | 
|         playerSkill = skillManager.GetSkillByIndex(i)  | 
|         if playerSkill == None:  | 
|             continue  | 
|           | 
|         playerSkillTypeID = playerSkill.GetSkillTypeID()  | 
|           | 
|         for seriesType, skillTypeIDList in jobMasterSkillDict.items():  | 
|             if playerSkillTypeID not in skillTypeIDList:  | 
|                 continue  | 
|               | 
|             skillLV = playerSkill.GetSkillLV()  | 
|             skillTypeLVDict[playerSkillTypeID] = skillLV  | 
|             seriesTotalPointDict[seriesType] = seriesTotalPointDict.get(seriesType, 0) + skillLV  | 
|             allSeriesTotalPoint += skillLV  | 
|             break  | 
|       | 
|     isAddSkill = True  | 
|     isRefreshAttr = False  | 
|     buffType = IPY_GameWorld.btPassiveBuf  | 
|     addPointDict = {} # ÇëÇó¼Óµã¼¼ÄÜÒÑÖ´ÐмӵãÊý  | 
|       | 
|     GameWorld.DebugLog("¡¾Ì츳¼Óµã¡¿jobType=%s,¼¼ÄܶÔÓ¦µÈ¼¶=%s,Ì츳ϵ¶ÔÓ¦×ܼ¼Äܵã=%s,×ܵãÊý=%s"   | 
|                        % (jobType, skillTypeLVDict, seriesTotalPointDict, allSeriesTotalPoint))  | 
|       | 
|     while isAddSkill:  | 
|         # Ã¿´ÎÑ»·ÖØÖÃ״̬£¬Ö±µ½ÎÞ·¨ÔÙ¼Ó¼¼ÄܲÅÌø³ö  | 
|         isAddSkill = False  | 
|           | 
|         for addSkill in needAddSkillPointList:  | 
|             skillTypeID = addSkill.SkillID  | 
|             totalAddPoint = addSkill.AddPoint  | 
|               | 
|             freeSkillPoint = GetGreatMasterFreeSkillPoint(curPlayer)  | 
|             if freeSkillPoint <= 0:  | 
|                 GameWorld.DebugLog("    µ±Ç°ÎÞÊ£ÓàÌ츳µã£¡")  | 
|                 break  | 
|               | 
|             if skillTypeID not in skillTypeSeriesDict:  | 
|                 GameWorld.ErrLog("¼¼Äܲ»ÔںϷ¨Ì츳ϵÀskillTypeID=%s" % skillTypeID)  | 
|                 continue  | 
|               | 
|             curSeriesType = skillTypeSeriesDict[skillTypeID]  | 
|               | 
|             addPoint = addPointDict.get(skillTypeID, 0) # ¸Ã¼¼ÄÜÒÑÖ´ÐмӵãÊý  | 
|               | 
|             # ÒѾ´ïµ½ÇëÇó¼ÓµÄµãÊý£¬²»ÔÙ´¦Àí  | 
|             if addPoint >= totalAddPoint:  | 
|                 #GameWorld.DebugLog("    ÒѾ¼Óµ½ÇëÇó¼ÓµÄµãÊý£¬²»ÔÙ´¦Àí!skillTypeID=%s,addPoint=%s" % (skillTypeID, addPoint))  | 
|                 continue  | 
|               | 
|             curSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)  | 
|               | 
|             # Î´Ñ§Ï°  | 
|             if not curSkill:  | 
|                 learnSkillLV = 1  | 
|             # ÒÑѧϰ  | 
|             else:  | 
|                 curSkillLV = curSkill.GetSkillLV()  | 
|                 curSkillMaxLV = curSkill.GetSkillMaxLV()  | 
|                 if curSkillLV >= curSkillMaxLV:  | 
|                     GameWorld.DebugLog("    ¼¼ÄÜÒÑÂú¼¶£¡skillTypeID=%s" % (skillTypeID))  | 
|                     continue  | 
|                   | 
|                 learnSkillLV = curSkillLV + 1  | 
|                   | 
|             learnSkillData = GameWorld.GetGameData().FindSkillByType(skillTypeID, learnSkillLV)  | 
|               | 
|             if not learnSkillData:  | 
|                 GameWorld.ErrLog("ÕÒ²»µ½Ñ§Ï°¼¼ÄÜÊý¾Ý£ºskillTypeID=%s,skillLV=%s" % (skillTypeID, learnSkillLV))  | 
|                 continue  | 
|   | 
|             learnSkillID = learnSkillData.GetSkillID()  | 
|             skillLearnReq = learnSkillData.GetLearnSkillReq()  | 
|             skillLearnReqLV = learnSkillData.GetLearnSkillLV()  | 
|             skillLearnSeriesPointReq = learnSkillData.GetLearnSkillPointReq()  | 
|                   | 
|             # Ç°Öü¼ÄܵãÊýÐèÇó  | 
|             reqSkillLV = skillTypeLVDict.get(skillLearnReq, 0)  | 
|             if skillLearnReq > 0 and skillTypeLVDict.get(skillLearnReq, 0) < skillLearnReqLV:  | 
|                 #GameWorld.DebugLog("    Ç°Öü¼ÄܼӵãδÂú×㣡learnSkillID=%s,[ǰÖü¼ÄÜ%s µ±Ç°%sµã Ðè%sµã]"   | 
|                 #                   % (learnSkillID, skillLearnReq, reqSkillLV, skillLearnReqLV))  | 
|                 continue  | 
|               | 
|             # Ì츳ϵµãÊýÐèÇó  | 
|             if skillLearnSeriesPointReq > 0:  | 
|                 isReqAllPoint = skillTypeID in reqTotalPointSkillList # ÊÇ·ñÐèÇóËùÓÐϵ×ܵãÊý  | 
|                   | 
|                 # ÒѼÓ×ÜÌ츳µãÊý²»×ã  | 
|                 if isReqAllPoint and allSeriesTotalPoint < skillLearnSeriesPointReq:  | 
|                     #GameWorld.DebugLog("    ×ÜÌ츳µãÊý²»×ã!learnSkillID=%s,curPoint=%s,reqPoint=%s"   | 
|                     #                   % (learnSkillID, allSeriesTotalPoint, skillLearnSeriesPointReq))  | 
|                     continue  | 
|                   | 
|                 # ÒѼӱ¾ÏµÌ츳µãÊý²»×ã  | 
|                 curSeriesTotalPoint = seriesTotalPointDict.get(curSeriesType, 0)  | 
|                 if not isReqAllPoint and curSeriesTotalPoint < skillLearnSeriesPointReq:  | 
|                     #GameWorld.DebugLog("    ±¾ÏµÌ츳µãÊý²»×ã!learnSkillID=%s,curSeriesType=%s,curPoint=%s,reqPoint=%s"   | 
|                     #                   % (learnSkillID, curSeriesType, curSeriesTotalPoint, skillLearnSeriesPointReq))  | 
|                     continue  | 
|                   | 
|             # ¿É¼Óµã, ÏÂÃæÖ´Ðиü¼ÄÜ¼Óµã  | 
|             skillManager.LVUpSkillBySkillTypeID(skillTypeID)  | 
|             DataRecordPack.DR_LearnORUPSkill(curPlayer, skillTypeID, learnSkillLV)     | 
|               | 
|             # ÊDZ»¶¯¼¼ÄÜÒªÖØË¢ÊôÐÔ  | 
|             #if SkillCommon.isPassiveBuffSkill(learnSkillData):  | 
|             #    BuffSkill.AddBuffNoRefreshState(curPlayer, buffType, learnSkillData, tick, [], curPlayer)  | 
|             #    isRefreshAttr = True  | 
|                   | 
|             isAddSkill = True  | 
|               | 
|             addPointDict[skillTypeID] = addPoint + 1  | 
|             skillTypeLVDict[skillTypeID] = learnSkillLV  | 
|             seriesTotalPointDict[curSeriesType] = seriesTotalPointDict.get(curSeriesType, 0) + 1  | 
|             allSeriesTotalPoint += 1  | 
|             SetGreatMasterFreeSkillPoint(curPlayer, freeSkillPoint - 1)  | 
|             # ³É¾Í  | 
|             #successKey = ChConfig.Def_PDict_Success_CntValue%(ShareDefine.SuccType_TalentPoint, 0)  | 
|             #curSuccess = PlayerSuccess.GetPDictValue(curPlayer, successKey)  | 
|             #if curSuccess < allSeriesTotalPoint:  | 
|             #    PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_TalentPoint, 1)  | 
|               | 
|             #GameWorld.DebugLog("    ¼ÓÌ츳¼¼ÄÜ learnSkillID=%s,skillTypeID=%s,skillLV=%s,doCnt=%s,needCnt=%s"   | 
|             #                   % (learnSkillID, skillTypeID, learnSkillLV, addPoint + 1, totalAddPoint))  | 
|           | 
|         #GameWorld.DebugLog("    isAddSkill=%s" % isAddSkill)  | 
|                   | 
|     if isRefreshAttr:  | 
|         curControl = PlayerControl.PlayerControl(curPlayer)  | 
|         #curControl.CalcPassiveBuffAttr()  | 
|         curControl.RefreshPlayerAttrByBuff()  | 
|           | 
|     PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_224510")  | 
|     Sync_GreatMasterFreeSkillPoint(curPlayer)  | 
|     return  | 
|   | 
|   | 
| #// A5 50 ÖØÖôóʦÌ츳¼¼ÄÜ #tagCMResetMasterSkill  | 
| #  | 
| #struct    tagCMResetMasterSkill  | 
| #{  | 
| #    tagHead        Head;  | 
| #};   | 
| ## ÖØÖôóʦÌ츳¼¼ÄÜ  | 
| #  @param index: Íæ¼ÒË÷Òý  | 
| #  @param clientData: ·â°ü½á¹¹Ìå  | 
| #  @param tick: Ê±¼ä´Á  | 
| #  @return: None  | 
| def OnResetMasterSkill(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     ResetMasterSkillCost = ReadChConfig.GetEvalChConfig("ResetMasterSkillCost")  | 
|       | 
|     moneyType = IPY_GameWorld.TYPE_Price_Gold_Money  | 
|       | 
|     if not PlayerControl.HaveMoney(curPlayer, moneyType, ResetMasterSkillCost):  | 
|         return  | 
|       | 
|     if not DoResetMasterSkillPoint(curPlayer):  | 
|         return  | 
|       | 
|     # ¿Û³ýÏûºÄ  | 
|     PlayerControl.PayMoney(curPlayer, moneyType, ResetMasterSkillCost, ChConfig.Def_Cost_ResetGreatMasterSkill)  | 
|     return  | 
|   | 
| ## ÖØÖôóʦÌ츳¼¼ÄÜ  | 
| #  @param curPlayer  | 
| #  @return: ÊÇ·ñ³É¹¦  | 
| def DoResetMasterSkillPoint(curPlayer):  | 
|     greatMasterSkillDict = ReadChConfig.GetEvalChConfig("GreatMasterSkill")  | 
|     jobType = ChConfig.JOB_TYPE_DICT[curPlayer.GetJob()]  | 
|       | 
|     if jobType not in greatMasterSkillDict:  | 
|         return False  | 
|        | 
|     jobMasterSkillDict = greatMasterSkillDict[jobType] # ±¾Ö°ÒµÌ츳ϵ¶ÔÓ¦¼¼ÄÜ  | 
|       | 
|     freeSkillPoint = GetGreatMasterFreeSkillPoint(curPlayer)  | 
|     resetPoint = 0  | 
|       | 
|     skillManager = curPlayer.GetSkillManager()  | 
|       | 
|     isRefreshAttr = False  | 
|       | 
|     # »ã×ÜÌ츳¼¼ÄÜËùÊôÌ츳ϵ  | 
|     for skillTypeIDList in jobMasterSkillDict.values():  | 
|           | 
|         for skillTypeID in skillTypeIDList:  | 
|             curSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)  | 
|               | 
|             if not curSkill:  | 
|                 continue  | 
|               | 
|             curSkillLV = curSkill.GetSkillLV()  | 
|               | 
|             # ±»¶¯¼¼ÄÜË¢ÊôÐÔ  | 
|             if SkillCommon.isPassiveSkill(curSkill):  | 
|                 isRefreshAttr = True  | 
|               | 
|             resetPoint += curSkillLV  | 
|               | 
|             skillManager.DeleteSkillBySkillTypeID(skillTypeID)  | 
|               | 
|     if resetPoint <= 0:  | 
|         GameWorld.DebugLog("²»ÐèÒªÖØÖü¼ÄÜÌ츳£¡")  | 
|         return False  | 
|               | 
|     SetGreatMasterFreeSkillPoint(curPlayer, freeSkillPoint + resetPoint)  | 
|     Sync_GreatMasterFreeSkillPoint(curPlayer)  | 
|       | 
|     if isRefreshAttr:  | 
|         curControl = PlayerControl.PlayerControl(curPlayer)  | 
|         #curControl.CalcPassiveBuffAttr()  | 
|         curControl.RefreshPlayerAttrByBuff()  | 
|     return True  | 
|   |