| | |
| | | import NetPackCommon
|
| | | import PlayerControl
|
| | | import PlayerFamily
|
| | | import AuctionHouse
|
| | | import ShareDefine
|
| | | import PyGameData
|
| | | import ChConfig
|
| | |
| | | FamilyWarState_SecondRoundOver = 23 # 次轮结束
|
| | | FamilyWarState_NextWeekGroupRank = 99 # 下周分组定级
|
| | |
|
| | | ''' 对战记录
|
| | | ''' 对战记录 Def_UniversalGameRecType_FamilyWarBattle
|
| | | value1 组级别
|
| | | value2 第几轮
|
| | | value3 家族ID1
|
| | |
| | | def GetBatRecDissolutionID(recData): return [] if not recData.GetStrValue3() else eval(recData.GetStrValue3()) # 解散的家族ID列表 [familyID, ...]
|
| | | def SetBatRecDissolutionID(recData, dissFamilyIDList): return recData.SetStrValue3(str(dissFamilyIDList))
|
| | |
|
| | | ''' 王者仙盟
|
| | | ''' 王者仙盟 Def_UniversalGameRecType_FamilyWarChampion
|
| | | value1 家族ID
|
| | | value2 盟主ID
|
| | | value3 连胜次数
|
| | |
| | | def SetFWChampionEndWinCount(championRecData, endWinCount): return championRecData.SetValue5(endWinCount)
|
| | | def GetFWChampionFamilyName(championRecData): return championRecData.GetStrValue1()
|
| | | def SetFWChampionFamilyName(championRecData, familyName): return championRecData.SetStrValue1(familyName)
|
| | |
|
| | | ''' 参赛人员 Def_UniversalGameRecType_FamilyWarMember
|
| | | value1 玩家ID
|
| | | value2 仙盟ID
|
| | | value3 是否有参与
|
| | | '''
|
| | | def GetFWMemPlayerID(recData): return recData.GetValue1()
|
| | | def SetFWMemPlayerID(recData, playerID): return recData.SetValue1(playerID)
|
| | | def GetFWMemFamilyID(recData): return recData.GetValue2()
|
| | | def SetFWMemFamilyID(recData, familyID): return recData.SetValue2(familyID)
|
| | | def GetFWMemIsJoin(recData): return recData.GetValue3()
|
| | | def SetFWMemIsJoin(recData, isJoin): return recData.SetValue3(isJoin)
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | def OnGameServerInitOK():
|
| | |
| | | warMemRecList = GameWorld.GetUniversalRecMgr().GetTypeList(ShareDefine.Def_UniversalGameRecType_FamilyWarMember)
|
| | | for i in xrange(warMemRecList.Count()):
|
| | | recData = warMemRecList.At(i)
|
| | | warPlayerID = recData.GetValue1()
|
| | | warFamilyID = recData.GetValue2()
|
| | | warPlayerID = GetFWMemPlayerID(recData)
|
| | | warFamilyID = GetFWMemFamilyID(recData)
|
| | | if warFamilyID not in PyGameData.g_familyWarFamilyIDList:
|
| | | PyGameData.g_familyWarFamilyIDList.append(warFamilyID)
|
| | | PyGameData.g_familyWarMemDict[warPlayerID] = warFamilyID
|
| | | PyGameData.g_familyWarMemDict[warPlayerID] = recData
|
| | |
|
| | | GameWorld.Log("加载仙盟联赛参赛仙盟ID: %s" % PyGameData.g_familyWarFamilyIDList)
|
| | | GameWorld.Log("加载仙盟联赛参赛仙盟玩家: %s" % PyGameData.g_familyWarMemDict)
|
| | | #GameWorld.Log("加载仙盟联赛参赛仙盟玩家: %s" % PyGameData.g_familyWarMemDict)
|
| | | return
|
| | |
|
| | | def DoFamilyWarReset(isDelRec=True):
|
| | |
| | |
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_Round, 0)
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_AllOver, 0)
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_StartWorldLV, 0)
|
| | | if isDelRec:
|
| | | GameWorld.GetUniversalRecMgr().Delete(ShareDefine.Def_UniversalGameRecType_FamilyWarBattle)
|
| | | GameWorld.GetUniversalRecMgr().Delete(ShareDefine.Def_UniversalGameRecType_FamilyWarChampion)
|
| | |
| | | if playerID not in PyGameData.g_familyWarMemDict:
|
| | | PlayerControl.NotifyCode(curPlayer, "PlayerNotInFamilyWarMemList")
|
| | | return False
|
| | | warFamilyID = PyGameData.g_familyWarMemDict[playerID]
|
| | | warFamilyID = GetFWMemFamilyID(PyGameData.g_familyWarMemDict[playerID])
|
| | | if familyID != warFamilyID:
|
| | | PlayerControl.NotifyCode(curPlayer, "PlayerWarFamilyIDIsChange")
|
| | | return False
|
| | |
| | |
|
| | | def OnPlayerLogin(curFamily, curPlayer):
|
| | | CheckPlayerJoinFamilyWarInfo(curPlayer)
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | state = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyWar)
|
| | | if state:
|
| | | Sync_FamilyWarInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def CheckPlayerJoinFamilyWarInfo(curPlayer):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_familyWarMemDict:
|
| | | return
|
| | | joinFamilyID = PyGameData.g_familyWarMemDict[playerID]
|
| | | joinFamilyID = GetFWMemFamilyID(PyGameData.g_familyWarMemDict[playerID])
|
| | | if not joinFamilyID or curPlayer.GetFamilyID() == joinFamilyID:
|
| | | return
|
| | |
|
| | |
| | | UpdFamilyWarRank()
|
| | |
|
| | | # 补发未分配的连胜奖励
|
| | | AllotWinRewardBySystem(GetFamilyWarChampionRecData(), True)
|
| | | #AllotWinRewardBySystem(GetFamilyWarChampionRecData(), True)
|
| | | return
|
| | |
|
| | | def OnChangeFamilyLeader(familyID, leaderID):
|
| | |
| | |
|
| | | groupID = FamilyWar_MaxGroupID
|
| | | groupFamilyList = []
|
| | | warFamilyMemInfo = {}
|
| | | #直接取排行榜前X名作为联赛仙盟名单
|
| | | familyMgr = GameWorld.GetFamilyManager()
|
| | | sortFamilyIDList = PlayerFamily.GetSortFamilyIDList()
|
| | |
| | |
|
| | | # 添加参赛仙盟及成员名单
|
| | | PyGameData.g_familyWarFamilyIDList.append(familyID)
|
| | | warMemIDList = []
|
| | | for index in xrange(family.GetCount()):
|
| | | curMember = family.GetAt(index)
|
| | | memPlayerID = curMember.GetPlayerID()
|
| | |
| | | # 重新通知玩家参与的仙盟
|
| | | if lastJoinFamilyID and isAddOK and lastJoinFamilyID != familyID and memPlayer:
|
| | | __NotifyPlayerJoinFamilyInfo(memPlayer, familyID)
|
| | | if isAddOK:
|
| | | warMemIDList.append(memPlayerID)
|
| | | warFamilyMemInfo[familyID] = warMemIDList
|
| | |
|
| | | # 满一组仙盟数 or 没有仙盟了
|
| | | if len(groupFamilyList) == FamilyWar_GroupFamilyCount or i == familyCount - 1:
|
| | |
| | | # 下一组
|
| | | groupID -= 1
|
| | | groupFamilyList = []
|
| | | |
| | | |
| | | worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv) |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_StartWorldLV, worldLV) # 设置分组时的世界等级
|
| | | |
| | | GameWorld.Log(" PyGameData.g_familyWarFamilyIDList: %s" % PyGameData.g_familyWarFamilyIDList)
|
| | | GameWorld.Log(" PyGameData.g_familyWarMemDict: %s" % PyGameData.g_familyWarMemDict)
|
| | | GameWorld.Log(" warFamilyMemInfo: %s" % warFamilyMemInfo)
|
| | | GameWorld.Log(" 通用记录对战家族数: %s" % warBatRecList.Count())
|
| | | GameWorld.Log(" 通用记录参与玩家数: %s" % warMemRecList.Count())
|
| | | GameWorld.Log(" 当前世界等级: %s" % worldLV)
|
| | | GameWorld.Log(" 仙盟联赛首轮比赛分组确认完毕!")
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_Round, FamilyWarRound_First) # 设置已处理过的轮次
|
| | | Sync_FamilyWarInfo()
|
| | | return
|
| | |
|
| | | def AddFamilyWarMem(playerID, familyID, warMemRecList=None):
|
| | |
| | | return
|
| | | if playerID in PyGameData.g_familyWarMemDict:
|
| | | GameWorld.DebugLog("本周已经添加过该成员所属参赛仙盟,不重复添加!playerID=%s,familyID=%s,warFamilyID=%s"
|
| | | % (playerID, familyID, PyGameData.g_familyWarMemDict[playerID]))
|
| | | % (playerID, familyID, GetFWMemFamilyID(PyGameData.g_familyWarMemDict[playerID])))
|
| | | return
|
| | | if not warMemRecList:
|
| | | warMemRecList = GameWorld.GetUniversalRecMgr().GetTypeList(ShareDefine.Def_UniversalGameRecType_FamilyWarMember)
|
| | | if not warMemRecList:
|
| | | return
|
| | | recData = warMemRecList.AddRec()
|
| | | recData.SetValue1(playerID)
|
| | | recData.SetValue2(familyID)
|
| | | PyGameData.g_familyWarMemDict[playerID] = familyID # 设置玩家对应的仙盟ID,本周联赛只能在该仙盟时才能进入战场
|
| | | SetFWMemPlayerID(recData, playerID)
|
| | | SetFWMemFamilyID(recData, familyID)
|
| | | PyGameData.g_familyWarMemDict[playerID] = recData # 设置玩家对应的仙盟ID,本周联赛只能在该仙盟时才能进入战场
|
| | | GameWorld.DebugLog(" 添加仙盟联赛战斗人员: playerID=%s,familyID=%s" % (playerID, familyID))
|
| | | return True
|
| | |
|
| | | def OnPlayerChangeMap(curPlayer):
|
| | | ## 玩家进入仙盟联赛地图
|
| | | if curPlayer.GetMapID() != ChConfig.Def_FBMapID_FamilyWar:
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | if playerID not in PyGameData.g_familyWarMemDict:
|
| | | return
|
| | | recData = PyGameData.g_familyWarMemDict[playerID]
|
| | | if GetFWMemIsJoin(recData):
|
| | | GameWorld.DebugLog("已经进入过仙盟联赛战场! ", playerID)
|
| | | return
|
| | | warFamilyID = GetFWMemFamilyID(recData)
|
| | | if familyID != warFamilyID:
|
| | | GameWorld.DebugLog("进入战场时参赛仙盟ID不一致! familyID=%s,warFamilyID=%s" % (familyID, warFamilyID), playerID)
|
| | | return
|
| | | SetFWMemIsJoin(recData, 1)
|
| | | GameWorld.Log("玩家进入仙盟联赛战场: familyID=%s" % (familyID), playerID)
|
| | | return
|
| | |
|
| | | def __DoFristRoundRandBattle(warBatRecList, groupID, groupFamilyList):
|
| | | ## 执行首轮联赛分组仙盟随机匹配比赛, 两两随机
|
| | |
| | | GameWorld.Log("除0后仙盟ID: %s" % familyWarIDRankList)
|
| | |
|
| | | # 5. 截取到倒数第二组,最后一组下周由战力决定
|
| | | familyWarIDRankList = familyWarIDRankList[:(FamilyWar_MaxFamilyCount - FamilyWar_GroupFamilyCount)]
|
| | | updFamilyIDRankList = familyWarIDRankList[:(FamilyWar_MaxFamilyCount - FamilyWar_GroupFamilyCount)]
|
| | | GameWorld.Log("最终的排名仙盟ID: %s" % familyWarIDRankList)
|
| | | GameWorld.Log("更新的排名仙盟ID: %s" % updFamilyIDRankList)
|
| | | GameWorld.Log(" 解散的仙盟ID: %s" % allDissFamilyIDList)
|
| | | # 注意: familyWarIDRankList 这个列表里的仙盟ID可能是已经解散的,但是在当前情况下还需要占用该联赛组的名额,直到下周分组定级才被顶掉
|
| | |
|
| | |
| | | if not lastRank:
|
| | | break
|
| | | updFamilyIDList.append(familyID)
|
| | | updRank = 0 if familyID not in familyWarIDRankList else (familyWarIDRankList.index(familyID) + 1)
|
| | | updRank = 0 if familyID not in updFamilyIDRankList else (updFamilyIDRankList.index(familyID) + 1)
|
| | | if updRank != lastRank:
|
| | | PlayerFamily.SetFamilyWarRank(family, updRank)
|
| | | GameWorld.Log("更新仙盟评级: familyID=%s,lastRank=%s,updRank=%s" % (familyID, lastRank, updRank))
|
| | |
|
| | | # 再更新本周新晋的联赛排名
|
| | | for updRank, familyID in enumerate(familyWarIDRankList, 1):
|
| | | for updRank, familyID in enumerate(updFamilyIDRankList, 1):
|
| | | if familyID in updFamilyIDList:
|
| | | continue
|
| | | family = familyMgr.FindFamily(familyID)
|
| | |
| | |
|
| | | if familyWarIDRankList:
|
| | | UpdFamilyWarChampion(familyWarIDRankList[0])
|
| | | GiveFamilyWinRankAuctionReward(familyWarIDRankList)
|
| | |
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_Round, 0) # 重置对战轮次
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_AllOver, 1) # 设置已经处理过总结算
|
| | |
| | | GameWorld.Log("上周冠军仙盟ID: %s" % lastChampionFamilyID)
|
| | | GameWorld.Log("本周冠军仙盟ID: %s" % championFamilyID)
|
| | | winCount = GetFWChampionWinCount(championRecData)
|
| | | rewardWinCount = winCount + 1
|
| | | GiveFamilyWinCountAuctionReward(championFamilyID, rewardWinCount)
|
| | | if lastChampionFamilyID == championFamilyID:
|
| | | winCount += 1
|
| | | SetFWChampionWinCount(championRecData, winCount)
|
| | | GameWorld.Log(" 更新连胜: %s" % winCount)
|
| | | AllotWinRewardBySystem(championRecData, False)
|
| | | #AllotWinRewardBySystem(championRecData, False)
|
| | | else:
|
| | | AllotWinRewardBySystem(championRecData, True)
|
| | | #AllotWinRewardBySystem(championRecData, True)
|
| | | SetFWChampionFamilyID(championRecData, championFamilyID)
|
| | | SetFWChampionWinCount(championRecData, 1)
|
| | | SetFWChampionWinRewardAllot(championRecData, 0)
|
| | |
| | | PlayerControl.WorldNotify(0, "FamilyMatchSecondSessionEnd", [championFamilyName])
|
| | | return
|
| | |
|
| | | def GiveFamilyWinCountAuctionReward(familyID, rewardWinCount):
|
| | | ## 给仙盟连胜仙盟拍品奖励
|
| | | |
| | | winRewardStartCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 2) # 起始连胜奖励次数
|
| | | winRewardSpaceCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 3) # 连胜奖励间隔次数
|
| | | |
| | | rewardIndex = -1
|
| | | |
| | | if rewardWinCount == winRewardStartCount:
|
| | | rewardIndex = 0
|
| | | elif rewardWinCount > winRewardStartCount:
|
| | | winCountValue = rewardWinCount - winRewardStartCount
|
| | | if winCountValue % winRewardSpaceCount == 0:
|
| | | rewardIndex = winCountValue / winRewardSpaceCount
|
| | | |
| | | if rewardIndex == -1:
|
| | | GameWorld.Log("不需要发放连胜仙盟拍品奖励: familyID=%s,rewardWinCount=%s" % (familyID, rewardWinCount))
|
| | | return
|
| | | |
| | | winRewardLoopList = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 4) # 连胜仙盟拍品循环奖励[[[拍品ID,个数], ...], ...]
|
| | | loopIndex = rewardIndex % len(winRewardLoopList)
|
| | | familyAuctionItemList = winRewardLoopList[loopIndex]
|
| | | family = GameWorld.GetFamilyManager().FindFamily(familyID)
|
| | | if not family:
|
| | | return
|
| | | |
| | | familyPlayerIDList = []
|
| | | for i in xrange(family.GetCount()):
|
| | | member = family.GetAt(i)
|
| | | memPlayerID = member.GetPlayerID()
|
| | | if memPlayerID not in PyGameData.g_familyWarMemDict:
|
| | | continue
|
| | | recData = PyGameData.g_familyWarMemDict[memPlayerID]
|
| | | if not GetFWMemIsJoin(recData):
|
| | | continue
|
| | | familyPlayerIDList.append(memPlayerID)
|
| | | |
| | | familyAuctionItemDict = {} # {仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,个数], [拍品ID,个数,是否拍品], ...]], ...}
|
| | | familyAuctionItemDict[familyID] = [familyPlayerIDList, familyAuctionItemList]
|
| | | GameWorld.Log("发放连胜仙盟拍品奖励: familyID=%s,rewardWinCount=%s,rewardIndex=%s,loopIndex=%s" |
| | | % (familyID, rewardWinCount, rewardIndex, loopIndex))
|
| | | GameWorld.Log(" familyPlayerIDList=%s" % familyPlayerIDList)
|
| | | GameWorld.Log(" familyAuctionItemList=%s" % familyAuctionItemList)
|
| | | AuctionHouse.DoAddFamilyAuctionItem(ChConfig.Def_FBMapID_FamilyWar, familyAuctionItemDict)
|
| | | return
|
| | |
|
| | | def GiveFamilyWinRankAuctionReward(familyWarIDRankList):
|
| | | ## 给仙盟排名仙盟拍品奖励
|
| | | |
| | | warWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_StartWorldLV)
|
| | | GameWorld.Log("发放排名仙盟拍品奖励: warWorldLV=%s, familyWarIDRankList=%s" % (warWorldLV, familyWarIDRankList))
|
| | | |
| | | cfgRankKey = 1
|
| | | cfgRankAuctionItemDict = {}
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in xrange(ipyDataMgr.GetFamilyWarRankAwardCount()):
|
| | | ipyData = ipyDataMgr.GetFamilyWarRankAwardByIndex(index)
|
| | | if warWorldLV > ipyData.GetWarWorldLV() and cfgRankAuctionItemDict:
|
| | | break
|
| | | warRank = ipyData.GetWarRank()
|
| | | auctionItemList = ipyData.GetRankAuctionItem()
|
| | | for rank in range(cfgRankKey, warRank + 1):
|
| | | cfgRankAuctionItemDict[rank] = auctionItemList
|
| | | cfgRankKey = warRank + 1
|
| | | |
| | | familyAuctionItemDict = {} # {仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,个数], [拍品ID,个数,是否拍品], ...]], ...}
|
| | | for rank, familyID in enumerate(familyWarIDRankList, 1):
|
| | | if rank not in cfgRankAuctionItemDict: |
| | | GameWorld.Log(" rank=%s,familyID=%s,该名次没有找到奖励!" % (rank, familyID))
|
| | | continue
|
| | | |
| | | family = GameWorld.GetFamilyManager().FindFamily(familyID)
|
| | | if not family:
|
| | | GameWorld.Log(" rank=%s,familyID=%s,仙盟不存在!" % (rank, familyID))
|
| | | continue
|
| | | |
| | | familyPlayerIDList = []
|
| | | for i in xrange(family.GetCount()):
|
| | | member = family.GetAt(i)
|
| | | memPlayerID = member.GetPlayerID()
|
| | | if memPlayerID not in PyGameData.g_familyWarMemDict:
|
| | | continue
|
| | | recData = PyGameData.g_familyWarMemDict[memPlayerID]
|
| | | if not GetFWMemIsJoin(recData):
|
| | | continue
|
| | | familyPlayerIDList.append(memPlayerID)
|
| | | |
| | | familyAuctionItemList = cfgRankAuctionItemDict[rank]
|
| | | familyAuctionItemDict[familyID] = [familyPlayerIDList, familyAuctionItemList]
|
| | | GameWorld.Log(" rank=%s,familyID=%s,familyPlayerIDList=%s,familyAuctionItemList=%s" |
| | | % (rank, familyID, familyPlayerIDList, familyAuctionItemList))
|
| | | |
| | | AuctionHouse.DoAddFamilyAuctionItem(ChConfig.Def_FBMapID_FamilyWar, familyAuctionItemDict)
|
| | | return
|
| | |
|
| | | def GetFamilyWarChampionRecData():
|
| | | universalRecMgr = GameWorld.GetUniversalRecMgr()
|
| | | championRecList = universalRecMgr.GetTypeList(ShareDefine.Def_UniversalGameRecType_FamilyWarChampion)
|
| | |
| | |
|
| | | def AllotWinRewardBySystem(championRecData, isAll):
|
| | | ## 系统自动分配仙盟未分配的连胜奖励
|
| | | |
| | | familyID = GetFWChampionFamilyID(championRecData)
|
| | | leaderID = GetFWChampionLeaderID(championRecData)
|
| | | winCount = GetFWChampionWinCount(championRecData) # 当前连胜次数
|
| | | lastAllotWinCount = GetFWChampionWinRewardAllot(championRecData) # 上次已分配的连胜奖励次数
|
| | | endWinCount = GetFWChampionEndWinCount(championRecData) # 终结对手的连胜次数
|
| | | |
| | | winRewardItemList = IpyGameDataPY.GetFuncEvalCfg("FamilyMatchLianWinReward", 1) # 连胜奖励
|
| | | winRewardStartCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 2) # 起始连胜奖励次数
|
| | | winRewardSpaceCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 3) # 连胜奖励间隔次数
|
| | | if not winRewardItemList or not winRewardStartCount or not winRewardSpaceCount:
|
| | | return
|
| | | |
| | | updAllotWinCount = 0 # 更新的已分配到的连胜次数
|
| | | startRewardWinCount = winRewardStartCount if not lastAllotWinCount else (lastAllotWinCount + winRewardSpaceCount) # 下次连胜奖励次数
|
| | | sysAllotWinCountList = range(startRewardWinCount, winCount + 1, winRewardSpaceCount)
|
| | | isAllotEndWinCount = (endWinCount and (isAll or sysAllotWinCountList))
|
| | | |
| | | if not isAll and sysAllotWinCountList:
|
| | | sysAllotWinCountList = sysAllotWinCountList[:-1] # 保留一个可手动分配, 其余自动分配
|
| | | if sysAllotWinCountList:
|
| | | updAllotWinCount = sysAllotWinCountList[-1]
|
| | | |
| | | sysAllotCount = len(sysAllotWinCountList) # 系统自动发放的奖励次数
|
| | | if isAllotEndWinCount:
|
| | | sysAllotCount += 1
|
| | | |
| | | if sysAllotCount <= 0:
|
| | | #GameWorld.Log("无需自动分配奖励!上次奖励连胜次数=%s,当前连胜数=%s,终结连胜=%s,isAll=%s,sysAllotWinCountList=%s" |
| | | # % (lastAllotWinCount, winCount, endWinCount, isAll, sysAllotWinCountList))
|
| | | return
|
| | | |
| | | if sysAllotCount > 1:
|
| | | winRewardItemList = copy.deepcopy(winRewardItemList)
|
| | | for itemInfo in winRewardItemList:
|
| | | itemInfo[1] *= sysAllotCount
|
| | | GameWorld.Log("系统自动分配连胜奖励给盟主!上次奖励连胜次数=%s,当前连胜数=%s,终结连胜=%s,分配次数=%s,物品=%s,isAll=%s,familyID=%s,leaderID=%s" |
| | | % (lastAllotWinCount, winCount, endWinCount, sysAllotCount, winRewardItemList, isAll, familyID, leaderID))
|
| | | if sysAllotWinCountList:
|
| | | GameWorld.Log(" sysAllotWinCountList=%s" % sysAllotWinCountList)
|
| | | if endWinCount:
|
| | | GameWorld.Log(" 重置已分配终结对手连胜次数奖励!")
|
| | | SetFWChampionEndWinCount(championRecData, 0)
|
| | | if updAllotWinCount:
|
| | | GameWorld.Log(" 更新已分配到的连胜次数: %s" % updAllotWinCount)
|
| | | SetFWChampionWinRewardAllot(championRecData, updAllotWinCount)
|
| | | PlayerCompensation.SendMailByKey("FamilyMatchWinAllotMail2", [leaderID], winRewardItemList)
|
| | | GameWorld.Log(" -----------------------")
|
| | | ## 单号 7195 2019-06-10 去除分配奖励,连胜改为拍品奖励
|
| | | return
|
| | | |
| | | # familyID = GetFWChampionFamilyID(championRecData)
|
| | | # leaderID = GetFWChampionLeaderID(championRecData)
|
| | | # winCount = GetFWChampionWinCount(championRecData) # 当前连胜次数
|
| | | # lastAllotWinCount = GetFWChampionWinRewardAllot(championRecData) # 上次已分配的连胜奖励次数
|
| | | # endWinCount = GetFWChampionEndWinCount(championRecData) # 终结对手的连胜次数
|
| | | # |
| | | # winRewardItemList = IpyGameDataPY.GetFuncEvalCfg("FamilyMatchLianWinReward", 1) # 连胜奖励
|
| | | # winRewardStartCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 2) # 起始连胜奖励次数
|
| | | # winRewardSpaceCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 3) # 连胜奖励间隔次数
|
| | | # if not winRewardItemList or not winRewardStartCount or not winRewardSpaceCount:
|
| | | # return
|
| | | # |
| | | # updAllotWinCount = 0 # 更新的已分配到的连胜次数
|
| | | # startRewardWinCount = winRewardStartCount if not lastAllotWinCount else (lastAllotWinCount + winRewardSpaceCount) # 下次连胜奖励次数
|
| | | # sysAllotWinCountList = range(startRewardWinCount, winCount + 1, winRewardSpaceCount)
|
| | | # isAllotEndWinCount = (endWinCount and (isAll or sysAllotWinCountList))
|
| | | # |
| | | # if not isAll and sysAllotWinCountList:
|
| | | # sysAllotWinCountList = sysAllotWinCountList[:-1] # 保留一个可手动分配, 其余自动分配
|
| | | # if sysAllotWinCountList:
|
| | | # updAllotWinCount = sysAllotWinCountList[-1]
|
| | | # |
| | | # sysAllotCount = len(sysAllotWinCountList) # 系统自动发放的奖励次数
|
| | | # if isAllotEndWinCount:
|
| | | # sysAllotCount += 1
|
| | | # |
| | | # if sysAllotCount <= 0:
|
| | | # #GameWorld.Log("无需自动分配奖励!上次奖励连胜次数=%s,当前连胜数=%s,终结连胜=%s,isAll=%s,sysAllotWinCountList=%s" |
| | | # # % (lastAllotWinCount, winCount, endWinCount, isAll, sysAllotWinCountList))
|
| | | # return
|
| | | # |
| | | # if sysAllotCount > 1:
|
| | | # winRewardItemList = copy.deepcopy(winRewardItemList)
|
| | | # for itemInfo in winRewardItemList:
|
| | | # itemInfo[1] *= sysAllotCount
|
| | | # GameWorld.Log("系统自动分配连胜奖励给盟主!上次奖励连胜次数=%s,当前连胜数=%s,终结连胜=%s,分配次数=%s,物品=%s,isAll=%s,familyID=%s,leaderID=%s" |
| | | # % (lastAllotWinCount, winCount, endWinCount, sysAllotCount, winRewardItemList, isAll, familyID, leaderID))
|
| | | # if sysAllotWinCountList:
|
| | | # GameWorld.Log(" sysAllotWinCountList=%s" % sysAllotWinCountList)
|
| | | # if endWinCount:
|
| | | # GameWorld.Log(" 重置已分配终结对手连胜次数奖励!")
|
| | | # SetFWChampionEndWinCount(championRecData, 0)
|
| | | # if updAllotWinCount:
|
| | | # GameWorld.Log(" 更新已分配到的连胜次数: %s" % updAllotWinCount)
|
| | | # SetFWChampionWinRewardAllot(championRecData, updAllotWinCount)
|
| | | # PlayerCompensation.SendMailByKey("FamilyMatchWinAllotMail2", [leaderID], winRewardItemList)
|
| | | # GameWorld.Log(" -----------------------")
|
| | | # return
|
| | |
|
| | | #// A4 10 仙盟联赛连胜奖励分配 #tagCGFamilyWarWinRewardAllot
|
| | | #
|
| | |
| | | # DWORD MemPlayerID; //分配给的仙盟成员玩家ID
|
| | | #};
|
| | | def OnFamilyWarWinRewardAllot(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | memPlayerID = clientData.MemPlayerID
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | curFamily = curPlayer.GetFamily()
|
| | | if curFamily == None:
|
| | | return
|
| | | curMember = curFamily.FindMember(playerID)
|
| | | if curMember == None:
|
| | | return
|
| | | if curMember.GetFamilyLV() != IPY_GameServer.fmlLeader:
|
| | | GameWorld.Log("不是盟主,不能分配连胜奖励!", playerID)
|
| | | return
|
| | | |
| | | familyID = curFamily.GetID()
|
| | | curTagMember = curFamily.FindMember(memPlayerID)
|
| | | if curTagMember == None:
|
| | | GameWorld.Log("仙盟没有该成员,无法分配连胜奖励!familyID=%s,memPlayerID=%s" % (familyID, memPlayerID), playerID)
|
| | | return
|
| | | |
| | | championRecData = GetFamilyWarChampionRecData()
|
| | | championFamilyID = GetFWChampionFamilyID(championRecData)
|
| | | if familyID != championFamilyID:
|
| | | GameWorld.Log("非王者仙盟,无法分配连胜奖励!championFamilyID=%s,familyID=%s" % (championFamilyID, familyID), playerID)
|
| | | return
|
| | | |
| | | endWinCount = GetFWChampionEndWinCount(championRecData) # 终结对手的连胜次数
|
| | | if endWinCount:
|
| | | SetFWChampionEndWinCount(championRecData, 0)
|
| | | GameWorld.Log("分配终结仙盟连胜奖励!familyID=%s,endWinCount=%s" % (familyID, endWinCount), playerID)
|
| | | |
| | | else:
|
| | | winCount = GetFWChampionWinCount(championRecData) # 当前连胜次数
|
| | | lastAllotWinCount = GetFWChampionWinRewardAllot(championRecData) # 上次已分配的连胜奖励次数
|
| | | |
| | | winRewardStartCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 2) # 起始连胜奖励次数
|
| | | winRewardSpaceCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 3) # 连胜奖励间隔次数
|
| | | nextRewardWinCount = winRewardStartCount if not lastAllotWinCount else (lastAllotWinCount + winRewardSpaceCount) # 下次连胜奖励次数
|
| | | if winCount < nextRewardWinCount:
|
| | | GameWorld.Log("连胜次数不足,无法分配连胜奖励!已分配连胜奖励次数=%s,下次连胜奖励次数(%s) > 当前连胜次数(%s)" |
| | | % (lastAllotWinCount, nextRewardWinCount, winCount), playerID)
|
| | | return
|
| | | SetFWChampionWinRewardAllot(championRecData, nextRewardWinCount)
|
| | | GameWorld.Log("分配仙盟连胜奖励!familyID=%s,分配连胜数=%s" % (familyID, nextRewardWinCount), playerID)
|
| | | |
| | | winRewardItemList = IpyGameDataPY.GetFuncEvalCfg("FamilyMatchLianWinReward", 1) # 连胜奖励
|
| | | PlayerCompensation.SendMailByKey("FamilyMatchWinAllotMail1", [memPlayerID], winRewardItemList)
|
| | | PlayerUniversalGameRec.SendUniversalGameRecSingle(curPlayer, championRecData) # 同步给该玩家
|
| | | |
| | | # <color=#44e863FF>%s0</color>仙盟盟主将连胜奖励<color=#44e863FF><Word info=item id=%s1/></color>分配给<color=#44e863FF>%s2</color>,神兵降世
|
| | | notifyItemID = winRewardItemList[0][0]
|
| | | PlayerControl.WorldNotify(0, "FamilyMatchLianWinReward", [curFamily.GetName(), notifyItemID, curTagMember.GetName()])
|
| | | # 单号 7195 2019-06-10 去除分配奖励,连胜改为拍品奖励
|
| | | return
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # memPlayerID = clientData.MemPlayerID
|
| | | # playerID = curPlayer.GetPlayerID()
|
| | | # curFamily = curPlayer.GetFamily()
|
| | | # if curFamily == None:
|
| | | # return
|
| | | # curMember = curFamily.FindMember(playerID)
|
| | | # if curMember == None:
|
| | | # return
|
| | | # if curMember.GetFamilyLV() != IPY_GameServer.fmlLeader:
|
| | | # GameWorld.Log("不是盟主,不能分配连胜奖励!", playerID)
|
| | | # return
|
| | | # |
| | | # familyID = curFamily.GetID()
|
| | | # curTagMember = curFamily.FindMember(memPlayerID)
|
| | | # if curTagMember == None:
|
| | | # GameWorld.Log("仙盟没有该成员,无法分配连胜奖励!familyID=%s,memPlayerID=%s" % (familyID, memPlayerID), playerID)
|
| | | # return
|
| | | # |
| | | # championRecData = GetFamilyWarChampionRecData()
|
| | | # championFamilyID = GetFWChampionFamilyID(championRecData)
|
| | | # if familyID != championFamilyID:
|
| | | # GameWorld.Log("非王者仙盟,无法分配连胜奖励!championFamilyID=%s,familyID=%s" % (championFamilyID, familyID), playerID)
|
| | | # return
|
| | | # |
| | | # endWinCount = GetFWChampionEndWinCount(championRecData) # 终结对手的连胜次数
|
| | | # if endWinCount:
|
| | | # SetFWChampionEndWinCount(championRecData, 0)
|
| | | # GameWorld.Log("分配终结仙盟连胜奖励!familyID=%s,endWinCount=%s" % (familyID, endWinCount), playerID)
|
| | | # |
| | | # else:
|
| | | # winCount = GetFWChampionWinCount(championRecData) # 当前连胜次数
|
| | | # lastAllotWinCount = GetFWChampionWinRewardAllot(championRecData) # 上次已分配的连胜奖励次数
|
| | | # |
| | | # winRewardStartCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 2) # 起始连胜奖励次数
|
| | | # winRewardSpaceCount = IpyGameDataPY.GetFuncCfg("FamilyMatchLianWinReward", 3) # 连胜奖励间隔次数
|
| | | # nextRewardWinCount = winRewardStartCount if not lastAllotWinCount else (lastAllotWinCount + winRewardSpaceCount) # 下次连胜奖励次数
|
| | | # if winCount < nextRewardWinCount:
|
| | | # GameWorld.Log("连胜次数不足,无法分配连胜奖励!已分配连胜奖励次数=%s,下次连胜奖励次数(%s) > 当前连胜次数(%s)" |
| | | # % (lastAllotWinCount, nextRewardWinCount, winCount), playerID)
|
| | | # return
|
| | | # SetFWChampionWinRewardAllot(championRecData, nextRewardWinCount)
|
| | | # GameWorld.Log("分配仙盟连胜奖励!familyID=%s,分配连胜数=%s" % (familyID, nextRewardWinCount), playerID)
|
| | | # |
| | | # winRewardItemList = IpyGameDataPY.GetFuncEvalCfg("FamilyMatchLianWinReward", 1) # 连胜奖励
|
| | | # PlayerCompensation.SendMailByKey("FamilyMatchWinAllotMail1", [memPlayerID], winRewardItemList)
|
| | | # PlayerUniversalGameRec.SendUniversalGameRecSingle(curPlayer, championRecData) # 同步给该玩家
|
| | | # |
| | | # # <color=#44e863FF>%s0</color>仙盟盟主将连胜奖励<color=#44e863FF><Word info=item id=%s1/></color>分配给<color=#44e863FF>%s2</color>,神兵降世
|
| | | # notifyItemID = winRewardItemList[0][0]
|
| | | # PlayerControl.WorldNotify(0, "FamilyMatchLianWinReward", [curFamily.GetName(), notifyItemID, curTagMember.GetName()])
|
| | | # return
|
| | |
|
| | | def MapServer_FamilyWarOver(msgList):
|
| | | ## 地图仙盟战结束
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def Sync_FamilyWarInfo(curPlayer=None):
|
| | | warInfo = ChPyNetSendPack.tagGCFamilyWarInfo()
|
| | | warInfo.WorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FamilyWar_StartWorldLV)
|
| | | NetPackCommon.SendPackByPlayer(warInfo, curPlayer)
|
| | | return
|
| | | |
| | | |
| | |
|