hxp
2019-01-24 050d498578914bf03e6e8acec7fd68c29dce79c4
5995 【后端】【1.5.100】诛仙装备合成(不同背包合成支持)
2个文件已修改
53 ■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -369,6 +369,9 @@
Def_ItemType_ZXWeapon2 = 135 # 诛仙剑2
Def_ItemType_ZXWeapon3 = 136 # 诛仙剑3
Def_ItemType_ZXWeapon4 = 137 # 诛仙剑4
Def_ItemType_ZhuXianStuff = 138 # 诛仙材料
Def_ItemType_DogzStuff = 139 # 神兽材料
#以下定义物品类型下次删除
Def_Item_Type_Horse = 1000036          #坐骑
@@ -379,23 +382,16 @@
                     ShareDefine.rptGatherSoul:'GatherSoulPackCount',
                     }
#背包可以放入的物品字典
Def_PackItemTypeList_Dict = {
ShareDefine.rptRune:[Def_ItemType_Rune, Def_ItemType_RuneExp],
ShareDefine.rptDogzItem:[Def_ItemType_DogzEquipExp, Def_ItemType_DogzEquipHorn, Def_ItemType_DogzEquipEye,
                         Def_ItemType_DogzEquipTooth, Def_ItemType_DogzEquipClaw, Def_ItemType_DogzEquipScute],
ShareDefine.rptZhuXianItem:range(Def_ItemType_ZXCloak, Def_ItemType_ZXWeapon4 + 1),
ShareDefine.rptGatherSoul:[Def_ItemType_GatherSoulExp, Def_ItemType_GatherSoul, Def_ItemType_GatherSoulCore],
                      }
def GetItemPackType(itemType, defaultPack=IPY_GameWorld.rptItem):
    ## 获取物品类型对应存放的默认背包类型
    if defaultPack in [ShareDefine.rptTreasure, ShareDefine.rptTempItem]:
        #寻宝背包、临时背包不做处理
        return defaultPack
    import IpyGameDataPY
    Def_PackItemTypeList_Dict = IpyGameDataPY.GetFuncEvalCfg("PutInItemPack", 1, {})
    for pack, itemTypeList in Def_PackItemTypeList_Dict.items():
        if itemType in itemTypeList:
            return pack
            return int(pack)
    return defaultPack
# 部位对应装备类型列表
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
@@ -93,12 +93,16 @@
        GameWorld.ErrLog("不存在该合成物品! makeItemID=%s" % makeItemID)
        return
    
    packType = ChConfig.GetItemPackType(makeItemData.GetType(), IPY_GameWorld.rptItem)
    GameWorld.DebugLog("makeItemID=%s,packType=%s" % (makeItemID, packType), playerID)
    needSpace = int(math.ceil(float(compoundCnt) / makeItemData.GetPackCount()))
    emptySpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
    emptySpace = ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace)
    #验证背包空间
    if needSpace > emptySpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_202580")
        GameWorld.DebugLog("背包空间不足!needSpace=%s > emptySpace=%s" % (needSpace, emptySpace), playerID)
        #PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_202580")
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packType])
        GameWorld.DebugLog("背包空间不足!packType=%s,needSpace=%s > emptySpace=%s" % (packType, needSpace, emptySpace), playerID)
        return
    
    compoundBindCnt = 0
@@ -123,7 +127,7 @@
    canDecompound = makeItemData.GetType() in canDecompoundItemTypeList and makeItemData.GetItemColor() >= decompoundMinColor
    decompoundItemInfo = [] # 拆解返还物品列表 [装备ID,材料1ID,个数,是否绑定,材料2ID,个数,是否绑定,...]
    
    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    itemPack = curPlayer.GetItemManager().GetPack(packType)
    itemExpireTime = 0
    wingItemExpInfo = None #材料翅膀精炼信息
    dogzEquipPlusExp = 0 #神兽装备强化熟练度
