| | |
| | | import IpyGameDataPY
|
| | | import PlayerControl
|
| | | import NPCHurtManager
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import ItemCommon
|
| | | import ChConfig
|
| | | import ShareDefine
|
| | | import PyGameData
|
| | | import FBCommon
|
| | |
|
| | | def DoPlayerOnDay(curPlayer):
|
| | | ## 过天处理
|
| | |
| | | ipyData = ipyDataMgr.GetAssistThanksGiftByIndex(index)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GetThanksGiftCount % ipyData.GetGiftID(), 0)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoney, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoneySocial, 0)
|
| | | Sync_TodayAssistMoneyInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def OnPlayerLeaveMap(curPlayer):
|
| | | ## 玩家离开地图处理
|
| | | |
| | | NPCHurtManager.OnPlayerLeaveMap(curPlayer)
|
| | | |
| | | mapID = curPlayer.GetMapID()
|
| | | if GameWorld.GetMap().GetMapFBTypeByMapID(mapID) == IPY_GameWorld.fbtTeam:
|
| | | mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
|
| | | if str(mapID) in mapAssistGiftDict and PlayerControl.GetAssistTagPlayerID(curPlayer):
|
| | | lineID = PlayerControl.GetFBFuncLineID(curPlayer)
|
| | | OnCancelAssistTeamFB(curPlayer.GetPlayerID(), mapID, lineID, "LeaveMap")
|
| | | |
| | | return
|
| | |
|
| | | #// B0 10 请求协助Boss #tagCMRequestAssistBoss
|
| | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | objID = clientData.ObjID
|
| | | npcID = clientData.NPCID
|
| | | |
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | |
|
| | | if not curPlayer.GetFamilyID():
|
| | | GameWorld.DebugLog("没有仙盟不能请求协助!", playerID)
|
| | |
| | | GameWorld.DebugLog("请求协助CD中!npcID=%s" % npcID, playerID)
|
| | | return
|
| | |
|
| | | npcLV = curNPC.GetLV()
|
| | | mapID = curPlayer.GetMapID()
|
| | | lineID = GameWorld.GetGameWorld().GetLineID()
|
| | | queryData = [mapID, lineID, npcID, objID]
|
| | | lineID = NPCHurtManager.GetBossLineID(npcID)
|
| | | queryData = [mapID, lineID, npcID, objID, npcLV]
|
| | | QueryGameServer_PlayerAssist(playerID, "RequestAssistBoss", queryData)
|
| | | return
|
| | |
|
| | |
| | | mapID = clientData.MapID
|
| | | lineID = clientData.LineID
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | |
| | | if not curPlayer.GetFamilyID():
|
| | | GameWorld.DebugLog("没有仙盟不能请求协助!", playerID)
|
| | | return
|
| | |
| | | GameWorld.DebugLog("请求协助CD中!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
|
| | | return
|
| | |
|
| | | mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
|
| | | if str(mapID) not in mapAssistGiftDict:
|
| | | return
|
| | | |
| | | teamID = curPlayer.GetTeamID()
|
| | | if teamID:
|
| | | if curPlayer.GetTeamLV() != IPY_GameWorld.tmlLeader:
|
| | | GameWorld.DebugLog("非队长,无法发布副本协助!")
|
| | | return
|
| | | |
| | | fbIpyData = FBCommon.GetFBIpyData(mapID)
|
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
|
| | | if PlayerControl.CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick) != ShareDefine.EntFBAskRet_OK:
|
| | | return
|
| | | |
| | | queryData = [mapID, lineID]
|
| | | QueryGameServer_PlayerAssist(playerID, "RequestAssistTeamFB", queryData)
|
| | | return
|
| | |
| | | ## 开始协助组队副本,协助玩家进入副本调用
|
| | | queryData = [mapID, lineID, tagPlayerID]
|
| | | QueryGameServer_PlayerAssist(playerID, "OnStartAssistTeamFB", queryData)
|
| | | return
|
| | |
|
| | | def OnCancelAssistTeamFB(playerID, mapID, lineID, reason):
|
| | | ## 取消副本协助
|
| | | queryData = [mapID, lineID, reason]
|
| | | QueryGameServer_PlayerAssist(playerID, "OnCancelAssistTeamFB", queryData)
|
| | | return
|
| | |
|
| | | def QueryGameServer_PlayerAssist(playerID, queryType, queryData):
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def OnPlayerEnterAssistFB(curPlayer, mapID, lineID=0):
|
| | | ## 玩家进入协助副本
|
| | | |
| | | if GameWorld.GetMap().GetMapFBTypeByMapID(mapID) != IPY_GameWorld.fbtTeam:
|
| | | return
|
| | | |
| | | mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
|
| | | if str(mapID) not in mapAssistGiftDict:
|
| | | return
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | noAssistPlayerID = gameFB.GetGameFBDictByKey("FBNoAssistPlayerID")
|
| | | if noAssistPlayerID:
|
| | | if playerID != noAssistPlayerID:
|
| | | OnStartAssistTeamFB(playerID, mapID, lineID, noAssistPlayerID)
|
| | | return
|
| | | |
| | | if curPlayer.GetTeamID():
|
| | | if curPlayer.GetTeamLV() != IPY_GameWorld.tmlLeader:
|
| | | # 非队长先进入的,暂不处理,等待队长进入后统一处理
|
| | | return
|
| | | |
| | | noAssistPlayerID = playerID # 队长或无队伍进入则为非协助玩家
|
| | | gameFB.SetGameFBDict("FBNoAssistPlayerID", noAssistPlayerID)
|
| | | GameWorld.DebugLog("设置副本非协助玩家: noAssistPlayerID=%s" % noAssistPlayerID)
|
| | | |
| | | copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for index in xrange(copyPlayerManager.GetPlayerCount()):
|
| | | player = copyPlayerManager.GetPlayerByIndex(index)
|
| | | if not player:
|
| | | continue
|
| | | fbPlayerID = player.GetPlayerID()
|
| | | if fbPlayerID == noAssistPlayerID:
|
| | | continue
|
| | | if PlayerControl.GetAssistTagPlayerID(player) != noAssistPlayerID:
|
| | | OnStartAssistTeamFB(fbPlayerID, mapID, lineID, noAssistPlayerID)
|
| | | |
| | | return
|
| | |
|
| | | def OnFBAssistOver(isPass, mapID, lineID=0):
|
| | | ''' 副本协助结束
|
| | | @return: noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict
|
| | | 当 noAssistPlayerID 为0时代表没有成功结算协助,副本额外的协助奖励也不能结算,防止被刷协助奖励
|
| | | '''
|
| | | assistPlayerMoneyDict = {}
|
| | | assistMoneyType = ShareDefine.TYPE_Price_FamilyActivity
|
| | | defaultReturn = (0, assistMoneyType, assistPlayerMoneyDict)
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | noAssistPlayerID = gameFB.GetGameFBDictByKey("FBNoAssistPlayerID")
|
| | | GameWorld.DebugLog("副本协助结算: isPass=%s,mapID=%s,lineID=%s,noAssistPlayerID=%s" % (isPass, mapID, lineID, noAssistPlayerID))
|
| | | |
| | | if not isPass or not noAssistPlayerID:
|
| | | return defaultReturn
|
| | | |
| | | copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | noAssistPlayer = copyPlayerManager.FindPlayerByID(noAssistPlayerID)
|
| | | if not noAssistPlayer:
|
| | | GameWorld.DebugLog(" 非协助玩家不在,不结算协助奖励!")
|
| | | return defaultReturn
|
| | | |
| | | mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
|
| | | if str(mapID) not in mapAssistGiftDict:
|
| | | return defaultReturn
|
| | | liheItemID, assistMoney = mapAssistGiftDict[str(mapID)]
|
| | | |
| | | friendList, memFamilyIDDict = [], {}
|
| | | teamID = GameWorld.GetGameWorld().GetPropertyID()
|
| | | if teamID in PyGameData.g_teamFBMemRelationDict:
|
| | | friendList, memFamilyIDDict = PyGameData.g_teamFBMemRelationDict[teamID][:2]
|
| | | noAssistPlayerFamilyID = memFamilyIDDict.get(noAssistPlayerID, 0)
|
| | | |
| | | assistAwardItemID = liheItemID
|
| | | assistPlayerDict = {}
|
| | | for index in xrange(copyPlayerManager.GetPlayerCount()):
|
| | | curPlayer = copyPlayerManager.GetPlayerByIndex(index)
|
| | | if not curPlayer:
|
| | | continue
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID == noAssistPlayerID:
|
| | | continue
|
| | | |
| | | assistPlayer = curPlayer
|
| | | assistPlayerID = playerID
|
| | | isFriend = [noAssistPlayerID, playerID] in friendList or [playerID, noAssistPlayerID] in friendList
|
| | | assistFamilyID = assistPlayer.GetFamilyID()
|
| | | |
| | | addAssistMoney = AddTodayAssistMoney(curPlayer, assistMoneyType, assistMoney, isFriend)
|
| | | assistPlayerMoneyDict[assistPlayerID] = addAssistMoney
|
| | | GameWorld.DebugLog("协助方给活跃令奖励: assistPlayerID=%s,assistMoney=%s,isFriend=%s,addAssistMoney=%s" |
| | | % (assistPlayerID, assistMoney, isFriend, addAssistMoney), mapID, lineID)
|
| | | |
| | | todayGiftCount = assistPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GetThanksGiftCount % liheItemID)
|
| | | assistPlayerDict[assistPlayerID] = {"PlayerName":assistPlayer.GetPlayerName(), "Job":assistPlayer.GetJob(), |
| | | "LV":assistPlayer.GetLV(), "RealmLV":assistPlayer.GetOfficialRank(),
|
| | | "TodayGiftCount":todayGiftCount}
|
| | | |
| | | # 暂定支持同队伍不同仙盟间协助
|
| | | if assistFamilyID and assistFamilyID == noAssistPlayerFamilyID:
|
| | | notifyParam = [assistPlayer.GetPlayerName(), noAssistPlayer.GetPlayerName(), mapID]
|
| | | PlayerControl.FamilyNotify(assistFamilyID, "AssistFBFinish", notifyParam)
|
| | | |
| | | if assistPlayerDict:
|
| | | GameWorld.DebugLog("发布方给感谢礼盒奖励: noAssistPlayerID=%s,assistAwardItemID=%s" % (noAssistPlayerID, assistAwardItemID), mapID, lineID)
|
| | | ItemControler.GivePlayerItemOrMail(noAssistPlayer, [[assistAwardItemID, 1, 0]])
|
| | | |
| | | queryData = [mapID, lineID, noAssistPlayerID, assistAwardItemID, assistPlayerDict]
|
| | | QueryGameServer_PlayerAssist(0, "OnFBAssistOver", queryData)
|
| | | return noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict
|
| | |
|
| | | def AddTodayAssistMoney(curPlayer, moneyType, addMoney, isSocialEx):
|
| | | ''' 增加今日协助货币奖励 |
| | | @param moneyType: 货币类型
|
| | | @param addMoney: 常规增加,有每日上限
|
| | | @param isSocialEx: 是否社交加成,不计入常规上限
|
| | | '''
|
| | | |
| | | todayAssistMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoney)
|
| | | socialMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoneySocial)
|
| | | todayAssistMoneyMax = IpyGameDataPY.GetFuncCfg("AssistAward", 4)
|
| | | if todayAssistMoney >= todayAssistMoneyMax:
|
| | | return 0
|
| | | |
| | | addValue = min(addMoney, todayAssistMoneyMax - todayAssistMoney)
|
| | | socialEx = 0
|
| | | if isSocialEx:
|
| | | friendAddAssistMoneyPer = IpyGameDataPY.GetFuncCfg("AssistAward", 3)
|
| | | socialEx = int(addValue * friendAddAssistMoneyPer / 100.0)
|
| | | |
| | | realAdd = addValue + socialEx
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, realAdd)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoney, todayAssistMoney + addValue)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoneySocial, socialMoney + socialEx)
|
| | | |
| | | Sync_TodayAssistMoneyInfo(curPlayer)
|
| | | return realAdd
|
| | |
|
| | | def Sync_TodayAssistMoneyInfo(curPlayer):
|
| | | ## 通知今日已获得协助货币信息
|
| | | infoPack = ChPyNetSendPack.tagMCTodayAssistMoneyInfo()
|
| | | infoPack.TodayAssistMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoney)
|
| | | infoPack.SocialMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoneySocial)
|
| | | NetPackCommon.SendFakePack(curPlayer, infoPack)
|
| | | return
|
| | |
|