| | |
| | | import ShareDefine
|
| | | import GameFuncComm
|
| | | import IpyGameDataPY
|
| | | import PlayerBillboard
|
| | | import PlayerTreasure
|
| | | import PlayerBillboard
|
| | | import ChPyNetSendPack
|
| | | import PlayerControl
|
| | | import NetPackCommon
|
| | | import ItemControler
|
| | | import GameWorld
|
| | | import ChConfig
|
| | | import ObjPool
|
| | |
|
| | | # 开服冲榜类型对应功能ID
|
| | | OSAFuncIDDict = {
|
| | |
| | | PlayerBillboard.DoGiveBillboardAwardByMail(osaType, "OSAHeroCall", billboardAwardDict, "OSAHeroCall")
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | | ## ------------------------------------------- 开服庆典 ---------------------------------------------
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | SyncOSACelebrationInfo(curPlayer)
|
| | | 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
|
| | | endDay = IpyGameDataPY.GetFuncCfg("OSACelebration", 1)
|
| | | serverDay = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_ServerDay) + 1
|
| | | if serverDay <= endDay:
|
| | | #GameWorld.DebugLog("开服庆典活动中! serverDay=%s,endDay=%s" % (serverDay, endDay))
|
| | | return 1
|
| | | if serverDay == (endDay + 1):
|
| | | #GameWorld.DebugLog("开服庆典结算中! serverDay=%s,endDay=%s" % (serverDay, endDay))
|
| | | return 2
|
| | | #GameWorld.DebugLog("开服庆典已结束! serverDay=%s,endDay=%s" % (serverDay, endDay))
|
| | | return 3
|
| | |
|
| | | def AddOSACelebrationPoint(curPlayer, addPoint):
|
| | | ## 庆典累计积分
|
| | | curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OSACelebrationPoint)
|
| | | updPoint = PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OSACelebrationPoint, curPoint + addPoint)
|
| | | GameWorld.DebugLog("增加开服庆典积分: addPoint=%s,curPoint=%s,updPoint=%s" % (addPoint, curPoint, updPoint))
|
| | | SyncOSACelebrationInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def GetOSACelebrationPointAward(curPlayer, awardPoint):
|
| | | ## 领取开服庆典累计积分阶段奖励
|
| | | curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OSACelebrationPoint)
|
| | | if curPoint < awardPoint:
|
| | | GameWorld.DebugLog("累计开服庆典积分不足: curPoint=%s < %s" % (curPoint, awardPoint))
|
| | | return
|
| | | awardDict = IpyGameDataPY.GetFuncEvalCfg("OSACelebration", 2, {}) # {"累计积分":[[物品ID,个数], ...], ...}
|
| | | pointKeyList = [int(p) for p in awardDict.keys()]
|
| | | pointKeyList.sort()
|
| | | if awardPoint not in pointKeyList:
|
| | | GameWorld.DebugLog("不存在该开服庆典积分阶段奖励: awardPoint=%s not in %s" % (awardPoint, pointKeyList))
|
| | | return
|
| | | index = pointKeyList.index(awardPoint)
|
| | | awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OSACelebrationAward)
|
| | | if awardState&pow(2, index):
|
| | | GameWorld.DebugLog("该开服庆典积分阶段奖励已领取: awardPoint=%s,index=%s,awardState=%s" % (awardPoint, index, awardState))
|
| | | return
|
| | | updState = PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OSACelebrationAward, awardState|pow(2, index))
|
| | | itemList = awardDict[str(awardPoint)]
|
| | | GameWorld.DebugLog("领取开服庆典积分阶段奖励: awardPoint=%s,index=%s,awardState=%s,updState=%s,itemList=%s" % (awardPoint, index, awardState, updState, itemList))
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, itemList, event=["OSACelebration", False, {}])
|
| | | SyncOSACelebrationInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def SyncOSACelebrationInfo(curPlayer):
|
| | | clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCOSACelebrationInfo)
|
| | | clientPack.PointTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OSACelebrationPoint)
|
| | | clientPack.PointAward = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OSACelebrationAward)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|