#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package Player.PlayerLove # # @todo:ÇéԵϵͳ # @author hxp # @date 2021-11-09 # @version 1.0 # # ÏêϸÃèÊö: ÇéԵϵͳ # #------------------------------------------------------------------------------- #"""Version = 2021-11-09 20:00""" #------------------------------------------------------------------------------- import GameWorld import ItemCommon import PlayerControl import IpyGameDataPY import ChPyNetSendPack import FunctionNPCCommon import IPY_GameWorld import ItemControler import NetPackCommon import ChConfig import SkillCommon import BuffSkill import PyGameData def DoPlayerOnDay(curPlayer): if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday): PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, 0) Sync_LoveInfo(curPlayer) return def DoPlayerLogin(curPlayer): Sync_LoveInfo(curPlayer) Sync_LoveRingInfo(curPlayer) return #// B3 10 ËÍÀñÎï #tagCMSendGifts # #struct tagCMSendGifts #{ # tagHead Head; # DWORD TagPlayerID; // Ä¿±êÍæ¼ÒID # WORD GiftNum; // ÔùËÍÀñÎï±àºÅ # DWORD GiftCount; // ÔùËÍÀñÎïÊýÁ¿ # BYTE IsAutoBuy; // ÊÇ·ñ×Ô¶¯¹ºÂò #}; def OnSendGifts(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) tagPlayerID = clientData.TagPlayerID giftNum = clientData.GiftNum giftCount = clientData.GiftCount isAutoBuy = clientData.IsAutoBuy if giftNum <= 0 or giftCount <= 0: return ipyData = IpyGameDataPY.GetIpyGameData("LoveGift", giftNum) if not ipyData: return giftItemID = ipyData.GetGiftItemID() if not ipyData.GetAllowBatch(): giftCount = 1 # ²»ÔÊÐíÅúÁ¿ÔùË͵ÄĬÈÏÔùËÍ1¸ö _, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, giftItemID, giftCount) lackCnt = giftCount - bindCnt - unBindCnt if lackCnt > 0: if not isAutoBuy: GameWorld.DebugLog("ÀñÎïµÀ¾ß²»×㣬ÎÞ·¨ÔùËÍ! giftItemID=%s,giftCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" % (giftItemID, giftCount, bindCnt, unBindCnt, lackCnt)) return moneyType = IpyGameDataPY.GetFuncCfg("LoveGift", 1) infoDict = {ChConfig.Def_Cost_Reason_SonKey:giftItemID} if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {giftItemID:lackCnt}, moneyType, ChConfig.Def_Cost_Love, infoDict, isCheck=True): return if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick): PlayerControl.NotifyCode(curPlayer, "RequestLater") return dataMsg = [tagPlayerID, giftNum, giftItemID, giftCount, isAutoBuy] SendToGameServer_Love(curPlayer, "SendGiftsReq", dataMsg) return #// B3 11 ÌáÇ× #tagCMMarryReq # #struct tagCMMarryReq #{ # tagHead Head; # DWORD TagPlayerID; // Ä¿±êÍæ¼ÒID # BYTE BridePriceID; // ƸÀñID #}; def OnMarryReq(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) tagPlayerID = clientData.TagPlayerID bridePriceID = clientData.BridePriceID ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID) if not ipyData: return costMoneyInfo = ipyData.GetCostMoneyInfo() if len(costMoneyInfo) != 2: return moneyType, moneyValue = costMoneyInfo if not PlayerControl.HaveMoney(curPlayer, moneyType, moneyValue): return if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick): PlayerControl.NotifyCode(curPlayer, "RequestLater") return dataMsg = [tagPlayerID, bridePriceID] SendToGameServer_Love(curPlayer, "MarryReq", dataMsg) return #// B3 13 ³ÔϲÌÇ #tagCMMarryEatCandy # #struct tagCMMarryEatCandy #{ # tagHead Head; # DWORD PlayerIDA; // ϲÌÇËùÊôÍæ¼ÒIDA # DWORD PlayerIDB; // ϲÌÇËùÊôÍæ¼ÒIDB #}; def OnMarryEatCandy(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerIDA = clientData.PlayerIDA playerIDB = clientData.PlayerIDB playerID = curPlayer.GetPlayerID() EatCandyMax = IpyGameDataPY.GetFuncCfg("LoveCandy", 4) if EatCandyMax: eatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday) if eatCandyToday >= EatCandyMax: GameWorld.DebugLog("ÒÑ´ï½ñÈÕ³ÔϲÌÇ´ÎÊýÉÏÏÞ. eatCandyToday=%s >= %s" % (eatCandyToday, EatCandyMax), playerID) return if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick): PlayerControl.NotifyCode(curPlayer, "RequestLater") return costMoneyType, costMoneyValue = IpyGameDataPY.GetFuncEvalCfg("LoveCandy", 2) playerMoneyValue = PlayerControl.GetMoney(curPlayer, costMoneyType) dataMsg = [playerIDA, playerIDB, playerID, costMoneyType, costMoneyValue, playerMoneyValue] SendToGameServer_Love(curPlayer, "MarryEatCandy", dataMsg) return #// B3 14 ¹ºÂò»éÀñÑÌ»¨ #tagCMMarryBuyFireworks # #struct tagCMMarryBuyFireworks #{ # tagHead Head; # DWORD PlayerIDA; // ϲÌÇËùÊôÍæ¼ÒIDA # DWORD PlayerIDB; // ϲÌÇËùÊôÍæ¼ÒIDB #}; def OnMarryBuyFireworks(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerIDA = clientData.PlayerIDA playerIDB = clientData.PlayerIDB playerID = curPlayer.GetPlayerID() costMoneyType, costMoneyValue = IpyGameDataPY.GetFuncEvalCfg("LoveCandyFire", 2) if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyValue): return playerMoneyValue = PlayerControl.GetMoney(curPlayer, costMoneyType) if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick): PlayerControl.NotifyCode(curPlayer, "RequestLater") return dataMsg = [playerIDA, playerIDB, playerID, costMoneyType, costMoneyValue, playerMoneyValue] SendToGameServer_Love(curPlayer, "MarryBuyFireworks", dataMsg) return #// B3 15 Àë»é #tagCMMarryBreak # #struct tagCMMarryBreak #{ # tagHead Head; # BYTE BreakType; // 0-ºÍƽÀë»é£»1-Ç¿ÖÆÀë»é #}; def OnMarryBreak(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) breakType = clientData.BreakType playerID = curPlayer.GetPlayerID() moneyType, moneyValue = 0, 0 if breakType == 1: costMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("LoveMarryBreak", 3) if len(costMoneyInfo) != 2: return moneyType, moneyValue = costMoneyInfo if not PlayerControl.HaveMoney(curPlayer, moneyType, moneyValue): return if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick): PlayerControl.NotifyCode(curPlayer, "RequestLater") return dataMsg = [playerID, breakType, moneyType, moneyValue] SendToGameServer_Love(curPlayer, "MarryBreakReq", dataMsg) return def SendToGameServer_Love(curPlayer, msgType, dataMsg): ## ·¢ËÍÐÅÏ¢µ½¿ç·þ·þÎñÆ÷ msgList = str([msgType, dataMsg]) GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetPlayerID(), 0, 0, "Love", msgList, len(msgList)) GameWorld.Log("ÇéÔµ·¢ËÍGameServer: %s, %s" % (msgType, dataMsg), curPlayer.GetPlayerID()) return def GameServer_Love_DoLogic(curPlayer, msgData): msgType, dataMsg = msgData[:2] ## ½á»é³É¹¦ if msgType == "MarrySuccess": __DoMarrySuccess(curPlayer, dataMsg) ## Àë»é³É¹¦ elif msgType == "ClearCoupleSocial": __ClearCoupleSocial(curPlayer, dataMsg) ## ͬ²½Ç×ÃÜ¶È elif msgType == "SyncMapServerIntimacy": SyncMapServerIntimacy(curPlayer, dataMsg) return def GameServer_Love_DoResult(curPlayer, msgData): msgType, dataMsg, ret = msgData ## ËÍÀñÎïÇëÇó·µ»Ø if msgType == "SendGiftsReq": if not ret: return __DoSendGiftsReq(curPlayer, dataMsg) ## ³ÔϲÌÇ·µ»Ø elif msgType == "MarryEatCandy": if not ret: return __DoMarryEatCandy(curPlayer, ret) ## ¹ºÂò»éÀñÑÌ»¨·µ»Ø elif msgType == "MarryBuyFireworks": if not ret: return __DoMarryBuyFireworks(curPlayer, ret) ## Àë»éÇëÇó·µ»Ø elif msgType == "MarryBreakReq": if not ret: return __DoMarryBreakReq(curPlayer, ret) return def __DoSendGiftsReq(curPlayer, dataMsg): ## ËÍÀñÎï·½´¦Àí playerID = curPlayer.GetPlayerID() tagPlayerID, giftNum, giftItemID, giftCount, isAutoBuy = dataMsg costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, giftItemID, giftCount) lackCnt = giftCount - bindCnt - unBindCnt delCnt = giftCount if lackCnt > 0: if not isAutoBuy: GameWorld.ErrLog("ÀñÎïµÀ¾ß²»×㣬ÎÞ·¨ÔùËÍ! giftItemID=%s,giftCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" % (giftItemID, giftCount, bindCnt, unBindCnt, lackCnt)) return moneyType = IpyGameDataPY.GetFuncCfg("LoveGift", 1) infoDict = {ChConfig.Def_Cost_Reason_SonKey:giftItemID} if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {giftItemID:lackCnt}, moneyType, ChConfig.Def_Cost_Love, infoDict): return delCnt -= lackCnt GameWorld.Log("ÔùËÍÀñÎï: tagPlayerID=%s,giftNum=%s,giftItemID=%s,giftCount=%s,isAutoBuy=%s" % (tagPlayerID, giftNum, giftItemID, giftCount, isAutoBuy), playerID) # ¿Û³ýÏûºÄ if delCnt > 0: ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "Love") SendToGameServer_Love(curPlayer, "SendGiftsOK", dataMsg) return def __DoMarryEatCandy(curPlayer, retInfo): ## Ö´ÐгÔϲÌǽá¹û canBuy, isFree, costMoneyType, costMoneyValue, candyItemInfo = retInfo if not isFree: if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyValue): return if not canBuy: return updEatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday) + 1 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, updEatCandyToday) Sync_LoveInfo(curPlayer) GameWorld.Log("³ÔϲÌǽá¹û: isFree=%s,updEatCandyToday=%s" % (isFree, updEatCandyToday), curPlayer.GetPlayerID()) if not isFree: infoDict = {ChConfig.Def_Cost_Reason_SonKey:"EatCandy"} PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, ChConfig.Def_Cost_Love, infoDict, isMinus=True) ItemControler.GivePlayerItemOrMail(curPlayer, candyItemInfo) return def __DoMarryBuyFireworks(curPlayer, retInfo): ## Ö´ÐйºÂò»éÀñÑÌ»¨½á¹û costMoneyType, costMoneyValue = retInfo GameWorld.Log("Ö´ÐйºÂò»éÀñÑÌ»¨½á¹û: costMoneyType=%s, costMoneyValue=%s" % (costMoneyType, costMoneyValue), curPlayer.GetPlayerID()) infoDict = {ChConfig.Def_Cost_Reason_SonKey:"MarryBuyFireworks"} PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, ChConfig.Def_Cost_Love, infoDict, isMinus=True) return def __DoMarryBreakReq(curPlayer, retInfo): ## Àë»éÇëÇó½á¹û·µ»Ø costMoneyType, costMoneyValue = retInfo GameWorld.Log("Ö´ÐÐÇ¿ÖÆÀë»éÇëÇó½á¹û: costMoneyType=%s, costMoneyValue=%s" % (costMoneyType, costMoneyValue), curPlayer.GetPlayerID()) infoDict = {ChConfig.Def_Cost_Reason_SonKey:"MarryBreak"} PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, ChConfig.Def_Cost_Love, infoDict, isMinus=True) return def __DoMarrySuccess(curPlayer, dataMsg): ## Ö´ÐгÉÇ׳ɹ¦ reqPlayerID, bridePriceID, mapServerCoupleInfo, coupleIntimacy = dataMsg playerID = curPlayer.GetPlayerID() PlayerControl.SetCoupleInfo(playerID, mapServerCoupleInfo) GameWorld.Log("Ö´ÐгÉÇ׳ɹ¦! reqPlayerID=%s,bridePriceID=%s,coupleIntimacy=%s" % (reqPlayerID, bridePriceID, coupleIntimacy), playerID) if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingClassLV) == 0: GameWorld.DebugLog("¼¤»îÇé½ä!") PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingClassLV, 1) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingStarLV, 1) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingEatCount, 0) Sync_LoveRingInfo(curPlayer) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, coupleIntimacy) RefreshCoupleTeamBuff(curPlayer) # ÌáÇ×µÄÍæ¼Ò¿Û³ýÏûºÄ if playerID == reqPlayerID: ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID) if ipyData: moneyType, moneyValue = ipyData.GetCostMoneyInfo() infoDict = {ChConfig.Def_Cost_Reason_SonKey:"MarrySuccess", "bridePriceID":bridePriceID} PlayerControl.PayMoney(curPlayer, moneyType, moneyValue, ChConfig.Def_Cost_Love, infoDict, isMinus=True) RefreshLoveAttr(curPlayer) return def __ClearCoupleSocial(curPlayer, dataMsg): ## Àë»é - Çå³ý°é¹Øϵ playerID = curPlayer.GetPlayerID() coupleID = PlayerControl.GetCoupleID(curPlayer) PlayerControl.SetCoupleInfo(playerID, None) GameWorld.Log("Çå³ý°é¹Øϵ³É¹¦! coupleID=%s" % (coupleID), playerID) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, 0) RefreshCoupleTeamBuff(curPlayer) RefreshLoveAttr(curPlayer) return #// B3 17 Çé½ä½âËø #tagCMLoveRingUnlock # #struct tagCMLoveRingUnlock #{ # tagHead Head; #}; def OnLoveRingUnlock(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerID = curPlayer.GetPlayerID() unlockItemID = IpyGameDataPY.GetFuncCfg("LoveRing", 1) unlockItem = ItemCommon.FindItemInPackByItemID(curPlayer, unlockItemID, IPY_GameWorld.rptItem) if not ItemCommon.CheckItemCanUse(unlockItem): GameWorld.DebugLog("ÎïÆ·½âËøÇé½äȱÉÙµÀ¾ß! unlockItemID=%s" % unlockItemID, playerID) return ItemCommon.DelItem(curPlayer, unlockItem, 1) classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingClassLV) if classLV < 1: GameWorld.DebugLog("ÎïÆ·½âËøÇé½ä!", playerID) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingClassLV, 1) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingStarLV, 1) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingEatCount, 0) Sync_LoveRingInfo(curPlayer) RefreshLoveAttr(curPlayer) NetPackCommon.SendFakePack(curPlayer, ChPyNetSendPack.tagMCLoveRingUnlockOK()) return #// B3 18 Çé½äÉý¼¶ #tagCMLoveRingUp # #struct tagCMLoveRingUp #{ # tagHead Head; # DWORD UseItemCnt; //ÏûºÄ²ÄÁϸöÊý #}; def OnLoveRingUp(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) costItemCount = clientData.UseItemCnt # ÏûºÄ²ÄÁϸöÊý #isAutoBuy = False # ±¾¹¦ÄÜÔݲ»Ìṩ×Ô¶¯¹ºÂò playerID = curPlayer.GetPlayerID() classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingClassLV) if not classLV: GameWorld.DebugLog("Çé½äδ½âËø!", playerID) return starLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingStarLV) curEatItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingEatCount) ringIpyData = IpyGameDataPY.GetIpyGameData("LoveRing", classLV, starLV) if not ringIpyData: return needEatCount = ringIpyData.GetNeedEatCount() if not needEatCount: GameWorld.DebugLog("Çé½äÒÑÂú¼¶£¡classLV=%s,starLV=%s" % (classLV, starLV), playerID) return costItemID = IpyGameDataPY.GetFuncCfg("LoveRing", 2) if not costItemID or costItemCount <= 0: return costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount) lackCnt = costItemCount - bindCnt - unBindCnt if lackCnt > 0: GameWorld.DebugLog("ÏûºÄµÀ¾ß²»×㣬ÎÞ·¨Éý¼¶Çé½ä! costItemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" % (costItemID, costItemCount, bindCnt, unBindCnt, lackCnt), playerID) return delCnt = costItemCount updClassLV, updStarLV = classLV, starLV updEatItemCount = curEatItemCount + costItemCount GameWorld.DebugLog("Çé½äÉý¼¶: classLV=%s,starLV=%s,curEatItemCount=%s,costItemCount=%s,updEatItemCount=%s,needEatCount=%s" % (classLV, starLV, curEatItemCount, costItemCount, updEatItemCount, needEatCount), playerID) ringUpType = "" if updEatItemCount >= needEatCount: ringUpType = "starUp" updStarLV += 1 nextRingIpyData = IpyGameDataPY.GetIpyGameDataNotLog("LoveRing", updClassLV, updStarLV) if not nextRingIpyData: updClassLV += 1 updStarLV = 1 nextRingIpyData = IpyGameDataPY.GetIpyGameData("LoveRing", updClassLV, updStarLV) if not nextRingIpyData: GameWorld.ErrLog("Çé½äÉý¼¶Êý¾ÝÒì³£: classLV=%s,starLV=%s,curEatItemCount=%s,costItemCount=%s,updEatItemCount=%s,needEatCount=%s" % (classLV, starLV, curEatItemCount, costItemCount, updEatItemCount, needEatCount), playerID) return ringUpType = "classUp" updEatItemCount -= needEatCount # ¿Û³ýÏûºÄ if delCnt: ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "Love") # ÉýÐÇ if ringUpType == "starUp": GameWorld.DebugLog(" ÉýÐÇ: updClassLV=%s,updStarLV=%s,updEatItemCount=%s" % (updClassLV, updStarLV, updEatItemCount), playerID) # Éý½× elif ringUpType == "classUp": GameWorld.DebugLog(" Éý½×: updClassLV=%s,updStarLV=%s,updEatItemCount=%s" % (updClassLV, updStarLV, updEatItemCount), playerID) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingClassLV, updClassLV) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingStarLV, updStarLV) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingEatCount, updEatItemCount) Sync_LoveRingInfo(curPlayer) RefreshLoveAttr(curPlayer) return def RefreshLoveAttr(curPlayer): CalcLoveAttr(curPlayer) PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState() return def CalcLoveAttr(curPlayer): classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingClassLV) starLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingStarLV) coupleID = PlayerControl.GetCoupleID(curPlayer) allAttrList = [{} for _ in range(4)] allAttrListCouple = [{} for _ in range(4)] ipyDataMgr = IpyGameDataPY.IPY_Data() for index in xrange(ipyDataMgr.GetLoveRingCount()): ringIpyData = ipyDataMgr.GetLoveRingByIndex(index) dataClassLV = ringIpyData.GetRingClassLV() dataStarLV = ringIpyData.GetRingStarLV() if dataClassLV > classLV or (dataClassLV == classLV and dataStarLV > starLV): break elif dataClassLV == classLV and dataStarLV == starLV: upItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingEatCount) else: upItemCount = ringIpyData.GetNeedEatCount() # ½×ÐÇÊôÐÔ starAttrTypeList = ringIpyData.GetStarAttrType() starAttrValueList = ringIpyData.GetStarAttrValue() for i, attrID in enumerate(starAttrTypeList): attrValue = starAttrValueList[i] PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList) # Éý¼¶¸öÊýÊôÐÔ upItemPerCount = ringIpyData.GetUpEatItemPerCount() if upItemCount and upItemPerCount: upItemAttrTypeList = ringIpyData.GetUpItemAttrType() upItemAttrValueList = ringIpyData.GetUpItemAttrValue() attrMultiple = upItemCount / upItemPerCount for i, attrID in enumerate(upItemAttrTypeList): attrValue = upItemAttrValueList[i] PlayerControl.CalcAttrDict_Type(attrID, attrValue * attrMultiple, allAttrList) # ÏÉÂÂÊôÐÔ if coupleID: coupleAttrTypeList = ringIpyData.GetCoupleAttrType() coupleAttrValueList = ringIpyData.GetCoupleAttrValue() for i, attrID in enumerate(coupleAttrTypeList): attrValue = coupleAttrValueList[i] PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListCouple) #GameWorld.DebugLog("Çé½ä»ù´¡ÊôÐÔ: classLV=%s,starLV=%s,allAttrList=%s" % (classLV, starLV, allAttrList)) #GameWorld.DebugLog("Çé½äÏÉÂÂÊôÐÔ: classLV=%s,starLV=%s,allAttrListCouple=%s" % (classLV, starLV, allAttrListCouple)) # ±£´æ¼ÆËãÖµ PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_LoveRing, allAttrList) PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_LoveRingCouple, allAttrListCouple) return def Sync_LoveRingInfo(curPlayer): ## ͬ²½Çé½äÐÅÏ¢ clientPack = ChPyNetSendPack.tagMCLoveRingInfo() clientPack.ClassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingClassLV) clientPack.StarLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingStarLV) clientPack.EatCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingEatCount) NetPackCommon.SendFakePack(curPlayer, clientPack) return def Sync_LoveInfo(curPlayer): ## ͬ²½ÇéÔµÏà¹ØÐÅÏ¢ clientPack = ChPyNetSendPack.tagMCLoveInfo() clientPack.EatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday) NetPackCommon.SendFakePack(curPlayer, clientPack) return def SyncMapServerIntimacy(curPlayer, dataMsg): tagID, intimacyValue = dataMsg coupleID = PlayerControl.GetCoupleID(curPlayer) if coupleID == tagID: PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, intimacyValue) RefreshCoupleTeamBuff(curPlayer) return def RefreshCoupleTeamBuff(curPlayer): ## ˢаéÂÂ×é¶Óbuff teamID = curPlayer.GetTeamID() playerID = curPlayer.GetPlayerID() cupleID = PlayerControl.GetCoupleID(curPlayer) teamPlayerInfoDict = PyGameData.g_teamPlayerInfoDict.get(teamID, {}) if teamID else {} teamPlayerIDList = teamPlayerInfoDict.keys() skillLV = 0 skillTypeID = IpyGameDataPY.GetFuncCfg("IntimacyBuff", 2) coupleIntimacy = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveCoupleIntimacy) if cupleID and cupleID in teamPlayerIDList: skillLVIntimacyList = IpyGameDataPY.GetFuncEvalCfg("IntimacyBuff", 1) for lv, lvIntimacy in enumerate(skillLVIntimacyList, 1): if coupleIntimacy >= lvIntimacy: skillLV = lv else: break GameWorld.DebugLog("ˢаéÂÂ×é¶ÓBuff: cupleID=%s,coupleIntimacy=%s,teamID=%s,teamPlayerIDList=%s,skillTypeID=%s,skillLV=%s" % (cupleID, coupleIntimacy, teamID, teamPlayerIDList, skillTypeID, skillLV), playerID) tick = GameWorld.GetGameWorld().GetTick() if skillLV > 0: findBuff = SkillCommon.FindBuffByID(curPlayer, skillTypeID)[0] if findBuff: if skillLV == findBuff.GetSkill().GetSkillLV(): return BuffSkill.DelBuffBySkillID(curPlayer, skillTypeID, tick) SkillCommon.AddBuffBySkillType(curPlayer, skillTypeID, tick, skillLV) else: if BuffSkill.DelBuffBySkillID(curPlayer, skillTypeID, tick): #ͳһˢÐÂ״̬ playerControl = PlayerControl.PlayerControl(curPlayer) playerControl.RefreshPlayerAttrByBuff() return