| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package CrossActCTGBillboard  | 
| #  | 
| # @todo:¿ç·þÔËÓª»î¶¯ - ³äÖµÅÅÐÐ  | 
| # @author hxp  | 
| # @date 2021-01-13  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: ¿ç·þÔËÓª»î¶¯ - ³äÖµÅÅÐÐ  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2021-01-13 17:00"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import ShareDefine  | 
| import PyDataManager  | 
| import PlayerCompensation  | 
| import IpyGameDataPY  | 
| import GameWorld  | 
| import CommFunc  | 
|   | 
| def OnActIDChange(cfgID, dbTemplateID, state):  | 
|     ## »î¶¯ID±ä¸ü  | 
|       | 
|     # ÏȽáËãÉÏÆÚ»î¶¯  | 
|     __GiveBillboardOrderAward(cfgID, dbTemplateID)  | 
|       | 
|     # Èç¹ûÓÐл£¬´¦Àíл  | 
|     if not state:  | 
|         return  | 
|       | 
|     groupValue1 = cfgID  | 
|     billboardType = ShareDefine.Def_CBT_ActCTG  | 
|       | 
|     billboardMgr = PyDataManager.GetCrossBillboardManager()  | 
|     billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1)  | 
|     billboardObj.ClearData() # ÐÂ»î¶¯ÖØÖðñµ¥Êý¾Ý  | 
|       | 
|     return  | 
|   | 
| def __GiveBillboardOrderAward(cfgID, dbTemplateID):  | 
|     ## ½áËã°ñµ¥ÅÅÃû½±Àø  | 
|       | 
|     groupValue1 = cfgID  | 
|     billboardType = ShareDefine.Def_CBT_ActCTG  | 
|       | 
|     # ÏȽáËãÉÏÆÚ»î¶¯  | 
|     billboardMgr = PyDataManager.GetCrossBillboardManager()  | 
|     billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1)  | 
|     billboardDataCount = billboardObj.GetCount()  | 
|     if not billboardDataCount:  | 
|         GameWorld.Log("¿ç·þ³äÖµÅÅÐÐÊý¾ÝΪ¿Õ! billboardType=%s,cfgID=%s" % (billboardType, cfgID))  | 
|         return  | 
|       | 
|     # ½áËãʱÅÅÐò²¢±£´æ°ñµ¥Êý¾ÝÁ÷Ïò  | 
|     billboardObj.SortData()  | 
|       | 
|     GameWorld.Log("½áËã¿ç·þ³äÖµÅÅÐн±Àø: billboardType=%s,cfgID=%s,dbTemplateID=%s,billboardDataCount=%s"   | 
|                   % (billboardType, cfgID, dbTemplateID, billboardDataCount))  | 
|       | 
|     orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("CrossActCTGBillboardOrder", dbTemplateID)  | 
|     if not orderIpyDataList:  | 
|         return  | 
|       | 
|     billboardIndex = 0  | 
|     for ipyData in orderIpyDataList:  | 
|         orderA = ipyData.GetOrderA()  | 
|         orderB = ipyData.GetOrderB()  | 
|         ctgAtleast = CommFunc.RMBToCoin(ipyData.GetCTGAtleast())  | 
|         awardItemList = ipyData.GetAwardItemList()  | 
|         orderCountTotal = orderB - orderA + 1 # ½±ÀøÃû´ÎÊýÁ¿  | 
|         orderCount = 0  | 
|           | 
|         for index in xrange(billboardIndex, billboardDataCount):  | 
|             if orderCount >= orderCountTotal:  | 
|                 break  | 
|               | 
|             billboardData = billboardObj.At(index)  | 
|             playerID = billboardData.ID  | 
|             ctgRMB = billboardData.CmpValue  | 
|             if ctgRMB < ctgAtleast:  | 
|                 break  | 
|               | 
|             realOrder = orderA + orderCount  | 
|             paramList = [realOrder]  | 
|             PlayerCompensation.SendMailByKey("CABillboardCTGOrder", [playerID], awardItemList, paramList, crossMail=True)  | 
|             GameWorld.Log("    playerID=%s,°ñµ¥Ãû´Î=%s,ʵ¼ÊÃû´Î=%s,³äÖµ×ÜRMB=%s" % (playerID, index + 1, realOrder, ctgRMB))  | 
|               | 
|             orderCount += 1  | 
|             billboardIndex += 1  | 
|               | 
|     # ½áËãÍêÇå³ý°ñµ¥Êý¾Ý  | 
|     billboardObj.ClearData()  | 
|     return  | 
|   | 
|   | 
|   |