| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GameWorldActionTeHui  | 
| #  | 
| # @todo:ÌØ»Ý»î¶¯  | 
| # @author hxp  | 
| # @date 2014-06-21  | 
| # @version 1.7  | 
| #  | 
| # @change: "2014-09-28 17:30" hxp Ôö¼Ó³äÖµÅÅÐл´¦Àí  | 
| # @change: "2014-10-11 12:30" hxp ÐÞ¸´³äÖµÅÅÐн±ÀøÖ»ÄܸøÇ°Á½ÃûµÄbug  | 
| # @change: "2014-12-06 16:30" hxp Ôö¼ÓºÏ·þÕÛ¿ÛµêÖ§³Ö£¬Ôö¼ÓGMÖØÖÃÌØ»Ý»î¶¯Êý¾Ý(·½±ã²âÊÔ)  | 
| # @change: "2014-12-11 22:00" hxp ÐÞ¸Äͬ²½µØÍ¼ÕÛ¿Û״̬Âß¼(È¡²»µ½ÖµÊ±²ÅȡͨÓüǼÖеÄÖµ)  | 
| # @change: "2015-08-21 14:30" hxp Ôö¼Ó¼Ç¼ÉÏÒ»ÆÚ³äÖµÌØ»ÝÅÅÐаñ°ñµ¥ÐÅÏ¢  | 
| # @change: "2017-03-24 15:00" hxp Æô¶¯Ê±³õʼ»¯»î¶¯Êý¾Ý״ֵ̬  | 
| # @change: "2017-06-14 11:00" hxp »¹ÔÌØ»ÝÏû·Ñ·µÀû°ñ  | 
| #  | 
| # ÏêϸÃèÊö: Ìػݻ  | 
| #  | 
| #---------------------------------------------------------------------  | 
| """Version = 2017-06-14 11:00"""  | 
|   | 
| import GameWorld  | 
| import ShareDefine  | 
| import ChPyNetSendPack  | 
| import NetPackCommon  | 
| import GameWorldShopItem  | 
| import PlayerDBGSEvent  | 
| import PlayerCompensation  | 
| import PlayerBillboard  | 
| import DataRecordPack  | 
| import ReadChConfig  | 
| import ChConfig  | 
|   | 
| ## GMÖØÖÃÌØ»ÝÊý¾Ý£¬·½±ã²âÊÔ  | 
| #  @param None  | 
| #  @return None  | 
| def OnGMClearTeHui():  | 
|     # Çå³ý³äÖµÌØ»ÝÅÅÐаñ  | 
|     PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_RechargeTeHui)  | 
|     PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_RechargeTeHuiLast)  | 
|     # Çå³ýÏû·ÑÌØ»ÝÅÅÐаñ  | 
|     PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_CostTeHui)  | 
|     PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_CostTeHuiLast)  | 
|       | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     for dictName in ShareDefine.TeHuiTypeKeyDict.values():  | 
|       | 
|         beginTime, endTime = 0, 0  | 
|         signID = 0  | 
|         #DZ¹æÔò£ºÔÚChConfig»î¶¯Ïà¹ØÉèÖÃÖУ¬ÌáÈ¡ÁË×ÖµäÃû  | 
|         gameWorld.SetDict(dictName, signID)  | 
|         gameWorld.SetDict(ShareDefine.Def_Notify_WorldKey_DayAction_BeginTime % dictName, beginTime)  | 
|         gameWorld.SetDict(ShareDefine.Def_Notify_WorldKey_DayAction_EndTime % dictName, endTime)  | 
|         # ±ê¼Ç»î¶¯Î¨Ò»id  | 
|         actionIDKey = ShareDefine.Def_Notify_WorldKey_DayAction_ID % dictName  | 
|         gameWorld.SetDict(actionIDKey, beginTime)  | 
|           | 
|         #֪ͨMapserver,ÉèÖÃ×Öµä  | 
|         GameWorld.SendMapServerMsgEx(actionIDKey, beginTime)  | 
|         GameWorld.SendMapServerMsgEx(dictName, signID)  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(actionIDKey, beginTime)  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(dictName, signID)  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_DayAction_BeginTime % dictName, beginTime)  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_DayAction_EndTime % dictName, endTime)  | 
|           | 
|     PlayerDBGSEvent.DelDBGSTrig_ByKey(PlayerDBGSEvent.Def_TeHuiRepeatOrderKey)  | 
|     PlayerDBGSEvent.DelDBGSTrig_ByKey(PlayerDBGSEvent.Def_TeHuiRepeatNumKey)  | 
|     return  | 
|   | 
| def OnGameServerInitOK():  | 
|     # ¶ÁÈ¡Êý¾Ý¿âÖеÄÖµ³õʼ»¯µ½ÄÚ´æÖÐ  | 
|     GameWorld.Log("³õʼ»¯Ìػݻֵ...")  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     for dictName in ShareDefine.TeHuiTypeKeyDict.values():  | 
|         actionIDKey = ShareDefine.Def_Notify_WorldKey_DayAction_ID % dictName  | 
|         beginTimeKey = ShareDefine.Def_Notify_WorldKey_DayAction_BeginTime % dictName  | 
|         endTimeKey = ShareDefine.Def_Notify_WorldKey_DayAction_EndTime % dictName  | 
|           | 
|         actionValue = PlayerDBGSEvent.GetDBGSTrig_ByKey(dictName)  | 
|         actionID = PlayerDBGSEvent.GetDBGSTrig_ByKey(actionIDKey)  | 
|         beginTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(beginTimeKey)  | 
|         endTIme = PlayerDBGSEvent.GetDBGSTrig_ByKey(endTimeKey)  | 
|           | 
|         gameWorld.SetDict(dictName, actionValue)  | 
|         gameWorld.SetDict(actionIDKey, actionID)  | 
|         gameWorld.SetDict(beginTimeKey, beginTime)  | 
|         gameWorld.SetDict(endTimeKey, endTIme)  | 
|         GameWorld.Log("    dictName=%s,actionValue=%s,actionID=%s,beginTime=%s,endTIme=%s"   | 
|                       % (dictName, actionValue, actionID, beginTime, endTIme))  | 
|     return  | 
|   | 
| def OnMapServerInitOK():  | 
|     SendTeHuiActionInfo()  | 
|     return  | 
|   | 
| ## ·¢ËÍMapServerÌØ»Ý»î¶¯ÐÅÏ¢  | 
| #  @param None  | 
| #  @return None  | 
| def SendTeHuiActionInfo():  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     for actionKey in ShareDefine.TeHuiTypeKeyDict.values():  | 
|         actionIDKey = ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionKey  | 
|   | 
|         actionID = gameWorld.GetDictByKey(actionIDKey)  | 
|         actionValue = gameWorld.GetDictByKey(actionKey)  | 
|           | 
|         # Èç¹ûûÓÐÖµ£¬ÔòÈ¡¼Ç¼ÖеÄÖµ  | 
|         if actionID <= 0:  | 
|             actionID = PlayerDBGSEvent.GetDBGSTrig_ByKey(actionIDKey)  | 
|             actionValue = PlayerDBGSEvent.GetDBGSTrig_ByKey(actionKey)  | 
|               | 
|         GameWorld.SendMapServerMsgEx(actionIDKey, actionID)  | 
|         GameWorld.SendMapServerMsgEx(actionKey, actionValue)  | 
|     return  | 
|   | 
|   | 
| ## Ìػݻ±ä¸ü´¦Àí  | 
| #  @param dictName »î¶¯key  | 
| #  @param value Öµ  | 
| #  @return None  | 
| def OnTeHuiActionChange(dictName, value):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     actionIDKey = ShareDefine.Def_Notify_WorldKey_DayAction_ID % dictName  | 
|     startTimeKey = ShareDefine.Def_Notify_WorldKey_DayAction_BeginTime % dictName  | 
|     endTimeKey = ShareDefine.Def_Notify_WorldKey_DayAction_EndTime % dictName  | 
|     curActionID = gameWorld.GetDictByKey(actionIDKey)  | 
|     dbActionID = PlayerDBGSEvent.GetDBGSTrig_ByKey(actionIDKey)  | 
|     dbStartTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(startTimeKey)  | 
|     dbEndTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(endTimeKey)  | 
|     dbActionValue = PlayerDBGSEvent.GetDBGSTrig_ByKey(dictName)  | 
|           | 
|     # Èç¹û²»ÊÇͬһ»î¶¯ID£¬Ôò¸üб£´æ  | 
|     GameWorld.Log("OnTeHuiActionChange dictName=%s,value=%s,dbActionValue=%s,curActionID=%s,dbActionID=%s"   | 
|                        % (dictName, value, dbActionValue, curActionID, dbActionID))  | 
|     if curActionID != dbActionID:  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(actionIDKey, curActionID)  | 
|         curStartTime = gameWorld.GetDictByKey(startTimeKey)  | 
|         curEndTime = gameWorld.GetDictByKey(endTimeKey)  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(startTimeKey, curStartTime)  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(endTimeKey, curEndTime)  | 
|         PlayerDBGSEvent.SetDBGSTrig_ByKey(dictName, value)  | 
|         GameWorld.Log("    »î¶¯ID²»Ò»Ñù£¬¸üÐÂDBGSTrig...curActionID=%s,sTime=%s,eTime=%s,value=%s"   | 
|                       % (curActionID, curStartTime, curEndTime, value))  | 
|           | 
|         # Èç¹ûÊÇÕۿ۵꣬ÔòÐèÒªÖØÖÃÈ«·þÏÞ¹ºÊý¾Ý  | 
|         if dictName in [ShareDefine.Def_Notify_WorldKey_DayAction_DiscountShop,  | 
|                         ShareDefine.Def_Notify_WorldKey_DayAction_MixDiscountShop]:  | 
|             GameWorldShopItem.DoShopItemClearBuyCnt(value)  | 
|             GameWorld.Log("    ÕÛ¿ÛµêлID¿ªÆô£¬ÖØÖÃÈ«·þÏÞ¹º´ÎÊý£¡shopID=%s" % value)  | 
|           | 
|         # ³äÖµÅÅÐÐÌØ»Ý  | 
|         elif dictName == ShareDefine.Def_Notify_WorldKey_DayAction_RechargeRank:  | 
|             # ¿½±´ÕâÒ»ÆÚµÄ×îÖÕ½á¹û±¸µµ  | 
|             PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_RechargeTeHuiLast, ShareDefine.Def_BT_RechargeTeHui)  | 
|             DataRecordPack.DR_BillboardDataByDay(ShareDefine.Def_BT_RechargeTeHui)  | 
|             GameWorld.Log("    ³äÖµÅÅÐÐÌØ»Ý ¿½±´ÀúÊ·»î¶¯Êý¾Ý±¸µµ¡£¡£.")  | 
|             # ·¢Ëͽ±ÀøÓʼþ  | 
|             __DoSendRechargeRankTeHuiRewardMail(dbActionID, dbActionValue, dbStartTime, dbEndTime)  | 
|             GameWorld.Log("    ³äÖµÅÅÐÐÌØ»Ý ·¢Ëͽ±ÀøÓʼþ¡£¡£.")  | 
|             # Èç¹û¿ªÆôеÄÒ»ÆÚ£¬ÔòÖØÖÃÐÂÒ»ÆÚÅÅÐаñ  | 
|             if value > 0:  | 
|                 PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_RechargeTeHui)  | 
|                 GameWorld.Log("    ³äÖµÅÅÐÐÌØ»Ý ÖØÖÃÐÂÒ»ÆÚÅÅÐаñ¡£¡£.")  | 
|           | 
|         # Ïû·ÑÌØ»ÝÅÅÐаñ  | 
|         elif dictName == ShareDefine.Def_Notify_WorldKey_DayAction_CostRank:  | 
|             # ¿½±´ÕâÒ»ÆÚµÄ×îÖÕ½á¹û±¸µµ  | 
|             PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_CostTeHuiLast, ShareDefine.Def_BT_CostTeHui)  | 
|             DataRecordPack.DR_BillboardDataByDay(ShareDefine.Def_BT_CostTeHui)  | 
|             __DoSendCostRankTeHuiRewardMail(dbActionID, dbActionValue, dbStartTime, dbEndTime)  | 
|             if value > 0:  | 
|                 PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_CostTeHui)  | 
|                   | 
|     Sync_TeHuiActivityToClient(None, 0)  | 
|     return  | 
|   | 
| ## Ö´Ðз¢ËÍÏû·ÑÌØ»ÝÅÅÐаñÓʼþ  | 
| #  @param None  | 
| #  @return None  | 
| def __DoSendCostRankTeHuiRewardMail(dbActionID, dbActionValue, dbStartTime, dbEndTime):  | 
|     GameWorld.Log("Ö´Ðз¢ËÍÏû·ÑÌØ»ÝÅÅÐаñÓʼþ...dbActionID=%s,dbActionValue=%s,dbStartTime=%s,dbEndTime=%s"   | 
|                   % (dbActionID, dbActionValue, dbStartTime, dbEndTime))  | 
|     # ·¢Ëͽ±ÀøÓʼþ  | 
|     billboard = GameWorld.GetBillboard().FindBillboard(ShareDefine.Def_BT_CostTeHui)  | 
|     if not billboard:  | 
|         GameWorld.ErrLog("    ÕÒ²»µ½Ïû·ÑÌØ»ÝÅÅÐаñ!!!")  | 
|         return  | 
|       | 
|     costRankInfoDict = ReadChConfig.GetEvalChConfig("TeHuiAction_CostRank")  | 
|       | 
|     if dbActionValue not in costRankInfoDict:  | 
|         GameWorld.ErrLog("    »î¶¯±àºÅ²»ÔÚÅÅÐн±ÀøÅäÖÃÀ±àºÅ=%s" % (dbActionValue))  | 
|         return  | 
|       | 
|     costRankInfoList = costRankInfoDict[dbActionValue]  | 
|       | 
|     if len(costRankInfoList) < 5:  | 
|         GameWorld.ErrLog("    ÅÅÐн±ÀøÅäÖÃÐÅÏ¢´íÎó!!!")  | 
|         return  | 
|       | 
|     startTimeStr = GameWorld.ChangeTimeNumToStr(dbStartTime)  | 
|     endTimeStr = GameWorld.ChangeTimeNumToStr(dbEndTime)  | 
|     rewardMailInfoList = costRankInfoList[1:]  | 
|     mailTitle, contentTemple, getDays, rewardDict = rewardMailInfoList  | 
|     mailLimitTime = str(GameWorld.GetDatetimeByDiffDays(getDays))  | 
|     mailLimitTime = mailLimitTime.split(".")[0]  | 
|       | 
|     billboardCnt = billboard.GetCount()  | 
|     #maxOrder = max(rewardDict)  | 
|     for index in range(0, billboardCnt):  | 
|         #if index < 0 or index >= billboardCnt:  | 
|         #    continue  | 
|           | 
|         objBillboard = billboard.At(index)  | 
|         playerID = objBillboard.GetID()  | 
|         curJob = objBillboard.GetType2()  | 
|         curJobType = ChConfig.JOB_TYPE_DICT.get(curJob) # »ñȡְҵ´óÀà  | 
|         jobRewardDict = __GetAwardByJob(curJobType, rewardDict)  | 
|          | 
|         if not jobRewardDict:  | 
|             GameWorld.ErrLog("Ïû·ÑÅÅÐÐÌØ»Ý ·¢Ëͽ±Àø£¬ÕÒ²»µ½Ö°Òµ¶ÔÓ¦½±ÀøÅäÖÃ, jobType=%s" % curJobType)  | 
|             continue  | 
|           | 
|         order = index + 1  | 
|           | 
|         rewardItemList = GameWorld.GetDictValueByRangeKey(jobRewardDict, order)  | 
|         if not rewardItemList:  | 
|             GameWorld.ErrLog("Ïû·ÑÅÅÐÐÌØ»Ý ·¢Ëͽ±Àø£¬order=%s not in jobRewardDict=%s" % (order, str(jobRewardDict)))  | 
|             continue  | 
|           | 
|         mailContent = contentTemple % (startTimeStr, endTimeStr, order)  | 
|         GUID = PlayerCompensation.SendPersonalItemMail(mailTitle, mailContent, mailLimitTime, [playerID], rewardItemList)  | 
|         DataRecordPack.DR_SendCostRankTeHuiRewardMail(playerID, GUID, dbActionID, dbActionValue, order, rewardItemList)  | 
|           | 
|     return  | 
|       | 
| ## Ö´Ðз¢ËͳäÖµÅÅÐн±ÀøÓʼþ  | 
| #  @param None  | 
| #  @return None  | 
| def __DoSendRechargeRankTeHuiRewardMail(dbActionID, dbActionValue, dbStartTime, dbEndTime):  | 
|     GameWorld.Log("Ö´Ðз¢ËͳäÖµÅÅÐн±ÀøÓʼþ...dbActionID=%s,dbActionValue=%s,dbStartTime=%s,dbEndTime=%s"   | 
|                   % (dbActionID, dbActionValue, dbStartTime, dbEndTime))  | 
|     # ·¢Ëͽ±ÀøÓʼþ  | 
|     billboard = GameWorld.GetBillboard().FindBillboard(ShareDefine.Def_BT_RechargeTeHui)  | 
|     if not billboard:  | 
|         GameWorld.ErrLog("    ÕÒ²»µ½³äÖµÅÅÐаñ!!!")  | 
|         return  | 
|       | 
|     RechargeRankInfoDict = ReadChConfig.GetEvalChConfig("TeHuiAction_RechargeRank")  | 
|       | 
|     if dbActionValue not in RechargeRankInfoDict:  | 
|         GameWorld.ErrLog("    »î¶¯±àºÅ²»ÔÚÅÅÐн±ÀøÅäÖÃÀ±àºÅ=%s" % (dbActionValue))  | 
|         return  | 
|       | 
|     rechargeRankInfoList = RechargeRankInfoDict[dbActionValue]  | 
|       | 
|     if len(rechargeRankInfoList) < 5:  | 
|         GameWorld.ErrLog("    ÅÅÐн±ÀøÅäÖÃÐÅÏ¢´íÎó!!!")  | 
|         return  | 
|       | 
|     startTimeStr = GameWorld.ChangeTimeNumToStr(dbStartTime)  | 
|     endTimeStr = GameWorld.ChangeTimeNumToStr(dbEndTime)  | 
|     rewardMailInfoList = rechargeRankInfoList[1:]  | 
|     mailTitle, contentTemple, getDays, rewardDict = rewardMailInfoList  | 
|     mailLimitTime = str(GameWorld.GetDatetimeByDiffDays(getDays))  | 
|     mailLimitTime = mailLimitTime.split(".")[0]  | 
|       | 
|     billboardCnt = billboard.GetCount()  | 
|     #maxOrder = max(rewardDict)  | 
|     for index in range(0, billboardCnt):  | 
|         #if index < 0 or index >= billboardCnt:  | 
|         #    continue  | 
|           | 
|         objBillboard = billboard.At(index)  | 
|         playerID = objBillboard.GetID()  | 
|         curJob = objBillboard.GetType2()  | 
|         curJobType = ChConfig.JOB_TYPE_DICT.get(curJob) # »ñȡְҵ´óÀà  | 
|         jobRewardDict = __GetAwardByJob(curJobType, rewardDict)  | 
|          | 
|         if not jobRewardDict:  | 
|             GameWorld.ErrLog("³äÖµÅÅÐÐÌØ»Ý ·¢Ëͽ±Àø£¬ÕÒ²»µ½Ö°Òµ¶ÔÓ¦½±ÀøÅäÖÃ, jobType=%s" % curJobType)  | 
|             continue  | 
|           | 
|         order = index + 1  | 
|           | 
|         rewardItemList = GameWorld.GetDictValueByRangeKey(jobRewardDict, order)  | 
|         if not rewardItemList:  | 
|             GameWorld.ErrLog("³äÖµÅÅÐÐÌØ»Ý ·¢Ëͽ±Àø£¬order=%s not in jobRewardDict=%s" % (order, str(jobRewardDict)))  | 
|             continue  | 
|           | 
|         mailContent = contentTemple % (startTimeStr, endTimeStr, order)  | 
|         GUID = PlayerCompensation.SendPersonalItemMail(mailTitle, mailContent, mailLimitTime,   | 
|                                                         [playerID], rewardItemList)  | 
|         DataRecordPack.DR_SendRechareRankTeHuiRewardMail(playerID, GUID, dbActionID,   | 
|                                                          dbActionValue, order, rewardItemList)  | 
|           | 
|     return  | 
|   | 
| ## ¸ù¾ÝÖ°Òµ»ñÈ¡½±Àø  | 
| #  @param curPlayer£ºÍæ¼ÒʵÀý  | 
| #  @param qqRewardDict£º½±ÀøÎïÆ·ÅäÖÃ×Öµä  | 
| #  @return None  | 
| def __GetAwardByJob(jobtype, rewardDict):  | 
|     if jobtype in rewardDict:  | 
|         return rewardDict[jobtype]  | 
|     infoKey = () # Ä¬ÈÏkey  | 
|     for jobkey in rewardDict.keys():  | 
|         # Èç¹ûÍæ¼ÒÖ°ÒµÔÚÅäÖõÄkeyÀÔòȡָ¶¨µÄkeyÐÅÏ¢  | 
|         if isinstance(jobkey, tuple) and jobtype in jobkey:  | 
|             infoKey = jobkey  | 
|             break  | 
|     return rewardDict.get(infoKey)  | 
|       | 
| ## ²éÑ¯ÌØ»Ý»î¶¯ÐÅÏ¢  | 
| #  @param index Íæ¼ÒʵÀý  | 
| #  @param clientData ·â°ü½á¹¹Ìå  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return None  | 
| def ClientRequestTeHuiActivity(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     activityType = clientData.ActivityType      | 
|     GameWorld.DebugLog("ClientRequestTeHuiActivity activityType=%s" % activityType)  | 
|     Sync_TeHuiActivityToClient(curPlayer, activityType)  | 
|     return  | 
|   | 
|   | 
| ## Í¬²½ÌػݻÐÅÏ¢  | 
| #  @param curPlayer   | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return None  | 
| def Sync_TeHuiActivityToClient(curPlayer, activityType):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|       | 
|     tehuiPack = ChPyNetSendPack.tagGCTeHuiActivityInfoList()  | 
|     tehuiPack.Clear()  | 
|     tehuiPack.ActivityInfoList = []  | 
|       | 
|     for teHuiType, dictKey in ShareDefine.TeHuiTypeKeyDict.items():  | 
|           | 
|         if activityType not in [0, teHuiType]:  | 
|             continue  | 
|           | 
|         tehuiInfo = ChPyNetSendPack.tagGCTeHuiActivityInfo()  | 
|         tehuiInfo.Clear()  | 
|         tehuiInfo.ActivityType = teHuiType  | 
|         tehuiInfo.ActivityValue = gameWorld.GetDictByKey(dictKey)  | 
|         startTime = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_BeginTime % dictKey)  | 
|         tehuiInfo.StartDate = startTime  | 
|         endTime = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_EndTime % dictKey)  | 
|         tehuiInfo.EndDate = endTime  | 
|         tehuiPack.ActivityInfoList.append(tehuiInfo)  | 
|       | 
|     tehuiPack.ActivityCount = len(tehuiPack.ActivityInfoList)  | 
|       | 
|     # Í¨Öª¿Í»§¶Ëͬ²½Ê±¼ä          | 
|     if not curPlayer:  | 
|         # È«·þ¹ã²¥ÔÚÏßÍæ¼Ò  | 
|         playerManager = GameWorld.GetPlayerManager()  | 
|         for i in range(0, playerManager.GetPlayerCount()):  | 
|             curPlayer = playerManager.GetPlayerByIndex(i)  | 
|             if curPlayer == None or not curPlayer.GetInitOK():  | 
|                 continue  | 
|               | 
|             NetPackCommon.SendFakePack(curPlayer, tehuiPack)  | 
|     else:  | 
|         NetPackCommon.SendFakePack(curPlayer, tehuiPack)  | 
|     return  | 
|   |