From c077942390adf47b144205e84e6a9217bc300093 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 30 八月 2018 10:51:45 +0800
Subject: [PATCH] fix:3063 【后端】仙盟宴会增加显示前三名实时排名以及实时答题王
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py | 102 ++++++++++++++++-----------------
ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py | 5 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py | 14 +++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py | 1
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py | 5 +
7 files changed, 76 insertions(+), 55 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py
index 0c297ac..095ede0 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py
@@ -26,16 +26,12 @@
import ChConfig
import PlayerFamilyRedPacket
import PlayerTalk
+import PyGameData
import random
FamilyPartyFB_QuestionID = 'FamilyPartyFB_QuestionID%s' #当前题ID
FamilyPartyFB_AnswerTick = 'FamilyPartyFB_AnswerTick%s' #答对时间
-
-
-g_questionIDHistory = {} #出过的题记录 {familyid:[出过的题id,..]}
-g_familyAnswerDict = {} #仙盟答题数量 {familyid:答题数量,..}
-g_heroAnswerDict = {} #个人答题数量 {playerid:答题数量,..}
## 玩家登录
@@ -62,14 +58,12 @@
def FamilyPartyStateChange(state):
#活动状态变更
- global g_questionIDHistory
- global g_familyAnswerDict
- global g_heroAnswerDict
-
+
if state == 1:
- g_questionIDHistory = {}
- g_familyAnswerDict = {}
- g_heroAnswerDict = {}
+ PyGameData.g_questionIDHistory = {}
+ PyGameData.g_familyAnswerDict = {}
+ PyGameData.g_familyPartyTopInfo = []
+ PyGameData.g_partyheroAnswerDict = {}
gameWorld = GameWorld.GetGameWorld()
familyManager = GameWorld.GetFamilyManager()
for i in range(0, familyManager.GetCount()):
@@ -81,18 +75,16 @@
if state == 0:
#活动结算 前3名仙盟、答题王
- GameWorld.Log(" 仙盟宴会结算 g_familyAnswerDict=%s, g_heroAnswerDict=%s"%(g_familyAnswerDict, g_heroAnswerDict))
+ GameWorld.Log(" 仙盟宴会结算 g_familyAnswerDict=%s, g_familyPartyTopInfo=%s"%(PyGameData.g_familyAnswerDict, PyGameData.g_familyPartyTopInfo))
noneStr = 'null'
topfamilyNameList = [noneStr,noneStr,noneStr]
- if g_familyAnswerDict:
- sortFamilyList = g_familyAnswerDict.items()
- sortFamilyList.sort(cmp=CmpFunc)
- familyIDList = [familyInfo[0] for familyInfo in sortFamilyList][:3]
- GameWorld.DebugLog(" 宴会结束 familyIDList=%s"%familyIDList)
+ if PyGameData.g_familyAnswerDict:
+ sortFamilyList = __GetFamilyAnswerRankList()
+ GameWorld.DebugLog(" 宴会结束 sortFamilyList=%s"%sortFamilyList)
redPackID = IpyGameDataPY.GetFuncCfg('PartyReward', 4)
- for i, familyID in enumerate(familyIDList):
- familyName = PlayerFamily.GetFamilyName_ByID(familyID)
+ for i, familyInfo in enumerate(sortFamilyList):
+ familyID, familyName = familyInfo[:2]
topfamilyNameList[i] = familyName
#发红包
family = GameWorld.GetFamilyManager().FindFamily(familyID)
@@ -101,31 +93,28 @@
PlayerFamilyRedPacket.CreatNewFamilyRedPacket(family, family.GetLeaderID(), redPackID)
PlayerControl.WorldNotify(0, 'Party_TopThree', topfamilyNameList)
- topHeroName = noneStr
- if g_heroAnswerDict:
+
+ if PyGameData.g_familyPartyTopInfo:
+ topHeroID, topHeroName = PyGameData.g_familyPartyTopInfo[:2]
rewardInfo = IpyGameDataPY.GetFuncEvalCfg('PartyReward', 3)
- sortHeroList = g_heroAnswerDict.items()
- sortHeroList.sort(cmp=CmpFunc)
- sortHeroidList = [heroInfo[0] for heroInfo in sortHeroList]
- GameWorld.DebugLog(" 宴会结束 sortHeroidList=%s"%sortHeroidList)
- playerManager = GameWorld.GetPlayerManager()
- for playerID in sortHeroidList:
- curPlayer = playerManager.FindPlayerByID(playerID)
- if not curPlayer:
- continue
-# if curPlayer.GetMapID() != ChConfig.Def_FBMapID_FamilyParty:
-# #不在副本
-# continue
- topHeroName = curPlayer.GetName()
- #给奖励
- mailKey, day, itemList = rewardInfo
- content = ShareDefine.Def_MailFormat % (mailKey, '')
- GameWorld.DebugLog('发送仙盟宴会答题王邮件 itemList=%s' % (itemList))
- PlayerCompensation.SendPersonalItemMailEx('', content, day, [playerID], itemList)
- break
- if topHeroName != noneStr:
+ #给奖励
+ mailKey, day, itemList = rewardInfo
+ content = ShareDefine.Def_MailFormat % (mailKey, '')
+ GameWorld.DebugLog('发送仙盟宴会答题王邮件 itemList=%s' % (itemList))
+ PlayerCompensation.SendPersonalItemMailEx('', content, day, [topHeroID], itemList)
+
PlayerControl.WorldNotify(0, 'Party_TopPlayer', [topHeroName])
return
+
+def __GetFamilyAnswerRankList():
+ if not PyGameData.g_familyAnswerDict:
+ return []
+ sortFamilyList = PyGameData.g_familyAnswerDict.items()
+ sortFamilyList.sort(cmp=CmpFunc)
+ rankList = [] #[[familyID, familyName, 答题数量]]
+ for familyID, info in sortFamilyList[:3]:
+ rankList.append([familyID, info[2], info[0]])
+ return rankList
## 排序函数
# @param elem1 元素1
@@ -139,7 +128,6 @@
return result
def FamilyParty_Process(tick):
- global g_questionIDHistory
#开始出题
gameWorld = GameWorld.GetGameWorld()
state = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyParty)
@@ -159,14 +147,14 @@
continue
#随机题目
- historyQuestionIDList = g_questionIDHistory.get(familyID, [])
+ historyQuestionIDList = PyGameData.g_questionIDHistory.get(familyID, [])
questionCnt = IpyGameDataPY.IPY_Data().GetQuestionBankCount()
for i in xrange(50):
questionID = random.randint(1, questionCnt)
# 随机到不重复的即可
if questionID not in historyQuestionIDList or i == 49:
historyQuestionIDList.append(questionID)
- g_questionIDHistory[familyID] = historyQuestionIDList
+ PyGameData.g_questionIDHistory[familyID] = historyQuestionIDList
break
gameWorld.SetDict(FamilyPartyFB_QuestionID % familyID, questionID)
@@ -175,9 +163,7 @@
## 仙盟频道聊天
def OnTalkFamily(curPlayer, content, tick):
- global g_familyAnswerDict
- global g_heroAnswerDict
-
+
gameWorld = GameWorld.GetGameWorld()
state = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyParty)
if state != 1:
@@ -207,14 +193,26 @@
if isRight:
GameWorld.DebugLog(" 答对了! %s"%playerID)
+ playerName = curPlayer.GetName()
gameWorld.SetDict(FamilyPartyFB_QuestionID%curFamilyid, 0)
gameWorld.SetDict(FamilyPartyFB_AnswerTick%curFamilyid, tick)
- PlayerControl.FamilyNotify(curFamilyid, 'Party_Answer', [curPlayer.GetName()])
+ PlayerControl.FamilyNotify(curFamilyid, 'Party_Answer', [playerName])
+ if curFamilyid in PyGameData.g_familyAnswerDict:
+ PyGameData.g_familyAnswerDict[curFamilyid][0] +=1
+ PyGameData.g_familyAnswerDict[curFamilyid][1] = tick
+ else:
+ familyName = PlayerFamily.GetFamilyName_ByID(curFamilyid)
+ PyGameData.g_familyAnswerDict[curFamilyid] = [1, tick, familyName]
- g_familyAnswerDict[curFamilyid] = [g_familyAnswerDict.get(curFamilyid, [0])[0] + 1, tick]
- g_heroAnswerDict[playerID] = [g_heroAnswerDict.get(playerID, [0])[0] + 1, tick]
+ PyGameData.g_partyheroAnswerDict[playerID] = PyGameData.g_partyheroAnswerDict.get(playerID, 0) + 1
-
+ if PyGameData.g_familyPartyTopInfo:
+ if PyGameData.g_partyheroAnswerDict[playerID] > PyGameData.g_partyheroAnswerDict[PyGameData.g_familyPartyTopInfo[0]]:
+ PyGameData.g_familyPartyTopInfo = [playerID, playerName]
+ else:
+ PyGameData.g_familyPartyTopInfo = [playerID, playerName]
+ msgList = [__GetFamilyAnswerRankList(), PyGameData.g_familyPartyTopInfo[1], PyGameData.g_partyheroAnswerDict[PyGameData.g_familyPartyTopInfo[0]]]
+ GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_FamilyPartyInfo, msgList)
#通知玩家可获得贡献
curPlayer.MapServer_QueryPlayerResult(0, 0, "FamilyPartyAnswer", '', 0)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
index f800d86..03760a9 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
@@ -68,3 +68,8 @@
g_yesterdayPlayerLVDict = {} #昨日玩家等级字典{playerID:lv,..}
g_ctgOfflinePlayerInfo = {} # {playerID:[[ctgInfo], ...], ...} # 离线玩家CTG信息缓存
+
+g_questionIDHistory = {}#出过的题记录 {familyid:[出过的题id,..]}
+g_familyAnswerDict = {} #仙盟答题数量 {familyid:[答题数量,tick],..}
+g_familyPartyTopInfo = [] #仙盟宴会答题王 [playerID,名字]
+g_partyheroAnswerDict = {} #仙盟宴会玩家答题数量 {playerid:答题数量,..}
\ No newline at end of file
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 0e3b58b..c6f474d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -162,6 +162,8 @@
Def_Notify_WorldKey_FamilyBossOpenCount = "FamilyBossOpenCount" # 仙盟boss开启次数
+Def_Notify_WorldKey_FamilyPartyInfo = "FamilyPartyInfo" # 仙盟宴会数据
+
Def_Notify_WorldKey_MergeBoss = "Merge_Boss" # 跨服boss
Def_Notify_WorldKey_Merge_PK = "Merge_PK" # 跨服PK, 仅跨服服务器有用,做为触发PKState用
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py
index 0d53221..17efc16 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py
@@ -26,7 +26,7 @@
import GameWorldProcess
import PlayerFairyCeremony
import EventReport
-
+import PyGameData
#当前副本地图的状态
@@ -194,6 +194,8 @@
elif fbStep == FB_Step_Fighting:
if not FBCommon.GetFBFuncOpenState(ChConfig.Def_FBMapID_FamilyParty):
GiveJoinPrize()
+ FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
+ PyGameData.g_familyPartyInfo = []
FBCommon.SetFBStep(FB_Step_Over, tick)
FBCommon.DoLogic_FBKickAllPlayer()
GameWorldProcess.CloseFB(tick)
@@ -323,9 +325,15 @@
hasCollect = gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasCollect%playerID)
getCnt = gameWorld.GetGameWorldDictByKey(ChConfig.Map_Player_AreaReward_GetCnt%playerID)
isFull = 1 if getCnt >= IpyGameDataPY.GetFuncCfg('FamilyPartyAreaAward', 3) else 0
-
-
helpDict = {FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint,FBCommon.Help_score:totalPoint, "hasCollect":hasCollect, "isFullExp":isFull}
+ if PyGameData.g_familyPartyInfo:
+ rankList = []
+ for i, info in enumerate(PyGameData.g_familyPartyInfo[0], 1):
+ rankList.append({"rank":i, "name":info[1], "cnt":info[2]})
+ helpDict['familyPartyRank'] = rankList
+ helpDict['familyPartyTop'] = {'name':PyGameData.g_familyPartyInfo[1], "cnt":PyGameData.g_familyPartyInfo[2]}
+
+
GameWorld.DebugLog("DoFBHelp %s" % helpDict, playerID)
FBCommon.Notify_FBHelp(curPlayer, helpDict)
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
index 973b23a..761b7fd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -1246,6 +1246,11 @@
GameLogic_FamilyBoss.GameServerOpenFamilyBoss(familyID, openCount)
return
+ if key == ShareDefine.Def_Notify_WorldKey_FamilyPartyInfo:
+ if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_FamilyParty:
+ PyGameData.g_familyPartyInfo = eval(msgValue)
+ return
+
if key.startswith(ShareDefine.Def_Notify_WorldKey_OperationActionInfo[:-2]):
keyHead = ShareDefine.Def_Notify_WorldKey_OperationActionInfo[:-2]
actionName = key[len(keyHead):]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
index 20c46dc..fba3f9a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
@@ -63,3 +63,4 @@
g_npcKillerInfo = {} # NPC击杀者信息 {(lineID, objID, npcID):[killerDict, curTeam, hurtType, hurtID], ...}
+g_familyPartyInfo = {} #[ [[familyID, familyName, 答题数量]], top名字,top答题数量]
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 0e3b58b..c6f474d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -162,6 +162,8 @@
Def_Notify_WorldKey_FamilyBossOpenCount = "FamilyBossOpenCount" # 仙盟boss开启次数
+Def_Notify_WorldKey_FamilyPartyInfo = "FamilyPartyInfo" # 仙盟宴会数据
+
Def_Notify_WorldKey_MergeBoss = "Merge_Boss" # 跨服boss
Def_Notify_WorldKey_Merge_PK = "Merge_PK" # 跨服PK, 仅跨服服务器有用,做为触发PKState用
--
Gitblit v1.8.0