| | |
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_GodWeapon):
|
| | | return
|
| | | Sync_GodWeaponLVInfo(curPlayer)
|
| | | |
| | | #老号相关神兵场景特效等级同步支持
|
| | | if curPlayer.GetExAttr15() == 0:
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
|
| | | for setWeaponType in xrange(1, maxType + 1):
|
| | | setLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % setWeaponType)
|
| | | if not setLV:
|
| | | continue
|
| | | SetGodWeaponLV(curPlayer, setWeaponType, setLV)
|
| | | GameWorld.Log("老号设置神兵场景等级: setWeaponType=%s,setLV=%s" % (setWeaponType, setLV), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | def SetGodWeaponLV(curPlayer, weaponType, lv):
|
| | | ## 设置神兵等级,同步设置场景神兵等级
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % weaponType, lv)
|
| | | sceneEffectsDict = {1:[lambda curObj, value:curObj.SetExAttr15(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_1],
|
| | | 2:[lambda curObj, value:curObj.SetExAttr16(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_2],
|
| | | 3:[lambda curObj, value:curObj.SetExAttr17(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_3],
|
| | | 4:[lambda curObj, value:curObj.SetExAttr18(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_4],
|
| | | }
|
| | | if weaponType in sceneEffectsDict:
|
| | | setFunc, notifyType = sceneEffectsDict[weaponType]
|
| | | setFunc(curPlayer, lv)
|
| | | curPlayer.SendPropertyRefresh(notifyType, lv, False)
|
| | | return
|
| | |
|
| | | ## 神器开启
|
| | | # @return: 是否激活成功
|
| | | def DoGodWeaponOpen(curPlayer):
|
| | | # 默认激活1级的类型
|
| | | for i in IpyGameDataPY.GetFuncEvalCfg('GodWeaponActive'):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % i, 1)
|
| | | SetGodWeaponLV(curPlayer, i, 1)
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_GodWeapon, 1, [i])
|
| | | Sync_GodWeaponLVInfo(curPlayer)
|
| | | return True
|
| | |
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------------------------------------
|
| | | #// A5 56 神兵激活 #tagCMGodWeaponActivate
|
| | | #
|
| | | #struct tagCMGodWeaponActivate
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD WeaponType; // 神兵类型
|
| | | #};
|
| | | def OnGodWeaponActivate(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | weaponType = clientData.WeaponType
|
| | |
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % weaponType):
|
| | | GameWorld.DebugLog("已经解锁的神兵!weaponType=%s" % weaponType)
|
| | | return
|
| | | |
| | | godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 2, {})
|
| | | if str(weaponType) not in godWeaponUnlockDict:
|
| | | GameWorld.DebugLog("该神兵不能解锁!weaponType=%s" % weaponType)
|
| | | return
|
| | | conditionList = godWeaponUnlockDict[str(weaponType)]
|
| | | |
| | | for needType, needLV in conditionList:
|
| | | needTypeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % needType)
|
| | | if needTypeLV < needLV:
|
| | | GameWorld.DebugLog("所需前置神兵等级不足,无法解锁!weaponType=%s,needType=%s,needLV=%s > needTypeLV(%s)" |
| | | % (weaponType, needType, needLV, needTypeLV))
|
| | | return
|
| | | |
| | | SetGodWeaponLV(curPlayer, weaponType, 1)
|
| | | GameWorld.DebugLog("解锁神兵: weaponType=%s" % weaponType)
|
| | | Sync_GodWeaponLVInfo(curPlayer, weaponType)
|
| | | return
|
| | |
|
| | | #===============================================================================
|
| | | #// A5 55 神兵升级 #tagCMGodWeaponPlus
|
| | | #
|
| | |
| | | if not effect:
|
| | | GameWorld.DebugLog('###神兵假包,物品ID=%s没有经验值'%useItemID)
|
| | | return
|
| | | addExp = effect.GetEffectValue(0)
|
| | | if not addExp:
|
| | | itemExp = effect.GetEffectValue(0)
|
| | | if not itemExp:
|
| | | GameWorld.DebugLog('###神兵假包,物品ID=%s没有经验值'%useItemID)
|
| | | return
|
| | |
|
| | | goldExpTotal = 0
|
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, useItemID, useItemCount)
|
| | | lackCount = max(0, useItemCount - (bindCnt + unBindCnt))
|
| | | if lackCount > 0:
|
| | |
| | | GameWorld.DebugLog("神兵升级消耗不足!useItemID=%s,useItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCount=%s"
|
| | | % (useItemID, useItemCount, bindCnt, unBindCnt, lackCount))
|
| | | return
|
| | | lackCost = ItemCommon.GetAutoBuyItemNeedGold({useItemID:lackCount})
|
| | | godMagicExpDict = IpyGameDataPY.GetFuncEvalCfg("GodMagicExp", 1, {})
|
| | | if str(weaponType) not in godMagicExpDict:
|
| | | return
|
| | | costGold, goldExp = godMagicExpDict[str(weaponType)]
|
| | | lackCost = costGold * lackCount
|
| | | goldExpTotal = goldExp * lackCount
|
| | | #lackCost = ItemCommon.GetAutoBuyItemNeedGold({useItemID:lackCount})
|
| | | if lackCost <= 0:
|
| | | return
|
| | |
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:useItemID}
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:useItemID, "lackCount":lackCount}
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, lackCost,
|
| | | ChConfig.Def_Cost_BuyStoreItem, infoDict, lackCount):
|
| | | ChConfig.Def_Cost_GodWeapon, infoDict, lackCount):
|
| | | return
|
| | |
|
| | | delUseItemCount = useItemCount - lackCount
|
| | |
| | | if delUseItemCount:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delUseItemCount, ChConfig.ItemDel_GodWeapon)
|
| | |
|
| | | addTotalExp = addExp * useItemCount
|
| | | addTotalExp = itemExp * delUseItemCount + goldExpTotal
|
| | | befExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponExp % weaponType)
|
| | | curExp = befExp + addTotalExp
|
| | | GameWorld.DebugLog("执行神兵升级: weaponType=%s,beforeAttrLV=%s,befExp=%s,addTotalExp=%s(%s*%s),curExp=%s" |
| | | % (weaponType, beforeAttrLV, befExp, addTotalExp, addExp, useItemCount, curExp))
|
| | | GameWorld.DebugLog("执行神兵升级: weaponType=%s,beforeAttrLV=%s,befExp=%s,addTotalExp=%s(%s*%s+%s),curExp=%s" |
| | | % (weaponType, beforeAttrLV, befExp, addTotalExp, itemExp, delUseItemCount, goldExpTotal, curExp))
|
| | |
|
| | | isLVUP = False
|
| | |
|
| | |
| | | #满级
|
| | | break
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % weaponType, attrLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponExp % weaponType, curExp)
|
| | | |
| | | if isLVUP:
|
| | | SetGodWeaponLV(curPlayer, weaponType, attrLV)
|
| | | GameWorld.DebugLog("神兵升级结果: attrLV=%s,curExp=%s" % (attrLV, curExp))
|
| | | RefreshGodWeaponAttr(curPlayer)
|
| | | #x神器达到X级成就
|
| | |
| | | for notifyLV in notifyDict[weaponType]:
|
| | | if beforeAttrLV < notifyLV and attrLV >= notifyLV:
|
| | | PlayerControl.WorldNotify(0, 'GodWeaponLv', [curPlayer.GetName(), weaponType, notifyLV])
|
| | | |
| | | #升级判断是否可解锁其他神兵
|
| | | godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 2, {})
|
| | | for unlockGodWeaponType, unlockConditionList in godWeaponUnlockDict.items():
|
| | | unlockGodWeaponType = int(unlockGodWeaponType)
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % unlockGodWeaponType):
|
| | | GameWorld.DebugLog("已经解锁的神兵不需要再判断!unlockGodWeaponType=%s" % unlockGodWeaponType)
|
| | | continue
|
| | | isUnlock = True
|
| | | for needType, needLV in unlockConditionList:
|
| | | needTypeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % needType)
|
| | | if needTypeLV < needLV:
|
| | | isUnlock = False
|
| | | GameWorld.DebugLog("所需前置神兵等级不足,无法解锁!unlockGodWeaponType=%s,needType=%s,needLV=%s > needTypeLV(%s)" |
| | | % (unlockGodWeaponType, needType, needLV, needTypeLV))
|
| | | break
|
| | | if isUnlock:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % unlockGodWeaponType, 1)
|
| | | GameWorld.DebugLog("解锁神兵: unlockGodWeaponType=%s" % unlockGodWeaponType)
|
| | | Sync_GodWeaponLVInfo(curPlayer, unlockGodWeaponType)
|
| | |
|
| | | Sync_GodWeaponLVInfo(curPlayer, weaponType)
|
| | | #任务
|