hxp
2018-10-12 066b40acecd07aa07cb07849f98f4e39d67eb189
4145 【后端】人物粉色品质防具装备的合成与拆解
6个文件已修改
326 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -5892,6 +5892,58 @@
#------------------------------------------------------
# A3 13 物品拆解 #tagCMItemDecompound
class  tagCMItemDecompound(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("Index", c_ubyte),    # 拆解物品所在背包索引
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA3
        self.SubCmd = 0x13
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xA3
        self.SubCmd = 0x13
        self.Index = 0
        return
    def GetLength(self):
        return sizeof(tagCMItemDecompound)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A3 13 物品拆解 //tagCMItemDecompound:
                                Cmd:%s,
                                SubCmd:%s,
                                Index:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.Index
                                )
        return DumpString
m_NAtagCMItemDecompound=tagCMItemDecompound()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMItemDecompound.Cmd,m_NAtagCMItemDecompound.SubCmd))] = m_NAtagCMItemDecompound
#------------------------------------------------------
#A3 02 丢弃背包物品 #tagPlayerDropItem
class  tagPlayerDropItem(Structure):
@@ -11328,6 +11380,62 @@
#------------------------------------------------------
# AA 05 限时抢购预约 #tagCMFlashSaleAppointment
class  tagCMFlashSaleAppointment(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("GoodsID", c_int),    # 抢购商品标识
                  ("State", c_ubyte),    # 1-预约 0-取消
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x05
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xAA
        self.SubCmd = 0x05
        self.GoodsID = 0
        self.State = 0
        return
    def GetLength(self):
        return sizeof(tagCMFlashSaleAppointment)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 05 限时抢购预约 //tagCMFlashSaleAppointment:
                                Cmd:%s,
                                SubCmd:%s,
                                GoodsID:%d,
                                State:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.GoodsID,
                                self.State
                                )
        return DumpString
m_NAtagCMFlashSaleAppointment=tagCMFlashSaleAppointment()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMFlashSaleAppointment.Cmd,m_NAtagCMFlashSaleAppointment.SubCmd))] = m_NAtagCMFlashSaleAppointment
#------------------------------------------------------
# AA 02 领取升阶功能特惠奖励 #tagCMGetClassUPDayAward
class  tagCMGetClassUPDayAward(Structure):
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -1221,6 +1221,7 @@
Def_IudetWingMaterialItemID = 27  # 翅膀精炼材料ID列表
Def_IudetWingMaterialItemCount = 29  # 翅膀精炼材料个数列表
Def_IudetDogzEquipPlus = 31  # 神兽装备强化信息列表 [强化等级, 累计总熟练度]
Def_IudetItemDecompound = 33  # 拆解返还物品列表 [装备ID,材料1ID,个数,是否绑定,材料2ID,个数,是否绑定,...]
Def_IudetItemColor = 16  # 物品颜色,如果该值没有就取物品
Def_IudetItemCount = 18  # 物品个数,支持20亿,目前仅特殊转化物品会用到
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -96,12 +96,16 @@
Writer = wdb
Releaser = wdb
RegType = 0
RegisterPackCount = 1
RegisterPackCount = 2
PacketCMD_1=0xA3
PacketSubCMD_1=0x03
PacketCallFunc_1=OnItemCompound
PacketCMD_2=0xA3
PacketSubCMD_2=0x13
PacketCallFunc_2=OnItemDecompound
;装备宝石
[EquipStone]
ScriptName = Event\EventSrc\Operate_EquipStone.py
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -5892,6 +5892,58 @@
#------------------------------------------------------
# A3 13 物品拆解 #tagCMItemDecompound
class  tagCMItemDecompound(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("Index", c_ubyte),    # 拆解物品所在背包索引
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA3
        self.SubCmd = 0x13
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xA3
        self.SubCmd = 0x13
        self.Index = 0
        return
    def GetLength(self):
        return sizeof(tagCMItemDecompound)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A3 13 物品拆解 //tagCMItemDecompound:
                                Cmd:%s,
                                SubCmd:%s,
                                Index:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.Index
                                )
        return DumpString
