hxp
2 天以前 388823edfe6308cba6f76ca6dc4f20022c5cb2be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/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