| | |
| | | import random
|
| | |
|
| | | FamilyPartyFB_QuestionID = 'FamilyPartyFB_QuestionID%s' #当前题ID
|
| | | FamilyPartyFB_QuestionTick = 'FamilyPartyFB_QuestionTick%s' #当前题出题时间
|
| | | FamilyPartyFB_AnswerTick = 'FamilyPartyFB_AnswerTick%s' #答对时间
|
| | |
|
| | |
|
| | | AnswerState = 2 #开始答题活动状态
|
| | | ## 玩家登录
|
| | | # @param None
|
| | | # @return None
|
| | |
| | | #刚登录的或刚进仙盟的补发最近的题目
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | state = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyParty)
|
| | | if state != 1:
|
| | | if state != AnswerState:
|
| | | return
|
| | | curFamilyid = curPlayer.GetFamilyID()
|
| | | if not curFamilyid:
|
| | |
| | | #开始出题
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | state = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyParty)
|
| | | if state != 1:
|
| | | if state != AnswerState:
|
| | | return
|
| | | allQuestionIDList = IpyGameDataPY.GetConfigEx('AllQuestionID')
|
| | | ipyMgr = IpyGameDataPY.IPY_Data()
|
| | |
| | | for i in range(0, familyManager.GetCount()):
|
| | | family = familyManager.GetAt(i)
|
| | | familyID = family.GetID()
|
| | | |
| | | if gameWorld.GetDictByKey(FamilyPartyFB_QuestionID % familyID):
|
| | | lastQuestionID = gameWorld.GetDictByKey(FamilyPartyFB_QuestionID % familyID)
|
| | | if lastQuestionID:
|
| | | #还有题未答
|
| | | continue
|
| | | maxSecond = IpyGameDataPY.GetFuncCfg('FairyCorrectAnswer')
|
| | | if tick - gameWorld.GetDictByKey(FamilyPartyFB_QuestionTick % familyID) > maxSecond*1000:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('QuestionBank', lastQuestionID)
|
| | | if ipyData:
|
| | | answer = ipyData.GetAnswer()
|
| | | answer = answer.replace('[', '')
|
| | | answer = answer.replace(']', '')
|
| | | PlayerControl.FamilyNotify(familyID, 'Party_Correct', [maxSecond, GameWorld.GbkToCode(answer)])
|
| | | else:
|
| | | continue
|
| | | answerTick = gameWorld.GetDictByKey(FamilyPartyFB_AnswerTick % familyID)
|
| | | if tick - answerTick < 5000:
|
| | | if not lastQuestionID and tick - answerTick < 5000:
|
| | | continue
|
| | |
|
| | | #随机题目
|
| | |
| | | break
|
| | |
|
| | | gameWorld.SetDict(FamilyPartyFB_QuestionID % familyID, questionID)
|
| | | gameWorld.SetDict(FamilyPartyFB_QuestionTick % familyID, tick)
|
| | | |
| | | PlayerControl.FamilyNotify(familyID, 'Party_Topic', [questionID])
|
| | | return
|
| | |
|
| | |
| | |
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | state = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyParty)
|
| | | if state != 1:
|
| | | if state != AnswerState:
|
| | | return
|
| | |
|
| | | curFamilyid = curPlayer.GetFamilyID()
|
| | |
| | | if not ipyData:
|
| | | GameWorld.ErrLog('仙盟宴会答题 该题不存在,异常 questionID=%s, 重新出题'%questionID)
|
| | | gameWorld.SetDict(FamilyPartyFB_QuestionID % curFamilyid, 0)
|
| | | gameWorld.SetDict(FamilyPartyFB_QuestionTick % curFamilyid, 0)
|
| | | return
|
| | |
|
| | | answerList = eval(ipyData.GetAnswer())
|
| | |
| | | ChContent = GameWorld.CodeToGBK(ChContent)
|
| | | ChContent = ChContent.strip()
|
| | | isRight = ChContent in answerList
|
| | | # if curPlayer.GetMapID() != ChConfig.Def_FBMapID_FamilyParty:
|
| | | # if isRight:
|
| | | # PlayerControl.FamilyNotify(curFamilyid, 'FamilyPleaseIntoParty')
|
| | | # PlayerControl.NotifyCode(curPlayer, 'FamilyNoIntoParty')
|
| | | # return
|
| | | if curPlayer.GetMapID() != ChConfig.Def_FBMapID_FamilyParty:
|
| | | if isRight:
|
| | | PlayerControl.FamilyNotify(curFamilyid, 'FamilyPleaseIntoParty')
|
| | | PlayerControl.NotifyCode(curPlayer, 'FamilyNoIntoParty')
|
| | | return
|
| | |
|
| | | playerID = curPlayer.GetID()
|
| | | GameWorld.DebugLog(" answer=%s ChContent=%s"%(answerList, ChContent), playerID)
|