From c2c30fce8df5dc5ea69f4f93bc9a6c655b2928cd Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 05 十二月 2025 15:15:15 +0800
Subject: [PATCH] 376 【福利】兑换码
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py | 159 +++++++++++++++++++++++++++++++++++------------------
1 files changed, 105 insertions(+), 54 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 7469282..209a64b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
@@ -20,7 +20,9 @@
import ShareDefine
import NetPackCommon
import PlayerControl
+import OpenServerActivity
import ChPyNetSendPack
+import IPY_GameWorld
import ItemControler
import IpyGameDataPY
import PyGameData
@@ -47,72 +49,119 @@
SyncSuccessAwardRecord(curPlayer)
return
-def ResetSuccessByType(curPlayer, succType, ignoreFinish=True):
+def ResetSuccessByTypes(curPlayer, succTypeList, ignoreFinish=True, isNotify=True):
+ ## 重置成就
+ for succType in succTypeList:
+ ResetSuccessByType(curPlayer, succType, ignoreFinish, isNotify)
+ return
+
+def ResetSuccessByType(curPlayer, succType, ignoreFinish=True, isNotify=True):
#重置某类型成就进度,一般用于先重置次数再重新计数,或者活动类
ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("Success", succType)
if not ipyDataList:
return
+ succIDList = []
+ syncTypeCondList = []
for ipyData in ipyDataList:
succID = ipyData.GetSuccID()
if ignoreFinish and GetSuccHasGot(curPlayer, succID):
continue
conds = ipyData.GetCondition()
SetSuccValue(curPlayer, succType, conds, 0)
+ SetSuccHasGot(curPlayer, succID, 0)
+ succIDList.append(succID)
+ if [succType, conds] not in syncTypeCondList:
+ syncTypeCondList.append([succType, conds])
+ if isNotify:
+ succIDList and SyncSuccessAwardRecord(curPlayer, succIDList, True)
+ syncTypeCondList and SyncSuccessInfo(curPlayer, syncTypeCondList, True)
return
-#def UpdateSuccessProgressByConditions(curPlayer, successType, conditionCountDict):
-# ## 根据多种条件更新进度,如装备多品质的
-# ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("Success", successType)
-# if not ipyDataList:
-# return
-# updIDList = []
-# updsuccDataList = []
-# updConditionDict = {}
-#
-# for condition, newCount in conditionCountDict.items():
-# addCondList = [] # 不同的成就ID条件可能相同,只是最大进度不同,故传入的条件计数针对相同成就条件只能累加一次
-# for ipyData in ipyDataList:
-# succID = ipyData.GetSuccID()
-# conds = ipyData.GetCondition()
-# needCnt = ipyData.GetNeedCnt()
-#
-# tupleCond = tuple(conds) # 作为字典key用
-#
-# if tupleCond not in updConditionDict:
-# updConditionDict[tupleCond] = [conds, 0, 0] # [条件, 更新值, 最大进度值]
-# updInfo = updConditionDict[tupleCond]
-# if updInfo[2] < needCnt:
-# updInfo[2] = needCnt
-#
-# if not __CheckCanAddSuccess(curPlayer, ipyData, list(condition)):
-# continue
-#
-# if succID not in updIDList:
-# updIDList.append(succID)
-# updsuccDataList.append(ipyData)
-#
-# if tupleCond not in addCondList:
-# addCondList.append(tupleCond)
-# updConditionDict[tupleCond][1] = updConditionDict[tupleCond][1] + newCount # 更新进度值
-#
-# # 没有找到更新目标不处理
-# #GameWorld.DebugLog(" updConditionDict=%s" % updConditionDict)
-# #GameWorld.DebugLog(" updIDList=%s" % updIDList)
-# if not updIDList:
-# return
-#
-# # 先更新成就记录值后再判断完成与否
-# for cond, updCnt, maxCnt in updConditionDict.values():
-# if not updCnt:
-# continue
-# updCnt = min(maxCnt, updCnt)
-# if GetSuccValue(curPlayer, successType, cond) == updCnt:
-# continue
-# SetSuccValue(curPlayer, successType, cond, updCnt)
-# SyncSuccessInfo(curPlayer, syncTypeCondList)
-# return
+def UpdateEquipSuccess(curPlayer):
+ # 装备相关成就
+
+ colorCountDict = {}
+ equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
+ for equipPlace in ChConfig.Def_MainEquipPlaces:
+ equipIndex = equipPlace - 1
+ if equipIndex < 0 or equipIndex >= equipPack.GetCount():
+ continue
+ curEquip = equipPack.GetAt(equipIndex)
+ if not curEquip or curEquip.IsEmpty():
+ continue
+ itemColor = curEquip.GetItemColor()
+ condKey = (itemColor, )
+ colorCountDict[condKey] = colorCountDict.get(condKey, 0) + 1
+
+ UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_OSAEquipColor, colorCountDict)
+ return
+
+def UpdateSuccessProgressByConditions(curPlayer, successType, conditionCountDict):
+ ## 根据多种条件更新进度,如装备多品质的
+ # @param conditionCountDict: 条件对应件数,条件需用元组为key {(c, ...):cnt, ..}
+ if successType in ShareDefine.OSASuccTypeList:
+ if OpenServerActivity.GetOSACelebrationState(curPlayer) != 1:
+ return
+ ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("Success", successType)
+ if not ipyDataList:
+ return
+
+ updIDList = []
+ updsuccDataList = []
+ updConditionDict = {}
+
+ for condition, newCount in conditionCountDict.items():
+ addCondList = [] # 不同的成就ID条件可能相同,只是最大进度不同,故传入的条件计数针对相同成就条件只能累加一次
+ for ipyData in ipyDataList:
+ succID = ipyData.GetSuccID()
+ conds = ipyData.GetCondition()
+ needCnt = ipyData.GetNeedCnt()
+
+ tupleCond = tuple(conds) # 作为字典key用
+
+ if tupleCond not in updConditionDict:
+ updConditionDict[tupleCond] = [conds, 0, 0] # [条件, 更新值, 最大进度值]
+ updInfo = updConditionDict[tupleCond]
+ if updInfo[2] < needCnt:
+ updInfo[2] = needCnt
+
+ if not __CheckCanAddSuccess(curPlayer, ipyData, list(condition)):
+ continue
+
+ if succID not in updIDList:
+ updIDList.append(succID)
+ updsuccDataList.append(ipyData)
+
+ if tupleCond not in addCondList:
+ addCondList.append(tupleCond)
+ updConditionDict[tupleCond][1] = updConditionDict[tupleCond][1] + newCount # 更新进度值
+
+ # 没有找到更新目标不处理
+ #GameWorld.DebugLog(" conditionCountDict=%s" % conditionCountDict)
+ #GameWorld.DebugLog(" updConditionDict=%s" % updConditionDict)
+ #GameWorld.DebugLog(" updIDList=%s" % updIDList)
+ if not updIDList:
+ return
+
+ # 先更新成就记录值后再判断完成与否
+ syncTypeCondList = []
+ for conds, updCnt, maxCnt in updConditionDict.values():
+ if not updCnt:
+ continue
+ updCnt = min(maxCnt, updCnt)
+ if GetSuccValue(curPlayer, successType, conds) == updCnt:
+ continue
+ SetSuccValue(curPlayer, successType, conds, updCnt)
+ if [successType, conds] not in syncTypeCondList:
+ syncTypeCondList.append([successType, conds])
+ #GameWorld.DebugLog(" syncTypeCondList=%s" % syncTypeCondList)
+ syncTypeCondList and SyncSuccessInfo(curPlayer, syncTypeCondList, True)
+ return
def UptateSuccessProgress(curPlayer, successType, newCnt, condition=[]):
+ if successType in ShareDefine.OSASuccTypeList:
+ if OpenServerActivity.GetOSACelebrationState(curPlayer) != 1:
+ return
ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("Success", successType)
if not ipyDataList:
return
@@ -226,7 +275,9 @@
return
if successType not in ShareDefine.SuccessTypeList:
return
-
+ if successType in ShareDefine.OSASuccTypeList:
+ if OpenServerActivity.GetOSACelebrationState(curPlayer) != 1:
+ return
ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("Success", successType)
if not ipyDataList:
GameWorld.DebugLog("找不到成就数据successType=%s" % successType)
@@ -274,7 +325,7 @@
needCnt = ipyData.GetNeedCnt()
curValue = GetSuccValue(curPlayer, succType, conds)
if curValue < needCnt:
- GameWorld.DebugLog("该成就未完成! succID=%s,curValue=%s < %s" % (succID, curValue, needCnt))
+ GameWorld.DebugLog("该成就未完成! succID=%s,succType=%s,conds=%s,curValue=%s < %s" % (succID, succType, conds, curValue, needCnt))
return
SetSuccHasGot(curPlayer, succID)
--
Gitblit v1.8.0