| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| # @todo: µ±Ç°ÉñÊÞ£¨°üÀ¨×°±¸£©ÊôÐÔÏÈçÉúÃü£©+xx%£¬¿É¶àÅä  | 
| #  | 
| # @author: Alee  | 
| # @date 2018-1-20 ÏÂÎç02:50:26  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import ChConfig  | 
| import PlayerControl  | 
| import ShareDefine  | 
| import IpyGameDataPY  | 
| import PlayerDogz  | 
| import ChEquip  | 
| #---------------------------------------------------------------------  | 
|   | 
| ## buffÏßÐÔÔö¼ÓÊôÐÔ  | 
| #  @param defender Buff³ÐÊÜÕß  | 
| #  @param curEffect ¼¼ÄÜЧ¹û  | 
| #  @param calcDict ¼¼ÄÜЧ¹ûÀÛ¼Ó×Ü±í  | 
| #  @return None  | 
| def OnCalcBuffEx(defender, curEffect, calcDict, curBuff):  | 
|     attrType = curEffect.GetEffectValue(1)  | 
|     attrList = GetTheDogzAttr(defender, curEffect.GetEffectValue(2))  | 
|     value = int(attrList[2].get(attrType, 0)*curEffect.GetEffectValue(0)*1.0/ChConfig.Def_MaxRateValue)  | 
|       | 
|     calcDict[attrType] = calcDict.get(attrType, 0) + value  | 
|       | 
|     return  | 
|   | 
|   | 
| ## ·µ»ØbuffÀàÐÍ£¬ÏßÐÔÓë·ñ  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.    | 
| def GetCalcType():  | 
|     return ChConfig.TYPE_Linear  | 
|   | 
| # Ö¸¶¨ÉñÊÞÊôÐÔ  | 
| def GetTheDogzAttr(curPlayer, dogzID):  | 
|     allAttrList = [{} for _ in range(4)]  | 
|       | 
|     dogzEquipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzEquip)  | 
|     equipPackCount = dogzEquipPack.GetCount()  | 
|     ipyData = IpyGameDataPY.GetIpyGameData("Dogz", dogzID)  | 
|     if not ipyData:  | 
|         return allAttrList  | 
|       | 
|     # 1. »ù´¡ÊôÐÔ  | 
|     attrTypeList = ipyData.GetBaseAttrTypes()  | 
|     attrValueList = ipyData.GetBaseAttrValues()  | 
|     if attrTypeList and len(attrTypeList) == len(attrValueList):  | 
|         for attrIndex, baseAttrID in enumerate(attrTypeList):  | 
|             baseAttrValue = attrValueList[attrIndex]  | 
|             PlayerControl.CalcAttrDict_Type(baseAttrID, baseAttrValue, allAttrList)  | 
|             #GameWorld.DebugLog("    »ù´¡ÊôÐÔ: baseAttrID=%s,baseAttrValue=%s, %s" % (baseAttrID, baseAttrValue, allAttrList))  | 
|               | 
|     # 2. ×°±¸ÊôÐÔ  | 
|     startIndex = (dogzID - 1) * PlayerDogz.DogzEquipCount  | 
|     for equipIndex in range(startIndex, startIndex + PlayerDogz.DogzEquipCount):  | 
|         if equipIndex < 0 or equipIndex >= equipPackCount:  | 
|             break  | 
|         curEquip = dogzEquipPack.GetAt(equipIndex)              | 
|         if curEquip.IsEmpty():  | 
|             continue  | 
|           | 
|         #itemID = curEquip.GetItemTypeID()  | 
|         # ×°±¸»ù´¡ÊôÐÔ  | 
|         for effIndex in xrange(curEquip.GetEffectCount()):  | 
|             curEffect = curEquip.GetEffectByIndex(effIndex)  | 
|             if not curEffect or not curEffect.GetEffectID():  | 
|                 break  | 
|             effID = curEffect.GetEffectID()  | 
|             if not effID or effID == ChConfig.Def_Effect_DogzEquipPlusExp:  | 
|                 continue  | 
|             effValue = curEffect.GetEffectValue(0)  | 
|             PlayerControl.CalcAttrDict_Type(effID, effValue, allAttrList)  | 
|             #GameWorld.DebugLog("    ×°±¸»ù´¡: itemID=%s,effID=%s,effValue=%s, %s" % (itemID, effID, effValue, allAttrList))  | 
|               | 
|         # Ç¿»¯ÊôÐÔ  | 
|         curPlusLV = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 0)  | 
|         plusIpyData = IpyGameDataPY.GetIpyGameData("DogzEquipPlus", curEquip.GetEquipPlace(), curPlusLV)  | 
|         if plusIpyData:  | 
|             plusAttrTypeList = plusIpyData.GetPlusAttrTypes()  | 
|             plusAttrValueList = plusIpyData.GetPlusAttrValues()  | 
|             if plusAttrTypeList and len(plusAttrTypeList) == len(plusAttrValueList):  | 
|                 for plusIndex, plusAttrID in enumerate(plusAttrTypeList):  | 
|                     plusAttrValue = plusAttrValueList[plusIndex]  | 
|                     PlayerControl.CalcAttrDict_Type(plusAttrID, plusAttrValue, allAttrList)  | 
|                     #GameWorld.DebugLog("    ×°±¸Ç¿»¯: itemID=%s,plusAttrID=%s, plusAttrValue=%s, %s" % (itemID, plusAttrID, plusAttrValue, allAttrList))  | 
|                       | 
|         # ´«ÆæÊôÐÔ  | 
|         ChEquip.CalcAttr_LegendAttr(curPlayer, curEquip, allAttrList)  | 
|   | 
|     return allAttrList  | 
|   | 
|   |