| | |
| | | # % (todayXianyuanCoin, playerXianyuanCoinUpper), playerID)
|
| | | # return
|
| | |
|
| | | relationAdd, relationPlayerID, relationPlayerName = 0, 0, ""
|
| | | relation, relationAdd, relationPlayerID, relationPlayerName = 0, 0, 0, ""
|
| | |
|
| | | fbType = GameWorld.GetMap().GetMapFBType()
|
| | | if fbType == IPY_GameWorld.fbtSingle:
|
| | |
| | | relationAddList = relationCoinAddDict.get(str(relation), [])
|
| | | relationAdd += relationAddList[0] if len(relationAddList) == 2 else 0
|
| | | elif fbType == IPY_GameWorld.fbtTeam:
|
| | | relationAdd, relationPlayerID, relationPlayerName = __GetTeamFBMemRelationInfo(curPlayer, relationCoinAddDict, isHelp)
|
| | | |
| | | if playerID in PyGameData.g_teamFBMemRelationAddDict:
|
| | | relation, relationAdd, relationPlayerID, relationPlayerName = PyGameData.g_teamFBMemRelationAddDict.pop(playerID)
|
| | | |
| | | coinAdd = 0
|
| | | if baseFBPoint:
|
| | | coinAdd = int((baseFBPoint + relationAdd) * addCoinRate / 10000.0)
|
| | |
| | | msgPack = ChPyNetSendPack.tagMCAddXianyuanCoinMsg()
|
| | | msgPack.MapID = mapID
|
| | | msgPack.FuncLineID = lineID
|
| | | msgPack.Relation = relation
|
| | | msgPack.RelationCoinAdd = relationAdd
|
| | | msgPack.XianyuanCoinAdd = coinAddReal
|
| | | msgPack.Reason = reason
|
| | | msgPack.CallPlayerID = relationPlayerID
|
| | | msgPack.CallPlayerName = relationPlayerName
|
| | | msgPack.NameLen = len(msgPack.CallPlayerName)
|
| | | msgPack.Reason = reason
|
| | | NetPackCommon.SendFakePack(curPlayer, msgPack)
|
| | | return coinAddReal, reason
|
| | |
|
| | | def __GetTeamFBMemRelationInfo(curPlayer, relationCoinAddDict, isHelp):
|
| | | def __GetTeamFBMemRelationInfo(curPlayer, isHelp, leavePlayerID):
|
| | | ## 计算队员间相互加成信息,离线玩家不算
|
| | | relation = 0
|
| | | relationAdd = 0 # 社交关系加成
|
| | | relationPlayerID = 0
|
| | | relationPlayerName = ""
|
| | | teamID = curPlayer.GetTeamID()
|
| | | if teamID not in PyGameData.g_teamFBMemRelationDict:
|
| | | return relationAdd, relationPlayerID, relationPlayerName
|
| | | return relation, relationAdd, relationPlayerID, relationPlayerName
|
| | |
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | friendList, memFamilyIDDict, memNameDict = PyGameData.g_teamFBMemRelationDict[teamID]
|
| | | relationList = IpyGameDataPY.GetFuncEvalCfg("HelpBattlePoint", 3, []) # 社交关系优先级
|
| | | relationCoinAddDict = IpyGameDataPY.GetFuncEvalCfg("HelpBattlePoint", 2, {}) # 社交关系加成 {"社交关系":[过关加成, 助战加成], ...} |
| | | playerID = curPlayer.GetPlayerID()
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | if isHelp:
|
| | | # 助战的随便取一位优先级最高的即可
|
| | | for checkRelation in relationList:
|
| | | memRelation, relationPlayerID = 0, 0
|
| | | if checkRelation == 1:
|
| | | for memPlayerID in memFamilyIDDict.keys():
|
| | | if [playerID, memPlayerID] in friendList:
|
| | | memRelation = checkRelation
|
| | | relationPlayerID = memPlayerID
|
| | | break
|
| | | if checkRelation == 2:
|
| | | for memPlayerID, memFamilyID in memFamilyIDDict.items():
|
| | | if playerID != memPlayerID and familyID and familyID == memFamilyID:
|
| | | memRelation = checkRelation
|
| | | relationPlayerID = memPlayerID
|
| | | break
|
| | | if memRelation and relationPlayerID:
|
| | | relationAddList = relationCoinAddDict.get(str(memRelation), [])
|
| | | relationAdd += relationAddList[1] if len(relationAddList) == 2 else 0
|
| | | relationPlayerName = memNameDict[relationPlayerID]
|
| | | return relationAdd, relationPlayerID, relationPlayerName
|
| | | for memPlayerID, memFamilyID in memFamilyIDDict.items():
|
| | | memRelation, relationPlayerID = __GetTemMemRelation(playerManager, playerID, familyID, memPlayerID, memFamilyID, relationList, friendList, leavePlayerID)
|
| | | if not memRelation:
|
| | | continue
|
| | | relation = memRelation
|
| | | relationAddList = relationCoinAddDict.get(str(memRelation), [])
|
| | | relationAdd += relationAddList[1] if len(relationAddList) == 2 else 0
|
| | | relationPlayerName = memNameDict[relationPlayerID]
|
| | | return relation, relationAdd, relationPlayerID, relationPlayerName
|
| | | |
| | | else:
|
| | | # 非助战享受所有队员加成
|
| | | for memPlayerID, memFamilyID in memFamilyIDDict.items():
|
| | | memRelation = 0
|
| | | for checkRelation in relationList:
|
| | | if [playerID, memPlayerID] in friendList:
|
| | | memRelation = checkRelation
|
| | | break
|
| | | if playerID != memPlayerID and familyID and familyID == memFamilyID:
|
| | | memRelation = checkRelation
|
| | | break
|
| | | memRelation = __GetTemMemRelation(playerManager, playerID, familyID, memPlayerID, memFamilyID, relationList, friendList, leavePlayerID)[0]
|
| | | if not memRelation:
|
| | | continue
|
| | | if memRelation == relationList[0]:
|
| | | relation = memRelation
|
| | | elif relation:
|
| | | relation = memRelation
|
| | | relationAddList = relationCoinAddDict.get(str(memRelation), [])
|
| | | relationAdd += relationAddList[0] if len(relationAddList) == 2 else 0
|
| | |
|
| | | return relationAdd, relationPlayerID, relationPlayerName
|
| | | return relation, relationAdd, relationPlayerID, relationPlayerName
|
| | |
|
| | | def __GetTemMemRelation(playerManager, playerID, familyID, memPlayerID, memFamilyID, relationList, friendList, leavePlayerID):
|
| | | ## 离线玩家不算社交关系
|
| | | if leavePlayerID and memPlayerID == leavePlayerID:
|
| | | return 0, 0
|
| | | memPlayer = playerManager.FindPlayerByID(memPlayerID)
|
| | | if memPlayer == None or memPlayer.IsEmpty():
|
| | | return 0, 0
|
| | | for checkRelation in relationList:
|
| | | if checkRelation == 1:
|
| | | if [playerID, memPlayerID] in friendList:
|
| | | return checkRelation, memPlayerID
|
| | | if checkRelation == 2:
|
| | | if playerID != memPlayerID and familyID and familyID == memFamilyID:
|
| | | return checkRelation, memPlayerID |
| | | return 0, 0
|
| | |
|
| | | def RefershTeamFBMemRelation(tick, leavePlayerID=0):
|
| | | ## 刷新组队副本队员关系
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | player = playerManager.GetPlayerByIndex(i)
|
| | | if player == None or player.IsEmpty():
|
| | | continue
|
| | | if leavePlayerID and player.GetPlayerID() == leavePlayerID:
|
| | | PyGameData.g_teamFBMemRelationAddDict.pop(leavePlayerID, 0)
|
| | | continue
|
| | | relation, relationAdd, relationPlayerID, relationPlayerName = __GetTeamFBMemRelationInfo(player, FBCommon.GetIsHelpFight(player), leavePlayerID)
|
| | | PyGameData.g_teamFBMemRelationAddDict[player.GetPlayerID()] = [relation, relationAdd, relationPlayerID, relationPlayerName]
|
| | | |
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | player = playerManager.GetPlayerByIndex(index)
|
| | | if player == None or player.IsEmpty():
|
| | | continue
|
| | | if leavePlayerID and player.GetPlayerID() == leavePlayerID:
|
| | | continue
|
| | | FBLogic.DoFBHelp(player, tick)
|
| | | |
| | | return
|
| | |
|
| | | def GetTeamFBMemRelationInfo(playerID):
|
| | | if playerID not in PyGameData.g_teamFBMemRelationAddDict:
|
| | | return 0, 0
|
| | | return PyGameData.g_teamFBMemRelationAddDict[playerID][:2]
|
| | |
|