xdh
2019-03-07 094b99fdbd566444b3e029bae944e0263e23a458
6307 【后端】【2.0】多套装备开发单(镶嵌)
1个文件已修改
62 ■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py
@@ -124,12 +124,12 @@
    playerID = curPlayer.GetPlayerID()
    
    # 验证背包类型合法性
    equipPlace = clientData.EquipIndex
    equipPackIndex = clientData.EquipIndex
    stoneIndex = clientData.StoneIndex
    holeIndex = clientData.HoleIndex
    
    GameWorld.DebugLog("宝石镶嵌: equipPlace=%s,stoneIndex=%s,holeIndex=%s" % (equipPlace, stoneIndex, holeIndex), playerID)
    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace)
    GameWorld.DebugLog("宝石镶嵌: equipPackIndex=%s,stoneIndex=%s,holeIndex=%s" % (equipPackIndex, stoneIndex, holeIndex), playerID)
    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPackIndex)
    
    #获得装备位装备实例
    equipPack = curPlayer.GetItemManager().GetPack(equipPackType)
@@ -158,23 +158,25 @@
    
    stoneEffType = curStoneEff.GetEffectValue(0)
    stoneCanPlaceList = IpyGameDataPY.GetFuncEvalCfg("GemType%s" % stoneEffType, 1)
    if equipPlace not in stoneCanPlaceList:
        GameWorld.Log("该宝石不可镶嵌在该装备位!stoneItemID=%s,stoneEffType=%s,stoneCanPlaceList=%s,equipPlace=%s"
                      % (stoneItemID, stoneEffType, stoneCanPlaceList, equipPlace), playerID)
    ipyData = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'GridIndex':equipPackIndex})
    if not ipyData:
        return
    if ipyData.GetEquipPlace() not in stoneCanPlaceList:
        GameWorld.Log("该宝石不可镶嵌在该装备位!stoneItemID=%s,stoneEffType=%s,stoneCanPlaceList=%s,equipPackIndex=%s"
                      % (stoneItemID, stoneEffType, stoneCanPlaceList, equipPackIndex), playerID)
        return
    
    equipStar = ChEquip.GetEquipPartStar(curEquip)
    equipStar = ChEquip.GetEquipPartStarByRank(curPlayer, placeIndex, curEquip)
    if not __CheckStoneHoleCanUse(curPlayer, equipStar, holeIndex, equipPackType):
        return
    
    # 扣除宝石
    ItemCommon.DelItem(curPlayer, curStone, 1, True, ChConfig.ItemDel_EquipEnchase, {"EquipPlace":equipPlace, "HoleIndex":holeIndex})
    ItemCommon.DelItem(curPlayer, curStone, 1, True, ChConfig.ItemDel_EquipEnchase, {"equipPackIndex":equipPackIndex, "HoleIndex":holeIndex})
    
    isBind = 1 if isBind else 0
    
    # 变更宝石孔宝石信息
    __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, stoneItemID, isBind, "EquipStone", True)
    __DoChangeEquipHoleStone(curPlayer, equipPackIndex, holeIndex, stoneItemID, isBind, "EquipStone", True)
    
#    #镶嵌成功
#    if not curEquip.GetIsBind():
@@ -184,7 +186,7 @@
    RefreshAttrByStoneAction(curPlayer, equipPackType, True)
    
    #同步客户端
    Sycn_StoneHoleInfo(curPlayer, [equipPlace])
    Sycn_StoneHoleInfo(curPlayer, [equipPackIndex])
    #成就
    DoStoneSuccess(curPlayer)
    return
@@ -235,11 +237,11 @@
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
    playerID = curPlayer.GetPlayerID()
    # 验证背包类型合法性
    equipPlace = clientData.EquipIndex
    equipPackIndex = clientData.EquipIndex
    holeIndex = clientData.HoleIndex
    GameWorld.DebugLog("宝石摘除: equipPlace=%s,holeIndex=%s" % (equipPlace, holeIndex), playerID)
    GameWorld.DebugLog("宝石摘除: equipPackIndex=%s,holeIndex=%s" % (equipPackIndex, holeIndex), playerID)
    
    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace)
    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPackIndex)
    #获得装备位装备实例
    equipPack = curPlayer.GetItemManager().GetPack(equipPackType)
    curEquip = equipPack.GetAt(placeIndex)
