| | |
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import DBDataMgr
|
| | | import PlayerMail
|
| | | import ShareDefine
|
| | | import GameFuncComm
|
| | | import IPY_GameWorld
|
| | | import IpyGameDataPY
|
| | | import PlayerTreasure
|
| | | import PlayerBillboard
|
| | |
| | | import PlayerControl
|
| | | import NetPackCommon
|
| | | import ItemControler
|
| | | import ItemCommon
|
| | | import GameWorld
|
| | | import ChConfig
|
| | | import ObjPool
|
| | | import math
|
| | |
|
| | | # 开服冲榜类型对应功能ID
|
| | | OSAFuncIDDict = {
|
| | |
| | | ## ------------------------------------------- 开服庆典 ---------------------------------------------
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | if GetOSACelebrationState(curPlayer) == 3:
|
| | | __autoChangeCelebrationPoint(curPlayer)
|
| | | return
|
| | | SyncOSACelebrationInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def PlayerOnDay(curPlayer):
|
| | | if GetOSACelebrationState(curPlayer) == 3:
|
| | | __autoChangeCelebrationPoint(curPlayer)
|
| | | return
|
| | | return
|
| | |
|
| | | def __autoChangeCelebrationPoint(curPlayer):
|
| | | ## 活动结束后自动转换庆典积分
|
| | | unUsePoint = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_OSAPoint)
|
| | | if unUsePoint <= 0:
|
| | | return
|
| | | moneyItemID = ItemCommon.GetMoneyItemID(IPY_GameWorld.TYPE_Price_Gold_Money)
|
| | | if not moneyItemID:
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | oneNeedPoint = IpyGameDataPY.GetFuncCfg("OSACelebration", 3) # 多少积分=1元宝
|
| | | changeMoney = int(math.ceil(unUsePoint / float(oneNeedPoint)))
|
| | | itemList = [[moneyItemID, changeMoney]]
|
| | | GameWorld.DebugLog("自动转化未使用的庆典积分: unUsePoint=%s,oneNeedPoint=%s,changeMoney=%s,itemList=%s" |
| | | % (unUsePoint, oneNeedPoint, changeMoney, itemList), playerID)
|
| | | if PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_OSAPoint, unUsePoint, "SysClear"):
|
| | | PlayerMail.SendMailByKey("OSACelebrationPoint", playerID, itemList)
|
| | | return
|
| | |
|
| | | def GetOSACelebrationState(curPlayer):
|
| | | ## 玩家是否在开服庆典活动中
|
| | | # @return: 0-未开启;1-活动中;2-结束显示期;3-结束关闭期
|
| | | funcID = ShareDefine.GameFuncID_OSA_Celebration
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, funcID):
|
| | | #GameWorld.DebugLog("开服庆典功能未开启! funcID=%s" % (funcID))
|
| | | return 0
|
| | | #开服庆典,后端不限制功能是否开启
|
| | | #funcID = ShareDefine.GameFuncID_OSA_Celebration
|
| | | #if not GameFuncComm.GetFuncCanUse(curPlayer, funcID):
|
| | | # #GameWorld.DebugLog("开服庆典功能未开启! funcID=%s" % (funcID))
|
| | | # return 0
|
| | | endDay = IpyGameDataPY.GetFuncCfg("OSACelebration", 1)
|
| | | serverDay = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_ServerDay) + 1
|
| | | if serverDay <= endDay:
|
| | |
| | | return
|
| | |
|
| | | def SyncOSACelebrationInfo(curPlayer):
|
| | | clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCOSACelebrationInfo)
|
| | | clientPack = ChPyNetSendPack.tagSCOSACelebrationInfo()
|
| | | clientPack.PointTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OSACelebrationPoint)
|
| | | clientPack.PointAward = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OSACelebrationAward)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|