From 27c520cac266513887f348cf9feb4be7b3efda45 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 10 五月 2021 12:17:51 +0800
Subject: [PATCH] 8932 【BT2】【主干】【后端】物品转移背包类型后,支持上线刷新
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py | 94 ++++++++++++++++++++++++-------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 13 +++
11 files changed, 93 insertions(+), 34 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index f2e6f8e..972e149 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -391,16 +391,25 @@
ShareDefine.rptGatherSoul:'GatherSoulPackCount',
}
-def GetItemPackType(itemType, defaultPack=IPY_GameWorld.rptItem):
- ## 获取物品类型对应存放的默认背包类型
+def GetItemPackType(itemData, defaultPack=IPY_GameWorld.rptItem):
+ ## 获取物品对应存放的默认背包类型
if defaultPack in [ShareDefine.rptTreasure, ShareDefine.rptTempItem]:
#寻宝背包、临时背包不做处理
return defaultPack
import IpyGameDataPY
+
+ itemID = itemData.GetItemTypeID()
+ Def_PackItemIDList_Dict = IpyGameDataPY.GetFuncEvalCfg("PutInItemPack", 2, {})
+ for pack, itemIDList in Def_PackItemIDList_Dict.items():
+ if itemID in itemIDList:
+ return int(pack)
+
+ itemType = itemData.GetType()
Def_PackItemTypeList_Dict = IpyGameDataPY.GetFuncEvalCfg("PutInItemPack", 1, {})
for pack, itemTypeList in Def_PackItemTypeList_Dict.items():
if itemType in itemTypeList:
return int(pack)
+
return defaultPack
# 部位对应装备类型列表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
index 9e32e8f..26b7c0a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
@@ -631,7 +631,7 @@
if not curItem:
GameWorld.ErrLog("Store shop item error! shopType=%s,itemID=%s" % (shopType, itemID))
return
- packType = ChConfig.GetItemPackType(curItem.GetType())
+ packType = ChConfig.GetItemPackType(curItem)
needSpace = ItemControler.GetItemNeedPackCount(packType, curItem, itemCnt)
needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
@@ -714,7 +714,7 @@
continue
userData = curItemObj.GetUserData()
if not sendMailKey:
- packType = ChConfig.GetItemPackType(curItemObj.GetType())
+ packType = ChConfig.GetItemPackType(curItemObj)
if not itemControl.PutInItem(packType, curItemObj, event=[ChConfig.ItemGive_BuyItem, isForceEvent, dataDict]):
curItemObj.Clear()
continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
index c2a7477..a858fcd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
@@ -98,7 +98,7 @@
PlayerControl.NotifyCode(curPlayer, "ItemCompoundJoblimit")
return
- packType = ChConfig.GetItemPackType(makeItemData.GetType(), IPY_GameWorld.rptItem)
+ packType = ChConfig.GetItemPackType(makeItemData, IPY_GameWorld.rptItem)
GameWorld.DebugLog("makeItemID=%s,packType=%s" % (makeItemID, packType), playerID)
needSpace = int(math.ceil(float(compoundCnt) / makeItemData.GetPackCount()))
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py
index aef14af..e42257f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py
@@ -582,7 +582,7 @@
curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
if not curItem:
return
- packType = ChConfig.GetItemPackType(curItem.GetType())
+ packType = ChConfig.GetItemPackType(curItem)
needSpace = ItemControler.GetItemNeedPackCount(packType, curItem, itemCnt)
needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
index 95f1db9..8b201c3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
@@ -246,7 +246,7 @@
isPutInTemp = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PickupItemPutInTemp)
packIndex = ShareDefine.rptTempItem if isPutInTemp else IPY_GameWorld.rptItem
- packIndex = ChConfig.GetItemPackType(singItem.GetType(), packIndex)
+ packIndex = ChConfig.GetItemPackType(singItem, packIndex)
# 是否可放入
if not itemControl.CanPutInItem(packIndex, curItemID, curItemCount, curItemIsAuctionItem):
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 13aee7c..4acb0d3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -1085,7 +1085,7 @@
self.__CrossServerPutInItem(packIndex, tagItem, event)
tagItem.Clear()
return True
- packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)
+ packIndex = ChConfig.GetItemPackType(curItemData, packIndex)
tagItemCount = GetItemCount(tagItem)
isAuctionItem = GetIsAuctionItem(tagItem)
@@ -1261,20 +1261,6 @@
GameWorld.DebugLog("传奇属性异常,重新刷新一次属性: packType=%s,itemID=%s,srcScore=%s,updScore=%s"
% (packType, curItem.GetItemTypeID(), srcScore, updScore), curPlayer.GetPlayerID())
return
-
- def CheckRolePackEquipAttr(self):
- ''' 玩家上线修复装备属性bug
- '''
-# curPlayer = self.__Player
-# checkVersion = 20190103
-# key = "LoginCheckEquipAttr"
-# curVersion = curPlayer.NomalDictGetProperty(key)
-# if curVersion == checkVersion:
-# return
-# playerID = curPlayer.GetPlayerID()
-# GameWorld.Log("玩家上线处理装备属性! curVersion=%s,checkVersion=%s" % (curVersion, checkVersion), playerID)
-# PlayerControl.NomalDictSetProperty(curPlayer, key, checkVersion)
- return
## 是否能放入物品
# @param packIndex 背包索引
@@ -1322,7 +1308,7 @@
return False, 0
# 特殊处理不同的物品放入不同的背包,如神兽背包
- packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)
+ packIndex = ChConfig.GetItemPackType(curItemData, packIndex)
maxCanPutItem = 0
curPlayer = self.__Player
@@ -1459,7 +1445,7 @@
curItem = movePack.GetAt(itemIndex)
if not curItem or curItem.IsEmpty():
continue
- toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), desPackIndex)
+ toPackIndex = ChConfig.GetItemPackType(curItem, desPackIndex)
if toPackIndex in fullPackList:
continue
if not __DoDropItemToOtherPack(curPlayer, itemControl, fromPackIndex, toPackIndex, itemIndex, curItem):
@@ -1474,7 +1460,7 @@
curItem = movePack.GetAt(index)
if not curItem or curItem.IsEmpty():
return
- toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), desPackIndex)
+ toPackIndex = ChConfig.GetItemPackType(curItem, desPackIndex)
__DoDropItemToOtherPack(curPlayer, itemControl, fromPackIndex, toPackIndex, index, curItem)
return
@@ -1487,7 +1473,7 @@
curItemCount = curItem.GetCount()
#curItemIsBind = curItem.GetIsBind()
isAuctionItem = GetIsAuctionItem(curItem)
- #toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), toPackIndex)
+ #toPackIndex = ChConfig.GetItemPackType(curItem, toPackIndex)
# 常规物品转移到虚拟符印背包
if toPackIndex == ShareDefine.rptRune:
@@ -1967,6 +1953,70 @@
# return 0
#===============================================================================
#==============================================================================
+def OnPlayerLogin(curPlayer):
+ __CheckTransferItemPack(curPlayer)
+ return
+
+def __CheckTransferItemPack(curPlayer):
+ ## 检查转移物品
+
+ # {调整版本编号:{(原背包类型, 目标背包类型):[物品ID, ...], ...}, ...}
+ transferItemPackRecordDict = IpyGameDataPY.GetFuncEvalCfg("TransferItemPack", 1, {})
+ if not transferItemPackRecordDict:
+ return
+ verList = transferItemPackRecordDict.keys()
+ verList.sort()
+ lastVersion = verList[-1]
+
+ key = "TransferItemPackVer"
+ curVersion = curPlayer.NomalDictGetProperty(key)
+
+ if curVersion >= lastVersion:
+ #GameWorld.DebugLog("已处理过转移物品!curVersion=%s >= lastVersion=%s" % (curVersion, lastVersion))
+ return
+
+ mailItemList = []
+ itemControl = PlayerItemControler(curPlayer)
+ playerID = curPlayer.GetPlayerID()
+ for newVerNum in verList:
+ if newVerNum <= curVersion:
+ continue
+ transferItemPackRule = transferItemPackRecordDict[newVerNum]
+ GameWorld.Log("玩家上线处理物品转移背包! curVersion=%s,newVerNum=%s" % (curVersion, newVerNum), playerID)
+ for transferPackInfo, itemIDList in transferItemPackRule.items():
+ fromPackType, toPackType = transferPackInfo
+ fromPack = curPlayer.GetItemManager().GetPack(fromPackType)
+ #toPack = curPlayer.GetItemManager().GetPack(toPackType)
+ for itemIndex in xrange(fromPack.GetCount()):
+ item = fromPack.GetAt(itemIndex)
+ if not ItemCommon.CheckItemCanUse(item):
+ continue
+ itemID = item.GetItemTypeID()
+ if itemID not in itemIDList:
+ continue
+ itemCount = item.GetCount()
+
+ if __DoDropItemToOtherPack(curPlayer, itemControl, fromPackType, toPackType, itemIndex, item):
+ # 拖成功的不再处理
+ GameWorld.Log(" 直接转移: fromPackType=%s,toPackType=%s,itemIndex=%s,itemID=%s,itemCount=%s"
+ % (fromPackType, toPackType, itemIndex, itemID, itemCount), playerID)
+ continue
+
+ GameWorld.Log(" 邮件转移: fromPackType=%s,toPackType=%s,itemIndex=%s,itemID=%s,itemCount=%s"
+ % (fromPackType, toPackType, itemIndex, itemID, itemCount), playerID)
+
+ # 不成功的,转发到邮件,最后清除物品
+ mailItemList.append(ItemCommon.GetMailItemDict(item))
+ item.Clear()
+
+ PlayerControl.NomalDictSetProperty(curPlayer, key, newVerNum)
+ curVersion = newVerNum
+
+ if mailItemList:
+ PlayerControl.SendMailByKey("TransferItemPack", [playerID], mailItemList)
+
+ return
+
## 清除背包中的任务物品
# @param curPlayer 当前玩家
# @param packIndex 背包类型
@@ -2015,7 +2065,7 @@
isAuctionItem = 0
defaultPack = IPY_GameWorld.rptItem if not packIndexList else packIndexList[0]
- packIndex = ChConfig.GetItemPackType(curItemData.GetType(), defaultPack)
+ packIndex = ChConfig.GetItemPackType(curItemData, defaultPack)
if packIndex != defaultPack or not packIndexList:
packIndexList = [packIndex]
@@ -2654,7 +2704,7 @@
curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
if not curItem:
return False
- packType = ChConfig.GetItemPackType(curItem.GetType())
+ packType = ChConfig.GetItemPackType(curItem)
needSpace = GetItemNeedPackCount(packType, curItem, itemCnt, isAuctionItem)
needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
@@ -2676,7 +2726,7 @@
if not curItem:
GameWorld.ErrLog('GivePlayerItemOrMail 物品ID不存在 itemID=%s'%itemID, curPlayer.GetID())
return
- packType = ChConfig.GetItemPackType(curItem.GetType())
+ packType = ChConfig.GetItemPackType(curItem)
needSpace = GetItemNeedPackCount(packType, curItem, itemCnt, isAuctionItem)
needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
isSendMail = False
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
index 0818423..1128e9e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
@@ -629,7 +629,7 @@
itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
if not itemData:
continue
- packType = ChConfig.GetItemPackType(itemData.GetType())
+ packType = ChConfig.GetItemPackType(itemData)
needSpace = ItemControler.GetItemNeedPackCount(packType, itemData, itemCount, isAuctionItem)
needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
index 3e12edf..509ab52 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
@@ -228,7 +228,7 @@
if not itemData:
GameWorld.ErrLog("宝箱奖励物品不存在! chestsItemID=%s,itemID=%s,jobItemID=%s" % (chestsItemID, itemID, jobItemID))
return
- packType = ChConfig.GetItemPackType(itemData.GetType())
+ packType = ChConfig.GetItemPackType(itemData)
needSpace = int(math.ceil(itemCount / float(itemData.GetPackCount())))
needSpaceDict[packType] = needSpaceDict.get(packType, 0) + needSpace
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 37bb8af..68e2cd1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -692,7 +692,7 @@
mailItem = ItemCommon.GetMailItemDict(itemObj)
equipInfo = [itemObj.GetEquipPlace(), ItemCommon.GetItemClassLV(itemObj), itemObj.GetItemColor(),
itemObj.GetSuiteID(), itemObj.GetUserData()]
- packIndex = ChConfig.GetItemPackType(itemObj.GetType())
+ packIndex = ChConfig.GetItemPackType(itemObj)
if not itemControl.PutInItem(packIndex, itemObj, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":npcID}]):
mailItemList.append(mailItem)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index b60f479..b08e2a9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -462,7 +462,7 @@
SyncGuideState(curPlayer)
#上线检查一次装备属性
- ItemControler.PlayerItemControler(curPlayer).CheckRolePackEquipAttr()
+ ItemControler.OnPlayerLogin(curPlayer)
#更新服务器组ID
PlayerControl.UpdPlayerServerGroupID(curPlayer)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
index ab5bef3..9783de3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
@@ -83,7 +83,7 @@
continue
isAuctionItem = curPackItem.IsBind
- packType = ChConfig.GetItemPackType(curItemData.GetType())
+ packType = ChConfig.GetItemPackType(curItemData)
needSpace = ItemControler.GetItemNeedPackCount(packType, curItemData, curPackItem.Count, isAuctionItem)
needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
if isAuctionItem:
--
Gitblit v1.8.0