#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package Player.PlayerBeauty # # @todo:ºìÑÕ # @author hxp # @date 2025-11-21 # @version 1.0 # # ÏêϸÃèÊö: ºìÑÕ # #------------------------------------------------------------------------------- #"""Version = 2025-11-21 17:00""" #------------------------------------------------------------------------------- import ChConfig import GameWorld import ItemCommon import PlayerOnline import PlayerControl import IpyGameDataPY import ChPyNetSendPack import PlayerGoldRush import NetPackCommon import ItemControler import PyGameData import PlayerTask import FBCommon import ObjPool # ºìÑÕ½âËø·½Ê½ ( UnlockWay_Item, # ÎïÆ·½âËø 1 UnlockWay_TaskID, # Íê³ÉÖ÷ÏßÈÎÎñID 2 UnlockWay_ArenaWinCnt, # ÑÝÎ䳡ʤÀû´ÎÊý 3 UnlockWay_GoldRushWorker, # ÓµÓм๤ÊýÁ¿ 4 UnlockWay_FBZhanchui, # °×¹ÇÓ¯Ò°¹ý¹Ø 5 UnlockWay_OfficialRank, # ¹ÙÖ°´ïµ½ 6 UnlockWay_TravelCnt, # ÓÎÀú´ÎÊý 7 ) = range(1, 1 + 7) # Ƥ·ô½âËø·½Ê½ UnlockWaySkin_Default = 1 # ĬÈϽâËø 1 UnlockWaySkin_Item = 2 # ÎïÆ·½âËø 2 # ºìÑÕЧ¹ûÀàÐÍ ( EffType_BootyPer, # 1. Ö÷ÏßÕ½ÀûÆ·ÉÏÏÞÌá¸ß°Ù·Ö±È£¨¶ÔËùÓÐÖ÷ÏßÕ½ÀûÆ·ÉúЧ£© Value:°Ù·Ö±È EffType_ArenaItemEx, # 2. ÑÝÎ䳡ÌôսʤÀû£¬¸ÅÂʶîÍâ»ñµÃ1¸öÎïÆ·µÄ¸ÅÂÊ TypeValue:ÎïÆ·ID Value:¸ÅÂÊ EffType_TravelEnergy, # 3.ÓÎÀúÌåÁ¦ÉÏÏÞÔö¼Ó Value:Ôö¼ÓÉÏÏÞ EffType_FBZhanchuiItemEx, # 4.°×¹ÇӯҰɨµ´¶îÍâÎïÆ·½±Àø TypeValue:ÎïÆ·ID Value:ÊýÁ¿ ) = range(1, 1 + 4) def OnPlayerLogin(curPlayer): SyncBeautyInfo(curPlayer) return ## Def_PDict_BeautyLVInfo ¾­Ñé*10000+µÈ¼¶*10+ÊÇ·ñÒѼ¤»î def GetBeautyState(curPlayer, beautyID): ## ºìÑÕ¼¤»î״̬ return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautyLVInfo % beautyID) % 10 def SetBeautyState(curPlayer, beautyID, state): ## ÉèÖúìÑÕ¼¤»î״̬ lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautyLVInfo % beautyID) lvInfo = lvInfo / 10 * 10 + min(1, state) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BeautyLVInfo % beautyID, lvInfo) return lvInfo def GetBeautyLVInfo(curPlayer, beautyID): ## »ñÈ¡ºìÑյȼ¶¾­Ñé lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautyLVInfo % beautyID) exp = lvInfo / 10000 lv = lvInfo % 10000 / 10 return lv, exp def SetBeautyLVInfo(curPlayer, beautyID, lv, exp): lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautyLVInfo % beautyID) lvInfo = min(exp, 200000) * 10000 + min(lv, 999) * 10 + lvInfo % 10 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BeautyLVInfo % beautyID, lvInfo) return lvInfo ## Def_PDict_BeautySkinInfo ÐǼ¶*100+ÊÇ·ñʹÓÃ+ÊÇ·ñÒѼ¤»î def GetBeautySkinState(curPlayer, skinID): ## ºìÑÕʱװ¼¤»î״̬ return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID) % 10 def SetBeautySkinState(curPlayer, skinID, state): info = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID) info = info / 10 * 10 + min(1, state) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BeautySkinInfo % skinID, info) return info def GetBeautySkinUsed(curPlayer, skinID): ## ÊÇ·ñʹÓÃÖÐ return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID) % 100 / 10 def SetBeautySkinUsed(curPlayer, skinID, isUsed): info = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID) info = info / 100 * 100 + min(1, isUsed) * 10 + info % 10 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BeautySkinInfo % skinID, info) return info def GetBeautySkinStar(curPlayer, skinID): ## ºìÑÕʱװÐǼ¶ return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID) / 100 def SetBeautySkinStar(curPlayer, skinID, star): info = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID) info = star * 100 + info % 100 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BeautySkinInfo % skinID, info) return info def IsBeautySkinCanUse(curPlayer, beautyID, skinID, ipyData=None): ## ºìÑÕʱװÊÇ·ñ¿ÉÓà if GetBeautySkinState(curPlayer, skinID): return True if not ipyData: ipyData = GetBeautySkinIpyData(curPlayer, beautyID, skinID) if ipyData: unlockWay = ipyData.GetUnlockWay() if unlockWay == UnlockWaySkin_Default: # ĬÈϼ¤»îµÄ return True return False #// B2 19 ºìÑÕ¼¤»î #tagCSBeautyActivate # #struct tagCSBeautyActivate #{ # tagHead Head; # WORD BeautyID; //ºìÑÕID #}; def OnBeautyActivate(index, curPackData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerID = curPlayer.GetPlayerID() beautyID = curPackData.BeautyID if GetBeautyState(curPlayer, beautyID): GameWorld.DebugLog("ºìÑÕÒѾ­¼¤»î¹ý£¡ beautyID=%s" % beautyID, playerID) return ipyData = IpyGameDataPY.GetIpyGameData("Beauty", beautyID) if not ipyData: return unlockWay = ipyData.GetUnlockWay() unlockValue = ipyData.GetUnlockValue() unlockNeedCnt = ipyData.GetUnlockNeedCnt() if unlockWay == UnlockWay_Item: needItemID = unlockValue needItemCnt = unlockNeedCnt itemCount = ItemControler.GetItemCountByID(curPlayer, needItemID) if itemCount < needItemCnt: GameWorld.DebugLog("¼¤»îºìÑÕÎïÆ·²»×ã! beautyID=%s,needItemID=%s,itemCount=%s < %s" % (beautyID, needItemID, itemCount, needItemCnt), playerID) return ItemControler.DelItemCountByID(curPlayer, needItemID, needItemCnt) elif unlockWay == UnlockWay_TaskID: taskID = unlockValue if not PlayerTask.IsTaskFinish(curPlayer, taskID): GameWorld.DebugLog("¼¤»îºìÑÕËùÐèÈÎÎñδÍê³É! beautyID=%s,taskID=%s" % (beautyID, taskID), playerID) return elif unlockWay == UnlockWay_ArenaWinCnt: needWinCnt = unlockNeedCnt winCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaWinCnt) if winCnt < needWinCnt: GameWorld.DebugLog("¼¤»îºìÑÕËùÐèÑÝÎ䳡ʤÀû´ÎÊý²»×ã! beautyID=%s,winCnt=%s < %s" % (beautyID, winCnt, needWinCnt), playerID) return elif unlockWay == UnlockWay_GoldRushWorker: needWorkerCnt = unlockNeedCnt workerTotal = PlayerGoldRush.GetWorkerTotal(curPlayer) if workerTotal < needWorkerCnt: GameWorld.DebugLog("¼¤»îºìÑÕËùÐè¼à¹¤²»×ã! beautyID=%s,workerTotal=%s < %s" % (beautyID, workerTotal, needWorkerCnt), playerID) return elif unlockWay == UnlockWay_FBZhanchui: mapID = ChConfig.Def_FBMapID_Zhanchui funcLineID = unlockValue isPass = FBCommon.IsFBPass(curPlayer, mapID, funcLineID) if not isPass: GameWorld.DebugLog("¼¤»îºìÑÕËùÐ踱±¾Î´¹ý¹Ø! beautyID=%s,mapID=%s,funcLineID=%s" % (beautyID, mapID, funcLineID), playerID) return elif unlockWay == UnlockWay_OfficialRank: realmLV = curPlayer.GetOfficialRank() needRealmLV = unlockValue if realmLV < needRealmLV: GameWorld.DebugLog("¼¤»îºìÑÕËùÐè¹ÙÖ°²»×ã! beautyID=%s,realmLV=%s < %s" % (beautyID, realmLV, needRealmLV), playerID) return elif unlockWay == UnlockWay_TravelCnt: travelCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelCnt) needTravelCnt = unlockNeedCnt if travelCnt < needTravelCnt: GameWorld.DebugLog("¼¤»îºìÑÕËùÐèÓÎÀú´ÎÊý²»×ã! beautyID=%s,travelCnt=%s < %s" % (beautyID, travelCnt, needTravelCnt), playerID) return else: GameWorld.DebugLog("¸ÃºìÑÕ²»Ö§³Ö¼¤»î! beautyID=%s,unlockWay=%s" % (beautyID, unlockWay), playerID) return DoBeautyActivate(curPlayer, beautyID) return def DoBeautyActivate(curPlayer, beautyID): ## Ö´Ð줻îºìÑÕÂß¼­ if GetBeautyState(curPlayer, beautyID): return lv, exp = 0, 0 SetBeautyState(curPlayer, beautyID, 1) SetBeautyLVInfo(curPlayer, beautyID, lv, exp) GameWorld.DebugLog("ºìÑÕ¼¤»î³É¹¦£¡ beautyID=%s" % beautyID, curPlayer.GetPlayerID()) RefreshBeautyAttr(curPlayer) SyncBeautyInfo(curPlayer, [beautyID]) return #// B2 20 ºìÑպøжÈÉý¼¶ #tagCSBeautyLVUP # #struct tagCSBeautyLVUP #{ # tagHead Head; # WORD BeautyID; //ºìÑÕID # DWORD ItemID; //ʹÓÃÎïÆ·ID # BYTE IsQuick; // ÊÇ·ñ¿ìËÙÉý¼¶£¬0-Ö»ÏûºÄ1¸öµÀ¾ß£»1-ÏûºÄÉý1¼¶µÄµÀ¾ß #}; def OnBeautyLVUP(index, curPackData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerID = curPlayer.GetPlayerID() beautyID = curPackData.BeautyID itemID = curPackData.ItemID isQuick = curPackData.IsQuick if not GetBeautyState(curPlayer, beautyID): GameWorld.DebugLog("ºìÑÕδ¼¤»î£¡ beautyID=%s" % beautyID, playerID) return ipyData = IpyGameDataPY.GetIpyGameData("Beauty", beautyID) if not ipyData: return quality = ipyData.GetBeautyQuality() curLV, curExp = GetBeautyLVInfo(curPlayer, beautyID) commItemIDList = IpyGameDataPY.GetFuncEvalCfg("BeautyLVUP", 1) commExpList = IpyGameDataPY.GetFuncEvalCfg("BeautyLVUP", 2) if itemID in commItemIDList: index = commItemIDList.index(itemID) perExp = commExpList[index] if len(commExpList) > index else 0 else: exclusiveItemID = ipyData.GetExclusiveItemID() if itemID != exclusiveItemID: GameWorld.DebugLog("·Ç¸ÃºìÑÕרÊôÐÅÎïID£¡ beautyID=%s,itemID=%s != %s" % (beautyID, itemID, exclusiveItemID), playerID) return perExp = IpyGameDataPY.GetFuncCfg("BeautyLVUP", 3) if perExp <= 0: return nextLV = curLV + 1 nextLVIpyData = IpyGameDataPY.GetIpyGameData("BeautyQualityLV", quality, nextLV) if not nextLVIpyData: GameWorld.DebugLog("ºìÑÕÒÑÂú¼¶£¡ beautyID=%s,quality=%s,curLV=%s" % (beautyID, quality, curLV), playerID) return lvNeedExp = nextLVIpyData.GetLVNeedExp() costItemCount = 0 needExp = lvNeedExp - curExp # Éý¼¶»¹Ðè¾­Ñé if needExp > 0: if isQuick: costItemCount = needExp / perExp if needExp % perExp > 0: costItemCount += 1 else: costItemCount = 1 if costItemCount < 1: return costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, itemID, costItemCount) lackCnt = costItemCount - bindCnt - unBindCnt if lackCnt > 0: costItemCount -= lackCnt GameWorld.DebugLog("ÏûºÄµÀ¾ß²»×㣬ÓжàÉÙÏûºÄ¶àÉÙ! itemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" % (itemID, costItemCount, bindCnt, unBindCnt, lackCnt)) # ¿Û³ýÏûºÄ if costItemCount > 0: ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, "Beauty") addExp = costItemCount * perExp updExp = curExp + addExp GameWorld.DebugLog("ºìÑÕ¼Ó¾­Ñé: beautyID=%s,quality=%s,curLV=%s,curExp=%s,addExp=%s,updExp=%s/%s,itemID=%s,costItemCount=%s,perExp=%s" % (beautyID, quality, curLV, curExp, addExp, updExp, lvNeedExp, itemID, costItemCount, perExp)) updLV = curLV if updExp >= lvNeedExp: updExp -= lvNeedExp updLV += 1 GameWorld.DebugLog(" Éý¼¶: updLV=%s,updExp=%s" % (updLV, updExp)) SetBeautyLVInfo(curPlayer, beautyID, updLV, updExp) SyncBeautyInfo(curPlayer, [beautyID]) # ÓÐÉý¼¶¶îÍâ´¦Àí if updLV > updLV: RefreshBeautyAttr(curPlayer) return def GetBeautyLVAward(curPlayer, beautyID): ## ÁìÈ¡ºìÑյȼ¶½±Àø if not GetBeautyState(curPlayer, beautyID): GameWorld.DebugLog("ºìÑÕδ¼¤»î£¡ beautyID=%s" % beautyID) return ipyData = IpyGameDataPY.GetIpyGameData("Beauty", beautyID) if not ipyData: return quality = ipyData.GetBeautyQuality() curLV = GetBeautyLVInfo(curPlayer, beautyID)[0] awardLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautyAwardLV % beautyID) if awardLV >= curLV: GameWorld.DebugLog("µ±Ç°Ã»ÓкìÑյȼ¶½±Àø¿ÉÁìÈ¡£¡ beautyID=%s,quality=%s,awardLV=%s >= curLV=%s" % (beautyID, quality, awardLV, curLV)) return GameWorld.DebugLog("ÁìÈ¡ºìÑյȼ¶½±Àø: beautyID=%s,quality=%s,curLV=%s,awardLV=%s" % (beautyID, quality, curLV, awardLV)) updAwardLV = awardLV itemDict = {} for getLV in range(awardLV + 1, curLV + 1): lvIpyData = IpyGameDataPY.GetIpyGameData("BeautyQualityLV", quality, getLV) if not lvIpyData: break itemList = lvIpyData.GetAwardItemList() for itemInfo in itemList: itemID = itemInfo[0] itemCount = itemInfo[1] itemDict[itemID] = itemDict.get(itemID, 0) + itemCount updAwardLV = getLV if not itemDict: return awardItemList = [[itemID, itemCount] for itemID, itemCount in itemDict.items()] GameWorld.DebugLog(" updAwardLV=%s,awardItemList=%s" % (updAwardLV, awardItemList)) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BeautyAwardLV % beautyID, updAwardLV) SyncBeautyInfo(curPlayer, [beautyID]) ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["BeautyLVAward", False, {}]) return #// B2 21 ºìÑÕʱװ²Ù×÷ #tagCSBeautySkinOP # #struct tagCSBeautySkinOP #{ # tagHead Head; # WORD BeautyID; //ºìÑÕID # WORD SkinID; //ʱװID # BYTE OPType; //²Ù×÷ 1-¼¤»î£»2-Åå´÷£»3-ÉýÐÇ #}; def OnBeautySkinOP(index, curPackData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerID = curPlayer.GetPlayerID() beautyID = curPackData.BeautyID skinID = curPackData.SkinID opType = curPackData.OPType if not GetBeautyState(curPlayer, beautyID): GameWorld.DebugLog("ºìÑÕδ¼¤»î£¡ beautyID=%s" % beautyID, playerID) return if opType == 1: OnBeautySkinActivate(curPlayer, beautyID, skinID) elif opType == 2: OnUseBeautySkin(curPlayer, beautyID, skinID) elif opType == 3: OnBeautySkinStarUP(curPlayer, beautyID, skinID) return def GetBeautySkinIpyData(curPlayer, beautyID, skinID): ipyDataList = IpyGameDataPY.GetIpyGameDataList("BeautySkin", beautyID) if not ipyDataList: return for ipyData in ipyDataList: if ipyData.GetSkinID() == skinID: return ipyData return def OnBeautySkinActivate(curPlayer, beautyID, skinID): ## ºìÑÕʱװ¼¤»î if GetBeautySkinState(curPlayer, skinID): GameWorld.DebugLog("ºìÑÕÆ¤·ôÒѼ¤»î! beautyID=%s,skinID=%s" % (beautyID, skinID)) return ipyData = GetBeautySkinIpyData(curPlayer, beautyID, skinID) if not ipyData: return unlockWay = ipyData.GetUnlockWay() unlockValue = ipyData.GetUnlockValue() unlockNeedCnt = ipyData.GetUnlockNeedCnt() if unlockWay == UnlockWaySkin_Item: needItemID = unlockValue needItemCnt = unlockNeedCnt itemCount = ItemControler.GetItemCountByID(curPlayer, needItemID) if itemCount < needItemCnt: GameWorld.DebugLog("¼¤»îºìÑÕʱװÎïÆ·²»×ã! beautyID=%s,needItemID=%s,itemCount=%s < %s" % (beautyID, needItemID, itemCount, needItemCnt)) return ItemControler.DelItemCountByID(curPlayer, needItemID, needItemCnt) else: GameWorld.DebugLog("ºìÑÕÆ¤·ô²»ÐèÒª¼¤»î! beautyID=%s,skinID=%s" % (beautyID, skinID)) return SetBeautySkinState(curPlayer, skinID, 1) GameWorld.DebugLog("ºìÑÕÆ¤·ô¼¤»î: beautyID=%s,skinID=%s" % (beautyID, skinID)) RefreshBeautyAttr(curPlayer) SyncBeautyInfo(curPlayer, [beautyID], [skinID]) return def OnUseBeautySkin(curPlayer, beautyID, skinID): playerID = curPlayer.GetPlayerID() if not IsBeautySkinCanUse(curPlayer, beautyID, skinID): GameWorld.DebugLog("¸ÃºìÑÕʱװ²»¿ÉÓÃ! beautyID=%s,skinID=%s" % (beautyID, skinID), playerID) return GameWorld.DebugLog("´©´÷ ºìÑÕʱװ! beautyID=%s,skinID=%s" % (beautyID, skinID), playerID) ipyDataList = IpyGameDataPY.GetIpyGameDataList("BeautySkin", beautyID) if not ipyDataList: return skinIDList = [] for ipyData in ipyDataList: ipySkinID = ipyData.GetSkinID() if ipySkinID == skinID: SetBeautySkinUsed(curPlayer, skinID, 1) elif GetBeautySkinUsed(curPlayer, ipySkinID): SetBeautySkinUsed(curPlayer, ipySkinID, 0) else: continue skinIDList.append(ipySkinID) SyncBeautyInfo(curPlayer, [beautyID], skinIDList) return def OnBeautySkinStarUP(curPlayer, beautyID, skinID): playerID = curPlayer.GetPlayerID() if not IsBeautySkinCanUse(curPlayer, beautyID, skinID): GameWorld.DebugLog("¸ÃºìÑÕʱװ²»¿ÉÓÃ! beautyID=%s,skinID=%s" % (beautyID, skinID), playerID) return ipyData = GetBeautySkinIpyData(curPlayer, beautyID, skinID) if not ipyData: return starMax = ipyData.GetStarMax() curStar = GetBeautySkinStar(curPlayer, skinID) if curStar >= starMax: GameWorld.DebugLog("ºìÑÕʱװÐǼ¶ÒÑÂú! skinID=%s,curStar=%s >= %s" % (skinID, curStar, starMax), playerID) return if ipyData.GetUnlockWay() != UnlockWaySkin_Item: return needItemID = ipyData.GetUnlockValue() needItemCnt = ipyData.GetUpNeedCnt() if not needItemID or not needItemCnt: return itemCount = ItemControler.GetItemCountByID(curPlayer, needItemID) if itemCount < needItemCnt: GameWorld.DebugLog("ºìÑÕʱװÉýÐÇÎïÆ·²»×ã! skinID=%s,needItemID=%s,itemCount=%s < %s" % (skinID, needItemID, itemCount, needItemCnt)) return ItemControler.DelItemCountByID(curPlayer, needItemID, needItemCnt) nextStar = curStar + 1 GameWorld.DebugLog("ºìÑÕʱװÉýÐÇ! skinID=%s,nextStar=%s" % (skinID, nextStar), playerID) SetBeautySkinStar(curPlayer, skinID, nextStar) RefreshBeautyAttr(curPlayer) SyncBeautyInfo(curPlayer, [beautyID], [skinID]) return def RefreshBeautyAttr(curPlayer): CalcBeautyAttr(curPlayer) PlayerOnline.GetOnlinePlayer(curPlayer).RefreshRoleAttr() return def CalcBeautyAttr(curPlayer): playerID = curPlayer.GetPlayerID() attrDict = {} effTypeDict = {} # ÌØÊâЧ¹û»º´æ talentLVUPPer = IpyGameDataPY.GetFuncCfg("BeautyLVUP", 4) # ÿx¼¶ºÃ¸Ð¶ÈÌáÉýÒ»¼¶Ì츳Ч¹û ipyDataMgr = IpyGameDataPY.IPY_Data() for index in range(ipyDataMgr.GetBeautyCount()): ipyData = ipyDataMgr.GetBeautyByIndex(index) beautyID = ipyData.GetBeautyID() if not GetBeautyState(curPlayer, beautyID): continue quality = ipyData.GetBeautyQuality() beautyLV = GetBeautyLVInfo(curPlayer, beautyID)[0] # µÈ¼¶ÊôÐÔ for lv in range(beautyLV + 1): lvIpyData = IpyGameDataPY.GetIpyGameData("BeautyQualityLV", quality, lv) if not lvIpyData: continue lvAttrIDList = lvIpyData.GetAttrIDList() lvAttrValueList = lvIpyData.GetAttrValueList() for lvIndex, attrID in enumerate(lvAttrIDList): attrValue = lvAttrValueList[lvIndex] if len(lvAttrValueList) > lvIndex else 0 attrDict[attrID] = attrDict.get(attrID, 0) + attrValue #GameWorld.DebugLog("ºìÑյȼ¶ÊôÐÔ: beautyID=%s,quality=%s,beautyLV=%s,%s" % (beautyID, quality, beautyLV, attrDict), playerID) # Ì츳ÊôÐÔ talentAttrIDList = ipyData.GetTalentAttrIDList() talentAttrValueList = ipyData.GetTalentAttrValueList() talentPerLVAddList = ipyData.GetTalentPerLVAddList() talentLV = beautyLV / talentLVUPPer for tIndex, attrID in enumerate(talentAttrIDList): initValue = talentAttrValueList[tIndex] if len(talentAttrValueList) > tIndex else 0 perLVAdd = talentPerLVAddList[tIndex] if len(talentPerLVAddList) > tIndex else 0 attrValue = initValue + perLVAdd * talentLV attrDict[attrID] = attrDict.get(attrID, 0) + attrValue #GameWorld.DebugLog("ºìÑÕÌ츳ÊôÐÔ: beautyID=%s,talentLV=%s,%s" % (beautyID, talentLV, attrDict), playerID) # ÌØÊâЧ¹û effType = ipyData.GetEffType() effTypeValue = ipyData.GetEffTypeValue() effValue = ipyData.GetEffValue() effPerLVAdd = ipyData.GetEffPerLVAdd() if effType: effValue = effValue + effPerLVAdd * talentLV effTypeDict[effType] = [effValue, effTypeValue] #GameWorld.DebugLog("ºìÑÕÌØÊâЧ¹û: beautyID=%s,effType=%s,talentLV=%s,%s" % (beautyID, effType, talentLV, effTypeDict), playerID) # ʱװ ipyDataList = IpyGameDataPY.GetIpyGameDataList("BeautySkin", beautyID) if not ipyDataList: continue for skinIpyData in ipyDataList: skinID = skinIpyData.GetSkinID() if not IsBeautySkinCanUse(curPlayer, beautyID, skinID, skinIpyData): continue attrIDList = skinIpyData.GetAttrIDList() initAttrValueList = skinIpyData.GetInitAttrValueList() perStarAddList = skinIpyData.GetAttrPerStarAddList() star = GetBeautySkinStar(curPlayer, skinID) for sIndex, attrID in enumerate(attrIDList): initValue = initAttrValueList[sIndex] if len(initAttrValueList) > sIndex else 0 perStarAdd = perStarAddList[sIndex] if len(perStarAddList) > sIndex else 0 attrValue = initValue + perStarAdd * star attrDict[attrID] = attrDict.get(attrID, 0) + attrValue #GameWorld.DebugLog("ºìÑÕʱװÊôÐÔ: beautyID=%s,skinID=%s,star=%s,%s" % (beautyID, skinID, star, attrDict), playerID) # ±£´æ¼ÆËãÖµ GameWorld.DebugLog("ºìÑÕÊôÐÔ: %s" % attrDict, playerID) GameWorld.DebugLog("ºìÑÕЧ¹û: %s" % effTypeDict, playerID) PyGameData.g_beautyEffTypeDict[playerID] = effTypeDict PlayerOnline.GetOnlinePlayer(curPlayer).SetCalcAttr(ChConfig.Def_CalcAttr_Beauty, attrDict) return def GetBeautyEffInfo(curPlayer, effType): ## »ñÈ¡ºìÑÕÌØÊâЧ¹ûÐÅÏ¢ # @return: effValue, effTypeValue effTypeDict = PyGameData.g_beautyEffTypeDict.get(curPlayer.GetPlayerID(), {}) return effTypeDict.get(effType, [0, 0]) def SyncBeautyInfo(curPlayer, beautyIDList=None, skinIDList=None): if beautyIDList == None: syncBeautyIDList = [] ipyDataMgr = IpyGameDataPY.IPY_Data() for index in range(ipyDataMgr.GetBeautyCount()): ipyData = ipyDataMgr.GetBeautyByIndex(index) syncBeautyIDList.append(ipyData.GetBeautyID()) else: syncBeautyIDList = beautyIDList beautyList = [] for beautyID in syncBeautyIDList: state = GetBeautyState(curPlayer, beautyID) if not state and beautyIDList == None: continue lv, exp = GetBeautyLVInfo(curPlayer, beautyID) beauty = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCBeauty) beauty.BeautyID = beautyID beauty.State = state beauty.LV = lv beauty.Exp = exp beauty.AwardLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautyAwardLV % beautyID) beauty.SkinList = [] ipyDataList = IpyGameDataPY.GetIpyGameDataList("BeautySkin", beautyID) if ipyDataList: for ipyData in ipyDataList: skinID = ipyData.GetSkinID() skinInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID) if skinIDList != None: if skinID not in skinIDList: continue else: if not skinInfo: continue beautySkin = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCBeautySkin) beautySkin.SkinID = skinID beautySkin.State = 1 if IsBeautySkinCanUse(curPlayer, beautyID, skinID, ipyData) else 0 beautySkin.Used = GetBeautySkinUsed(curPlayer, skinID) beautySkin.Star = GetBeautySkinStar(curPlayer, skinID) beauty.SkinList.append(beautySkin) beauty.SkinCnt = len(beauty.SkinList) beautyList.append(beauty) if not beautyList: return clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCBeautyInfo) clientPack.BeautyList = beautyList clientPack.Count = len(clientPack.BeautyList) NetPackCommon.SendFakePack(curPlayer, clientPack) return