m_NAtagCMItemDecompound=tagCMItemDecompound()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMItemDecompound.Cmd,m_NAtagCMItemDecompound.SubCmd))] = m_NAtagCMItemDecompound
#------------------------------------------------------
#A3 02 丢弃背包物品 #tagPlayerDropItem
class  tagPlayerDropItem(Structure):
@@ -11328,6 +11380,62 @@
#------------------------------------------------------
# AA 05 限时抢购预约 #tagCMFlashSaleAppointment
class  tagCMFlashSaleAppointment(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("GoodsID", c_int),    # 抢购商品标识
                  ("State", c_ubyte),    # 1-预约 0-取消
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x05
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xAA
        self.SubCmd = 0x05
        self.GoodsID = 0
        self.State = 0
        return
    def GetLength(self):
        return sizeof(tagCMFlashSaleAppointment)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 05 限时抢购预约 //tagCMFlashSaleAppointment:
                                Cmd:%s,
                                SubCmd:%s,
                                GoodsID:%d,
                                State:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.GoodsID,
                                self.State
                                )
        return DumpString
m_NAtagCMFlashSaleAppointment=tagCMFlashSaleAppointment()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMFlashSaleAppointment.Cmd,m_NAtagCMFlashSaleAppointment.SubCmd))] = m_NAtagCMFlashSaleAppointment
#------------------------------------------------------
# AA 02 领取升阶功能特惠奖励 #tagCMGetClassUPDayAward
class  tagCMGetClassUPDayAward(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
@@ -102,6 +102,12 @@
        GameWorld.DebugLog("货币不足合成! totalNeedMoney=%s" % totalNeedMoney, playerID)
        return
    
    # 目标物品可否拆解判断
    canDecompoundItemTypeList = IpyGameDataPY.GetFuncEvalCfg("ItemDecompound", 1)
    decompoundMinColor = IpyGameDataPY.GetFuncCfg("ItemDecompound", 2)
    canDecompound = makeItemData.GetType() in canDecompoundItemTypeList and makeItemData.GetItemColor() >= decompoundMinColor
    decompoundItemInfo = [] # 拆解返还物品列表 [装备ID,材料1ID,个数,是否绑定,材料2ID,个数,是否绑定,...]
    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    wingItemExpInfo = None #材料翅膀精炼信息
    dogzEquipPlusExp = 0 #神兽装备强化熟练度
@@ -148,7 +154,11 @@
        hasBind = ItemCommon.ReduceItem(curPlayer, unfixedItemPack, bindUnfixedIndexList + unbindUnfixedIndexList, needUnfixedItemCount, 
                                        False, ChConfig.ItemDel_ItemCompound, drDict)
        makeItemBind = True if hasBind else makeItemBind
    if canDecompound:
        decompoundUnfixedItemID = 0 if not unfixedItemIDList else random.choice(unfixedItemIDList) # 拆解时随机返还一件不固定消耗道具
        decompoundItemInfo.append(decompoundUnfixedItemID)
    # 扣固定消耗物品
    if fixedItemIDList:
        for fixedItemID, countInfo in fixedItemNeedCntDict.items():
@@ -157,9 +167,17 @@
            if delBindCnt:
                makeItemBind = True
                ItemCommon.ReduceItem(curPlayer, itemPack, bindFixedIndexList, delBindCnt, False, ChConfig.ItemDel_ItemCompound, drDict)
                if canDecompound:
                    decompoundItemInfo.append(fixedItemID)
                    decompoundItemInfo.append(delBindCnt)
                    decompoundItemInfo.append(1) # 绑定
            if delUnBindCnt:
                ItemCommon.ReduceItem(curPlayer, itemPack, unbindFixedIndexList, delUnBindCnt, False, ChConfig.ItemDel_ItemCompound, drDict)
                if canDecompound:
                    decompoundItemInfo.append(fixedItemID)
                    decompoundItemInfo.append(delUnBindCnt)
                    decompoundItemInfo.append(0) # 不绑定
    # 扣附加道具
    if addonsCountMax > 0:
        for i, addonsItemIndex in enumerate(addonsItemIndexList):
@@ -199,7 +217,7 @@
        
    if canHappen:
        GameWorld.DebugLog("合成成功: makeItemID=%s,compoundCnt=%s,compoundBindCnt=%s" % (makeItemID, compoundCnt, compoundBindCnt), playerID)
        userData = GiveNewCompoundItem(curPlayer, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp)
        userData = GiveNewCompoundItem(curPlayer, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo)
        
        msgMark = ipyData.GetSysMark()
        paramType = ipyData.GetSysMarkParamType()
@@ -475,19 +493,19 @@
#  @param newItem: 新物品
#  @param itemCount: 合成数量
#  @return None
def GiveNewCompoundItem(curPlayer, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp):
def GiveNewCompoundItem(curPlayer, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo):
    compoundUnBindCnt = itemCount - compoundBindCnt
    
    if compoundBindCnt > 0:
        userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundBindCnt, True, wingItemExpInfo, dogzEquipPlusExp)
        userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundBindCnt, True, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo)
    if compoundUnBindCnt > 0:
        userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp)
        userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo)
        
    if not userData:
        return ""
    return userData
