From a4cc5ca09eb2b1ccbb40d7db4b45ded8195d0a98 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 27 十一月 2019 16:19:16 +0800
Subject: [PATCH] 8346 【恺英】【后端】协助系统(协助表修改)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py | 148 +++++++++++++++++++++++++++---------------------
1 files changed, 83 insertions(+), 65 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
index 91aef53..9ebc49c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
@@ -28,7 +28,6 @@
import ItemCommon
import ChConfig
import ChEquip
-import EventShell
import random
@@ -37,18 +36,16 @@
Def_EquipWashMaxAttrCount = 3 # 装备洗练最大洗练属性条数
g_allIndexList = [] #可洗炼的部位缓存
-def OnEquipWashLogin(curPlayer):
- Sycn_EquipWashInfo(curPlayer, isLogin=True)
- return
+#def OnEquipWashLogin(curPlayer):
+# Sycn_EquipWashInfo(curPlayer, isLogin=True)
+# return
def GetEquipWashMaxLV(curPlayer, equipPackindex, equipPlace):
# @return: 0-未开放; >=1-该装备位最大可洗练等级
washType = GetEquipWashType(equipPlace)
if not washType:
return 0
- maxLVDict = IpyGameDataPY.GetFuncEvalCfg("EquipWashGroup%s" % washType, 2)
- if not maxLVDict:
- return 0
+
equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
curEquip = equipPack.GetAt(equipPackindex)
if not curEquip or curEquip.IsEmpty():
@@ -56,38 +53,18 @@
return 0
equipStar = ChEquip.GetEquipPartStarByRank(curPlayer, equipPackindex, curEquip)
- minStarCfg = min(maxLVDict)
- if equipStar < minStarCfg:
- GameWorld.DebugLog("该装备位装备星数=%s < minStarCfg(%s),无法洗练!equipPackindex=%s"
- % (equipStar, minStarCfg, equipPackindex))
+ ipyData = IpyGameDataPY.InterpolationSearch('ItemWashMax', 'Star', equipStar, {'Type':washType})
+ if not ipyData:
return 0
- if equipStar in maxLVDict:
- maxWashLV = maxLVDict[equipStar]
- if not maxWashLV:
- GameWorld.DebugLog("该装备位装备星数=%s,maxWashLV=%s,无法洗练!equipPackindex=%s"
- % (equipStar, maxWashLV, equipPackindex))
- return 0
- return maxWashLV
- maxStarCfg = max(maxLVDict)
- if equipStar > maxStarCfg:
- return maxLVDict[maxStarCfg]
- # 默认返回当前部位洗练等级
- return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPackindex) + 1
+ return ipyData.GetLevelMax()
+
+
-def GetEquipWashPlaceList(washType):
- ## 获取洗练类型对应的所有装备位
- placeList = IpyGameDataPY.GetFuncEvalCfg("EquipWashGroup%s" % washType, 1)
- if placeList:
- return placeList
- return []
def GetEquipWashType(equipPlace):
## 获取装备位对应的洗练类型
- for washType in range(1, Def_EquipWashMaxType + 1):
- placeList = GetEquipWashPlaceList(washType)
- if equipPlace in placeList:
- return washType
- return
+ return IpyGameDataPY.GetFuncEvalCfg('EquipWashGroup', 1, {}).get(equipPlace)
+
def GetEquipWashData(washType, washLV):
return IpyGameDataPY.GetIpyGameData("EquipWash", washType, washLV)
@@ -97,13 +74,12 @@
global g_allIndexList
if not g_allIndexList:
maxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv')
- for washType in range(1, Def_EquipWashMaxType + 1):
- for equipPlace in GetEquipWashPlaceList(washType):
- for classLV in xrange(1, maxClasslv+1):
- ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
- if not ipyData:
- continue
- g_allIndexList.append(ipyData.GetGridIndex())
+ for equipPlace in IpyGameDataPY.GetFuncEvalCfg('EquipWashGroup', 1, {}):
+ for classLV in xrange(1, maxClasslv+1):
+ ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
+ if not ipyData:
+ continue
+ g_allIndexList.append(ipyData.GetGridIndex())
return g_allIndexList
#// A3 25 装备洗炼 #tagCMEquipXLAttrChange
@@ -126,17 +102,24 @@
return
equipPlace = ipyData.GetEquipPlace()
classLV = ipyData.GetClassLV()
+ funcPlusMinClassInfo = IpyGameDataPY.GetFuncEvalCfg("EquipPlusByFuncID", 1, {})
+ funcID = ShareDefine.GameFuncID_EquipWash
+ if str(funcID) in funcPlusMinClassInfo:
+ funcMinClassLV = funcPlusMinClassInfo[str(funcID)]
+ if classLV < funcMinClassLV:
+ GameWorld.Log("该装备阶无法洗练! classLV=%s < funcMinClassLV=%s" % (classLV, funcMinClassLV), playerID)
+ return
washType = GetEquipWashType(equipPlace)
if washType is None:
GameWorld.Log("该装备位无法洗练! equipPlace=%s" % (equipPlace), playerID)
return
maxWashLV = GetEquipWashMaxLV(curPlayer, equipPackindex, equipPlace)
- washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPackindex) + 1
+ washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPackindex)
GameWorld.DebugLog("装备洗练: classLV=%s,equipPlace=%s,checkUseGoldAttr=%s,washType=%s,washLV=%s,maxWashLV=%s"
% (classLV, equipPlace, checkUseGoldAttr, washType, washLV, maxWashLV), playerID)
- if maxWashLV < 1:
+ if maxWashLV < washLV:
return
washData = GetEquipWashData(washType, washLV)
@@ -202,6 +185,14 @@
return
GameWorld.DebugLog("随机范围属性%s, washValue=%s, %s~%s" % (attrNum, washValue, randValueMin, randValueMax))
randValue = random.randint(randValueMin, randValueMax)
+ for _ in xrange(50):
+ if randValue != 0:
+ break
+ randValue = random.randint(randValueMin, randValueMax)
+ #GameWorld.DebugLog("随机值0,重新随机!")
+ if randValue == 0:
+ randValue = 1
+ #GameWorld.DebugLog("随机值还是0,强制设置为1!")
randAttrDict[attrNum] = randValue
if randValue <= 0:
negativeValueCnt += 1
@@ -229,7 +220,7 @@
return
preWashData = None # 上一洗练等级数据
- if washLV > 1:
+ if washLV > 0:
preWashData = GetEquipWashData(washType, washLV - 1)
if not preWashData:
GameWorld.ErrLog("找不到上一级洗练数据,无法洗练!preWashLV=%s" % (washLV - 1))
@@ -324,9 +315,14 @@
ipyData = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'GridIndex':equipPackindex})
if not ipyData:
return
+ curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
+ curEquip = curPack.GetAt(equipPackindex)
+ if not curEquip or curEquip.IsEmpty():
+ GameWorld.DebugLog("OnEquipWashAttrChangeOK() equip is empty")
+ return
equipPlace = ipyData.GetEquipPlace()
classLV = ipyData.GetClassLV()
- washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
+ washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPackindex)
maxWashLV = GetEquipWashMaxLV(curPlayer, equipPackindex, equipPlace)
GameWorld.DebugLog("确认洗练结果: classLV=%s, equipPlace=%s,isSave=%s,washLV=%s,maxWashLV=%s"
% (classLV, equipPlace, isSave, washLV, maxWashLV), playerID)
@@ -334,7 +330,7 @@
washType = GetEquipWashType(equipPlace)
if washType is None:
return
- if maxWashLV < 1:
+ if maxWashLV < 0:
return
washData = GetEquipWashData(washType, washLV)
if not washData:
@@ -345,7 +341,7 @@
if washLV >= maxWashLV:
GameWorld.DebugLog("已达到最大洗练等级,不可升级!", playerID)
return
- if CheckEquipWashLVUp(curPlayer, equipPackindex, classLV, equipPlace, washLV, washData):
+ if CheckEquipWashLVUp(curPlayer, curEquip, equipPackindex, washLV, washData):
RefreshEquipWashAttr(curPlayer, classLV)
Sycn_EquipWashInfo(curPlayer, equipPackindex)
EquipWashSuccess(curPlayer)
@@ -374,7 +370,7 @@
Sycn_EquipWashInfo(curPlayer, equipPackindex)
return
-def CheckEquipWashLVUp(curPlayer, equipPackindex, classLV, equipPlace, washLV, washData):
+def CheckEquipWashLVUp(curPlayer, curEquip, equipPackindex, washLV, washData):
# 检查洗练类型升级
for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
@@ -383,14 +379,32 @@
if tempValue < getattr(washData, "GetAttrMax%s" % attrNum)():
return
washLV += 1
- # 字典存储的从0开始,0代表1级,所以实际存进去的值需减1
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashLV % (equipPackindex), washLV - 1)
- GameWorld.DebugLog("装备洗练等级升级: equipPackindex=%s,washLV=%s" % (equipPackindex, washLV), curPlayer.GetPlayerID())
+ SetEquipWashLV(curPlayer, equipPackindex, washLV)
# 洗练广播
- PlayerControl.WorldNotify(0, "WashCongratulation", [curPlayer.GetPlayerName(), curPlayer.GetPlayerID(), classLV, equipPlace, washLV])
+ itemID = curEquip.GetItemTypeID()
+ userData = curEquip.GetUserData()
+ guid = ItemCommon.CacheNotifyEquipDetailInfo(curPlayer, curEquip)
+ msgParamList = [curPlayer.GetPlayerName(), itemID, userData, guid, washLV]
+ PlayerControl.WorldNotify(0, "WashCongratulation", msgParamList)
return True
+def SetEquipWashLV(curPlayer, index, setWashLV):
+ befWashLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % index)
+ if befWashLV == setWashLV:
+ return
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashLV % (index), setWashLV)
+
+ # 同步更新洗练总等级
+ befTotalWashLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalEquipWashLV)
+ updTotalWashLV = max(0, befTotalWashLV + setWashLV - befWashLV)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalEquipWashLV, updTotalWashLV)
+ GameWorld.DebugLog("设置洗练等级: index=%s,befWashLV=%s,setWashLV=%s,befTotalWashLV=%s,updTotalWashLV=%s"
+ % (index, befWashLV, setWashLV, befTotalWashLV, updTotalWashLV))
+ return
+
+## 全身洗练总等级
+def GetTotalEquipWashLV(curPlayer): return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalEquipWashLV)
def Sycn_EquipWashInfo(curPlayer, equipPackindex=-1, isLogin=False):
hasValue = False
@@ -407,7 +421,7 @@
for place in syncPlaceList:
equipPart = ChPyNetSendPack.tagMCEquipPartXLAttr()
equipPart.EquipPlace = place
- equipPart.XLAttrLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % place) + 1
+ equipPart.XLAttrLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % place)
equipPart.XLAttrList = []
for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
washValue = ChPyNetSendPack.tagMCEquipPartXLAttrValue()
@@ -438,7 +452,9 @@
def CalcAttr_EquipWash(curPlayer, equipIndex, equipPlace, allAttrList):
## 装备位洗练属性
- washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipIndex) + 1
+ washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipIndex)
+ maxWashLV = GetEquipWashMaxLV(curPlayer, equipIndex, equipPlace)
+ washLV = min(washLV, maxWashLV)
washType = GetEquipWashType(equipPlace)
if washType is None:
return
@@ -448,23 +464,25 @@
#GameWorld.DebugLog("装备位属性: equipPlace=%s,washLV=%s" % (equipPlace, washLV))
for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
attrID = getattr(washData, "GetAttrType%s" % attrNum)()
+ maxValue = getattr(washData, "GetAttrMax%s" % attrNum)()
attrValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipIndex, attrNum))
+ attrValue = min(attrValue, maxValue)
#GameWorld.DebugLog(" attrNum=%s,attrID=%s, attrValue=%s" % (attrNum, attrID, attrValue))
if attrValue:
PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
return
def EquipWashSuccess(curPlayer):
- succList = [ShareDefine.SuccType_EquipWashLV1,ShareDefine.SuccType_EquipWashLV2,ShareDefine.SuccType_EquipWashLV3]
- for washType in range(1, Def_EquipWashMaxType + 1):
- washTypeLV = 999
- placeList = GetEquipWashPlaceList(washType)
- for equipPlace in placeList:
- washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
- washTypeLV = min(washTypeLV, washLV)
-
- if not washTypeLV:
- continue
- PlayerSuccess.DoAddSuccessProgress(curPlayer, succList[washType-1], 1, [washTypeLV])
+# succList = [ShareDefine.SuccType_EquipWashLV1,ShareDefine.SuccType_EquipWashLV2,ShareDefine.SuccType_EquipWashLV3]
+# for washType in range(1, Def_EquipWashMaxType + 1):
+# washTypeLV = 999
+# placeList = GetEquipWashPlaceList(washType)
+# for equipPlace in placeList:
+# washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace)
+# washTypeLV = min(washTypeLV, washLV)
+#
+# if not washTypeLV:
+# continue
+# PlayerSuccess.DoAddSuccessProgress(curPlayer, succList[washType-1], 1, [washTypeLV])
return
--
Gitblit v1.8.0