From 8d68127a62c17a160c575842e1607833cc42564b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 23 十二月 2020 17:04:13 +0800
Subject: [PATCH] 8668 【主干】可拍卖道具取消拍卖时间限制并可以叠加后,上架时可选择拍卖的数量(封包);
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py | 323 +++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 239 insertions(+), 84 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 5f9aa08..67318d0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
@@ -29,6 +29,7 @@
import ItemControler
import PlayerMagicWeapon
import PlayerFamilyRedPacket
+import PlayerGatherSoul
import IpyGameDataPY
import EventShell
import PyGameData
@@ -37,6 +38,14 @@
import datetime
import time
import math
+import ChEquip
+import PlayerRune
+import Operate_EquipStone
+import Operate_EquipWash
+import PlayerFeastRedPacket
+import PlayerDogz
+import QuestCommon
+import DataRecordPack
## 获取成就字典信息值
@@ -76,11 +85,20 @@
SetSuccFinish(curPlayer, succID, 0)
Sync_SuccTypeIndexAwardRecord(curPlayer, [succID], True) #设置成未领取的在外层同步
- PlayerMagicWeapon.ActiveMagicWeapon(curPlayer, succID)
EventShell.EventRespons_SuccessFinish(curPlayer, succID)
return
+def GetSuccPassportAwardHasGot(curPlayer, succID):
+ #获取成就通行证奖励是否已领取
+ return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_Success_PassportAward, succID)
+def SetSuccPassportAwardHasGot(curPlayer, succID, hasGot=True):
+ #设置成就通行证奖励领取状态
+ GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_Success_PassportAward, succID, hasGot)
+ if hasGot:
+ Sync_SuccTypeIndexAwardRecord(curPlayer, [succID])
+ return
+
def SetSuccFinishValue(curPlayer, succType, condition, value):
#设置成就完成度
key = ChConfig.Def_PDict_Success_CntValue % (succType, condition)
@@ -104,6 +122,7 @@
self.preSuccIDList = [] # 前置成就ID
self.condition = [] # 辅助条件(根据类型自定义配置)
self.awardItemDict = {} # 完成成就可领取的奖励物品{itemid:itemcnt}
+ self.awardItemDict2 = {} # 完成成就可领取的奖励物品,通行证奖励{itemid:itemcnt}
self.moneyDict = {} # 完成成就获得的金钱 {moneyType:money}
self.exp = 0 # 完成成就获得的经验
self.attrDict = {} # 完成成就获得的属性 {attrid:attrvalue}
@@ -145,6 +164,7 @@
succData.preSuccIDList = list(successIpyData.GetPreSuccess())
succData.condition = list(successIpyData.GetCondition())
succData.awardItemDict = successIpyData.GetAwardItem()
+ succData.awardItemDict2 = successIpyData.GetAwardItem2()
succData.moneyDict = successIpyData.GetMoney()
succData.exp = successIpyData.GetExp()
succData.attrDict = successIpyData.GetAwardAttr()
@@ -153,7 +173,8 @@
magicWeaponExp = successIpyData.GetMagicWeaponExp()
if magicWeaponID and magicWeaponExp:
succData.magicWeaponExp[magicWeaponID] = magicWeaponExp
- succData.hasAward = bool(succData.awardItemDict or succData.moneyDict or succData.exp or succData.attrDict or succData.redPacketID or succData.magicWeaponExp)
+ succData.hasAward = bool(succData.awardItemDict or succData.moneyDict or succData.exp or succData.attrDict or succData.redPacketID or succData.magicWeaponExp \
+ or succData.awardItemDict2)
successDataObjDict[succData.succID]=succData
if tuple(succData.condition) not in conditionDict:
conditionDict[tuple(succData.condition)] = [succData.succID]
@@ -216,7 +237,7 @@
# 检查老玩家
- #__CheckOldPlayerSuccess(curPlayer)
+ __CheckOldPlayerSuccess(curPlayer)
# 检查达成与否(有些可能改过上限,然后玩家可以完成,上线统一做一次检查)
for succType in ShareDefine.SuccessTypeList:
@@ -230,36 +251,25 @@
# @param None
# @return
def __CheckOldPlayerSuccess(curPlayer):
- ''' 成就版本更新老玩家检查
- 正式上线后,成就的修改或者增加,一般是增加新成就,则需要对老玩家成就版本进行校正,检查成就完成情况
- 成就版本号递增
+ ''' 成就版本更新老玩家检查 每次启动服务后 玩家第一次上线检查成就完成情况
'''
- Versions = 2 #版本号,往上增加
-
- # 上线需要检查老玩家成就完成情况类型{成就类型:维护版本号, ...}
- NeedCheckSuccTypeDict = {
- }
+ initGameWorldTime = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_InitGameWorldTime)
+ # 上线需要检查老玩家成就完成情况类型
+ NeedCheckSuccTypeList = [
+ ]
curCheckVersion = GetPDictValue(curPlayer, ChConfig.Def_PDict_Success_CheckVersion)
+ if curCheckVersion == initGameWorldTime:
+ GameWorld.DebugLog(' 本次开启服务器处理过成就检查,不再处理 ', curPlayer.GetID())
+ return
GameWorld.DebugLog("更新老玩家上线检查成就curCheckVersion=%s" % (curCheckVersion))
- for succType, version in NeedCheckSuccTypeDict.items():
-
- if curCheckVersion >= version:
- continue
-
-# condition = 0
-# if succType == ShareDefine.SuccType_MainTaskNode: #主线任务结点
-# succInfoDict = GetSuccDataMng().GetSuccDataByType(ShareDefine.SuccType_MainTaskNode)
-# condition = QuestCommon.GetCurMainTaskState(curPlayer, succInfoDict)
-# addCnt = 1 if condition >= 0 else 0
-#
-# else:
-# continue
-#
-# DoAddSuccessProgress(curPlayer, succType, addCnt, condition)
-
- SetPDictValue(curPlayer, ChConfig.Def_PDict_Success_CheckVersion, Versions)
- GameWorld.DebugLog("更新老玩家上线检查成就updCheckVersions=%s" % (Versions))
+ ipyDataMgr = IpyGameDataPY.IPY_Data()
+ for succType in NeedCheckSuccTypeList:
+ pass
+
+ DataRecordPack.DR_CheckOldPlayerSuccess(curPlayer)
+ SetPDictValue(curPlayer, ChConfig.Def_PDict_Success_CheckVersion, initGameWorldTime)
+ GameWorld.DebugLog("更新老玩家上线检查成就updCheckVersions=%s" % (initGameWorldTime), curPlayer.GetID())
return
## 成就OnWeek
@@ -282,6 +292,29 @@
SetSuccHasGot(curPlayer, succID, False)
resetList.append(succID)
GameWorld.DebugLog(" OnWeek 重置成就类型: succID=%s" % (succID))
+ if resetList:
+ Sync_SuccTypeIndexAwardRecord(curPlayer, resetList, True)
+ Sync_SuccessInfo(curPlayer, resetList, True)
+ return
+
+def DoResetSuccessIDList(curPlayer, resetSuccIDList):
+ ## 重置成就相关数据
+ if not resetSuccIDList:
+ return
+ resetList = []
+ for succID in resetSuccIDList:
+ succData = GetSuccDataMng().GetSuccessData(succID)
+ if not succData:
+ continue
+ succType = succData.succType
+ condition = succData.condition
+ #if not GetSuccFinishValue(curPlayer, succType, condition):
+ # continue
+ SetSuccFinishValue(curPlayer, succType, condition, 0)
+ SetSuccFinish(curPlayer, succID, False)
+ SetSuccHasGot(curPlayer, succID, False)
+ resetList.append(succID)
+ GameWorld.DebugLog(" 重置成就类型: succType=%s,succID=%s" % (succType, succID))
if resetList:
Sync_SuccTypeIndexAwardRecord(curPlayer, resetList, True)
Sync_SuccessInfo(curPlayer, resetList, True)
@@ -364,37 +397,111 @@
SetSuccFinishValue(curPlayer, succType, condition, 0)
return
-def DoEquipSuccessLogic(curPlayer):
+def DoEquipSuccessLogic(curPlayer, classLV):
#玩家当前可装备的装备类型
- ResetSuccessByType(curPlayer, ShareDefine.SuccType_EquipColorItem)
- ResetSuccessByType(curPlayer, ShareDefine.SuccType_EquipArmor)
- ResetSuccessByType(curPlayer, ShareDefine.SuccType_EquipWeapon)
- packType = IPY_GameWorld.rptEquip
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'ClassLV':classLV}, True)
+ if not ipyDataList:
+ return
- playerEquip = curPlayer.GetItemManager().GetPack(packType)
- for equipIndex in xrange(playerEquip.GetCount()):
- if equipIndex not in ShareDefine.RoleEquipType :
- continue
-
+ placeCountDict, colorCountDict, suitCountDict = {}, {}, {}
+ playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
+ for ipyData in ipyDataList:
+ equipIndex = ipyData.GetGridIndex()
curEquip = playerEquip.GetAt(equipIndex)
if curEquip.IsEmpty():
continue
- itemColor = curEquip.GetUserAttr(ShareDefine.Def_IudetItemColor)
- if not itemColor:
+ itemPlace = curEquip.GetEquipPlace()
+
+ # 套装、颜色 成就 统计基础部位
+ if itemPlace in ChConfig.EquipPlace_Base:
itemColor = curEquip.GetItemColor()
+ colorConditionKey = (classLV, itemColor)
+ colorCountDict[colorConditionKey] = colorCountDict.get(colorConditionKey, 0) + 1
+
+ # 统计套装数
+ if curEquip.GetSuiteID():
+ suitConditionKey = (classLV, )
+ suitCountDict[suitConditionKey] = suitCountDict.get(suitConditionKey, 0) + 1
+
+ # 部位 成就 统计特殊部位
+ elif itemPlace in ChConfig.EquipPlace_Special:
+ placeConditionKey = (classLV, itemPlace)
+ placeCountDict[placeConditionKey] = placeCountDict.get(placeConditionKey, 0) + 1
+
+ # 更新成就
+ #GameWorld.DebugLog("装备阶部位成就数据: classLV=%s,placeCountDict=%s" % (classLV, placeCountDict))
+ UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipPlace, placeCountDict)
+
+ #GameWorld.DebugLog("装备阶颜色成就数据: classLV=%s,colorCountDict=%s" % (classLV, colorCountDict))
+ UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipColorItem, colorCountDict)
+
+ #GameWorld.DebugLog("装备阶套装成就数据: classLV=%s,suitCountDict=%s" % (classLV, suitCountDict))
+ UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipSuit, suitCountDict)
+ return
+
+def UpdateSuccessProgressByConditions(curPlayer, successType, conditionCountDict):
+ if successType not in ShareDefine.SuccessTypeList:
+ return
+ succInfoList = GetSuccDataMng().GetSuccDataByType(successType)
+ if not succInfoList:
+ return
+ updIDList = []
+ updsuccDataList = []
+ updConditionDict = {}
+
+ for condition, newCount in conditionCountDict.items():
+ addCondList = [] # 不同的成就ID条件可能相同,只是最大进度不同,故传入的条件计数针对相同成就条件只能累加一次
+ for succDataObj in succInfoList:
+ cond = succDataObj.condition
+
+ tupleCond = tuple(cond) # 作为字典key用
+ succID = succDataObj.succID
+ needCnt = succDataObj.needCnt
+
+ if tupleCond not in updConditionDict:
+ updConditionDict[tupleCond] = [cond, 0, 0] # [条件, 更新值, 最大进度值]
+ updInfo = updConditionDict[tupleCond]
+ if updInfo[2] < needCnt:
+ updInfo[2] = needCnt
+
+ if not __CheckCanAddSuccess(curPlayer, succDataObj, list(condition)):
+ continue
+
+ if succID not in updIDList:
+ updIDList.append(succID)
+ updsuccDataList.append(succDataObj)
+
+ 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
+
+ isUpd = False
+ # 先更新成就记录值后再判断完成与否
+ for cond, updCnt, maxCnt in updConditionDict.values():
+ if not updCnt:
+ continue
+ updCnt = min(maxCnt, updCnt)
+ if GetSuccFinishValue(curPlayer, successType, cond) == updCnt:
+ continue
+ isUpd = True
+ SetSuccFinishValue(curPlayer, successType, cond, updCnt)
+ #GameWorld.DebugLog(" successType=%s,cond=%s,updCnt=%s,maxCnt=%s" % (successType, cond, updCnt, maxCnt))
- itemQuality = curEquip.GetItemQuality()
- classLV = ItemCommon.GetItemClassLV(curEquip)
- if equipIndex not in [ShareDefine.retWing,ShareDefine.retGuard,ShareDefine.retHorse]:
- DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipColorItem, 1, [classLV, itemColor])
- if equipIndex in ChConfig.BaseEquipPlace_Weapon:
- DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipWeapon, 1, [itemColor, itemQuality, classLV])
- elif equipIndex in ChConfig.BaseEquipPlace_Armor:
- DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipArmor, 1, [itemColor, itemQuality, classLV])
-
- elif equipIndex == ShareDefine.retWing:
- DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipWing, 1, [classLV, itemColor])
+ if not isUpd:
+ return
+
+ # 同步更新信息
+ Sync_SuccessInfo(curPlayer, updIDList, False)
+
+ # 更新值后检查成就完成情况
+ __DoCheckSuccessFinish(curPlayer, successType, updsuccDataList)
return
@@ -406,6 +513,9 @@
def UptateSuccessProgress(curPlayer, successType, newCnt, condition=[]):
if successType not in ShareDefine.SuccessTypeList:
return
+ if successType in ShareDefine.FeastRedPackSuccessTypeList:
+ if not PlayerFeastRedPacket.GetFeastRedPacketState():
+ return
succInfoList = GetSuccDataMng().GetSuccDataByType(successType)
if not succInfoList:
return
@@ -427,6 +537,11 @@
succID = succDataObj.succID
cond = succDataObj.condition
+ if successType in ShareDefine.FeastRedPackSuccessTypeList:
+ todayFeastSuccIDList = PlayerFeastRedPacket.GetTodayFeastSuccIDList()
+ if not todayFeastSuccIDList or succID not in todayFeastSuccIDList:
+ #GameWorld.DebugLog(" 非今日节日红包成就,不增加进度! succID=%s,todayFeastSuccIDList=%s" % (succID, todayFeastSuccIDList))
+ return
isUnDownCheck = successType in ShareDefine.UnDownCheckSuccessTypeList
isContain = successType in ShareDefine.ContainSuccessTypeList
# 已完成的不再检查
@@ -456,7 +571,14 @@
# 可向下增加进度的, 仅配置值 <= 该值的可增加进度
if not isUnDownCheck:
isbreak = False
+ undowncheckIndexList = [] # 不向下检查的条件索引
+ if successType in ShareDefine.PartUnDownCheckSuccessTypeInfo:
+ undowncheckIndexList = ShareDefine.PartUnDownCheckSuccessTypeInfo[successType]
for i, num in enumerate(cond):
+ if i in undowncheckIndexList:
+ if num != condition[i]:
+ isbreak = True
+ break
if num > condition[i]:
isbreak = True
break
@@ -497,7 +619,14 @@
def DoAddSuccessProgress(curPlayer, successType, addCnt, condition=[], delayCalc=True):
#GameWorld.DebugLog("DoAddSuccessProgress type=%s,addCnt=%s,condition=%s"
# % (successType, addCnt, condition), curPlayer.GetPlayerID())
-
+ if GameWorld.IsCrossServer():
+ return
+
+ if successType in ShareDefine.FeastRedPackSuccessTypeList:
+ if not PlayerFeastRedPacket.GetFeastRedPacketState():
+ #GameWorld.DebugLog("非节日红包活动时间,不增加成就!successType=%s" % successType)
+ return
+
playerID = curPlayer.GetID()
if delayCalc and successType not in ShareDefine.NeedResetSuccessTypeList:
if playerID not in PyGameData.g_delaySuccessDict:
@@ -749,47 +878,64 @@
awardDict[itemID] = awardDict.get(itemID, 0)+itemCnt
return awardDict
+def GetSuccessPassportState(curPlayer):
+ ## 成就通行证状态
+ return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % ChConfig.Def_CTGID_SuccessPassport) > 0
+
#// A5 42 领取成就奖励 #tagMCGetSuccessAward
#
#struct tagMCGetSuccessAward
#{
# tagHead Head;
# DWORD SuccID; //成就ID
+# BYTE IsPassport; //是否通行证奖励
#};
-## 领取成就奖励
-# @param None
-# @return
def OnGetSuccessAward(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
succID = clientData.SuccID
- __DoGetSuccTypeIndexAward(curPlayer, succID)
+ isPassport = clientData.IsPassport
+ __DoGetSuccTypeIndexAward(curPlayer, succID, isPassport=isPassport)
return
## 领取某个成就奖励
# @param None
# @return
-def __DoGetSuccTypeIndexAward(curPlayer, succID, isGiveItem=True):
- GameWorld.DebugLog("领取成就奖励succID=%s" % (succID))
+def __DoGetSuccTypeIndexAward(curPlayer, succID, isGiveItem=True, isPassport=False):
+ GameWorld.DebugLog("领取成就奖励succID=%s,isPassport=%s" % (succID, isPassport))
succData = GetSuccDataMng().GetSuccessData(succID)
if not succData:
GameWorld.DebugLog(" 成就数据不存在!succID=%s" % (succID))
return
-
- finishTime = GetSuccIsFinish(curPlayer, succID)
- if finishTime <= 0:
- GameWorld.DebugLog(" 该成就未完成!")
- return
-
- if GetSuccHasGot(curPlayer, succID):
- GameWorld.DebugLog(" 该成就奖励已经领取过!")
- return
-
+
if not succData.hasAward:
GameWorld.DebugLog(" 该成就没有配置奖励!")
return
- itemDict = succData.awardItemDict
+ finishTime = GetSuccIsFinish(curPlayer, succID)
+ hasGot = GetSuccHasGot(curPlayer, succID) # 因为普通奖励领取后会重置是否已完成,所以如果已经领取普通奖励也代表已完成
+ if finishTime <= 0 and not hasGot:
+ GameWorld.DebugLog(" 该成就未完成!")
+ return
+
+ if isPassport:
+ if GetSuccPassportAwardHasGot(curPlayer, succID):
+ GameWorld.DebugLog(" 该成就通行证奖励已经领取过!")
+ return
+
+ if not GetSuccessPassportState(curPlayer):
+ GameWorld.DebugLog(" 未开通成就通行证,无法领取通行证奖励!")
+ return
+ itemDict = succData.awardItemDict2
+ if not itemDict:
+ GameWorld.DebugLog(" 该成就没用通行证奖励!")
+ return
+ else:
+ if hasGot:
+ GameWorld.DebugLog(" 该成就奖励已经领取过!")
+ return
+ itemDict = succData.awardItemDict
+
# if awardItemDict and '[' in str(awardItemDict):
# #修行成就奖励根据境界等级变
# curRealmLV = curPlayer.GetOfficialRank()
@@ -803,26 +949,31 @@
# else:
# itemDict = awardItemDict
-
-
-
# 检查背包
if isGiveItem:
- packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
- needSpace = len(itemDict)
- if needSpace > packSpace:
- PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
+ if not ItemCommon.CheckPackEnough(curPlayer, itemDict):
return
+# packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
+# needSpace = len(itemDict)
+# if needSpace > packSpace:
+# PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
+# return
# 更新领奖记录
- SetSuccHasGot(curPlayer, succID)
+ if isPassport:
+ SetSuccPassportAwardHasGot(curPlayer, succID)
+ else:
+ SetSuccHasGot(curPlayer, succID)
# 给物品
if isGiveItem:
for itemID, itemCnt in itemDict.items():
- isPutIn = ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1,
- [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere], True)
+ isPutIn = ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere])
+ if isPassport:
+ # 通行证奖励只给物品
+ return itemDict
+
#给钱
for moneyType, value in succData.moneyDict.items():
PlayerControl.GiveMoney(curPlayer, moneyType, value)
@@ -853,27 +1004,31 @@
if succIDList:
recordIndexList = []
for succID in succIDList:
- recordIndexList.append(succID / 31)
+ recordIndex = succID / 31
+ if recordIndex not in recordIndexList:
+ recordIndexList.append(recordIndex)
else:
ipyDataMgr = IpyGameDataPY.IPY_Data()
succCnt = ipyDataMgr.GetSuccessCount()
if not succCnt:
return
maxSuccid = ipyDataMgr.GetSuccessByIndex(succCnt-1).GetID()
- recordIndexList = range(maxSuccid / 31+1)
+ recordIndexList = xrange(maxSuccid / 31+1)
succFARPack = ChPyNetSendPack.tagMCSuccessFinishAwardRecordList()
succFARPack.Clear()
succFARPack.RecordList = []
for i in recordIndexList:
awardRecord=curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_AwardRecord%i)
- if not isSyncZero and not awardRecord:
+ passportAwardRecord=curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_PassportAward%i)
+ if not isSyncZero and not awardRecord and not passportAwardRecord:
continue
recordInfo = ChPyNetSendPack.tagMCSuccessFinishAwardRecord()
recordInfo.RecordIndex = i
recordInfo.Record = awardRecord
+ recordInfo.PassportRecord = passportAwardRecord
succFARPack.RecordList.append(recordInfo)
-
+
succFARPack.RecordCnt = len(succFARPack.RecordList)
NetPackCommon.SendFakePack(curPlayer, succFARPack)
return
--
Gitblit v1.8.0