|  |  |  | 
|---|
|  |  |  | import random | 
|---|
|  |  |  |  | 
|---|
|  |  |  | FamilyPartyFB_QuestionID = 'FamilyPartyFB_QuestionID%s' #当前题ID | 
|---|
|  |  |  | FamilyPartyFB_QuestionTick = 'FamilyPartyFB_QuestionTick%s' #当前题出题时间 | 
|---|
|  |  |  | FamilyPartyFB_AnswerTick = 'FamilyPartyFB_AnswerTick%s' #答对时间 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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()) | 
|---|