|  |  |  | 
|---|
|  |  |  | import NetPackCommon | 
|---|
|  |  |  | import DataRecordPack | 
|---|
|  |  |  | import PlayerSuccess | 
|---|
|  |  |  | import PlayerWeekParty | 
|---|
|  |  |  | import ShareDefine | 
|---|
|  |  |  | import EquipZhuXian | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | stoneCanPlaceList = [] | 
|---|
|  |  |  | for stoneTypeIndex in xrange(1, GemTypeCount + 1): | 
|---|
|  |  |  | #循环宝石类型对应的装备位 | 
|---|
|  |  |  | stoneCanPlaceList += IpyGameDataPY.GetFuncEvalCfg("GemType%s" % stoneTypeIndex, 1) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | placeList = IpyGameDataPY.GetFuncEvalCfg("GemType%s" % stoneTypeIndex, 1) | 
|---|
|  |  |  | for place in placeList: | 
|---|
|  |  |  | if place not in stoneCanPlaceList: | 
|---|
|  |  |  | stoneCanPlaceList.append(place) | 
|---|
|  |  |  | return stoneCanPlaceList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetAllEquipPlaceHoleIndex(): | 
|---|
|  |  |  | 
|---|
|  |  |  | changeStoneID * ChConfig.Def_Stone_SaveStoneInfoXNumber + isBind) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetPackTypeByEquipPlace(equipPlace): | 
|---|
|  |  |  | ##目前支持镶嵌普通装备、诛仙装备 | 
|---|
|  |  |  | if equipPlace in ShareDefine.ZhuXianEquipPlace: | 
|---|
|  |  |  | equipPackType = ShareDefine.rptZhuXianEquip | 
|---|
|  |  |  | stonePackType = ShareDefine.rptZhuXianItem | 
|---|
|  |  |  | placeIndex = EquipZhuXian.GetZhuXianEquipIndexByPlace(equipPlace) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | equipPackType = IPY_GameWorld.rptEquip | 
|---|
|  |  |  | stonePackType = IPY_GameWorld.rptItem | 
|---|
|  |  |  | placeIndex = equipPlace | 
|---|
|  |  |  | return equipPackType, stonePackType, placeIndex | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #//A3 04 宝石镶嵌或替换 #tagCMEquipEnchase | 
|---|
|  |  |  | #struct    tagCMEquipEnchase | 
|---|
|  |  |  | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 验证背包类型合法性 | 
|---|
|  |  |  | equipIndex = clientData.EquipIndex | 
|---|
|  |  |  | equipPlace = clientData.EquipIndex | 
|---|
|  |  |  | stoneIndex = clientData.StoneIndex | 
|---|
|  |  |  | holeIndex = clientData.HoleIndex | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("宝石镶嵌: equipIndex=%s,stoneIndex=%s,holeIndex=%s" % (equipIndex, stoneIndex, holeIndex), playerID) | 
|---|
|  |  |  | GameWorld.DebugLog("宝石镶嵌: equipPlace=%s,stoneIndex=%s,holeIndex=%s" % (equipPlace, stoneIndex, holeIndex), playerID) | 
|---|
|  |  |  | equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #获得装备位装备实例 | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(equipIndex) | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(equipPackType) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(placeIndex) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not ItemCommon.CheckItemCanUse(curEquip): | 
|---|
|  |  |  | GameWorld.Log("目标装备为空或不可用,无法镶嵌!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #获得宝石实例 | 
|---|
|  |  |  | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) | 
|---|
|  |  |  | itemPack = curPlayer.GetItemManager().GetPack(stonePackType) | 
|---|
|  |  |  | curStone = itemPack.GetAt(stoneIndex) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not ItemCommon.CheckItemCanUse(curStone): | 
|---|
|  |  |  | 
|---|
|  |  |  | stoneEffType = curStoneEff.GetEffectValue(0) | 
|---|
|  |  |  | stoneCanPlaceList = IpyGameDataPY.GetFuncEvalCfg("GemType%s" % stoneEffType, 1) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if equipIndex not in stoneCanPlaceList: | 
|---|
|  |  |  | if equipPlace not in stoneCanPlaceList: | 
|---|
|  |  |  | GameWorld.Log("该宝石不可镶嵌在该装备位!stoneItemID=%s,stoneEffType=%s,stoneCanPlaceList=%s,equipPlace=%s" | 
|---|
|  |  |  | % (stoneItemID, stoneEffType, stoneCanPlaceList, equipIndex), playerID) | 
|---|
|  |  |  | % (stoneItemID, stoneEffType, stoneCanPlaceList, equipPlace), playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | equipClassLV = ItemCommon.GetItemClassLV(curEquip) | 
|---|
|  |  |  | if not __CheckStoneHoleCanUse(curPlayer, equipClassLV, holeIndex): | 
|---|
|  |  |  | if not __CheckStoneHoleCanUse(curPlayer, equipClassLV, holeIndex, equipPackType): | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 扣除宝石 | 
|---|
|  |  |  | ItemCommon.DelItem(curPlayer, curStone, 1, True, ChConfig.ItemDel_EquipEnchase, {"EquipPlace":equipIndex, "HoleIndex":holeIndex}) | 
|---|
|  |  |  | ItemCommon.DelItem(curPlayer, curStone, 1, True, ChConfig.ItemDel_EquipEnchase, {"EquipPlace":equipPlace, "HoleIndex":holeIndex}) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isBind = 1 if isBind else 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 变更宝石孔宝石信息 | 
|---|
|  |  |  | __DoChangeEquipHoleStone(curPlayer, equipIndex, holeIndex, stoneItemID, isBind, "EquipStone", True) | 
|---|
|  |  |  | __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, stoneItemID, isBind, "EquipStone", True) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #    #镶嵌成功 | 
|---|
|  |  |  | #    if not curEquip.GetIsBind(): | 
|---|
|  |  |  | #        ItemControler.SetItemIsBind(curEquip, True) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 刷新属性 | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, IPY_GameWorld.rptEquip, True) | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, equipPackType, True) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #同步客户端 | 
|---|
|  |  |  | Sycn_StoneHoleInfo(curPlayer, [equipIndex]) | 
|---|
|  |  |  | Sycn_StoneHoleInfo(curPlayer, [equipPlace]) | 
|---|
|  |  |  | #成就 | 
|---|
|  |  |  | DoStoneSuccess(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | # 记录开服活动宝石总等级 | 
|---|
|  |  |  | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_StoneLV, totalStoneLV) | 
|---|
|  |  |  | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_StoneTotalLV, totalStoneLV) | 
|---|
|  |  |  | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Stone, totalStoneLV, False, True) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #//A3 05 宝石摘取 #tagCMEquipStonePick | 
|---|
|  |  |  | 
|---|
|  |  |  | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex) | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  | # 验证背包类型合法性 | 
|---|
|  |  |  | equipIndex = clientData.EquipIndex | 
|---|
|  |  |  | equipPlace = clientData.EquipIndex | 
|---|
|  |  |  | holeIndex = clientData.HoleIndex | 
|---|
|  |  |  | GameWorld.DebugLog("宝石摘除: equipIndex=%s,holeIndex=%s" % (equipIndex, holeIndex), playerID) | 
|---|
|  |  |  | GameWorld.DebugLog("宝石摘除: equipPlace=%s,holeIndex=%s" % (equipPlace, holeIndex), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace) | 
|---|
|  |  |  | #获得装备位装备实例 | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(equipIndex) | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(equipPackType) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(placeIndex) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not ItemCommon.CheckItemCanUse(curEquip): | 
|---|
|  |  |  | GameWorld.Log("目标装备为空或不可用,无法镶嵌!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #验证背包空间 | 
|---|
|  |  |  | if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem, True): | 
|---|
|  |  |  | if not ItemCommon.CheckPackHasSpace(curPlayer, stonePackType, True): | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 验证宝石 | 
|---|
|  |  |  | stoneID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex)[0] | 
|---|
|  |  |  | stoneID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)[0] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not stoneID: | 
|---|
|  |  |  | GameWorld.DebugLog("孔为空或不存在宝石!") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | __DoChangeEquipHoleStone(curPlayer, equipIndex, holeIndex, 0, 0, "StonePick", True) | 
|---|
|  |  |  | __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, 0, 0, "StonePick", True) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 刷新属性 | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, IPY_GameWorld.rptEquip, False) | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, equipPackType, False) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #同步客户端 | 
|---|
|  |  |  | Sycn_StoneHoleInfo(curPlayer, [equipIndex]) | 
|---|
|  |  |  | Sycn_StoneHoleInfo(curPlayer, [equipPlace]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | totalStoneLV = GetTotalStoneLV(curPlayer) | 
|---|
|  |  |  | # 记录开服活动宝石总等级 | 
|---|
|  |  |  | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_StoneLV, totalStoneLV) | 
|---|
|  |  |  | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Stone, totalStoneLV, False, True) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetTotalStoneLV(curPlayer): | 
|---|
|  |  |  | ##宝石总等级 | 
|---|
|  |  |  | totalStoneLV = 0 | 
|---|
|  |  |  | holeIndexList = GetAllEquipPlaceHoleIndex() | 
|---|
|  |  |  | gameData = GameWorld.GetGameData() | 
|---|
|  |  |  | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | gemLV = curGem.GetEffectByIndex(0).GetEffectValue(1) | 
|---|
|  |  |  | totalStoneLV += gemLV | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 记录开服活动宝石总等级 | 
|---|
|  |  |  | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_StoneLV, totalStoneLV) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return totalStoneLV | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #// A3 06 宝石升级 #tagCMEquipStoneUpgrade | 
|---|
|  |  |  | #struct    tagCMEquipStoneUpgrade | 
|---|
|  |  |  | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 验证背包类型合法性 | 
|---|
|  |  |  | equipIndex = clientData.EquipIndex | 
|---|
|  |  |  | equipPlace = clientData.EquipIndex | 
|---|
|  |  |  | holeIndex = clientData.HoleIndex | 
|---|
|  |  |  | upWay = clientData.UpWay | 
|---|
|  |  |  | GameWorld.DebugLog("宝石升级: equipPlace=%s,holeIndex=%s" % (equipIndex, holeIndex), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("宝石升级: equipPlace=%s,holeIndex=%s" % (equipPlace, holeIndex), playerID) | 
|---|
|  |  |  | equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace) | 
|---|
|  |  |  | #获得装备位装备实例 | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(equipIndex) | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(equipPackType) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(placeIndex) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not ItemCommon.CheckItemCanUse(curEquip): | 
|---|
|  |  |  | GameWorld.Log("目标装备为空或不可用,无法镶嵌!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #升级宝石ID | 
|---|
|  |  |  | stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex) | 
|---|
|  |  |  | stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex) | 
|---|
|  |  |  | if stoneID == 0: | 
|---|
|  |  |  | GameWorld.DebugLog("孔为空或不存在宝石!") | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | level = curStoneEff.GetEffectValue(1) | 
|---|
|  |  |  | upgradeStoneID = curStoneEff.GetEffectValue(2) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | stoneTypeItemIDDict = IpyGameDataPY.GetFuncEvalCfg("GemUpCostFormula", 1) | 
|---|
|  |  |  | GameWorld.DebugLog("stoneEffType=%s,stoneTypeItemIDDict=%s,level=%s,upgradeStoneID=%s" | 
|---|
|  |  |  | % (stoneEffType, stoneTypeItemIDDict, level, upgradeStoneID)) | 
|---|
|  |  |  | if stoneEffType not in stoneTypeItemIDDict: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | stoneTypeItemID = stoneTypeItemIDDict[stoneEffType] | 
|---|
|  |  |  | GameWorld.DebugLog("stoneEffType=%s,level=%s,upgradeStoneID=%s" % (stoneEffType, level, upgradeStoneID)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not upgradeStoneID: | 
|---|
|  |  |  | GameWorld.Log("该宝石已是最大级,不能升级!stoneIndex=%s,stoneItemID=%s,curEffID=%s,upgradeStoneID=%s" | 
|---|
|  |  |  | 
|---|
|  |  |  | if not needCount: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if upWay == 0: #仙玉 | 
|---|
|  |  |  | stoneTypeItemIDDict = IpyGameDataPY.GetFuncEvalCfg("GemUpCostFormula", 1) | 
|---|
|  |  |  | if stoneEffType not in stoneTypeItemIDDict: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | stoneTypeItemID = stoneTypeItemIDDict[stoneEffType] | 
|---|
|  |  |  | unitPrice = ItemCommon.GetShopItemPrice(stoneTypeItemID, IPY_GameWorld.TYPE_Price_Gold_Money) | 
|---|
|  |  |  | if not unitPrice: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | #同级宝石 | 
|---|
|  |  |  | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, stoneItemID) | 
|---|
|  |  |  | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, stoneItemID, packType=stonePackType) | 
|---|
|  |  |  | if bindCnt + unBindCnt < needCount-1: | 
|---|
|  |  |  | GameWorld.DebugLog("同级宝石不足 %s!" % (needCount-1)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | costIndexList = (costItemIndexList[0]+costItemIndexList[1])[:2] | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | costIndexList = (costItemIndexList[1]+costItemIndexList[0])[:2] | 
|---|
|  |  |  | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) | 
|---|
|  |  |  | itemPack = curPlayer.GetItemManager().GetPack(stonePackType) | 
|---|
|  |  |  | hasBind = ItemCommon.ReduceItem(curPlayer, itemPack, costIndexList, needCount-1, False, ChConfig.ItemDel_StoneUpgrade, | 
|---|
|  |  |  | {"EquipPlace":equipIndex, "HoleIndex":holeIndex}) | 
|---|
|  |  |  | {"EquipPlace":equipPlace, "HoleIndex":holeIndex}) | 
|---|
|  |  |  | if hasBind: | 
|---|
|  |  |  | stoneIsBind = True | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | __DoChangeEquipHoleStone(curPlayer, equipIndex, holeIndex, upgradeStoneID, stoneIsBind, "StoneUpgrade", False) | 
|---|
|  |  |  | __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, upgradeStoneID, stoneIsBind, "StoneUpgrade", False) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 刷新属性 | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, IPY_GameWorld.rptEquip, False) | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, equipPackType, False) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #同步客户端 | 
|---|
|  |  |  | Sycn_StoneHoleInfo(curPlayer, [equipIndex]) | 
|---|
|  |  |  | Sycn_StoneHoleInfo(curPlayer, [equipPlace]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DoStoneSuccess(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __CheckStoneHoleCanUse(curPlayer, equipClassLV, holeIndex): | 
|---|
|  |  |  | def __CheckStoneHoleCanUse(curPlayer, equipClassLV, holeIndex, equipPackType): | 
|---|
|  |  |  | ##验证孔合法性 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | holeIndexList = GetAllEquipPlaceHoleIndex() | 
|---|
|  |  |  | 
|---|
|  |  |  | return False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | openCommHoleCnt = 0 # 已经开放装备常规孔数 | 
|---|
|  |  |  | gemOpenClassLVList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1) | 
|---|
|  |  |  | if equipPackType == ShareDefine.rptZhuXianEquip: | 
|---|
|  |  |  | gemOpenClassLVList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 2) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | gemOpenClassLVList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1) | 
|---|
|  |  |  | for holeCnt, openClassLV in enumerate(gemOpenClassLVList, 1): | 
|---|
|  |  |  | if equipClassLV >= openClassLV: | 
|---|
|  |  |  | openCommHoleCnt = holeCnt | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __DoChangeEquipHoleStone(curPlayer, equipIndex, holeIndex, changeStoneID, isBind, eventName, isPickoff): | 
|---|
|  |  |  | def __DoChangeEquipHoleStone(curPlayer, equipPlace, holeIndex, changeStoneID, isBind, eventName, isPickoff): | 
|---|
|  |  |  | ## 变更玩家装备孔宝石 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #获得装备位孔索引宝石存储信息 | 
|---|
|  |  |  | stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex) | 
|---|
|  |  |  | stoneID, stoneIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex) | 
|---|
|  |  |  | #保存装备位孔位上宝石ID和绑定状态 | 
|---|
|  |  |  | SetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex, changeStoneID, isBind) | 
|---|
|  |  |  | SetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex, changeStoneID, isBind) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isPickoff and stoneID: | 
|---|
|  |  |  | equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace) | 
|---|
|  |  |  | itemCount = 1 | 
|---|
|  |  |  | # 摘除的宝石都绑定 | 
|---|
|  |  |  | if ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem): | 
|---|
|  |  |  | if ItemCommon.CheckPackHasSpace(curPlayer, stonePackType): | 
|---|
|  |  |  | ItemControler.GivePlayerItem(curPlayer, stoneID, itemCount, True if stoneIsBind else False, | 
|---|
|  |  |  | [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere], | 
|---|
|  |  |  | event=[ChConfig.ItemGive_StonePickoff, False, {"EquipPlace":equipIndex, "HoleIndex":holeIndex}]) | 
|---|
|  |  |  | [stonePackType], | 
|---|
|  |  |  | event=[ChConfig.ItemGive_StonePickoff, False, {"EquipPlace":equipPlace, "HoleIndex":holeIndex}]) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | PlayerControl.SendMailByKey("GemToPlayer", [curPlayer.GetPlayerID()], [[stoneID, 1, stoneIsBind]]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataRecordPack.DR_StoneItemChange(curPlayer, eventName, {'equipIndex':equipIndex,"holeIndex":holeIndex, "stoneID":stoneID, 'changeStoneID':changeStoneID}) | 
|---|
|  |  |  | DataRecordPack.DR_StoneItemChange(curPlayer, eventName, {'equipPlace':equipPlace,"holeIndex":holeIndex, "stoneID":stoneID, 'changeStoneID':changeStoneID}) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def RefreshAttrByStoneAction(curPlayer, packType, isNeedNotify): | 
|---|
|  |  |  | ## 宝石刷新属性 | 
|---|
|  |  |  | # 装备等级改变,判断是否为玩家身上的装备,如果是的话刷新玩家属性 | 
|---|
|  |  |  | if packType in [IPY_GameWorld.rptEquip, IPY_GameWorld.rptHorseEquip]: | 
|---|
|  |  |  | if packType in [IPY_GameWorld.rptEquip]: | 
|---|
|  |  |  | #先刷装备BUFF 再计算属性 | 
|---|
|  |  |  | if isNeedNotify: | 
|---|
|  |  |  | curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrActivatyNotify, ChConfig.Def_AttrActivatyNotify_Stone) | 
|---|
|  |  |  | 
|---|
|  |  |  | #刷新所有属性 | 
|---|
|  |  |  | playControl = PlayerControl.PlayerControl(curPlayer) | 
|---|
|  |  |  | playControl.RefreshPlayerAttrState() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | elif packType == ShareDefine.rptZhuXianEquip: | 
|---|
|  |  |  | EquipZhuXian.RefreshZhuXianAttr(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DoMoveEquipStone(curPlayer, equipIndex): | 
|---|
|  |  |  | def DoMoveEquipStone(curPlayer, equipPlace): | 
|---|
|  |  |  | ###替换装备时宝石转移 | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(equipIndex) | 
|---|
|  |  |  | equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace) | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(equipPackType) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(placeIndex) | 
|---|
|  |  |  | if not ItemCommon.CheckItemCanUse(curEquip): | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for holeIndex in xrange(maxEquipHoleCnt): | 
|---|
|  |  |  | if holeIndex < openEquipHoleCnt: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex)[0] | 
|---|
|  |  |  | curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)[0] | 
|---|
|  |  |  | if curGemID == 0: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | pickoffHoleList.append([equipIndex, holeIndex]) | 
|---|
|  |  |  | pickoffHoleList.append([equipPlace, holeIndex]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #没有开启普通装备孔,需摘除VIP孔 | 
|---|
|  |  |  | if not openEquipHoleCnt: | 
|---|
|  |  |  | 
|---|
|  |  |  | maxVipHoleCnt = len(gemOpenVipList)# 最大VIP开放孔数 | 
|---|
|  |  |  | #判断VIP等级孔信息 | 
|---|
|  |  |  | for holeIndex in xrange(ChConfig.Def_Stone_VipHole, ChConfig.Def_Stone_VipHole + maxVipHoleCnt): | 
|---|
|  |  |  | curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex)[0] | 
|---|
|  |  |  | curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)[0] | 
|---|
|  |  |  | if curGemID == 0: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | pickoffHoleList.append([equipIndex, holeIndex]) | 
|---|
|  |  |  | pickoffHoleList.append([equipPlace, holeIndex]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 脱装备的外层刷属性, 这里不刷 | 
|---|
|  |  |  | __DoSysPickoffEquipStone(curPlayer, pickoffHoleList, "EquipChange", False) | 
|---|
|  |  |  | __DoSysPickoffEquipStone(curPlayer, equipPackType, stonePackType, pickoffHoleList, "EquipChange", False) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OnVIPTimeOut(curPlayer): | 
|---|
|  |  |  | 
|---|
|  |  |  | #=============================================================================================== | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __DoSysPickoffEquipStone(curPlayer, pickoffHoleList, eventName, isRefreshAttr): | 
|---|
|  |  |  | def __DoSysPickoffEquipStone(curPlayer, equipPackType, stonePackType, pickoffHoleList, eventName, isRefreshAttr): | 
|---|
|  |  |  | ## 系统摘除宝石 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not pickoffHoleList: | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | equipIndexList = [] | 
|---|
|  |  |  | stoneCount = len(pickoffHoleList) | 
|---|
|  |  |  | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, stoneCount) | 
|---|
|  |  |  | packSpace = ItemCommon.GetItemPackSpace(curPlayer, stonePackType, stoneCount) | 
|---|
|  |  |  | if packSpace >= stoneCount: | 
|---|
|  |  |  | for equipIndex, holeIndex in pickoffHoleList: | 
|---|
|  |  |  | __DoChangeEquipHoleStone(curPlayer, equipIndex, holeIndex, 0, 0, eventName, True) | 
|---|
|  |  |  | 
|---|
|  |  |  | PlayerControl.SendMailByKey("GemToPlayer", [curPlayer.GetPlayerID()], mailItemInfoList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isRefreshAttr: | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, IPY_GameWorld.rptEquip, False) | 
|---|
|  |  |  | RefreshAttrByStoneAction(curPlayer, equipPackType, False) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if equipIndexList: | 
|---|
|  |  |  | Sycn_StoneHoleInfo(curPlayer, equipIndexList) | 
|---|