| | |
| | | import PlayerNewFairyCeremony
|
| | | import PlayerActLogin
|
| | | import PlayerWeekParty
|
| | | import EventShell
|
| | | #------------------------------------------------------------------------------
|
| | |
|
| | | #获取金币祈愿奖励
|
| | |
| | |
|
| | |
|
| | | #祈愿类型列表
|
| | | TotalPrayList = [ChConfig.VIPPrivilege_MoneyPray,ChConfig.VIPPrivilege_ExpPray]
|
| | | TotalPrayList = [ChConfig.VIPPrivilege_MoneyPray, ChConfig.VIPPrivilege_ExpPray]
|
| | |
|
| | |
|
| | | #struct tagCMBuySomething
|
| | |
| | | buyType = clientData.Type #购买的类型
|
| | | #祈愿类型错误,不处理
|
| | | if buyType not in TotalPrayList:
|
| | | GameWorld.DebugLog("祈愿类型错误---buyType:%s"%buyType )
|
| | | GameWorld.DebugLog("祈愿类型错误---buyType:%s" % buyType)
|
| | | return
|
| | | if buyType == ChConfig.VIPPrivilege_MoneyPray:
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_RefineMoney):
|
| | |
| | | return
|
| | |
|
| | | totalCnt = PlayerVip.GetPrivilegeValue(curPlayer, buyType)
|
| | | curCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HasPrayCnt%buyType)
|
| | | cnt = curCnt+1 #参数用
|
| | | curCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HasPrayCnt % buyType)
|
| | | cnt = curCnt + 1 #参数用
|
| | | #金币祈愿
|
| | | if buyType == ChConfig.VIPPrivilege_MoneyPray:
|
| | | historyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HistoryPrayCnt%buyType)
|
| | | historyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HistoryPrayCnt % buyType)
|
| | | #判断免费祈愿CD时间
|
| | | needTime = __GetFreeCD(curPlayer)
|
| | | if needTime:
|
| | |
| | | GameWorld.DebugLog("仙玉不足!costGold=%s" % needGold)
|
| | | return
|
| | | if not isCostItem: #用物品不增加次数
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasPrayCnt%buyType, curCnt + 1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasPrayCnt % buyType, curCnt + 1)
|
| | | else:
|
| | | curTime = int(time.time())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FreePrayTime, curTime)
|
| | | |
| | | preCnt, fixMoney =IpyGameDataPY.GetFuncEvalCfg('MoneyPray', 4)
|
| | | GameWorld.DebugLog('11111fixMoney=%s,historyCnt=%s,preCnt=%s'%(fixMoney,historyCnt,preCnt))
|
| | | if fixMoney and historyCnt< preCnt:
|
| | | |
| | | preCnt, fixMoney = IpyGameDataPY.GetFuncEvalCfg("MoneyPray", 4)
|
| | | GameWorld.DebugLog('11111fixMoney=%s,historyCnt=%s,preCnt=%s' % (fixMoney, historyCnt, preCnt))
|
| | | if fixMoney and historyCnt < preCnt:
|
| | | addMoney = fixMoney
|
| | | #更新历史次数(特殊收益次数达到后不再更新)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HistoryPrayCnt%buyType, historyCnt+1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HistoryPrayCnt % buyType, historyCnt + 1)
|
| | | else:
|
| | | addMoney = GetMoneyPrayAward()
|
| | | addDataDict = {ChConfig.Def_Give_Reason_SonKey:"MoneyPray"}
|
| | | PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, addMoney, |
| | | ChConfig.Def_GiveMoney_Pray, addDataDict, False)
|
| | | PlayerControl.NotifyCode(curPlayer, 'MoneyPray_HowMuch', [addMoney])
|
| | | #20190917 by hxp 祈愿金币改为绑玉
|
| | | giveMoneyType = IPY_GameWorld.TYPE_Price_Gold_Paper
|
| | | PlayerControl.GiveMoney(curPlayer, giveMoneyType, addMoney, ChConfig.Def_GiveMoney_Pray, addDataDict, False)
|
| | | PlayerControl.NotifyCode(curPlayer, 'MoneyPray_HowMuch', [addMoney, giveMoneyType])
|
| | | PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_MoneyPray, 1)
|
| | |
|
| | | #经验祈愿
|
| | |
| | | else:
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:buyType}
|
| | | needGold = eval(GetExpPrayCost())
|
| | | GameWorld.DebugLog("需要仙玉--needGold--%s"%needGold )
|
| | | GameWorld.DebugLog("需要仙玉--needGold--%s" % needGold)
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold, ChConfig.Def_Cost_Pray, infoDict):
|
| | | GameWorld.DebugLog("仙玉不足!costGold=%s" % needGold)
|
| | | return
|
| | |
| | | PlayerControl.PlayerControl(curPlayer).AddExp(addExp)
|
| | | PlayerControl.NotifyCode(curPlayer, 'ExpPray_HowMuch', [addExp])
|
| | | if not isCostItem: #用物品不增加次数
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasPrayCnt%buyType, curCnt + 1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasPrayCnt % buyType, curCnt + 1)
|
| | | PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_ExpPray, 1)
|
| | | else:
|
| | | return
|
| | | EventShell.EventRespons_Pray(curPlayer, buyType)
|
| | | #成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_Pray, 1, [buyType])
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FeastRedPack_Pray, 1)
|
| | |
| | | curTime = int(time.time())
|
| | | passTime = curTime - lastTime
|
| | | cdTime = IpyGameDataPY.GetFuncCfg("MoneyPray", 3)
|
| | | needTime = max(0,cdTime - passTime)
|
| | | needTime = max(0, cdTime - passTime)
|
| | | return needTime
|
| | |
|
| | | ## OnDay操作,通知客户端,购买次数变了
|
| | |
| | | def PlayerOnDay(curPlayer):
|
| | | needSyncList = []
|
| | | for prayType in TotalPrayList:
|
| | | hasPrayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HasPrayCnt%prayType)
|
| | | hasPrayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HasPrayCnt % prayType)
|
| | | if not hasPrayCnt:
|
| | | continue
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasPrayCnt%prayType, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasPrayCnt % prayType, 0)
|
| | | needSyncList.append(prayType)
|
| | | Sync_NotifyDataChange(curPlayer, needSyncList)
|
| | | return
|
| | |
| | | ## 通知客户端,购买次数变了
|
| | | # @param curPlayer: 玩家实例
|
| | | # @return None
|
| | | def Sync_NotifyDataChange(curPlayer, prayType = []):
|
| | | def Sync_NotifyDataChange(curPlayer, prayType=[]):
|
| | | if prayType == []:
|
| | | prayList = TotalPrayList
|
| | | else:
|
| | |
| | | for buyType in prayList:
|
| | | subPack = ChPyNetSendPack.tagMCSingleBuySomethingInfo()
|
| | | subPack.Type = buyType
|
| | | subPack.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HasPrayCnt%buyType)
|
| | | subPack.HistoryBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HistoryPrayCnt%buyType)
|
| | | subPack.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HasPrayCnt % buyType)
|
| | | subPack.HistoryBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HistoryPrayCnt % buyType)
|
| | |
|
| | | if buyType == ChConfig.VIPPrivilege_MoneyPray:
|
| | | subPack.LastFreeTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FreePrayTime)
|
| | | pack.Infos.append(subPack)
|
| | | GameWorld.DebugLog("通知祈愿次数--buyType:%s--BuyCnt:%s--LastFreeTime%s" % (subPack.Type,subPack.BuyCnt,subPack.LastFreeTime))
|
| | | GameWorld.DebugLog("通知祈愿次数--buyType:%s--BuyCnt:%s--LastFreeTime%s" % (subPack.Type, subPack.BuyCnt, subPack.LastFreeTime))
|
| | | pack.Cnt = len(pack.Infos)
|
| | | NetPackCommon.SendFakePack(curPlayer, pack)
|
| | |
|
| | |
| | | def DoPlayerLogin(curPlayer):
|
| | | Sync_NotifyDataChange(curPlayer)
|
| | | return
|
| | | |
| | | |