From 905bad6a43c7ed07a436781600c8fe7ad41dd887 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 25 二月 2019 15:14:51 +0800
Subject: [PATCH] 6250 【后端】【2.0】拍卖行开发单(封包)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py |   65 +++++++++++++++++++++-----------
 1 files changed, 43 insertions(+), 22 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
index 47c70b3..1f0a059 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -2522,41 +2522,36 @@
     # 纯随机类型及数值的规则
         
     itemType = curItem.GetType()
-    equipTypeRandGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 2, {}) # 随机传奇属性类型组配置: {(装备类型1, 装备类型2, ...):[传奇属性类型组1, ...], ...}
-    if itemType in equipTypeRandGroupDict:
-        randGroupList = equipTypeRandGroupDict[itemType]
-    else:
-        randGroupList = []
-        for typeTuple, groupList in equipTypeRandGroupDict.items():
-            if not isinstance(typeTuple, tuple):
-                continue
-            if itemType in typeTuple:
-                randGroupList = groupList
-                break
-            
+    equipTypeRandGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 2, {}) # 随机传奇属性类型组配置: {"装备类型":[传奇类型组1, 组2, ...], ...}
+    if str(itemType) not in equipTypeRandGroupDict:
+        return
+    randGroupList = equipTypeRandGroupDict[str(itemType)]
     if not randGroupList:
         GameWorld.ErrLog("该物品类型没有传奇属性!itemType=%s" % itemType)
         return
     
     randLegendAttrIDLsit = []
-    legendAttrGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 1, {}) # 传奇类型组 {1:[传奇属性类型ID组], ...}
+    legendAttrGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 1, {}) # 传奇类型组 {"组ID":[属性ID1, 属性ID2], ...}
     for groupType in randGroupList:
-        if groupType not in legendAttrGroupDict:
+        if str(groupType) not in legendAttrGroupDict:
             GameWorld.ErrLog("没有配置传奇属性组对应传奇属性类型列表! groupType=%s" % groupType)
             continue
-        randLegendAttrIDLsit += legendAttrGroupDict[groupType]
+        randLegendAttrIDLsit += legendAttrGroupDict[str(groupType)]
     
     if not randLegendAttrIDLsit:
         return
     
     itemClassLV = ItemCommon.GetItemClassLV(curItem)
     itemQuality = curItem.GetItemQuality()
-    randCountKey = (itemClassLV, itemQuality)
-    randCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 3) # 随机条数: {(阶,星):[随机条数A, 随机条数B]], ...}
-    if randCountKey not in randCountDict:
+    randCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 3) # 随机条数: {"阶":{"星":[条数A, 条数B], ...}, ...}
+    if str(itemClassLV) not in randCountDict:
+        GameWorld.ErrLog("没有配置装备阶对应随机传奇属性条数: itemClassLV=%s" % (itemClassLV))
+        return
+    qualityCountDict = randCountDict[str(itemClassLV)]
+    if str(itemQuality) not in qualityCountDict:
         GameWorld.ErrLog("没有配置装备阶星对应随机传奇属性条数: itemClassLV=%s, itemQuality=%s" % (itemClassLV, itemQuality))
         return
-    randCountList = randCountDict[randCountKey]
+    randCountList = qualityCountDict[str(itemQuality)]
     if not randCountList or len(randCountList) != 2:
         return
     legAttrCnt = random.randint(randCountList[0], randCountList[1])
@@ -2564,7 +2559,7 @@
     curLegAttrIDList = random.sample(randLegendAttrIDLsit, legAttrCnt)
     curLegAttrValueList = []
     
-    randValueListDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 4) # 随机数值: {传奇属性类型:[随机数值1, 数值2, ...], ...}
+    randValueListDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 4) # 随机数值: {"传奇属性ID":[随机数值1, 数值2, ...], ...}
     maxValueMinCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 5) # 保底最大数值条数: {(阶,星):条数, ...], ...}  没配置的默认0
     maxValueMinCount = maxValueMinCountDict.get((itemClassLV, itemQuality), 0)
     if legAttrCnt < maxValueMinCount:
@@ -2573,10 +2568,10 @@
         return
     
     for i, attrID in enumerate(curLegAttrIDList):
-        if attrID not in randValueListDict:
+        if str(attrID) not in randValueListDict:
             GameWorld.ErrLog("传奇属性没有配置随机数值范围或配置错误: attrID=%s" % (attrID))
             return
-        randValueList = randValueListDict[attrID]
+        randValueList = randValueListDict[str(attrID)]
         if i < maxValueMinCount:
             randValue = max(randValueList)
         else:
@@ -2756,4 +2751,30 @@
             itemID, isBind = keyStr.split('_')
             itemList.append([int(itemID), giveCnt, int(isBind)])
         PlayerControl.SendMailByKey(mailKey, [curPlayer.GetID()], itemList)
+    return
+
+def GivePlayerItemOrMail(curPlayer, itemList, mailKey=None, event=["", False, {}]):
+    ##给物品,背包满则发邮件
+    needPackSpaceDict = {}
+    for itemID, itemCnt, isBind in itemList:
+        curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
+        if not curItem:
+            GameWorld.ErrLog('GivePlayerItemOrMail 物品ID不存在 itemID=%s'%itemID, curPlayer.GetID())
+            return
+        packType = ChConfig.GetItemPackType(curItem.GetType())
+        needSpace = GetItemNeedPackCount(packType, curItem, itemCnt)
+        needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
+    isSendMail = False
+    for packType, needSpace in needPackSpaceDict.items():
+        if needSpace > ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace):
+            isSendMail = True
+            break
+           
+    if isSendMail:
+        PlayerControl.SendMailByKey(mailKey, [curPlayer.GetPlayerID()], itemList)
+        GameWorld.DebugLog("GivePlayerItemOrMail背包空间不够,发送邮件: mailItemList=%s" % str(itemList), curPlayer.GetPlayerID())
+    else:
+        for itemID, itemCnt, isBind in itemList:
+            GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem],
+                                            event=event)
     return
\ No newline at end of file

--
Gitblit v1.8.0