| | |
| | | import ChConfig
|
| | | import ChEquip
|
| | | import EventShell
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | #-------------------------------------------------------------------------------------------
|
| | |
|
| | | #===============================================================================
|
| | |
| | |
|
| | | # 判断 1.装备 2.最高强化等级, 3.铜钱数
|
| | | if packType not in ChConfig.Pack_EquipPart_CanPlusStar:
|
| | | GameWorld.DebugLog("packType not in ChConfig.Pack_EquipPart_CanPlusStar", playerID)
|
| | | #GameWorld.DebugLog("packType not in ChConfig.Pack_EquipPart_CanPlusStar", playerID)
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'GridIndex':index})
|
| | | if not ipyData:
|
| | | return
|
| | | equipPlace = ipyData.GetEquipPlace()
|
| | | indexList = ChConfig.Pack_EquipPart_CanPlusStar[packType]
|
| | | if equipPlace not in indexList:
|
| | | GameWorld.Log(" index not in ChConfig.Pack_EquipPart_CanPlusStar", playerID)
|
| | | equipPlaceList = ChConfig.Pack_EquipPart_CanPlusStar[packType]
|
| | | if equipPlace not in equipPlaceList:
|
| | | #GameWorld.Log("index=%s, equipPlace=%s not in ChConfig.Pack_EquipPart_CanPlusStar" % (index, equipPlace), playerID)
|
| | | return
|
| | |
|
| | | # 暂不判断开启等级由客户端处理
|
| | |
| | | curPack = curPlayer.GetItemManager().GetPack(packType)
|
| | | curEquip = curPack.GetAt(index)
|
| | | if not curEquip or curEquip.IsEmpty():
|
| | | GameWorld.DebugLog("OnEquipMayaPlus() equip is empty")
|
| | | GameWorld.DebugLog("equip is empty")
|
| | | return
|
| | |
|
| | | maxPlusLV = ItemCommon.GetItemMaxPlusLV(curPlayer, index, curEquip)
|
| | | curPartPlusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, index)
|
| | | if curPartPlusLV >= maxPlusLV:
|
| | | GameWorld.Log("OnEquipMayaPlus:curPartPlusLV(%s) >= maxPlusLV(%s)" % (curPartPlusLV, maxPlusLV), playerID)
|
| | | return
|
| | |
|
| | | # 强化处理
|
| | | result = DoLogic_EquipMayaPlus(curPlayer, curEquip, packType, index)
|
| | | |
| | | updPartPlusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, index)
|
| | | #GameWorld.Log(" result=%s,curStarLV=%s,updStarLV=%s" % (result, curPartPlusLV, updPartStarLV), playerID)
|
| | | if result == ChConfig.Def_ComposeState_None:
|
| | | return
|
| | | |
| | | #===========================================================================
|
| | | # curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitEquipMayaPlus, result)
|
| | | |
| | | # 每日活动
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_EquipPlus)
|
| | | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_EquipPlus, 1)
|
| | | #===========================================================================
|
| | | |
| | |
|
| | | # 强化变更时处理
|
| | | if curPartPlusLV != updPartPlusLV:
|
| | | DoLogic_OnEquipPartStarLVChange(curPlayer, packType, ItemCommon.GetItemClassLV(curEquip))
|
| | | # 增加强化成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipPlus, 1)
|
| | | EventShell.EventRespons_EquipPlus(curPlayer)
|
| | | return
|
| | |
|
| | | |
| | |
|
| | | ## 开始装备强化
|
| | | # @param index 为装备位
|
| | | # @return |
| | | def DoLogic_EquipMayaPlus(curPlayer, curEquip, packType, index):
|
| | | result = ChConfig.Def_ComposeState_None
|
| | |
|
| | | findType = ChEquip.GetEquipPlusType(curEquip)
|
| | | if findType == -1:
|
| | | return result
|
| | | if not findType:
|
| | | return
|
| | |
|
| | | curPartPlusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, index)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ItemPlus", findType, curPartPlusLV)
|
| | | if not ipyData:
|
| | | classLV = ItemCommon.GetItemClassLV(curEquip)
|
| | | plusMaxIpyData = IpyGameDataPY.GetIpyGameData("ItemPlusMax", findType, classLV)
|
| | | if not plusMaxIpyData:
|
| | | return
|
| | | costSilver = ipyData.GetCostCount()
|
| | |
|
| | | if not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costSilver):
|
| | | # 金币不足,返回
|
| | | return result
|
| | |
|
| | | totalExp = ipyData.GetTotalExp()
|
| | | curExp = ChEquip.GetEquipPartProficiency(curPlayer, packType, index) + ipyData.GetAddExp()
|
| | |
|
| | | if curExp >= totalExp:
|
| | | #升级
|
| | | curPartPlusLV = __EquipMayaPlusChange(curPlayer, packType, curEquip, index)
|
| | | curExp = curExp - totalExp
|
| | | plusLVMax = plusMaxIpyData.GetPlusLVMax()
|
| | | if curPartPlusLV >= plusLVMax:
|
| | | #GameWorld.DebugLog("强化达到本阶最大等级,无法强化! classLV=%s,plusLVMax=%s,curPartPlusLV=%s" % (classLV, plusLVMax, curPartPlusLV))
|
| | | return
|
| | | plusIpyData = IpyGameDataPY.GetIpyGameData("ItemPlus", findType, curPartPlusLV)
|
| | | if not plusIpyData:
|
| | | return
|
| | | costSilver = plusIpyData.GetCostCount()
|
| | | costItemInfo = plusIpyData.GetCostItemInfo()
|
| | | if not costSilver and not costItemInfo:
|
| | | #GameWorld.DebugLog("已到强化最大等级! curPartPlusLV=%s" % curPartPlusLV, playerID) |
| | | return
|
| | | |
| | | curEvolveLV = ChEquip.GetEquipPartPlusEvolveLV(curPlayer, packType, index) # 进化等级
|
| | | nextEvolveLV = curEvolveLV + 1
|
| | | evolveIpyData = IpyGameDataPY.GetIpyGameDataNotLog('EquipPlusEvolve', equipPlace, nextEvolveLV)
|
| | | if not evolveIpyData:
|
| | | return
|
| | | maxPlusLV = evolveIpyData.GetNeedPlusLV()
|
| | | if curPartPlusLV >= maxPlusLV:
|
| | | GameWorld.Log("已到当前强化最大等级,进化后增加强化等级上限! curPartPlusLV(%s) >= maxPlusLV(%s), curEvolveLV=%s" |
| | | % (curPartPlusLV, maxPlusLV, curEvolveLV), playerID)
|
| | | return
|
| | | |
| | | if costSilver and not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costSilver):
|
| | | GameWorld.DebugLog("铜钱不足,无法强化! costSilver=%s" % costSilver)
|
| | | return
|
| | | |
| | | costItemID, costItemCount = 0, 0
|
| | | if costItemInfo:
|
| | | costItemID, costItemCount = costItemInfo
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(costItemID, itemPack, costItemCount)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog("材料不足,无法强化! costItemID=%s, costItemCount=%s" % (costItemID, costItemCount))
|
| | | return
|
| | |
|
| | | if costSilver:
|
| | | PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costSilver, isNotify=False)
|
| | | |
| | | if costItemID:
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, itemIndexList, costItemCount, True, ChConfig.ItemDel_EquipPlus)
|
| | | |
| | | isLVUp = False
|
| | | curExp = 0
|
| | | addExp = plusIpyData.GetAddExp()
|
| | | totalExp = plusIpyData.GetTotalExp()
|
| | | if addExp and totalExp:
|
| | | curExp = ChEquip.GetEquipPartProficiency(curPlayer, packType, index) + addExp
|
| | | if curExp >= totalExp:
|
| | | curExp = curExp - totalExp
|
| | | isLVUp = True
|
| | | else:
|
| | | isLVUp = True
|
| | | |
| | | if isLVUp:
|
| | | curPartPlusLV += 1
|
| | | __EquipMayaPlusChange(curPlayer, packType, curEquip, index, curPartPlusLV)
|
| | | |
| | | DataRecordPack.DR_UpStarLVSuccess(curPlayer, curExp, curPartPlusLV)
|
| | | ChEquip.SetEquipPartProficiency(curPlayer, packType, index, curExp)
|
| | | ChEquip.NotifyEquipPartPlusLV(curPlayer, packType, index)
|
| | | # 支付金币
|
| | | PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costSilver, isNotify=False)
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_EquipPlus)
|
| | | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_EquipPlus, 1)
|
| | | return
|
| | |
|
| | | DataRecordPack.DR_UpStarLVSuccess(curPlayer, curExp, curPartPlusLV)
|
| | | return ChConfig.Def_ComposeState_Sucess
|
| | |
|
| | |
|
| | |
|
| | | ## 玛雅加强等级改变
|
| | | # @param curPlayer: 玩家
|
| | | # @param packType: 背包类型
|
| | | # @param curEquip: 当前装备
|
| | | # @param succeedRate: 成功率
|
| | | # @param failStarLV: 失败时的强化数
|
| | | # @return |
| | | def __EquipMayaPlusChange(curPlayer, packType, curEquip, index):
|
| | | curPlusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, index)
|
| | | updPlusLV = curPlusLV + 1
|
| | | def __EquipMayaPlusChange(curPlayer, packType, curEquip, index, updPlusLV):
|
| | | ## 玛雅加强等级改变
|
| | | |
| | | ChEquip.SetEquipPartPlusLV(curPlayer, packType, index, curEquip, updPlusLV)
|
| | |
|
| | | broadCastLVList = IpyGameDataPY.GetFuncEvalCfg("StrengthenLevelBroadCast", 1)
|
| | | #GameWorld.DebugLog("PlusLVChange index=%s,updPlusLV=%s,broadCastLVList=%s" % (index, updPlusLV, broadCastLVList))
|
| | | if updPlusLV in broadCastLVList:
|
| | | msgParamList = [curPlayer.GetPlayerName()] + ItemCommon.GetNotifySuperItemInfo(curPlayer, curEquip, index) + [updPlusLV]
|
| | | itemID = curEquip.GetItemTypeID()
|
| | | userData = curEquip.GetUserData()
|
| | | guid = ItemCommon.CacheNotifyEquipDetailInfo(curPlayer, curEquip)
|
| | | msgParamList = [curPlayer.GetPlayerName(), itemID, userData, guid, updPlusLV]
|
| | | PlayerControl.WorldNotify(0, "StrengthenCongratulation", msgParamList)
|
| | |
|
| | | # 成就
|
| | | #PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipPlusLV, 1, [updPlusLV])
|
| | | |
| | | #任务触发
|
| | | #EventShell.EventRespons_OnEquipPartStarUp(curPlayer, setLV)
|
| | | classLV = ItemCommon.GetItemClassLV(curEquip) |
| | | |
| | | DoLogic_OnEquipPartStarLVChange(curPlayer, packType, classLV)
|
| | | # 强化成就
|
| | | __UpdateEquipPlusSuccess(curPlayer, classLV)
|
| | | EventShell.EventRespons_EquipPlus(curPlayer, classLV, updPlusLV)
|
| | | |
| | | # 开服活动数据
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_PlusLV, ChEquip.GetTotalPlusLV(curPlayer))
|
| | | return updPlusLV
|
| | | #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Plus, ChEquip.GetTotalPlusLV(curPlayer))
|
| | | return
|
| | |
|
| | | def __UpdateEquipPlusSuccess(curPlayer, classLV):
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'ClassLV':classLV}, True)
|
| | | if not ipyDataList:
|
| | | return
|
| | | |
| | | packType = IPY_GameWorld.rptEquip
|
| | | plusLVCountDict = {}
|
| | | for ipyData in ipyDataList:
|
| | | index = ipyData.GetGridIndex()
|
| | | plusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, index)
|
| | | if not plusLV:
|
| | | continue
|
| | | conditionKey = (classLV, plusLV)
|
| | | plusLVCountDict[conditionKey] = plusLVCountDict.get(conditionKey, 0) + 1
|
| | | |
| | | #GameWorld.DebugLog("强化成就数据: classLV=%s,plusLVCountDict=%s" % (classLV, plusLVCountDict))
|
| | | PlayerSuccess.UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipPlus, plusLVCountDict)
|
| | | return
|
| | |
|
| | | def DoLogic_OnEquipPartStarLVChange(curPlayer, packType, classLV):
|
| | | #先刷装备BUFF 再计算属性
|
| | |
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | | return
|
| | | curEvolveLV = ChEquip.GetEquipPartPlusEvolveLV(curPlayer, packType, equipPackindex)
|
| | | maxEvolveLV = ItemCommon.GetItemMaxPlusEvolveLV(curPlayer, equipPackindex, curEquip)
|
| | | if curEvolveLV >= maxEvolveLV:
|
| | | GameWorld.DebugLog('装备强化进化, 已达最大进化等级equipPackindex=%s, maxEvolveLV=%s'%(equipPackindex, maxEvolveLV))
|
| | | return
|
| | | nextEvolveLV = curEvolveLV + 1
|
| | | equipPlace = curEquip.GetEquipPlace()
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlusEvolve', equipPlace, nextEvolveLV)
|
| | | if not ipyData:
|
| | | return
|
| | | needPlusLV = ipyData.GetNeedPlusLV()
|
| | | curPartPlusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, equipPackindex)
|
| | | if curPartPlusLV < needPlusLV:
|
| | | GameWorld.DebugLog("强化等级不足,无法进化! curPartPlusLV=%s < needPlusLV=%s, nextEvolveLV=%s" |
| | | % (curPartPlusLV, needPlusLV, nextEvolveLV))
|
| | | return
|
| | | |
| | | costItemDict = ipyData.GetCostItem()
|
| | | delItemDict = {}
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | for itemID, itemCnt in costItemDict.items():
|
| | | hasEnough, indexList, findItemIsBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(itemID, itemPack, itemCnt)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog('装备强化进化 材料不足itemID= %s,itemCnt=%s'%(itemID, itemCnt))
|
| | | GameWorld.DebugLog('装备强化进化 材料不足itemID= %s,itemCnt=%s' % (itemID, itemCnt))
|
| | | return
|
| | | delItemDict[tuple(indexList)] = itemCnt
|
| | | for itemIndexList, delCnt in delItemDict.items():
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, itemIndexList, delCnt, True, ChConfig.ItemDel_EquipPlusEvolve)
|
| | | |
| | | ItemCommon.ReduceItem(curPlayer, itemPack, itemIndexList, delCnt, True, ChConfig.ItemDel_EquipPlus)
|
| | | |
| | | ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, equipPackindex, nextEvolveLV)
|
| | | DoLogic_OnEquipPartStarLVChange(curPlayer, packType, ItemCommon.GetItemClassLV(curEquip))
|
| | | ChEquip.NotifyEquipPartPlusLV(curPlayer, packType, equipPackindex)
|
| | | EventShell.EventRespons_EquipPlusEvolve(curPlayer, nextEvolveLV)
|
| | | return
|
| | |
|
| | |
|
| | | #// A5 C7 激活大师强化等级 #tagCMActivateMasterPlusLV
|
| | | #
|
| | | #struct tagCMActivateMasterPlusLV
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE ClassLV; // 所属装备阶
|
| | | # WORD MasterPlusLV; // 大师强化等级
|
| | | #};
|
| | | def OnActivateMasterPlusLV(index, clientData, tick):
|
| | | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | classLV = clientData.ClassLV
|
| | | actMasterPlusLV = clientData.MasterPlusLV
|
| | | |
| | | curMasterPlusLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartMasterPlusLV % classLV)
|
| | | if curMasterPlusLV >= actMasterPlusLV:
|
| | | # 已经激活过了
|
| | | GameWorld.DebugLog("已经激活过该强化大师等级了! actMasterPlusLV=%s,curMasterPlusLV=%s" % (actMasterPlusLV, curMasterPlusLV))
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("ItemPlusMaster", {"ClassLV":classLV, "MasterPlusLV":actMasterPlusLV}, False, False)
|
| | | if not ipyData:
|
| | | GameWorld.DebugLog("不存在该强化大师等级! actMasterPlusLV=%s" % actMasterPlusLV)
|
| | | return
|
| | | |
| | | packType = IPY_GameWorld.rptEquip
|
| | | # 判断可否激活
|
| | | for equipPlace in ChConfig.EquipPlace_Base:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
|
| | | if not ipyData:
|
| | | return
|
| | | equipIndex = ipyData.GetGridIndex()
|
| | | plusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, equipIndex)
|
| | | if plusLV < actMasterPlusLV:
|
| | | GameWorld.DebugLog("部位强化等级不足,无法激活强化大师! equipPlace=%s,equipIndex=%s,plusLV=%s < %s" |
| | | % (equipPlace, equipIndex, plusLV, actMasterPlusLV))
|
| | | return
|
| | | |
| | | GameWorld.DebugLog("激活强化大师等级! classLV=%s,actMasterPlusLV=%s" % (classLV, actMasterPlusLV))
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartMasterPlusLV % classLV, actMasterPlusLV)
|
| | | |
| | | SyncEquipMasterPlusLVInfo(curPlayer, classLV)
|
| | | ChEquip.ChangeEquipEffectByPlusMaster(curPlayer, classLV)
|
| | | #刷新所有属性
|
| | | DoLogic_OnEquipPartStarLVChange(curPlayer, packType, classLV)
|
| | | return
|
| | |
|
| | | def SyncEquipMasterPlusLVInfo(curPlayer, classLV=0, isForce=False):
|
| | | ## 同步大师强化等级信息
|
| | | if not classLV:
|
| | | needSyncClassLVList = xrange(1, IpyGameDataPY.GetFuncCfg('EquipMaxClasslv') + 1)
|
| | | else:
|
| | | needSyncClassLVList = [classLV]
|
| | | |
| | | masterPlusLVInfoList = []
|
| | | for classLV in needSyncClassLVList:
|
| | | masterPlusLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartMasterPlusLV % classLV)
|
| | | if not masterPlusLV and not isForce:
|
| | | continue
|
| | | lvInfo = ChPyNetSendPack.tagMCMasterPlusLV()
|
| | | lvInfo.ClassLV = classLV
|
| | | lvInfo.MasterPlusLV = masterPlusLV
|
| | | masterPlusLVInfoList.append(lvInfo)
|
| | | |
| | | if not masterPlusLVInfoList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCMasterPlusLVInfo()
|
| | | clientPack.MasterPlusLVInfoList = masterPlusLVInfoList
|
| | | clientPack.Count = len(masterPlusLVInfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | |
|