#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- # ##@package PlayerLoginDayAward # # @todo: ÀۼƵǽÀñ # @author xdh # @date 2018-03-05 20:30 # @version 1.0 # # ÏêϸÃèÊö: #"""Version = 2018-03-05 20:30""" #------------------------------------------------------------------------------ import ChConfig import GameWorld import NetPackCommon import ChPyNetSendPack import ItemCommon import IPY_GameWorld import PlayerControl import ItemControler import DataRecordPack import IpyGameDataPY ## ondayÌí¼ÓÀۼƵǽÌìÊý # @param curPlayer # @return None def NotePlayerLoginDayCnt(curPlayer): cnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginDayCnt) + 1 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoginDayCnt, cnt) NotifyPlayerLoginDayAward(curPlayer) return ## µÇ½֪ͨÀۼƽ±ÀøÐÅÏ¢ # @param curPlayer # @return None def OnLoginNotifyLoginDayAward(curPlayer): NotifyPlayerLoginDayAward(curPlayer) return ## ֪ͨÀۼƵǽÐÅÏ¢ # @param curPlayer # @return None def NotifyPlayerLoginDayAward(curPlayer): sendPack = ChPyNetSendPack.tagMCTotalLoginDayCntInfo() sendPack.Clear() sendPack.DayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginDayCnt) sendPack.AwardInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginDayAward) #֪ͨ¿Í»§¶Ëʱ¼ä NetPackCommon.SendFakePack(curPlayer, sendPack) return ## ÁìÈ¡ÀۼƵǽ½±Àø # @param curPlayer # @return None def GetTotalLoginDayAward(index, clientPack, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) # µÚÒ»ÌìΪ1 cnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginDayCnt) index = clientPack.Index if index > cnt: #µÇ½´ÎÊý²»¹» return awardInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginDayAward) awardMark = pow(2, index-1) if awardInfo & awardMark: #ÒÑÁìÈ¡ return ipyData = IpyGameDataPY.GetIpyGameData('LoginDayAward', index) if not ipyData: return job = curPlayer.GetJob() awardDict = ipyData.GetReward() if str(job) not in awardDict: return itemList = awardDict[str(job)] # ¼ì²é±³°ü needSpace = len(itemList) packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace) if needSpace > packSpace: PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371") return # ¸øÎïÆ· for itemID, itemCount in itemList: ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem]) ItemControler.NotifyGiveAwardInfo(curPlayer, itemList, "LoginDayAward") PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoginDayAward, awardInfo | awardMark) # ¼Ç¼Áìȡʼþ DataRecordPack.DR_LoginDayAward(curPlayer, index) NotifyPlayerLoginDayAward(curPlayer) return