def __GivePlayerCompoundItem(curPlayer, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp):
def __GivePlayerCompoundItem(curPlayer, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo):
    playerID = curPlayer.GetPlayerID()
    curSingleItem = ItemControler.GetOutPutItemObj(newItemID, itemCount, isBind)
    if not curSingleItem:
@@ -518,6 +536,13 @@
        GameWorld.DebugLog("合成神兽装备成功, dogzEquipLV=%s,dogzEquipExp=%s,remainExp=%s,总EXP=%s" 
                           % (dogzEquipLV, dogzEquipExp, remainExp, dogzEquipPlusExp), playerID)
        __SendDogzEquipRemainExpMail(playerID, remainExp, True)
    # 保留合成材料消耗,拆解时用
    if decompoundItemInfo:
        curSingleItem.ClearUserAttr(ShareDefine.Def_IudetItemDecompound)
        for decompoundValue in decompoundItemInfo:
            curSingleItem.AddUserAttr(ShareDefine.Def_IudetItemDecompound, decompoundValue)
        GameWorld.Log("保存可拆解装备拆解物品信息: %s" % decompoundItemInfo, playerID)
        
    userData = curSingleItem.GetUserData()
    if not ItemControler.PlayerItemControler(curPlayer).PutInItem(IPY_GameWorld.rptItem, curSingleItem, 
@@ -559,3 +584,66 @@
    PlayerControl.SendMailByKey(mailTypeKey, [playerID], [[expItemID, giveItemCount, isBind]])
    return
#// A3 13 物品拆解 #tagCMItemDecompound
#
#struct    tagCMItemDecompound
#{
#    tagHead        Head;
#    BYTE        Index;    // 拆解物品所在背包索引
#};
def OnItemDecompound(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    decompoundItemIndex = clientData.Index
    GameWorld.DebugLog("玩家拆解物品: decompoundItemIndex=%s" % decompoundItemIndex, playerID)
    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    if decompoundItemIndex < 0 or decompoundItemIndex >= itemPack.GetCount():
        return
    curEquip = itemPack.GetAt(decompoundItemIndex)
    if not ItemCommon.CheckItemCanUse(curEquip):
        return
    attrCount = curEquip.GetUserAttrCount(ShareDefine.Def_IudetItemDecompound)
    if not attrCount:
        GameWorld.DebugLog("    该物品没有记录拆解物品信息,无法拆解!", playerID)
        return
    giveItemList = []
    giveEquipID = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetItemDecompound, 0)
    if giveEquipID:
        giveItemList.append([giveEquipID, 1, curEquip.GetIsBind()])
    if attrCount > 1:
        for i in range(1, attrCount)[::3]:
            if i + 3 > attrCount:
                break
            itemID = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetItemDecompound, i)
            itemCount = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetItemDecompound, i + 1)
            isBind = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetItemDecompound, i + 2)
            giveItemList.append([itemID, itemCount, isBind])
    needSpace = len(giveItemList)
    emptySpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
    #验证背包空间
    if needSpace > emptySpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_202580")
        return
    decompoundItemNoteDict = ItemCommon.GetItemNoteDict(curEquip, curEquip.GetCount())
    # 删除拆解的物品
    saveDataDict = {"giveItemList":giveItemList}
    ItemCommon.DelItem(curPlayer, curEquip, curEquip.GetCount(), False, "ItemDecompound", saveDataDict, isForceDR=True)
    # 返还物品
    for itemID, itemCount, isBind in giveItemList:
        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem],
                                     event=["ItemDecompound", True, {"decompoundItemNoteDict":decompoundItemNoteDict}])
    GameWorld.Log("拆解物品成功: decompoundItemNoteDict=%s" % str(decompoundItemNoteDict), playerID)
    GameWorld.Log("    giveItemList=%s" % str(giveItemList), playerID)
    return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1221,6 +1221,7 @@
Def_IudetWingMaterialItemID = 27  # 翅膀精炼材料ID列表
Def_IudetWingMaterialItemCount = 29  # 翅膀精炼材料个数列表
Def_IudetDogzEquipPlus = 31  # 神兽装备强化信息列表 [强化等级, 累计总熟练度]
Def_IudetItemDecompound = 33  # 拆解返还物品列表 [装备ID,材料1ID,个数,是否绑定,材料2ID,个数,是否绑定,...]
Def_IudetItemColor = 16  # 物品颜色,如果该值没有就取物品
Def_IudetItemCount = 18  # 物品个数,支持20亿,目前仅特殊转化物品会用到