@@ -132,11 +136,7 @@
        unfixedItem = GameWorld.GetGameData().GetItemByTypeID(unfixedItemIDList[0])
        if not unfixedItem:
            return
        if ItemCommon.GetIsDogzEquip(unfixedItem):
            unfixedItemPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzItem)
        else:
            unfixedItemPack = itemPack
        unfixedItemCostInfo = __CheckUnfixedItem(playerID, compoundID, makeItemData, unfixedItemPack, unfixedItemIndexList,
        unfixedItemCostInfo = __CheckUnfixedItem(playerID, compoundID, makeItemData, itemPack, unfixedItemIndexList,
                                                 unfixedItemIDList, needUnfixedItemCount)
        if not unfixedItemCostInfo:
            return
@@ -178,13 +178,13 @@
    PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, totalNeedMoney, ChConfig.Def_Cost_ItemProduce, 
                           {ChConfig.Def_Cost_Reason_SonKey:makeItemID, "CompoundCount":compoundCnt})
    
    drDict = {"CompoundID":compoundID, "MakeItemID":makeItemID, "CompoundCount":compoundCnt, "itemExpireTime":itemExpireTime}
    drDict = {"CompoundID":compoundID, "MakeItemID":makeItemID, "CompoundCount":compoundCnt, "itemExpireTime":itemExpireTime, "PackType":packType}
    makeItemBind = False
    
    # 扣不固定消耗物品
    if unfixedItemIDList:
        bindUnfixedIndexList, unbindUnfixedIndexList = unfixedItemCostList
        hasBind = ItemCommon.ReduceItem(curPlayer, unfixedItemPack, bindUnfixedIndexList + unbindUnfixedIndexList, needUnfixedItemCount,
        hasBind = ItemCommon.ReduceItem(curPlayer, itemPack, bindUnfixedIndexList + unbindUnfixedIndexList, needUnfixedItemCount,
                                        False, ChConfig.ItemDel_ItemCompound, drDict)
        makeItemBind = True if hasBind else makeItemBind
        
@@ -254,13 +254,13 @@
    if successRate != maxRateValue:
        drDict = {"PlayerID":curPlayer.GetPlayerID(), "AccID":curPlayer.GetAccID(), "ID":compoundID, "MakeItemID":makeItemID, "IsSuccess":canHappen,
                  "RateInfo":{"totalSuccRate":"%s(%s+%s+%s)" % (totalSuccRate, successRate, addSuccRate, incRate), "randValue":randValue, "maxRateValue":maxRateValue},
                  "AddSuccRateItemInfo":addSuccRateItemInfo
                  "AddSuccRateItemInfo":addSuccRateItemInfo, "PackType":packType,
                  }
        DataRecordPack.SendEventPack("ItemCompound", drDict, curPlayer)
        
    if canHappen:
        GameWorld.DebugLog("合成成功: makeItemID=%s,compoundCnt=%s,compoundBindCnt=%s,itemExpireTime=%s" % (makeItemID, compoundCnt, compoundBindCnt, itemExpireTime), playerID)
        userData = GiveNewCompoundItem(curPlayer, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
        userData = GiveNewCompoundItem(curPlayer, packType, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
        
        msgMark = ipyData.GetSysMark()
        paramType = ipyData.GetSysMarkParamType()
@@ -601,19 +601,19 @@
#  @param newItem: 新物品
#  @param itemCount: 合成数量
#  @return None
def GiveNewCompoundItem(curPlayer, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime):
def GiveNewCompoundItem(curPlayer, packType, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime):
    compoundUnBindCnt = itemCount - compoundBindCnt
    
    if compoundBindCnt > 0:
        userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundBindCnt, True, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
        userData = __GivePlayerCompoundItem(curPlayer, packType, newItemID, compoundBindCnt, True, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
    if compoundUnBindCnt > 0:
        userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
        userData = __GivePlayerCompoundItem(curPlayer, packType, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
        
    if not userData:
        return ""
    return userData
def __GivePlayerCompoundItem(curPlayer, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, expireTime):
def __GivePlayerCompoundItem(curPlayer, packType, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, expireTime):
    playerID = curPlayer.GetPlayerID()
    curSingleItem = ItemControler.GetOutPutItemObj(newItemID, itemCount, isBind, expireTime)
    if not curSingleItem:
@@ -653,8 +653,7 @@
        GameWorld.Log("保存可拆解装备拆解物品信息: %s" % decompoundItemInfo, playerID)
        
    userData = curSingleItem.GetUserData()
    if not ItemControler.PlayerItemControler(curPlayer).PutInItem(IPY_GameWorld.rptItem, curSingleItem,
                                                                  event=[ChConfig.ItemGive_ItemCompound, False, {}]):
    if not ItemControler.PlayerItemControler(curPlayer).PutInItem(packType, curSingleItem, event=[ChConfig.ItemGive_ItemCompound, False, {}]):
        GameWorld.ErrLog("给合成物品失败, give item itemid:%s,count:%s" % (newItemID, itemCount), playerID)
        curSingleItem.Clear()
        return