| | |
| | | import IpyGameDataPY
|
| | | import NetPackCommon
|
| | | import PyGameDataStruct
|
| | | import PlayerFBHelpBattle
|
| | | import ChPyNetSendPack
|
| | | import PlayerControl
|
| | | import PlayerFamily
|
| | |
| | | playerThanksList = thanksMgr.playerThanksDict[playerID]
|
| | | playerThanksList.append(dbData)
|
| | |
|
| | | # 已经感谢的
|
| | | else:
|
| | | for assistPlayerID, assistPlayerInfo in dbData.AssistPlayerDict.items():
|
| | | if "IsGet" in assistPlayerInfo:
|
| | | # 已经接受感谢奖励的不再处理
|
| | |
| | | curPlayer = playerMgr.FindPlayerByID(playerID)
|
| | | if not curPlayer:
|
| | | continue
|
| | | __AddAssistThanks(curPlayer, assistAwardItemID, mapID, lineID, assistPlayerDict, npcID)
|
| | | AddNewAssistThanks(curPlayer, assistAwardItemID, mapID, lineID, assistPlayerDict, npcID)
|
| | |
|
| | | return
|
| | |
|
| | | def __AddAssistThanks(curPlayer, itemID, mapID, lineID, assistPlayerDict, npcID=0, exData=""):
|
| | | def AddNewAssistThanks(curPlayer, itemID, mapID, lineID, assistPlayerDict, npcID=0, exData=""):
|
| | | ## 添加协助感谢数据
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
| | | assistThanksMgr = PyDataManager.GetPlayerAssistThanksPyManager()
|
| | | OnInitAssistThanksData(assistThanksMgr, newThanks)
|
| | |
|
| | | GameWorld.DebugLog("增加协助感谢: mapID=%s,lineID=%s,npcID=%s,exData=%s" % (mapID, lineID, npcID, exData), playerID)
|
| | | GameWorld.DebugLog("增加协助感谢: itemID=%s,mapID=%s,lineID=%s,npcID=%s,exData=%s" % (itemID, mapID, lineID, npcID, exData), playerID)
|
| | | return
|
| | |
|
| | | #// B0 14 使用协助感谢礼盒 #tagCGUseAssistThanksGift
|
| | |
| | | queryData = [itemID]
|
| | | QueryPlayerResult_PlayerAssist(curPlayer, "UseAssistThanksGift", queryData)
|
| | |
|
| | | # 加入协助玩家接收感谢列表
|
| | | # 通知协助玩家可接收的感谢个数
|
| | | playerMgr = GameWorld.GetPlayerManager()
|
| | | for assistPlayerID in useThanks.AssistPlayerDict.keys():
|
| | | if assistPlayerID not in assistThanksMgr.assistPlayerThanksDict:
|
| | | assistThanksMgr.assistPlayerThanksDict[assistPlayerID] = []
|
| | | assistPlayerThanksList = assistThanksMgr.assistPlayerThanksDict[assistPlayerID]
|
| | | assistPlayerThanksList.append(useThanks)
|
| | | assistPlayer = playerMgr.FindPlayerByID(assistPlayerID)
|
| | | if assistPlayer:
|
| | | SyncCanGetAssistThanksGiftCount(assistPlayer, len(assistPlayerThanksList))
|
| | | SyncCanGetAssistThanksGiftCount(assistPlayer)
|
| | | return
|
| | |
|
| | | #// B0 15 接收协助感谢礼物 #tagCGGetAssistThanksGift
|
| | |
| | | GameWorld.ErrLog("玩家没有可接收感谢的协助感谢礼盒!", playerID)
|
| | | return
|
| | | assistPlayerThanksList = assistThanksMgr.assistPlayerThanksDict[playerID]
|
| | | if not assistPlayerThanksList:
|
| | | getThanks = None
|
| | | for thanks in assistPlayerThanksList:
|
| | | if thanks.ThanksState:
|
| | | getThanks = thanks
|
| | | break
|
| | | if not getThanks:
|
| | | GameWorld.ErrLog("找不到玩家可接收感谢的协助感谢礼盒!", playerID)
|
| | | return
|
| | | getThanks = assistPlayerThanksList[0] # 默认接收第一个
|
| | | itemID = getThanks.ItemID
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AssistThanksGift", itemID)
|
| | | if not ipyData:
|
| | |
| | | if getThanks in assistThanksMgr.allAssistThanksList:
|
| | | assistThanksMgr.allAssistThanksList.remove(getThanks)
|
| | |
|
| | | assistPlayerThanksList.pop(0) # 移除
|
| | | assistPlayerThanksList.remove(getThanks) # 移除
|
| | |
|
| | | updateTodayGiftCount = todayGiftCount + 1
|
| | | # 更新当天该礼盒ID已领取次数
|
| | |
| | | assistPlayerInfoDict = thanks.AssistPlayerDict[playerID]
|
| | | assistPlayerInfoDict["TodayGiftCount"] = updateTodayGiftCount
|
| | |
|
| | | SyncCanGetAssistThanksGiftCount(curPlayer, len(assistPlayerThanksList))
|
| | | SyncCanGetAssistThanksGiftCount(curPlayer, True)
|
| | | |
| | | isCurDailyDate = getThanks.DailyDateStr == GameWorld.GetDailyDateStr()
|
| | | |
| | | # 如果是镜像协助的,更新今日接收感谢礼盒次数
|
| | | if isCurDailyDate:
|
| | | if IpyGameDataPY.GetIpyGameDataNotLog("FBHelpBattle", getThanks.MapID, getThanks.LineID):
|
| | | PlayerFBHelpBattle.UpdateGetThanksGiftCountDict(curPlayer, itemID, updateTodayGiftCount)
|
| | |
|
| | | # 通知地图
|
| | | isCurDailyDate = getThanks.DailyDateStr == GameWorld.GetDailyDateStr()
|
| | | queryData = [itemID, isExtraAward, isCurDailyDate, updateTodayGiftCount]
|
| | | QueryPlayerResult_PlayerAssist(curPlayer, "GetAssistThanksGift", queryData)
|
| | | return
|
| | |
|
| | | def SyncCanGetAssistThanksGiftCount(curPlayer, canGetCount=None):
|
| | | def SyncCanGetAssistThanksGiftCount(curPlayer, isForce=False):
|
| | | ## 通知可接收协助感谢礼物个数
|
| | | if canGetCount == None:
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | assistThanksMgr = PyDataManager.GetPlayerAssistThanksPyManager()
|
| | | if playerID not in assistThanksMgr.assistPlayerThanksDict:
|
| | | return
|
| | | assistPlayerThanksList = assistThanksMgr.assistPlayerThanksDict[playerID]
|
| | | if not assistPlayerThanksList:
|
| | | canGetCount = 0
|
| | | for thanks in assistPlayerThanksList:
|
| | | if thanks.ThanksState:
|
| | | canGetCount += 1
|
| | | |
| | | if not canGetCount and not isForce:
|
| | | return
|
| | | canGetCount = len(assistPlayerThanksList)
|
| | | |
| | | countPack = ChPyNetSendPack.tagGCCanGetAssistThanksGiftCount()
|
| | | countPack.CanGetCount = canGetCount
|
| | | NetPackCommon.SendFakePack(curPlayer, countPack)
|