@@ -253,19 +255,19 @@
        return
    
    # 验证宝石
    stoneID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)[0]
    stoneID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPackIndex, holeIndex)[0]
    
    if not stoneID:
        GameWorld.DebugLog("孔为空或不存在宝石!")
        return
    
    __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, 0, 0, "StonePick", True)
    __DoChangeEquipHoleStone(curPlayer, equipPackIndex, holeIndex, 0, 0, "StonePick", True)
    
    # 刷新属性
    RefreshAttrByStoneAction(curPlayer, equipPackType, False)
    
    #同步客户端
    Sycn_StoneHoleInfo(curPlayer, [equipPlace])
    Sycn_StoneHoleInfo(curPlayer, [equipPackIndex])
    
    totalStoneLV = GetTotalStoneLV(curPlayer)
    # 记录开服活动宝石总等级
@@ -306,11 +308,11 @@
    playerID = curPlayer.GetPlayerID()
    
    # 验证背包类型合法性
    equipPlace = clientData.EquipIndex
    equipPackIndex = clientData.EquipIndex
    holeIndex = clientData.HoleIndex
    upWay = clientData.UpWay
    GameWorld.DebugLog("宝石升级: equipPlace=%s,holeIndex=%s" % (equipPlace, holeIndex), playerID)
    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace)
    GameWorld.DebugLog("宝石升级: equipPackIndex=%s,holeIndex=%s" % (equipPackIndex, holeIndex), playerID)
    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPackIndex)
    #获得装备位装备实例
    equipPack = curPlayer.GetItemManager().GetPack(equipPackType)
    curEquip = equipPack.GetAt(placeIndex)
@@ -320,7 +322,7 @@
        return
        
    #升级宝石ID
    stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)
    stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPackIndex, holeIndex)
    if stoneID == 0:
        GameWorld.DebugLog("孔为空或不存在宝石!")      
        return      
@@ -373,18 +375,18 @@
            costIndexList = (costItemIndexList[1]+costItemIndexList[0])[:2]
        itemPack = curPlayer.GetItemManager().GetPack(stonePackType)
        hasBind = ItemCommon.ReduceItem(curPlayer, itemPack, costIndexList, needCount-1, False, ChConfig.ItemDel_StoneUpgrade, 
                                        {"EquipPlace":equipPlace, "HoleIndex":holeIndex})
                                        {"equipPackIndex":equipPackIndex, "HoleIndex":holeIndex})
        if hasBind:
            stoneIsBind = True
        
    
    __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, upgradeStoneID, stoneIsBind, "StoneUpgrade", False)
    __DoChangeEquipHoleStone(curPlayer, equipPackIndex, holeIndex, upgradeStoneID, stoneIsBind, "StoneUpgrade", False)
    
    # 刷新属性
    RefreshAttrByStoneAction(curPlayer, equipPackType, False)
    
    #同步客户端
    Sycn_StoneHoleInfo(curPlayer, [equipPlace])
    Sycn_StoneHoleInfo(curPlayer, [equipPackIndex])
    
    DoStoneSuccess(curPlayer)
    return
@@ -436,26 +438,26 @@
    
    return True
def __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, changeStoneID, isBind, eventName, isPickoff):
def __DoChangeEquipHoleStone(curPlayer, equipPackIndex, holeIndex, changeStoneID, isBind, eventName, isPickoff):
    ## 变更玩家装备孔宝石
    
    #获得装备位孔索引宝石存储信息
    stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)
    stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPackIndex, holeIndex)
    #保存装备位孔位上宝石ID和绑定状态
    SetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex, changeStoneID, isBind)
    SetEquipIndexStoneIDAndIsBand(curPlayer, equipPackIndex, holeIndex, changeStoneID, isBind)
    
    if isPickoff and stoneID:
        equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace)
        equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPackIndex)
        itemCount = 1
        # 摘除的宝石都绑定
        if ItemCommon.CheckPackHasSpace(curPlayer, stonePackType):
            ItemControler.GivePlayerItem(curPlayer, stoneID, itemCount, 0,
                                         [stonePackType], 
                                         event=[ChConfig.ItemGive_StonePickoff, False, {"EquipPlace":equipPlace, "HoleIndex":holeIndex}])
                                         event=[ChConfig.ItemGive_StonePickoff, False, {"equipPackIndex":equipPackIndex, "HoleIndex":holeIndex}])
        else:
            PlayerControl.SendMailByKey("GemToPlayer", [curPlayer.GetPlayerID()], [[stoneID, 1, stoneIsBind]])
            
    DataRecordPack.DR_StoneItemChange(curPlayer, eventName, {'equipPlace':equipPlace,"holeIndex":holeIndex, "stoneID":stoneID, 'changeStoneID':changeStoneID})
    DataRecordPack.DR_StoneItemChange(curPlayer, eventName, {'equipPackIndex':equipPackIndex,"holeIndex":holeIndex, "stoneID":stoneID, 'changeStoneID':changeStoneID})
    return