From 388823edfe6308cba6f76ca6dc4f20022c5cb2be Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 30 六月 2025 19:03:50 +0800 Subject: [PATCH] 10431 【英文】看广告获得限时代金券 --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py index f6b51be..dea19da 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyParty.py @@ -183,8 +183,14 @@ for i in xrange(ipyMgr.GetQuestionBankCount()): ipyData = ipyMgr.GetQuestionBankByIndex(i) questionID = ipyData.GetID() + try: + eval(ipyData.GetAnswer()) + except: + GameWorld.ErrLog("答题题库答案异常,不处理! questionID=%s,answer=%s" % (questionID, ipyData.GetAnswer())) + continue allQuestionIDList.append(questionID) IpyGameDataPY.SetConfigEx('AllQuestionID', allQuestionIDList) + GameWorld.Log("加载仙盟宴会答题题库ID! %s" % str(allQuestionIDList)) if not allQuestionIDList: GameWorld.ErrLog('仙盟宴会题库没有题目!') return @@ -200,8 +206,12 @@ ipyData = IpyGameDataPY.GetIpyGameData('QuestionBank', lastQuestionID) if ipyData: answer = ipyData.GetAnswer() - answer = answer.replace('[', '') - answer = answer.replace(']', '') + #不能用replace, 可能导致替换错误, 如 ['望廬山瀑布'] 为 "['\xcd\xfb\x8f]\xc9\xbd\xc6\xd9\xb2\xbc']" 中间有个 ] 替换会导致乱码 + #answer = answer.replace('[', '') + #answer = answer.replace(']', '') + answer = answer.strip() + if answer.startswith("[") and answer.endswith("]"): + answer = answer[1:-1] PlayerControl.FamilyNotify(familyID, 'Party_Correct', [maxSecond, GameWorld.GbkToCode(answer)]) for index in xrange(family.GetCount()): -- Gitblit v1.8.0