hxp
2020-01-07 26534f375db82568cf5e29e74fd5a58cf71ce20f
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -64,6 +64,8 @@
def OnLogin(curPlayer):
    if not DoResetCTGCountByTime(curPlayer):
        Sync_CoinToGoldCountInfo(curPlayer)
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
        Sync_DayFreeGoldGiftState(curPlayer)
    return
def DoResetCTGCountByTime(curPlayer):
@@ -97,6 +99,8 @@
    for i in xrange(ipyDataMgr.GetCTGCount()):
        ipyData = ipyDataMgr.GetCTGByIndex(i)
        recordID = ipyData.GetRecordID()
        if not ipyData.GetCanResetBuyCount():
            continue
        totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
        todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
        if not totalBuyCount and not todayBuyCount:
@@ -113,6 +117,8 @@
def OnDay(curPlayer):
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, 0)
    syncRecordIDList = []
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    for i in xrange(ipyDataMgr.GetCTGCount()):
@@ -126,6 +132,10 @@
        syncRecordIDList.append(recordID)
    if syncRecordIDList:
        Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 0)
        Sync_DayFreeGoldGiftState(curPlayer)
    return
## 创角赠送
@@ -234,26 +244,37 @@
        DataRecordPack.DR_CTGError(curPlayer, "Can not find CTG ipyData!", addDRDict)
        return
    
    dailyBuyCount = ipyData.GetDailyBuyCount()
    addDRDict.update({"recordID":recordID})
    totalBuyCountLimit = ipyData.GetTotalBuyCount()
    totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
    if totalBuyCountLimit:
        addDRDict.update({"totalBuyCountLimit":totalBuyCountLimit, "totalBuyCount":totalBuyCount})
        if totalBuyCount >= totalBuyCountLimit:
            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit total!totalBuyCount=%s" % totalBuyCount, addDRDict)
            return
    dailyBuyCountLimit = ipyData.GetDailyBuyCount()
    todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
    if dailyBuyCount:
        addDRDict.update({"dailyCanBuyCount":dailyBuyCount, "todayBuyCount":todayBuyCount})
        if todayBuyCount >= dailyBuyCount:
    if dailyBuyCountLimit:
        addDRDict.update({"dailyBuyCountLimit":dailyBuyCountLimit, "todayBuyCount":todayBuyCount})
        if todayBuyCount >= dailyBuyCountLimit:
            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit today!todayBuyCount=%s" % todayBuyCount, addDRDict)
            return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, todayBuyCount + 1)
    if totalBuyCountLimit:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, totalBuyCount + 1)
        addDRDict.update({"totalBuyCountUpd":(totalBuyCount + 1)})
    if dailyBuyCountLimit:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, todayBuyCount + 1)
        addDRDict.update({"todayBuyCountUpd":(todayBuyCount + 1)})
    giveItemList = ipyData.GetGainItemList()
    addGold = ipyData.GetGainGold() # 获得仙玉数
    gainGoldPrize = ipyData.GetGainGoldPrize() # 赠送仙玉数,首次充值赠送仙玉时,此仙玉不给
    firstGoldPrize = ipyData.GetFirstGoldPrize() # 首次充值赠送的仙玉
    notifyMark = ipyData.GetNotifyMark()
    totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, totalBuyCount + 1)
    prizeGold = firstGoldPrize if (not totalBuyCount and firstGoldPrize) else gainGoldPrize
    addDRDict.update({"totalBuyCount":(totalBuyCount + 1)})
    
    Sync_CoinToGoldCountInfo(curPlayer, [recordID])
    return addGold, prizeGold, giveItemList, notifyMark
@@ -288,10 +309,13 @@
    curPlayer.SetChangeCoinPointTotal(changeCoinPointBefore + orderCoin, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0)
    
    todayCTGCoinTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCoinTotal) + orderCoin
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, todayCTGCoinTotal)
    goldAfter = curPlayer.GetGold()
    changeCoinPointAfter = curPlayer.GetChangeCoinPointTotal()
    bourseMoneyAfter = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
    addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter],
    addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], "todayCTGCoinTotal":todayCTGCoinTotal,
                      "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter], "addGold":addGold, "prizeGold":prizeGold, "giveItemList":giveItemList})
    
    DataRecordPack.DR_CTGOK(curPlayer, addDRDict)
@@ -300,11 +324,13 @@
    #仙界盛典-充值大礼
    PlayerFairyCeremony.OnFCRecharge(curPlayer)
    PlayerNewFairyCeremony.OnFCRecharge(curPlayer)
    PlayerGoldGift.DayChargeRedPackAward(curPlayer)
    PlayerGoldGift.OnPlayerChargeGold(curPlayer, addGold)
    #累积充值X元
    PlayerActTotalRecharge.AddTotalRechargeGold(curPlayer, orderCoin/100)
    PlayerFairyCeremony.AddFCCTGRMB(curPlayer, orderCoin/100)
    PlayerNewFairyCeremony.AddFCCostGold(curPlayer, orderCoin/100)
    #开服活动
    OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin)
    #OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin)
    PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Recharge, addVIPExp)
    #投资
    if ipyData:
@@ -402,3 +428,42 @@
    NetPackCommon.SendFakePack(curPlayer, countInfoPack)
    return
## ---------- 每日免费直购礼包 ----------------
def OnGetDayFreeGoldGift(curPlayer):
    ''' 领取每日免费直购礼包
    '''
    isGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
    if isGet:
        #GameWorld.DebugLog("已经领取过每日免费直购礼包!")
        return
    rewardItemList = IpyGameDataPY.GetFuncEvalCfg("DayFreeGoldGift", 1)
    if not rewardItemList:
        return
    needSpace = len(rewardItemList)
    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
    if needSpace > packSpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 1)
    # 给物品
    isAuctionItem = False
    for itemID, itemCount in rewardItemList:
        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
    # 通知客户端
    Sync_DayFreeGoldGiftState(curPlayer)
    return
def Sync_DayFreeGoldGiftState(curPlayer):
    clientPack = ChPyNetSendPack.tagMCDayFreeGoldGiftState()
    clientPack.DayFreeGoldGiftState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
## ------------------------------------------