| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package PlayerControl  | 
| # @todo: Íæ¼Ò¿ØÖÆÆ÷  | 
| #  | 
| # @author: panwei  | 
| # @date 2010-02-16  | 
| # @version 2.6  | 
| #  | 
| # @change: "2011-02-23 14:20" panwei ÏµÍ³Ìáʾº¯ÊýÖØÐ´  | 
| # @change: "2011-07-15 19:30" Alee ¶ÓÎé֪ͨ  | 
| # @change: "2012-11-06 15:00" jiang ÐÂÔö¾ºÍþÍûÉèÖúͻñÈ¡ÍþÍûÉè½Ó¿Ú  | 
| # @change: "2012-11-07 17:30" wdb ÐÂÔö¿ç·þԤѡÈüÅÅλÐÅÏ¢  | 
| # @change: "2012-11-14 12:00" jiang ÐÞ¸ÄÀ©Õ¹ÊôÐÔ×ֶμǼµÄÊôÐÔÀàÐͱØÐëºÍMapServerÒ»Ö  | 
| # @change: "2013-12-27 13:30" xmnathan ÁÄÌì¼ÓGm±êʶ  | 
| # @change: "2014-02-28 21:10" hxp Ôö¼ÓÐÂÊÖÖ¸µ¼Ô±Âß¼  | 
| # @change: "2014-03-05 10:00" Alee ÁÄÌì֪ͨ±êʶ  | 
| # @change: "2014-11-12 20:00" hxp Ôö¼Ó֪ͨMapServerÔö¼Ó³É¾ÍÍê³É½ø¶È  | 
| # @change: "2015-07-14 21:00" xdh ÁÄÌìÐÅÏ¢Ô¸½¼ÓÖµ¸ÄΪExtras  | 
| # @change: "2015-10-28 00:00" hxp Ôö¼ÓÉèÖöÔÕ½·¿¼äID  | 
| # @change: "2015-11-05 12:00" hxp Ôö¼Ó¿ç·þÈ«·þ¹ã²¥  | 
| # @change: "2017-06-22 15:00" hxp ¿ç·þ¹ã²¥Ôö¼ÓÌõ¼þ¹ýÂË×Ó·þÊÇ·ñÌáÐÑ£»¿ç·þ·þÎñÆ÷È«·þ¹ã²¥Í¬²½×Ó·þ  | 
| #---------------------------------------------------------------------  | 
| #"""Version = 2017-06-22 15:00"""  | 
| #---------------------------------------------------------------------  | 
| import GameWorld  | 
| import PlayerDBOper  | 
| import IPY_GameServer  | 
| import PlayerDBGSEvent  | 
| import CrossChampionship  | 
| import IpyGameDataPY  | 
| import CrossRealmMsg  | 
| import ShareDefine  | 
| import PyGameData  | 
| import ChConfig  | 
| import types  | 
| #---------------------------------------------------------------------  | 
| #ϵͳÌáʾ²ÎÊýÁÐ±í  | 
| NotifyCodeList = IPY_GameServer.IPY_NotifyCodeList()  | 
| #---------------------------------------------------------------------  | 
| ## ÏûÏ¢Ìáʾ  | 
| #  @param curPlayer ÌáʾµÄÍæ¼Ò  | 
| #  @param msgMark ÌáʾÐÅÏ¢Mark  | 
| #  @param msgParamList ÐÅÏ¢²ÎÊýÁÐ±í  | 
| #  @return ÎÞ·µ»ØÖµ  | 
| #  @remarks   | 
| def NotifyCode(curPlayer, msgMark, msgParamList=[]):  | 
|     if curPlayer == None:  | 
|         GameWorld.ErrLog('NotifyCode Player = None')  | 
|         return  | 
|         | 
|     curPlayer.NotifyCode(msgMark, __GetNotifyCodeList(msgParamList))  | 
|     return  | 
|   | 
| def CrossNotifyCode(serverGroupID, playerID, msgMark, msgParamList=[]):  | 
|     NotifyCodeCross(serverGroupID, playerID, msgMark, msgParamList)  | 
|     return  | 
|   | 
| def NotifyCodeCross(serverGroupID, playerID, msgMark, msgParamList=[]):  | 
|     crossNotifyList = [{"Type":ShareDefine.CrossNotify_Player, "Params":[playerID, msgMark, msgParamList]}]  | 
|     CrossNotify([serverGroupID], crossNotifyList)  | 
|     return  | 
|   | 
| def WorldNotifyCross(serverGroupIDList, country, msgMark, msgParamList=[]):  | 
|     crossNotifyList = [GetCrossWorldNotifyInfo(country, msgMark, msgParamList)]  | 
|     CrossNotify(serverGroupIDList, crossNotifyList)  | 
|     return  | 
|   | 
| def GetCrossWorldNotifyInfo(country, msgMark, msgParamList=[]):  | 
|     return {"Type":ShareDefine.CrossNotify_World, "Params":[country, msgMark, msgParamList]}  | 
|   | 
| def GetCrossFamilyNotifyInfo(familyID, msgMark, msgParamList=[]):  | 
|     return {"Type":ShareDefine.CrossNotify_Family, "Params":[familyID, msgMark, msgParamList]}  | 
|   | 
| def CrossNotify(serverGroupIDList, crossNotifyList):  | 
|     ''' ¿ç·þ¹ã²¥ÐÅÏ¢Ìáʾ£¬Ö§³Öͬ²½¶àÌõ£¬Í¬Ê±Ò²½¨Òé¶àÌõÒ»Æðͬ²½  | 
|     @param serverGroupIDList: ÐèҪͬ²½µ½µÄÄ¿±ê·þÎñÆ÷×éIDÁÐ±í  | 
|     @param crossNotifyList: ÐÅÏ¢ÌáʾÁÐ±í£¬Í¨¹ý GetCrossWorldNotifyInfo GetCrossFamilyNotifyInfo º¯Êý»ñµÃ·µ»ØÖµÌí¼Óµ½ÁÐ±í  | 
|     '''  | 
|     CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Notify, crossNotifyList, serverGroupIDList)  | 
|     return  | 
|   | 
| def CrossNotifyEx(serverGroupIDList, crossNotifyList):  | 
|     ''' ¿ç·þ¹ã²¥ÐÅÏ¢Ìáʾ£¬Ö§³Öͬ²½¶àÌõ£¬Í¬Ê±Ò²½¨Òé¶àÌõÒ»Æðͬ²½  | 
|     @param serverGroupIDList: ÐèҪͬ²½µ½µÄÄ¿±ê·þÎñÆ÷×éIDÁÐ±í  | 
|     @param crossNotifyList: ÐÅÏ¢ÌáʾÁÐ±í£¬[[notifyType, paramsList, ×Ô¶¨ÒåÀ©Õ¹ÐÅÏ¢], ...]  notifyType Èç ShareDefine.CrossNotify_CrossAct  | 
|     '''  | 
|     CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Notify, crossNotifyList, serverGroupIDList)  | 
|     return  | 
|   | 
| def CrossServerMsg_Notify(crossNotifyList):  | 
|     GameWorld.DebugLog("ÊÕµ½¿ç·þͬ²½µÄ¹ã²¥ÌáʾÄÚÈÝ: count=%s" % len(crossNotifyList))  | 
|     for notifyInfo in crossNotifyList:  | 
|         if isinstance(notifyInfo, dict):  | 
|             if "Type" not in notifyInfo or "Params" not in notifyInfo:  | 
|                 continue  | 
|             notifyType = notifyInfo["Type"]  | 
|             params = notifyInfo["Params"]  | 
|         elif isinstance(notifyInfo, list) and len(notifyInfo) >= 2:  | 
|             notifyType, params = notifyInfo[:2]  | 
|         else:  | 
|             continue  | 
|           | 
|         if notifyType == ShareDefine.CrossNotify_World:  | 
|             country, msgMark, msgParamList = params  | 
|             openServerDayLimit = IpyGameDataPY.GetFuncCfg("CrossRealmCfg", 1)  | 
|             if msgMark.startswith("CrossBattlefield"):  | 
|                 openServerDayLimit = IpyGameDataPY.GetFuncCfg("CrossRealmCfg", 2)  | 
|             openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay) + 1  | 
|             if openServerDay < openServerDayLimit:  | 
|                 GameWorld.DebugLog("¿ª·þÌì²»×㣬²»´¦Àí¸Ã¿ç·þ¹ã²¥! openServerDay=%s < %s" % (openServerDay, openServerDayLimit))  | 
|                 continue  | 
|             WorldNotify(country, msgMark, msgParamList)  | 
|         elif notifyType == ShareDefine.CrossNotify_CrossAct:  | 
|             country, msgMark, msgParamList = params  | 
|             serverIDRangeList = notifyInfo[2]  | 
|             playerManager = GameWorld.GetPlayerManager()  | 
|             for i in xrange(playerManager.GetPlayerCount()):  | 
|                 curPlayer = playerManager.GetPlayerByIndex(i)  | 
|                 if curPlayer == None or not curPlayer.GetInitOK() or GetIsTJG(curPlayer):  | 
|                     continue  | 
|                 if not serverIDRangeList:  | 
|                     NotifyCode(curPlayer, msgMark, msgParamList)  | 
|                     return  | 
|                 playerServerID = GameWorld.GetPlayerServerID(curPlayer)  | 
|                 for serverIDA, serverIDB in serverIDRangeList:  | 
|                     if serverIDA <= playerServerID <= serverIDB:  | 
|                         NotifyCode(curPlayer, msgMark, msgParamList)  | 
|                         break  | 
|                       | 
|         elif notifyType == ShareDefine.CrossNotify_Family:  | 
|             familyID, msgMark, msgParamList = params  | 
|             FamilyNotify(familyID, msgMark, msgParamList)  | 
|         elif notifyType == ShareDefine.CrossNotify_Player:  | 
|             playerID, msgMark, msgParamList = params  | 
|             curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)  | 
|             if curPlayer:  | 
|                 NotifyCode(curPlayer, msgMark, msgParamList)  | 
|     return  | 
|       | 
| ## ÊÀ½ç¹ã²¥  | 
| #  @param country ÌáʾµÄ¹ú¼Ò  | 
| #  @param msgMark ÌáʾÐÅÏ¢Mark  | 
| #  @param msgParamList ÐÅÏ¢²ÎÊýÁÐ±í  | 
| #  @return ÎÞ·µ»ØÖµ  | 
| #  @remarks   | 
| def WorldNotify(country, msgMark, msgParamList=[]):  | 
|     GameWorld.GetPlayerManager().CountryNotifyCode(country, msgMark, __GetNotifyCodeList(msgParamList))  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ¼Ò×å¹ã²¥  | 
| #  @param familyID ÌáʾµÄ¼Ò×åID  | 
| #  @param msgMark ÌáʾÐÅÏ¢Mark  | 
| #  @param msgParamList ÐÅÏ¢²ÎÊýÁÐ±í  | 
| #  @return ÎÞ·µ»ØÖµ  | 
| #  @remarks   | 
| def FamilyNotify(familyID, msgMark, msgParamList=[]):  | 
|     GameWorld.GetPlayerManager().FamilyNotifyCode(familyID, msgMark, __GetNotifyCodeList(msgParamList))  | 
|     return  | 
|   | 
| ## ¶ÓÎé¹ã²¥  | 
| #  @param teamID ¶ÓÎéID  | 
| #  @param msgMark ÌáʾÐÅÏ¢Mark  | 
| #  @param msgParamList ÐÅÏ¢²ÎÊýÁÐ±í  | 
| #  @return ÎÞ·µ»ØÖµ  | 
| def TeamNotify(teamID, msgMark, msgParamList=[]):  | 
|     curTeam = GameWorld.GetGameWorld().GetTeamManager().FindTeam(teamID)  | 
|     if curTeam == None:  | 
|         return  | 
|       | 
|     for i in range(curTeam.GetMemberCount()):  | 
|         curPlayer = curTeam.GetMemberPlayer(i)  | 
|         if not curPlayer:  | 
|             continue  | 
|           | 
|         #֪ͨÿ¸ö¶ÓÔ±  | 
|         NotifyCode(curPlayer, msgMark, msgParamList)  | 
|       | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ¹¹½¨ÏµÍ³Ìáʾ²ÎÊýÁÐ±í  | 
| #  @param msgParamList ÐÅÏ¢²ÎÊýÁÐ±í  | 
| #  @return ÏµÍ³Ìáʾ²ÎÊýÁбí IPY_NotifyCodeList  | 
| #  @remarks   | 
| def __GetNotifyCodeList(msgParamList):  | 
|     #ÏûÏ¢ÌáʾÁбí, ÏÈÇåÔÚÌí¼Ó  | 
|     global NotifyCodeList  | 
|     NotifyCodeList.Clear()  | 
|       | 
|     if not msgParamList:  | 
|         return NotifyCodeList  | 
|       | 
|     for msg in msgParamList:  | 
|         itemPythonType = type(msg)  | 
|           | 
|         if itemPythonType is types.IntType or itemPythonType is types.LongType:  | 
|             #PythonÒªÑéÖ¤ÕûÐͺͳ¤ÕûÐÍ  | 
|             NotifyCodeList.AddInt(msg)  | 
|         else:  | 
|             NotifyCodeList.AddStr(msg)  | 
|   | 
|     return NotifyCodeList  | 
|   | 
| #------------------------------------------------------------------------------   | 
| def LoadDBPlayer():  | 
|     if GameWorld.IsCrossServer():  | 
|         return  | 
|     PlayerDBOper.FindDBOper(PlayerDBOper.Table_DBPlayer, {}, {"PlayerID":1, "AccID":1, "_id":0}, LoadDBPlayerRet)  | 
|     return  | 
|   | 
| def LoadDBPlayerRet(resultSetList, extendValueList):  | 
|     for resultDict in resultSetList:  | 
|         PyGameData.g_dbPlayerIDMap[resultDict["PlayerID"]] = resultDict["AccID"]  | 
|     GameWorld.Log("Æô¶¯·þÎñÆ÷¼ÓÔØDBPlayerÍæ¼ÒÕ˺ÅID¶ÔÓ¦¹ØÏµ! %s, %s" % (len(PyGameData.g_dbPlayerIDMap), PyGameData.g_dbPlayerIDMap))  | 
|     return  | 
|   | 
| def GetDBPlayerAccIDByID(playerID):  | 
|     ## »ñÈ¡Íæ¼Ò±íÕ˺ÅID - ¸ù¾ÝÍæ¼ÒID£¬ ¿ÉÓÃÓÚÅжÏÊÇ·ñ±¾·þÍæ¼Ò  | 
|     return PyGameData.g_dbPlayerIDMap.get(playerID, "")  | 
|   | 
| #waring:ÒÔÏÂʹÓõÄÀ©Õ¹ÊôÐÔ×ֶμǼµÄÊôÐÔÀàÐͱØÐëºÍMapServerÒ»Ö  | 
| #------------------------------------------------------------------------------   | 
| ## ÉèÖÃÍþÍû  | 
| #  @param curPlayer: Íæ¼ÒʵÀý  | 
| #  @param value: ÍþÍûÖµ  | 
| #  @return:   | 
| def SetPrestige(curPlayer, value):  | 
|     return  | 
|   | 
|   | 
| ## »ñÈ¡ÍþÍû  | 
| #  @param curPlayer: Íæ¼ÒʵÀý  | 
| #  @return: ÍþÍûÖµ  | 
| def GetPrestige(curPlayer):  | 
|     return 0  | 
|   | 
| ##×ÜÕ½¶·Á¦  | 
| def GetFightPower(curPlayer): return curPlayer.GetFightPowerEx() * ChConfig.Def_PerPointValue + curPlayer.GetFightPower()  | 
| def SetFightPower(curPlayer, value):  | 
|     curPlayer.SetFightPower(value % ChConfig.Def_PerPointValue, value / ChConfig.Def_PerPointValue)  | 
|     return  | 
|   | 
| #------------------------------------------------------------------------------   | 
| ## ÐÖúÄ¿±êÍæ¼ÒID  | 
| def SetAssistTagPlayerID(curPlayer, value):  | 
|     curPlayer.SetExAttr1(value)  | 
|     SetMapServerPlayerAttrValue(curPlayer, "SetAssistTagPlayerID", value)  | 
|     return  | 
| def GetAssistTagPlayerID(curPlayer): return curPlayer.GetExAttr1()  | 
|   | 
| ## ¸±±¾¹¦ÄÜÏß·ID  | 
| def SetFBFuncLineID(curPlayer, funcLineID): return curPlayer.SetExAttr3(funcLineID)  | 
| def GetFBFuncLineID(curPlayer): return curPlayer.GetExAttr3()  | 
|   | 
| ##VIPµ½ÆÚʱ¼ä  | 
| def GetVIPExpireTime(curPlayer): return 0  | 
| def SetVIPExpireTime(curPlayer, expireTime): return  | 
| def GetValidVIPLV(curPlayer):  | 
|     # @return: ·µ»Øµ±Ç°ÓÐЧµÄVIPµÈ¼¶  | 
| #    vipTime = GetVIPExpireTime(curPlayer)  | 
| #    curTime = GameWorld.ChangeTimeStrToNum(GameWorld.GetCurrentDataTimeStr())  | 
| #    if vipTime <= curTime:  | 
| #        return 0  | 
|     return curPlayer.GetVIPLv()  | 
|   | 
| ## ¸ù¾ÝÌØÈ¨ID ºÍ VIPµÈ¼¶»ñµÃÌØÈ¨Öµ  | 
| def GetPrivilegeValue(vipLV, privilegeID):  | 
|     if privilegeID not in ChConfig.VIPPrivilegeList:  | 
|         return 0  | 
|     vipMsg = IpyGameDataPY.GetIpyGameData('VipPrivilege', privilegeID)  | 
|     if not vipMsg:  | 
|         return 0  | 
|     return getattr(vipMsg, 'GetVIP%d' % vipLV)()  | 
|   | 
| ##ÁÄÌìÆøÅÝ¿ò  | 
| def GetChatBubbleBox(curPlayer): return curPlayer.GetExAttr10()  | 
| def SetChatBubbleBox(curPlayer, value): return curPlayer.SetExAttr10(value)  | 
|   | 
| ##Íæ¼ÒÖ÷¶¯Í˳öÏÉÃËʱ¼ä(<100´ú±íÍ˳ö´ÎÊý)  | 
| def SetLeaveFamilyTime(curPlayer, value, isSyncMap=True):  | 
|     curPlayer.SetExAttr12(value)  | 
|     if isSyncMap:  | 
|         sysMsg = '%s'%value  | 
|         curPlayer.MapServer_QueryPlayerResult(0, 0, "SetLeaveFamilyTime", sysMsg, len(sysMsg))  | 
|     return   | 
| def GetLeaveFamilyTime(curPlayer):return curPlayer.GetExAttr12()  | 
|   | 
| ## Íæ¼ÒËùÊô·þÎñÆ÷×éID  | 
| def GetPlayerServerGroupID(curPlayer): return curPlayer.GetExAttr13()  | 
| def SetPlayerServerGroupID(curPlayer, groupID): return curPlayer.SetExAttr13(groupID)  | 
|   | 
| ## ÊÇ·ñÍÑ»ú¹Ò»ú״̬  | 
| def GetIsTJG(curPlayer):  | 
|     if curPlayer.GetDictByKey(ChConfig.Def_OnlineType):  | 
|         return True  | 
|       | 
|     if curPlayer.GetIP() == "127.0.0.1":  | 
|         # ´Ë´¦Ö»ÄÜÓÃIPÅж¨£¬ÒòΪÍÑ»ú״̬»¹Î´Í¨Öªµ½GameServer  | 
|         return True  | 
|       | 
|     return False  | 
|   | 
| def SetIsTJG(curPlayer, state): curPlayer.SetDict(ChConfig.Def_OnlineType, state)  | 
| ## »ñÈ¡ÍÑ»ú¹Ò»úÊ£Óàʱ¼ä  | 
| def GetTJGTime(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_TJGTime)  | 
| def SetTJGTime(curPlayer, tjgTime): curPlayer.SetDict(ChConfig.Def_TJGTime, tjgTime)  | 
|   | 
| # ½ûÑÔ  | 
| def GetGMForbidenTalk(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_ForbiddenTalk)  | 
| def SetGMForbidenTalk(curPlayer, value): curPlayer.SetDict(ChConfig.Def_ForbiddenTalk, value)  | 
|   | 
| # Íæ¼ÒÕ˺Å״ֵ̬  | 
| def SetPlayerAccState(curPlayer, accState):  | 
|     #curPlayer.SetAccState(accState)  | 
|     curPlayer.SetExAttr17(accState)  | 
|     #ÐèÒªÁ¢¼´¸üÐÂDB  | 
|     PlayerDBOper.UpdateDBOper(PlayerDBOper.Table_DBPlayer, {"PlayerID":curPlayer.GetPlayerID()}, {"AccState":accState, "ExAttr17":accState})  | 
|     return  | 
|   | 
| #------------------------------------------------------------------------------   | 
|   | 
| def MapServer_QueryPlayer_DoLogic(tagPlayer, callName, cmdInfo, srcPlayerID=0, queryType=0):  | 
|     ## Í¨ÖªÄ¿±êÍæ¼ÒµØÍ¼Ö´ÐРDoLogic  | 
|     tagPlayerID = tagPlayer.GetPlayerID()  | 
|     tagMapID = tagPlayer.GetRealMapID()  | 
|     if tagMapID:  | 
|         cmdStr = str(cmdInfo)  | 
|         GameWorld.Log("MapServer_QueryPlayer_DoLogic: %s, cmdInfo=%s,tagPlayerID=%s,tagMapID=%s"   | 
|                       % (callName, cmdInfo, tagPlayerID, tagMapID), srcPlayerID)  | 
|         #MapServer_QueryPlayer(int srcPlayerID, int queryType, int queryID, int mapID, char *callName, char *cmd,WORD cmdLen, int RouteServerIndex)  | 
|         GameWorld.GetPlayerManager().MapServer_QueryPlayer(srcPlayerID, 0, tagPlayerID, tagMapID, callName,  | 
|                                                            cmdStr, len(cmdStr), tagPlayer.GetRouteServerIndex())  | 
|     return  | 
|   | 
| ## Ôö¼Ó³É¾ÍÍê³É½ø¶È  | 
| #  @param curPlayer  | 
| #  @param successType: ³É¾ÍÀàÐÍ  | 
| #  @param addCnt: Ôö¼Ó½ø¶ÈÖµ  | 
| #  @param condition: À©Õ¹Ìõ¼þ  | 
| #  @return  | 
| def DoAddSuccessProgress(curPlayer, successType, addCnt, condition=[]):  | 
|     if successType not in ShareDefine.SuccessTypeList:  | 
|         return  | 
|       | 
|     sysMsg = '%s'%([successType, addCnt, condition])  | 
|     curPlayer.MapServer_QueryPlayerResult(0, 0, "AddSuccessProgress", sysMsg, len(sysMsg))  | 
|     return  | 
|   | 
| ## ÉèÖÃÍæ¼Ò·¿¼äID  | 
| #  @param curPlayer  | 
| #  @param roomID  | 
| #  @return  | 
| def SetVsRoomId(curPlayer, roomID, isSetMergeRegRoomID=False):  | 
|     curPlayer.SetVsRoomId(roomID)  | 
|     if isSetMergeRegRoomID:  | 
|         curPlayer.SetDict(ChConfig.Def_PlayerKey_MergeRegisterRoomID, roomID)   | 
|     GameWorld.Log("SetVSRoomID playerID=%s, roomID=%s" % (curPlayer.GetPlayerID(), roomID))  | 
|     SetMapServerPlayerAttrValue(curPlayer, "SetVsRoomId", roomID)  | 
|     return  | 
|   | 
| ## ¿ç·þ״̬ËùÔÚµØÍ¼ID: 0-·Ç¿ç·þ״̬£¬·Ç0-¿ç·þ״̬¶ÔÓ¦µÄµØÍ¼ID  | 
| def GetCrossMapID(curPlayer): return curPlayer.GetExAttr5()  | 
| def SetCrossMapID(curPlayer, value, isNotifyMapServer=True):  | 
|     curPlayer.SetExAttr5(value)  | 
|     if isNotifyMapServer:  | 
|         SetMapServerPlayerAttrValue(curPlayer, "SetExAttr5", value)  | 
|     return  | 
|   | 
| def SetMapServerPlayerAttrValue(curPlayer, attrName, value, exData=[]):  | 
|     ## ÉèÖõØÍ¼·þÎñÆ÷Íæ¼Ò¶ÔÓ¦ÊôÐÔÖµ  | 
|     setAttrInfo = str([attrName, value] + exData)  | 
|     curPlayer.MapServer_QueryPlayerResult(0, 0, "SetPlayerAttr", setAttrInfo, len(setAttrInfo))  | 
|     return  | 
|   | 
| ## µØÍ¼·þÎñÆ÷¿ÛÎïÆ·  | 
| #  @param curPlayer  | 
| #  @param itemList [(itemID,count), (itemID,count),..]  | 
| def MapServerDelItem(curPlayer, itemList, eventName):  | 
|     result = str([itemList, eventName])  | 
|     curPlayer.MapServer_QueryPlayerResult(0, 0, "DelItem", result, len(result))  | 
|     return  | 
|   | 
| ## Ôö¼ÓÏÉÃË»îÔ¾  | 
| #  @param curPlayer  | 
| #  @param successType: ³É¾ÍÀàÐÍ  | 
| #  @param addCnt: Ôö¼Ó½ø¶ÈÖµ  | 
| #  @param condition: À©Õ¹Ìõ¼þ  | 
| #  @return  | 
| def DoAddFamilyActivity(curPlayer, actionid, addCnt):  | 
|     if actionid not in ShareDefine.FamilyActiveIDList:  | 
|         return  | 
|     sysMsg = '%s'%([actionid, addCnt])  | 
|     curPlayer.MapServer_QueryPlayerResult(0, 0, "AddFamilyActivity", sysMsg, len(sysMsg))  | 
|     return  | 
|   | 
| ## »ñÈ¡¹¦ÄÜÏÞÖÆµÈ¼¶(µÈ¼¶Ìõ¼þΪȫ¾Ö)  | 
| def GetFuncLimitLV(funcID):  | 
|     ipyData = IpyGameDataPY.GetIpyGameData("FuncOpenLV", funcID)  | 
|     if not ipyData:  | 
|         return 0  | 
|       | 
|     return ipyData.GetLimitLV()  | 
|   | 
| # ÒòΪMapServerÍæ¼ÒÊôÐÔ±ä¸ü֪ͨGameServerÓ빦ÄÜ¿ªÆô֪ͨ´¥·¢Ê±»úÓÐÏȺó˳Ðò£¬¿ÉÄܵ¼ÖÂÅжϹ¦ÄÜ¿ªÆô²»×¼È·£¬ËùÒÔÔÝʱ¼Ç¼¸ÃÐÅÏ¢£¬ÁÙʱÓà  | 
| g_playerOpenFuncInfo = {} # Íæ¼Ò´¥·¢¹¦ÄÜ¿ªÆô¹¦ÄÜIDÐÅÏ¢£¬{playerID:[funcID, ...], ...}  | 
| ## ¹¦ÄÜÊÇ·ñ¿ÉÓ㬸ú¯Êý²¢²»ÄÜÈ·±£°Ù·Ö°ÙÕýÈ·£¬Ö»ÄÜ´óÖÂÅжϣ¬½öÅжϲ¿·ÖÌõ¼þ£¬Èç°üº¬Î´ÅжϵÄÌõ¼þÔò²»ÄÜÈ·±£°Ù·Ö°ÙÕýÈ·  | 
| def GetFuncCanUse(curPlayer, funcID):  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     if playerID in g_playerOpenFuncInfo:  | 
|         if funcID in g_playerOpenFuncInfo[playerID]:  | 
|             return True  | 
|           | 
|     ipyData = IpyGameDataPY.GetIpyGameData("FuncOpenLV", funcID)  | 
|     if not ipyData:  | 
|         return False  | 
|       | 
|     if ipyData.GetLimitLV() and ipyData.GetLimitLV() > curPlayer.GetLV():  | 
|         return False  | 
|       | 
|     if ipyData.GetLimiRealmLV() and ipyData.GetLimiRealmLV() > curPlayer.GetOfficialRank():  | 
|         return False  | 
|       | 
|     if ipyData.GetLimitVIPLV() and ipyData.GetLimitVIPLV() > curPlayer.GetVIPLv():  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
| def DoFuncOpenLogic(curPlayer, funcIDList):  | 
|     global g_playerOpenFuncInfo  | 
|     if GameWorld.IsCrossServer():  | 
|         return  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     FuncOpenLogicDict = {  | 
|                          ShareDefine.GameFuncID_Championship:lambda curObj:CrossChampionship.DoChampionshipOpen(curObj),  | 
|                          }  | 
|     for funcID in funcIDList:  | 
|         if funcID in FuncOpenLogicDict:  | 
|             if playerID not in g_playerOpenFuncInfo:  | 
|                 g_playerOpenFuncInfo[playerID] = []  | 
|             openFuncIDList = g_playerOpenFuncInfo[playerID]  | 
|             if funcID not in openFuncIDList:  | 
|                 openFuncIDList.append(funcID)  | 
|             GameWorld.DebugLog("´¥·¢¹¦ÄÜ¿ªÆôÂß¼! funcID=%s" % funcID, playerID)  | 
|             FuncOpenLogicDict[funcID](curPlayer)  | 
|     return  | 
|   | 
|   |