#!/usr/bin/python # -*- coding: GBK -*- #--------------------------------------------------------------------- # #--------------------------------------------------------------------- ##@package PlayerCoin # @todo: Íæ¼Òµã¾í´¦Àí # # @author: panwei # @date 2011-06-30 # @version 2.8 # # @note: ´Ëº¯ÊýÂß¼­¸Ä¶¯ÐèÉ÷ÖØ!!! # # @change: "2013-07-26 17:00" Alee VIP¸Ä³É¹ºÂò # @change: "2013-12-27 16:30" Alee ·ö³ÖÕ˺Š# @change: "2014-01-22 16:00" hxp Ð޸ijäֵʼþͬ²½ÊýֵΪnoteCoin # @change: "2014-04-24 19:10" xcc »Ö¸´Ô­À´³äÖµÉý¼¶vipµÈ¼¶µÄ´¦Àí # @change: "2014-06-12 21:00" hxp Ôö¼Ó³äÖµÀñ°ü´¦ÀíÈë¿Ú # @change: "2014-06-21 15:20" hxp Ôö¼ÓÌØ»Ý³äÖµ»î¶¯ # @change: "2014-10-16 19:00" Alee CTG²»·¢Ëͺǫ́¼Ç¼£¬Á÷Ïò¼Ç¼֧³ÖСÊýµã # @change: "2014-11-11 16:30" xmnathan Ôö¼Ó³äÖµÅÅÐаñ # @change: "2014-11-25 19:30" hxp Ôö¼Ó¿ª·þ³äÖµ»î¶¯ # @change: "2014-12-03 14:30" hxp Ôö¼ÓºÏ·þ³äÖµ»î¶¯ # @change: "2014-12-23 00:30" hxp Ôö¼Ó³äֵǰÐÅÏ¢Á÷Ïò # @change: "2015-01-14 00:30" hxp Ôö¼ÓCTGʼþ»ã±¨ # @change: "2015-06-08 20:30" hxp Ôö¼Óµãȯ¶Ò»»Ê¼þ»ã±¨ # @change: "2015-08-26 14:00" zqx Ôö¼Ó»ñµÃ×êʯ³É¾Í # @change: "2016-06-30 21:30" hxp È¥³ý¿ª·þ»î¶¯ # @change: "2016-07-20 14:30" hxp µãȯ¶Ò»»Ôö¼ÓÁ÷ÏòÀàÐÍ; Á÷ÏòÕûºÏ #------------------------------------------------------------------------------ #"""Version = 2016-07-20 14:30""" #------------------------------------------------------------------------------ import PlayerControl import ItemControler import GameWorld import IPY_GameWorld import DataRecordPack import ChConfig import ChPyNetSendPack import NetPackCommon import PlayerVip import IpyGameDataPY import ShareDefine import PlayerFlashGiftbag import PlayerDailyGiftbag import PlayerFairyCeremony import PlayerNewFairyCeremony import PlayerGoldGift import PlayerActTotalRecharge import PlayerActGarbageSorting import PlayerActRechargeRebateGold import PlayerActManyDayRecharge import PlayerActSingleRecharge import PlayerActRechargePrize import PlayerFamilyRedPacket import CrossActCTGBillboard import PlayerActGrowupBuy import OpenServerCampaign import PlayerFeastTravel import PlayerWeekParty import PlayerGoldInvest import PlayerActTurntable import ItemCommon import PyGameData import CommFunc import time # ³äÖµµãȯ´¦ÀíÀàÐÍ ( CoinType_Gold, # Ö±½Ó³äÏÉÓñ CoinType_Buy, # Ö±¹º£¬·ÇÖ±½Ó³äÏÉÓñµÄ£¬ÈçRMBÖ±½Ó¹ºÂòij¸öÎïÆ·»ò¼¤»îij¸ö¹¦ÄÜ CoinType_Item, # ʹÓÃÎïÆ·£¬Àà³äÖµÏÉÓñЧ¹û£¬µ«ÊÇÓÐijЩ¹¦ÄÜÉϵÄÏÞÖÆ£¬Ò»°ãÊÇbt°æ±¾ÔùËÍ ) = range(3) # ³äÖµÀàÐͶ¨Òå PayType_Gold = 2 # ³£¹æÏÉÓñ³äÖµ PayType_GoldPlus = 3 # ÖÁ×ðÏÉÓñ³äÖµ PayType_GrowupBuy = 16 # ³É³¤±ØÂò #--------------------------------------------------------------------- #×¢Òâ: GetChangeCoinPointTotal ³äÖµµãºÍÔùË͵ã×ÜºÍ # GetPrizeCoinPointTotal ÔùË͵ã×ÜºÍ #µã¾í¶Ò»»±ÈÂÊ(´Ë±ÈÂÊÑϽûÉÏÏßÔËÓªºóÐÞ¸Ä!!!) def GetCoinRate(): return IpyGameDataPY.GetFuncCfg("PayRMB") def OnLogin(curPlayer): if not DoResetCTGCountByTime(curPlayer): Sync_CoinToGoldCountInfo(curPlayer) if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState): Sync_DayFreeGoldGiftState(curPlayer) if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlineRechargeTHAward): SyncOnlineRechargeTH(curPlayer) return def DoResetCTGCountByTime(curPlayer): # ÖØÖóäÖµ´ÎÊý ctgResetTimeYMD = IpyGameDataPY.GetFuncCfg("CTG", 1) if not ctgResetTimeYMD: return if not isinstance(ctgResetTimeYMD, int): GameWorld.ErrLog("³äÖµÖØÖÃʱ¼äÅäÖñØÐëÊÇÊýÖµ¸ñʽ£¬²»Äܰüº¬·ûºÅ!") return curTime = int(time.time()) #playerID = curPlayer.GetPlayerID() resetTime = GameWorld.ChangeTimeStrToNum(str(ctgResetTimeYMD), "%Y%m%d") if curTime < resetTime: #GameWorld.DebugLog("»¹Î´µ½´ï³äÖµ³äÖµ´ÎÊýʱ¼ä£¡curTime=%s < resetTime=%s" % (curTime, resetTime), playerID) return playerResetTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGCountResetTime) if playerResetTime == resetTime: #GameWorld.DebugLog("ÒѾ­ÖØÖùý³äÖµ´ÎÊý£¡resetTime=%s" % resetTime, playerID) return PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGCountResetTime, resetTime) DoResetCTGCount(curPlayer, ctgResetTimeYMD) return True def DoResetCTGCount(curPlayer, resetEvent): # ÖØÖóäÖµ´ÎÊý playerID = curPlayer.GetPlayerID() ipyDataMgr = IpyGameDataPY.IPY_Data() 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: continue PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0) drDict = {"PlayerID":curPlayer.GetPlayerID(),"AccID":curPlayer.GetAccID(), "ResetEvent":resetEvent, "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID} DataRecordPack.SendEventPack("ResetCTGCount", drDict, curPlayer) GameWorld.Log("ÖØÖóäÖµ´ÎÊý: resetEvent=%s,recordID=%s,totalBuyCount=%s,todayBuyCount=%s" % (resetEvent, recordID, totalBuyCount, todayBuyCount), playerID) Sync_CoinToGoldCountInfo(curPlayer) return def OnDay(curPlayer): ## ³äÖµÏà¹Ø¹ýÌì #ÔÚÖØÖÃ֮ǰÐèÒª´¦ÀíµÄ PlayerActGrowupBuy.DoUpdateGrowupBuyStateOnDay(curPlayer) # ³É³¤±ØÂò PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, 0) syncRecordIDList = [] ipyDataMgr = IpyGameDataPY.IPY_Data() for i in xrange(ipyDataMgr.GetCTGCount()): ipyData = ipyDataMgr.GetCTGByIndex(i) #if not ipyData.GetDailyBuyCount(): # continue recordID = ipyData.GetRecordID() if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID): continue PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0) 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 #// A1 23 ²éѯ³äÖµ´ÎÊý #tagCMQueryCoinToGoldCount # #struct tagCMQueryCoinToGoldCount #{ # tagHead Head; # BYTE RecordID; //³äÖµ¼Ç¼ID£¬Ò²¾ÍÊdzäÖµID£¬·¢0Ôò²éÈ«²¿ #}; def OnQueryCoinToGoldCount(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) recordID = clientData.RecordID Sync_CoinToGoldCountInfo(curPlayer, [recordID] if recordID else []) return ## ´´½ÇÔùËÍ # @param curPlayer Íæ¼ÒʵÀý # @return None def GiveGoldByCreate(curPlayer): giveCoinByCreate = IpyGameDataPY.GetFuncCfg("CornerPresentedMoney", 1) if not giveCoinByCreate: return isAddBourseMoney = IpyGameDataPY.GetFuncCfg("CornerPresentedMoney", 2) PlayerCoinToGoldEx(curPlayer, giveCoinByCreate, ChConfig.Def_GiveMoney_SuperAccountCreate, isAddBourseMoney) return def PlayerCoinToGoldEx(curPlayer, orderRMB, eventName, isAddBourseMoney): ## Ö±½Ó³äÖµ×Ô¶¨Òå½ð¶î appID = GameWorld.GetPlayerPlatform(curPlayer) payRMBNum = 1 oneRMBIpyData = None # ĬÈÏÈ¡µ¥Î»1»õ±Ò¶ÔÓ¦³äÖµÅäÖà ipyDataMgr = IpyGameDataPY.IPY_Data() for i in xrange(ipyDataMgr.GetOrderInfoCount()): ipyData = ipyDataMgr.GetOrderInfoByIndex(i) # µ¥Î»1ÔªÅäÖ㬲»¹ØÁª³äÖµID¡¢Àñ°üID if appID == ipyData.GetAppID() and ipyData.GetPayRMBNum() == payRMBNum and not ipyData.GetCTGID() and not ipyData.GetGiftbagID(): oneRMBIpyData = ipyData break if not oneRMBIpyData: GameWorld.ErrLog("Can not found one RMB pay num orderInfo! appID=%s,payRMBNum=%s" % (appID, payRMBNum), curPlayer.GetPlayerID()) return oneRMBCoinExp = oneRMBIpyData.GetCoinExp() prizeGold = 0 giveItemList = [] orderCoin = CommFunc.RMBToCoin(orderRMB) coinExp = int(orderRMB * oneRMBCoinExp) addGold = coinExp # ´Ë·½Ê½Ôö¼ÓµÄÏÉÓñ = Ö±³ä¾­Ñé addDRDict = {"orderCoin":orderCoin, "isAddBourseMoney":isAddBourseMoney, "eventName":eventName} DoCTGLogic(curPlayer, CoinType_Gold, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, coinExp=coinExp) return True def PlayerItemCTG(curPlayer, orderRMB, eventName, isAddBourseMoney, addDataDict={}): ## ʹÓÃÔùË͵ÄÎïÆ·¶Ò»»µãȯ£¬Ò»°ãÓÃÓÚbt°æ # 20210120 ¸Ų̂Ö÷¸É°æÔÝ·ÏÆú # prizeGold = 0 # giveItemList = [] # orderCoin = CommFunc.RMBToCoin(orderRMB) # µ¥Î»£¬·Ö # addGold = orderRMB * GetCoinRate() # addDRDict = {"orderCoin":orderCoin, "eventName":eventName} # addDRDict.update(addDataDict) # DoCTGLogic(curPlayer, CoinType_Item, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict) return def DoGMCTG(curPlayer, orderInfo, appID, isAddBourseMoney, eventName): ## GM³äÖµ£¬°üº¬GMÃüÁîÖ±½Ó³äÖµ¡¢ºǫ́GM¹¤¾ß³äÖµ ipyData = IpyGameDataPY.GetIpyGameData("OrderInfo", orderInfo, appID) if not ipyData: return cPlayerCoin = CPY_PlayerCoinToGold() cPlayerCoin.useCoin = CommFunc.RMBToCoin(ipyData.GetPayRMBNum()) cPlayerCoin.orderInfo = orderInfo cPlayerCoin.appID = appID cPlayerCoin.isAddBourseMoney = isAddBourseMoney return PlayerCoinToGold(curPlayer, cPlayerCoin, eventName) ##ÌØ±ð˵Ã÷£º³äÖµÔùË͵ãȯ¶¼Òª¼ÆËãµ½¸÷¸ö»î¶¯ÖÐ ##Íæ¼Òµã¾í¶Ò»»Ôª±¦. # @param curPlayer Íæ¼ÒʵÀý # @param useCoin ʹÓõĵã¾í # @param eventName ¶Ò»»Ê¼þÃû # @return None def PlayerCoinToGold(curPlayer, chargeInfo, eventName): ## °´ÉÌÆ·±àºÅ³äÖµ orderCoin = chargeInfo.GetCoin() # ½ð¶î ÒѳËÒÔ100 ÈËÃñ±Òµ¥Î»Îª·Ö #notePrizeCoin = chargeInfo.GetPrizeCoin() orderInfo = chargeInfo.GetOrderInfo() # ÉÌÆ·±àºÅ orderID = chargeInfo.GetOrderID() #¶©µ¥ºÅ£¬¶Ò»»³É¹¦ºóÇå³ý isAddBourseMoney = chargeInfo.GetIsAddBourseMoney() if orderID: curPlayer.SendDBFinishRecharge(orderID) appID = chargeInfo.GetAppID() if not appID: appID = GameWorld.GetPlayerPlatform(curPlayer) addDRDict = {"orderCoin":orderCoin, "orderInfo":orderInfo, "orderID":orderID, "isAddBourseMoney":isAddBourseMoney, "eventName":eventName, "appID":appID} if orderCoin <= 0: DataRecordPack.DR_CTGError(curPlayer, "The orderCoin is zero!", addDRDict) return ipyData = IpyGameDataPY.GetIpyGameData("OrderInfo", orderInfo, appID) if not ipyData: DataRecordPack.DR_CTGError(curPlayer, "Can not found the orderInfo.", addDRDict) return payRMBNum = ipyData.GetPayRMBNum() # µ¥Î»£¬Ôª if orderCoin != CommFunc.RMBToCoin(payRMBNum): DataRecordPack.DR_CTGError(curPlayer, "The orderCoin is not equal to the ipyData's RMB(%s)!" % payRMBNum, addDRDict) return addGold, prizeGold, giveItemList, ctgIpyData = 0, 0, [], None if ipyData.GetCTGID(): ctgResultInfo = __GetCTGInfoByID(curPlayer, ipyData.GetCTGID(), addDRDict) if not ctgResultInfo: return addGold, prizeGold, giveItemList, ctgIpyData = ctgResultInfo elif ipyData.GetGiftbagID(): giftbagID = ipyData.GetGiftbagID() if 100 <= giftbagID < 199: if not PlayerDailyGiftbag.OnPlayerOrderDailyGiftbag(curPlayer, giftbagID, addDRDict): return elif not PlayerFlashGiftbag.OnPlayerOrderGiftbag(curPlayer, [ipyData.GetGiftbagID()], addDRDict): return else: #ÓÃÓÚÖ§¸¶ÆäËûµÄÉÌÆ·£¬´ýÀ©Õ¹... DataRecordPack.DR_CTGError(curPlayer, "The orderInfo is useless!", addDRDict) return coinExp = ipyData.GetCoinExp() coinType = CoinType_Gold if (ctgIpyData and ctgIpyData.GetPayType() in [PayType_Gold, PayType_GoldPlus]) else CoinType_Buy # ¹æ¶¨2Ϊֱ³ä£¬ÆäËûΪֱ¹º DoCTGLogic(curPlayer, coinType, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, ctgIpyData, coinExp) #³äÖµ³É¹¦Ö÷¶¯²éѯһ´Î£¬ÎÞ³äÖµÊýÁ¿¾Í²»»á¼ÌÐø²éѯ if orderID: #curPlayer.SendDBFinishRecharge(orderID) # ³äÖµ³É¹¦»Ø±¨¿Í»§¶Ë£¬SDKµÈ»áÓõ½ Sync_CoinToGoldReport(curPlayer, orderID, orderCoin) curPlayer.SendDBQueryRecharge() return True def __GetCTGInfoByID(curPlayer, recordID, addDRDict): ## ¸ù¾Ý³äÖµÊý¾ÝID»ñÈ¡³äÖµÐÅÏ¢ ipyData = IpyGameDataPY.GetIpyGameData("CTG", recordID) if not ipyData: DataRecordPack.DR_CTGError(curPlayer, "Can not find CTG ipyData!", addDRDict) return addDRDict.update({"recordID":recordID}) # ³É³¤±ØÂòÀàÐÍ if ipyData.GetPayType() == PayType_GrowupBuy: canBuy, errInfo = PlayerActGrowupBuy.CheckGrowupBuyState(curPlayer, recordID) if not canBuy: DataRecordPack.DR_CTGError(curPlayer, errInfo, addDRDict) return 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 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_CTGGoodsBuyCount % recordID, totalBuyCount + 1) addDRDict.update({"totalBuyCountUpd":(totalBuyCount + 1)}) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, todayBuyCount + 1) addDRDict.update({"todayBuyCountUpd":(todayBuyCount + 1)}) giveItemList = GetCTGGiveItemList(ipyData) addGold = ipyData.GetGainGold() # »ñµÃÏÉÓñÊý gainGoldPrize = ipyData.GetGainGoldPrize() # ÔùËÍÏÉÓñÊý£¬Ê״γäÖµÔùËÍÏÉÓñʱ£¬´ËÏÉÓñ²»¸ø firstGoldPrize = ipyData.GetFirstGoldPrize() # Ê״γäÖµÔùË͵ÄÏÉÓñ prizeGold = firstGoldPrize if (not totalBuyCount and firstGoldPrize) else gainGoldPrize actPrizeGold = PlayerActRechargePrize.DoAddPlayerActRechargePrizeCount(curPlayer, recordID) if actPrizeGold: prizeGold += actPrizeGold addDRDict.update({"actRechargePrize":1}) Sync_CoinToGoldCountInfo(curPlayer, [recordID]) return addGold, prizeGold, giveItemList, ipyData def GetCTGGiveItemList(ipyData): ## »ñÈ¡³äÖµID¶ÔÓ¦¸øÎïÆ·Áбí if not ipyData: return [] gainItemList = ipyData.GetGainItemList() actWorldLVGainItemInfo = ipyData.GetActWorldLVGainItemInfo() giveItemList = [] # »î¶¯ÊÀ½çµÈ¼¶¶ÔÓ¦ÎïÆ·ÐÅÏ¢£¬Èç¹ûÓжÔÓ¦»î¶¯Ö§³Ö ÇÒ ¸ÃÅäÖÃÓÐÅ䣬ÔòĬÈÏ×߸ÃÅäÖ㬷ñÔòʹÓ󣹿µÄĬÈÏÎïÆ·ÅäÖà payTypeActNameDict = {PayType_GrowupBuy:ShareDefine.OperationActionName_GrowupBuy, # ... ÓÐÐÂÔöµÄ»î¶¯ÐèÒªÖ§³Ö£¬ÔòÔÚ´ËÐÂÔöÅäÖÃÉϼ´¿É£¬ºóÃæÈ¡ÎïÆ·µÄÂß¼­¶¼ÊÇÒ»ÑùµÄ } if actWorldLVGainItemInfo and ipyData.GetPayType() in payTypeActNameDict: actName = payTypeActNameDict[ipyData.GetPayType()] actInfo = PyGameData.g_operationActionDict.get(actName, {}) # ×¢£ºÏà¹Ø×´Ì¬ÔÚǰÖÃÂß¼­ÒѾ­ÅжϹý£¬ÕâÀï²»ÔÙÅÐ¶Ï actWorldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0) actWorldLVList = [int(strWorldLV) for strWorldLV in actWorldLVGainItemInfo.keys()] actWorldLVList.sort() # ʹÓà int µÄÖµÅÅ£¬·ñÔò¿ÉÄÜÒýÆðÅÅÐò´íÎó for worldLV in actWorldLVList: if actWorldLV <= worldLV: giveItemList = actWorldLVGainItemInfo[str(worldLV)] break if not giveItemList: giveItemList = actWorldLVGainItemInfo[str(actWorldLVList[-1])] # ûÓÐÆ¥Åäµ½µÄ»°Ä¬ÈÏÈ¡×îºóÒ»¸öµÈ¼¶ÅäÖà else: giveItemList = gainItemList return giveItemList def DoCTGLogic(curPlayer, coinType, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, ctgIpyData=None, coinExp=0): notifyMark = ctgIpyData.GetNotifyMark() if ctgIpyData else "" goldBefore = curPlayer.GetGold() bourseMoneyBefore = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney) if addGold: PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, addGold, eventName, addDRDict, isGiveBourseMoney=isAddBourseMoney) if prizeGold: PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, prizeGold, eventName, addDRDict, isGiveBourseMoney=isAddBourseMoney) if giveItemList: ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList, "", event=[ChConfig.ItemGive_CTG, True, addDRDict]) if notifyMark: mainItemID = giveItemList[0][0] PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetName(), mainItemID, '']) else: if notifyMark: PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetName()]) addVIPExp = coinExp PlayerVip.AddVIPExp(curPlayer, addVIPExp) changeCoinPointBefore = curPlayer.GetChangeCoinPointTotal() 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) #---³äÖµ³É¹¦ºóÂß¼­--- # ¹¦ÄÜͳһÒÔ·Ö´æ´¢¼Ç¼£¬Íæ¼Ò×ֵ䲻֧³Ö´æÐ¡Êý # ËùÓÐÕæÊµ³äÖµ¾ùÓÐЧµÄ if coinType in [CoinType_Gold, CoinType_Buy]: #¿ç·þ³äÖµÅÅÐл CrossActCTGBillboard.AddCTGRMB(curPlayer, orderCoin) PlayerActManyDayRecharge.AddManyDayRechargeValue(curPlayer, orderCoin) # ¶àÈÕÁ¬³ä #ºì°ü, ÐèÒªÕæÊµ³äÖµ PlayerFamilyRedPacket.OnPlayerRecharge(curPlayer, orderCoin) # Ö»Ëã³äÏÉÓñµÄ if coinType == CoinType_Gold: PlayerActRechargeRebateGold.AddRechargeRebateGoldRMB(curPlayer, addGold) #ÏɽçÊ¢µä-³äÖµ´óÀñ PlayerFairyCeremony.OnFCRecharge(curPlayer) PlayerNewFairyCeremony.OnFCRecharge(curPlayer) PlayerGoldGift.OnPlayerChargeGold(curPlayer) #ÀÛ»ý³äÖµXÔª PlayerActTotalRecharge.AddTotalRechargeGold(curPlayer, orderCoin) PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_CTG, addVIPExp, coinType) # À¬»ø·ÖÀà PlayerActSingleRecharge.UpdSingleRechargeValue(curPlayer, orderCoin, coinType) # µ¥±ÊÀÛ³ä PlayerActTurntable.OnPlayerRecharge(curPlayer, orderCoin, coinType) # תÅÌ PlayerFairyCeremony.AddFCCTGRMB(curPlayer, orderCoin) PlayerNewFairyCeremony.AddFCCostGold(curPlayer, orderCoin) #¿ª·þ»î¶¯ #OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin) PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Recharge, addVIPExp) PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_CTGExp, addVIPExp) #Ͷ×Ê if ctgIpyData: PlayerGoldInvest.InvestByCTG(curPlayer, ctgIpyData.GetRecordID()) serverDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1 addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], "todayCTGCoinTotal":todayCTGCoinTotal, "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter], "addGold":addGold, "prizeGold":prizeGold, "giveItemList":giveItemList, "coinType":coinType, "coinExp":coinExp, "addVIPExp":addVIPExp, "VIPLv":curPlayer.GetVIPLv(), "ServerDay":serverDay}) DataRecordPack.DR_CTGOK(curPlayer, addDRDict) GameWorld.Log("Billing: coinType=%s,eventName=%s, %s" % (coinType, eventName, addDRDict), curPlayer.GetPlayerID()) return #=============================================================================== ## Ä£Äâ³äÖµÐÅÏ¢£¬µãȯ³äÖµÐÅÏ¢ # # µãȯ³äÖµÐÅÏ¢ class CPY_PlayerCoinToGold(): ## ³õʼ»¯ # @param ²ÎÊý # @return ·µ»ØÖµ # @remarks def __init__(self): self.useCoin = 0 # ³äÖµ½ð¶î webÓжԽð¶î½øÐд¦Àí£¬×ªÕûÊýÈ絥λ1.10ԪתΪ110·Ö self.prizeCoin = 0 # Ôݲ»Ê¹Óà self.appendix = '' # Ôݲ»Ê¹Óà self.orderInfo = "" # ÉÌÆ·±àºÅ È繺ÂòÀñ°ü Ô¿¨ ³äÖµ½ð¶îµÈ self.appID = "" self.orderID = "" self.isAddBourseMoney = False # ÊÇ·ñͬ²½Ôö¼Ó½»Ò×Ëù¹ºÂò¶î¶È return ## ʹÓõãȯÊý # @param ²ÎÊý # @return ·µ»ØÖµ # @remarks def GetCoin(self): return self.useCoin ## ÔùË͵ãȯÊý # @param ²ÎÊý # @return ·µ»ØÖµ # @remarks def GetPrizeCoin(self): return self.prizeCoin ## ¸½¼ÓÐÅÏ¢ # @param self # @return None def GetAppendix(self): return self.appendix # ÉÌÆ·±àºÅ def GetOrderInfo(self): return self.orderInfo def GetAppID(self): return self.appID def GetOrderID(self): return self.orderID def GetIsAddBourseMoney(self): return self.isAddBourseMoney # ֪ͨ¿Í»§¶Ë±¾´Î³äÖµ½ð¶î£¬ÓÃÓÚSDKµÈ£¬coinΪÈËÃñ±Òµ¥Î»·Ö def Sync_CoinToGoldReport(curPlayer, orderID, money): openGleeGame = ChPyNetSendPack.tagMCCoinToGoldReport() openGleeGame.Clear() openGleeGame.OrderLen = len(orderID) openGleeGame.OrderID = orderID openGleeGame.Coin = money NetPackCommon.SendFakePack(curPlayer, openGleeGame) return def Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList=[]): if not syncRecordIDList: ipyDataMgr = IpyGameDataPY.IPY_Data() for i in xrange(ipyDataMgr.GetCTGCount()): ipyData = ipyDataMgr.GetCTGByIndex(i) syncRecordIDList.append(ipyData.GetRecordID()) if not syncRecordIDList: return countInfoPack = ChPyNetSendPack.tagMCCoinToGoldCountInfo() countInfoPack.Clear() countInfoPack.CTGCountInfoList = [] for recordID in syncRecordIDList: countInfo = ChPyNetSendPack.tagMCCoinToGoldCount() countInfo.RecordID = recordID countInfo.TodayPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID) countInfo.TotalPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID) countInfoPack.CTGCountInfoList.append(countInfo) countInfoPack.RecordCount = len(countInfoPack.CTGCountInfoList) 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 ## ------------------------------------------ ## ---------- ´´½ÇÔÚÏß³äÖµÌØ»Ý --------------- def OnGetOnlineRechargeTH(curPlayer): ## ÁìÈ¡´´½ÇÔÚÏß³äÖµÌØ»Ý awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlineRechargeTHAward) if awardState: #GameWorld.DebugLog("ÒÑÁìÈ¡¸Ã½±Àø!") return # ºó¶ËÖ»ÑéÖ¤ÊÇ·ñÓгäÖµÆäÖÐÒ»¸ö¼´¿É£¬²»ÑéÖ¤³äֵʱ¼ä£¨³äֵͬ²½µ½ÓÎÏ··þÎñÆ÷ÓÐʱ¼ä²î£© canGet = False needCtgIDList = IpyGameDataPY.GetFuncEvalCfg("OnlineRechargeTH", 2) for ctgID in needCtgIDList: if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % ctgID): canGet = True break if not canGet: return awardItemList = IpyGameDataPY.GetFuncEvalCfg("OnlineRechargeTH", 3) if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList): return PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnlineRechargeTHAward, 1) for itemID, itemCount, isAuctionItem in awardItemList: ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem], event=["OnlineRechargeTH", False, {}]) SyncOnlineRechargeTH(curPlayer) return def SyncOnlineRechargeTH(curPlayer): clientPack = ChPyNetSendPack.tagMCOnlineRechargeTH() clientPack.AwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlineRechargeTHAward) NetPackCommon.SendFakePack(curPlayer, clientPack) return ## ------------------------------------------