From c80c8718c507a7e52f065eee9e35bb4f27573f48 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 05 十二月 2025 11:07:07 +0800
Subject: [PATCH] 374 【活动内容】开服庆典-服务端

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/OpenServerActivity.py |   71 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/OpenServerActivity.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/OpenServerActivity.py
index 253c496..14bc9b8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/OpenServerActivity.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/OpenServerActivity.py
@@ -19,10 +19,15 @@
 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 = {
@@ -97,3 +102,67 @@
             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

--
Gitblit v1.8.0