From 495f9eed41e29b54672a767817c9cb11419dfa4c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 31 七月 2023 16:36:46 +0800
Subject: [PATCH] 9788 【BT9】【后端】成就系统(增加成就积分) hygame2

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
index 1f181c5..11b362c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
@@ -245,6 +245,9 @@
         if not succInfoList:
             continue
         __DoCheckSuccessFinish(curPlayer, succType, succInfoList)
+        
+    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_ScoreAward):
+        Sync_SuccessScoreAward(curPlayer)
     return
 
 ## 检查老玩家成就激活情况
@@ -1044,4 +1047,36 @@
     elif mapID == ChConfig.Def_FBMapID_IceLode:
         #冰晶矿脉
         DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_IceLode, addCount)
-    return
\ No newline at end of file
+    return
+
+def GetSuccessScoreAward(curPlayer, awardIndex):
+    playerID = curPlayer.GetPlayerID()
+    awardDict = IpyGameDataPY.GetFuncEvalCfg("SucceeScore", 1, {})
+    if str(awardIndex) not in awardDict:
+        return
+    awardInfo = awardDict[str(awardIndex)]
+    if len(awardInfo) != 2:
+        return
+    needScore, awardItemList = awardInfo
+    if not PlayerControl.HaveMoney(curPlayer, ShareDefine.TYPE_Price_SuccessSocre, needScore):
+        GameWorld.Log("成就积分不足,无法领奖! awardIndex=%s,needScore=%s" % (awardIndex, needScore), playerID)
+        return
+    awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_ScoreAward)
+    if awardState & pow(2, awardIndex):
+        GameWorld.DebugLog("已领取过该成就积分奖励! awardIndex=%s" % awardIndex, playerID)
+        return
+    updAwardState = awardState | pow(2, awardIndex)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Success_ScoreAward, updAwardState)
+    GameWorld.DebugLog("领取成就积分奖励! awardIndex=%s,awardState=%s,updAwardState=%s" % (awardIndex, awardState, updAwardState), playerID)
+    Sync_SuccessScoreAward(curPlayer)
+    ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["SuccessScore", False, {}])
+    return
+
+def Sync_SuccessScoreAward(curPlayer):
+    clientPack = ChPyNetSendPack.tagMCSuccessScoreInfo()
+    clientPack.Clear()
+    clientPack.ScoreAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_ScoreAward)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+    
+    
\ No newline at end of file

--
Gitblit v1.8.0