| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Player.PlayerBindJadeWheel  | 
| #  | 
| # @todo:°óÓñתÅÌ  | 
| # @author xdh  | 
| # @date 2018-09-27  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: °óÓñתÅÌ  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2018-09-27 16:00"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import GameWorld  | 
| import PlayerVip  | 
| import IpyGameDataPY  | 
| import IPY_GameWorld  | 
| import ChPyNetSendPack  | 
| import PlayerControl  | 
| import NetPackCommon  | 
| import ChConfig  | 
|   | 
|   | 
|   | 
|   | 
| def OnDay(curPlayer):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BindJadeWheelCurCnt, 0)  | 
|     SyncBindJadeWheelResult(curPlayer)  | 
|     return  | 
|   | 
| def OnLogin(curPlayer):  | 
|     SyncBindJadeWheelResult(curPlayer)  | 
|     return  | 
|   | 
| #// A5 17 °óÓñתÅÌ¿ªÊ¼ #tagCMStartBindJadeWheel  | 
| #  | 
| #struct    tagCMStartBindJadeWheel  | 
| #  | 
| #{  | 
| #    tagHead        Head;  | 
| #};  | 
| def OnStartBindJadeWheel(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     maxCnt = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_BindJadeWheel)  | 
|     curCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BindJadeWheelCurCnt)  | 
|     if curCnt >= maxCnt:  | 
|         GameWorld.DebugLog('    °óÓñתÅÌ´ÎÊý²»×㣡')  | 
|         return  | 
|     costMoney = IpyGameDataPY.GetFuncCfg('BindJadeWheelCfg')  | 
|     if not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costMoney):  | 
|         return  | 
|     historyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BindJadeWheelHistoryCnt)  | 
|     beSureCountDict = IpyGameDataPY.GetFuncEvalCfg('BindJadeWheelCfg', 4, {})  | 
|     updHistory = historyCnt + 1  | 
|     if updHistory in beSureCountDict:  | 
|         gridNumRateList = beSureCountDict[updHistory]  | 
|     else:  | 
|         gridNumRateList = IpyGameDataPY.GetFuncEvalCfg('BindJadeWheelCfg', 3)  | 
|     gridNum = GameWorld.GetResultByRandomList(gridNumRateList)  | 
|     if not gridNum:  | 
|         GameWorld.ErrLog('    °óÓñתÅ̠ûת³ö½á¹û  gridNumRateList=%s'%gridNumRateList, curPlayer.GetID())  | 
|         return  | 
|     giveMoney = IpyGameDataPY.GetFuncEvalCfg('BindJadeWheelCfg', 2, {}).get(str(gridNum))  | 
|     if not giveMoney:  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BindJadeWheelCurCnt, curCnt+1)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BindJadeWheelHistoryCnt, updHistory)  | 
|       | 
|     infoDict = {"giveMoney":giveMoney, "historyCnt":historyCnt, "curCnt":curCnt}  | 
|     PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costMoney, ChConfig.Def_Cost_BindJadeWheel, infoDict)  | 
|     PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, giveMoney, ChConfig.Def_GiveMoney_BindJadeWheel, isSysHint=False)  | 
|     SyncBindJadeWheelResult(curPlayer, gridNum)  | 
|       | 
|     if giveMoney >= IpyGameDataPY.GetFuncCfg('BindJadeWheelNotice'):  | 
|         PlayerControl.WorldNotify(0, 'BindJadeNotice', [curPlayer.GetName(), giveMoney])  | 
|     return  | 
|   | 
| def SyncBindJadeWheelResult(curPlayer, gridNum=0):  | 
|     sendPack = ChPyNetSendPack.tagMCBindJadeWheelResult()  | 
|     sendPack.Clear()  | 
|     sendPack.Index = gridNum  | 
|     sendPack.Cnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BindJadeWheelCurCnt)  | 
|     NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|     return |