| | |
| | | import GameFuncComm
|
| | | import SkillCommon
|
| | | import BuffSkill
|
| | | import ItemControler
|
| | | import PlayerWeekParty
|
| | | #import EventReport
|
| | | import IpyGameDataPY
|
| | | import PassiveBuffEffMng
|
| | | import OpenServerCampaign
|
| | |
|
| | | import random
|
| | |
|
| | | Def_GodWeaponType_HP = 1 # 生命神兵类型
|
| | | Def_GodWeaponType_Atk = 2 # 攻击神兵类型
|
| | | Def_GodWeaponType_SuperHit = 3 # 暴击神兵类型
|
| | | Def_GodWeaponType_Def = 4 # 护盾神兵类型
|
| | |
|
| | | ## 神器功能登录处理
|
| | | # @param curPlayer 玩家
|
| | |
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_GodWeapon):
|
| | | return
|
| | | Sync_GodWeaponLVInfo(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | | def SetGodWeaponLV(curPlayer, weaponType, lv):
|
| | | ## 设置神兵等级,同步设置场景神兵等级
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % weaponType, lv)
|
| | | |
| | | totalLV = GetGodWeaponTotalLV(curPlayer)
|
| | | # 开服活动数据
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_GodWeaponLV, totalLV)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_GodWeapon, totalLV, False, True)
|
| | | return
|
| | |
|
| | | def GetGodWeaponTotalLV(curPlayer):
|
| | | ##获取神兵总等级
|
| | | totalLV = 0
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
|
| | | for gwType in xrange(1, maxType + 1):
|
| | | totalLV += curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % gwType)
|
| | | return totalLV
|
| | |
|
| | | ## 神器开启
|
| | | # @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
|
| | |
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
|
| | |
|
| | | fightPowerEx = 0 # 额外增加的战力
|
| | | allAttrList = [{} for i in range(4)]
|
| | | for gwType in xrange(1, maxType + 1):
|
| | | # 因为神兵解锁条件做了调整,由之前的0~1阶解锁改为由前置神兵类型等级解锁,默认解锁后为1阶
|
| | | # 为兼容老号,刷属性时只要判断等级是否大于0,不管是否解锁,新号解锁由神兵升级的时候进行解锁
|
| | | attrLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % gwType)
|
| | | if not attrLV:
|
| | | continue
|
| | | godWeaponData = IpyGameDataPY.GetIpyGameData('GodWeapon', gwType, attrLV)
|
| | | if not godWeaponData:
|
| | | continue
|
| | |
| | | for i, attrID in enumerate(attrTypeList):
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList)
|
| | |
|
| | | fightPowerEx += IpyGameDataPY.GetFuncEvalCfg('MagicExterior').get(str(gwType), 0)
|
| | | |
| | | |
| | | # 附加战力
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_GodWeapon, fightPowerEx)
|
| | | GameWorld.DebugLog("神兵属性:%s" % allAttrList)
|
| | | # 保存计算值
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_GodWeapon, allAttrList)
|
| | | 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
|
| | | |
| | | # 满足玩家等级或者前置神兵等级可解锁
|
| | | if __GWCheckPlayerLV(curPlayer, weaponType) or __GWCheckOtherGWLV(curPlayer, weaponType):
|
| | | |
| | | SetGodWeaponLV(curPlayer, weaponType, 1)
|
| | | RefreshGodWeaponAttr(curPlayer)
|
| | | GameWorld.DebugLog("解锁神兵: weaponType=%s" % weaponType)
|
| | | Sync_GodWeaponLVInfo(curPlayer, weaponType)
|
| | | return
|
| | |
|
| | | # 神兵激活需2次判断等级 {2:100, 4:100}
|
| | | def __GWCheckPlayerLV(curPlayer, weaponType):
|
| | | godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 3, {})
|
| | | if str(weaponType) not in godWeaponUnlockDict:
|
| | | GameWorld.DebugLog("该神兵不能解锁!weaponType=%s" % weaponType)
|
| | | return False
|
| | | return curPlayer.GetLV() >= godWeaponUnlockDict[str(weaponType)]
|
| | |
|
| | | # 神兵激活需判断前置神兵等级
|
| | | def __GWCheckOtherGWLV(curPlayer, weaponType):
|
| | | godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 2, {})
|
| | | if str(weaponType) not in godWeaponUnlockDict:
|
| | | GameWorld.DebugLog("该神兵不能解锁!weaponType=%s" % weaponType)
|
| | | return False
|
| | | 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 False
|
| | | |
| | | return True
|
| | |
|
| | | #===============================================================================
|
| | | # // A5 55 神兵升级 #tagCMGodWeaponPlus
|
| | | # |
| | | # struct tagCMGodWeaponPlus
|
| | | # {
|
| | | #// A5 55 神兵升级 #tagCMGodWeaponPlus
|
| | | #
|
| | | #struct tagCMGodWeaponPlus
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD WeaponType; // 神兵类型
|
| | | # DWORD ItemID; //消耗的物品ID
|
| | | # };
|
| | | # BYTE ItemCount; //消耗个数,默认1
|
| | | # BYTE IsAutoBuy; //是否自动购买,默认0
|
| | | #};
|
| | | #===============================================================================
|
| | | def OnPlusGodWeapon(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | weaponType = clientData.WeaponType
|
| | | useItemID = clientData.ItemID
|
| | | useItemCount = max(1, clientData.ItemCount)
|
| | | isAutoBuy = clientData.IsAutoBuy
|
| | |
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_GodWeapon):
|
| | | #等级不足
|
| | |
| | |
|
| | | #1.判断表中有没此类型,2.是否满级,3.判断是否有物品
|
| | | attrLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % weaponType)
|
| | | # if not attrLV and Def_GodWeaponType_SuperHit != weaponType:
|
| | | # GameWorld.DebugLog("神兵未解锁,无法升级!weaponType=%s,attrLV=%s" % (weaponType, attrLV))
|
| | | # return 由配置表决定等级0是否可升级
|
| | | |
| | | beforeAttrLV = attrLV # 用于提示
|
| | | godWeaponData = IpyGameDataPY.GetIpyGameData('GodWeapon', weaponType, attrLV)
|
| | | if not godWeaponData:
|
| | |
| | | if useItemID not in IpyGameDataPY.GetFuncEvalCfg("GodWeapon%s"%weaponType):
|
| | | return
|
| | |
|
| | | curItem = ItemCommon.FindItemInPackByItemID(curPlayer, useItemID, IPY_GameWorld.rptItem)
|
| | | if not curItem:
|
| | | GameWorld.DebugLog('###神兵假包,没有物品ID=%s'%useItemID)
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(useItemID)
|
| | | if not itemData:
|
| | | return
|
| | |
|
| | | effect = ItemCommon.GetItemEffectByEffectID(curItem, ChConfig.Def_Item_Eff_GodWeaponExp)
|
| | | effect = ItemCommon.GetItemEffectByEffectID(itemData, ChConfig.Def_Item_Eff_GodWeaponExp)
|
| | | 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
|
| | |
|
| | | delCnt = 1
|
| | | ItemCommon.DelItem(curPlayer, curItem, delCnt, False, ChConfig.ItemDel_GodWeapon)
|
| | | |
| | | curExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponExp % weaponType)
|
| | | curExp = curExp + addExp
|
| | | goldExpTotal = 0
|
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, useItemID, useItemCount)
|
| | | lackCount = max(0, useItemCount - (bindCnt + unBindCnt))
|
| | | if lackCount > 0:
|
| | | if not isAutoBuy:
|
| | | GameWorld.DebugLog("神兵升级消耗不足!useItemID=%s,useItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCount=%s" |
| | | % (useItemID, useItemCount, bindCnt, unBindCnt, lackCount))
|
| | | return
|
| | | 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, "lackCount":lackCount}
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, lackCost,
|
| | | ChConfig.Def_Cost_GodWeapon, infoDict, lackCount):
|
| | | return
|
| | | |
| | | delUseItemCount = useItemCount - lackCount
|
| | | # 扣除消耗
|
| | | if delUseItemCount:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delUseItemCount, ChConfig.ItemDel_GodWeapon)
|
| | | |
| | | 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+%s),curExp=%s" |
| | | % (weaponType, beforeAttrLV, befExp, addTotalExp, itemExp, delUseItemCount, goldExpTotal, curExp))
|
| | |
|
| | | isLVUP = False
|
| | |
|
| | | # 安全为主不用while
|
| | | for i in xrange(100):
|
| | | for _ in xrange(100):
|
| | | if curExp < totalExp:
|
| | | break
|
| | | godWeaponData = IpyGameDataPY.GetIpyGameData('GodWeapon', weaponType, attrLV+1)
|
| | |
| | | GameWorld.DebugLog('神兵升级找不到数据 %s-%s'%(weaponType, attrLV))
|
| | | break
|
| | |
|
| | | GameWorld.DebugLog(" 神兵升级: attrLV=%s,needExp=%s" % (attrLV, totalExp))
|
| | | curExp = curExp - totalExp
|
| | | attrLV += 1
|
| | | isLVUP = True
|
| | | GodWeaponLVUP(curPlayer, godWeaponData)
|
| | | GodWeaponLVUP(curPlayer, godWeaponData, attrLV)
|
| | |
|
| | | totalExp = godWeaponData.GetExp()
|
| | | if totalExp == 0:
|
| | |
| | | #满级
|
| | | 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级成就
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_GodWeapon, attrLV, [weaponType])
|
| | | EventShell.EventRespons_GodWeaponUp(curPlayer, weaponType, attrLV)
|
| | | if beforeAttrLV == 0:
|
| | | # 解封通知
|
| | | PlayerControl.WorldNotify(0, 'GetGodWeapon', [curPlayer.GetName(), weaponType])
|
| | | sysMark = IpyGameDataPY.GetFuncEvalCfg('GodWeaponSys', 1, {}).get(weaponType, 'GetGodWeapon')
|
| | | PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), weaponType])
|
| | |
|
| | | #{1:[100,200,300,400],2:[100,200,300,400],3:[100,200,300,400]}
|
| | | notifyDict = IpyGameDataPY.GetFuncEvalCfg('GodLv', 1, {})
|
| | | if weaponType in notifyDict:
|
| | | for notifyLV in notifyDict[weaponType]:
|
| | | if beforeAttrLV < notifyLV and attrLV >= notifyLV:
|
| | | PlayerControl.WorldNotify(0, 'GodWeaponLv', [curPlayer.GetName(), weaponType, notifyLV])
|
| | | #=======================================================================
|
| | | # notifyDict = IpyGameDataPY.GetFuncEvalCfg('GodLv', 1, {})
|
| | | # if weaponType in notifyDict:
|
| | | # for notifyLV in notifyDict[weaponType]:
|
| | | # if beforeAttrLV < notifyLV and attrLV >= notifyLV:
|
| | | # PlayerControl.WorldNotify(0, 'GodWeaponLv', [curPlayer.GetName(), weaponType, notifyLV])
|
| | | #=======================================================================
|
| | | |
| | |
|
| | | totalExp = godWeaponData.GetExp()
|
| | | |
| | |
|
| | | Sync_GodWeaponLVInfo(curPlayer, weaponType)
|
| | | #任务
|
| | | EventShell.EventRespons_PlusGodWeapon(curPlayer)
|
| | | EventShell.EventRespons_PlusGodWeapon(curPlayer, weaponType)
|
| | | return
|
| | |
|
| | | #神兵升级触发其他功能:技能
|
| | | def GodWeaponLVUP(curPlayer, godWeaponData):
|
| | | def GodWeaponLVUP(curPlayer, godWeaponData, attrLV):
|
| | | skillID = godWeaponData.GetSkillID()
|
| | | |
| | | if skillID:
|
| | | __GiveGodWeaponSkill(curPlayer, skillID)
|
| | | if __GiveGodWeaponSkill(curPlayer, skillID):
|
| | | sysMark = godWeaponData.GetSysMark()
|
| | | if sysMark:
|
| | | PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), attrLV, skillID])
|
| | | return skillID
|
| | | return
|
| | | |
| | |
|
| | |
|
| | |
|
| | |
| | | # BuffSkill.DoAddBuff(curPlayer, buffType, skillData, GameWorld.GetGameWorld().GetTick(), [], curPlayer)
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, skillResId)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshSkillFightPowerEx(skillResId, 0)
|
| | | return
|
| | | return True
|
| | |
|