comparison src/plugins/plugin_misc_quiz.py @ 372:f964dcec1611

core: plugins refactored according to bridge + updatedValue now use profile
author Goffi <goffi@goffi.org>
date Wed, 06 Jul 2011 01:06:18 +0200
parents 208107419b17
children afe9cfd2ddbb
comparison
equal deleted inserted replaced
371:3ea41a199b36 372:f964dcec1611
62 def __init__(self, host): 62 def __init__(self, host):
63 info(_("Plugin Quiz initialization")) 63 info(_("Plugin Quiz initialization"))
64 self.host = host 64 self.host = host
65 self.games={} 65 self.games={}
66 self.waiting_inv = {} #Invitation waiting for people to join to launch a game 66 self.waiting_inv = {} #Invitation waiting for people to join to launch a game
67 host.bridge.addMethod("quizGameLaunch", ".communication", in_sign='ass', out_sign='', method=self.quizGameLaunch) #args: room_jid, players, profile 67 host.bridge.addMethod("quizGameLaunch", ".plugin", in_sign='ass', out_sign='', method=self.quizGameLaunch) #args: room_jid, players, profile
68 host.bridge.addMethod("quizGameCreate", ".communication", in_sign='sass', out_sign='', method=self.quizGameCreate) #args: room_jid, players, profile 68 host.bridge.addMethod("quizGameCreate", ".plugin", in_sign='sass', out_sign='', method=self.quizGameCreate) #args: room_jid, players, profile
69 host.bridge.addMethod("quizGameReady", ".communication", in_sign='sss', out_sign='', method=self.newPlayerReady) #args: player, referee, profile 69 host.bridge.addMethod("quizGameReady", ".plugin", in_sign='sss', out_sign='', method=self.newPlayerReady) #args: player, referee, profile
70 host.bridge.addMethod("quizGameAnswer", ".communication", in_sign='ssss', out_sign='', method=self.playerAnswer) 70 host.bridge.addMethod("quizGameAnswer", ".plugin", in_sign='ssss', out_sign='', method=self.playerAnswer)
71 host.bridge.addSignal("quizGameStarted", ".communication", signature='ssass') #args: room_jid, referee, players, profile 71 host.bridge.addSignal("quizGameStarted", ".plugin", signature='ssass') #args: room_jid, referee, players, profile
72 host.bridge.addSignal("quizGameNew", ".communication", 72 host.bridge.addSignal("quizGameNew", ".plugin",
73 signature='sa{ss}s', 73 signature='sa{ss}s',
74 doc = { 'summary': 'Start a new game', 74 doc = { 'summary': 'Start a new game',
75 'param_0': "room_jid: jid of game's room", 75 'param_0': "room_jid: jid of game's room",
76 'param_1': "game_data: data of the game", 76 'param_1': "game_data: data of the game",
77 'param_2': '%(doc_profile)s'}) 77 'param_2': '%(doc_profile)s'})
78 host.bridge.addSignal("quizGameQuestion", ".communication", 78 host.bridge.addSignal("quizGameQuestion", ".plugin",
79 signature = 'sssis', 79 signature = 'sssis',
80 doc = { 'summary': "Send the current question", 80 doc = { 'summary': "Send the current question",
81 'param_0': "room_jid: jid of game's room", 81 'param_0': "room_jid: jid of game's room",
82 'param_1': "question_id: question id", 82 'param_1': "question_id: question id",
83 'param_2': "question: question to ask", 83 'param_2': "question: question to ask",
84 'param_3': "timer: timer", 84 'param_3': "timer: timer",
85 'param_4': '%(doc_profile)s'}) 85 'param_4': '%(doc_profile)s'})
86 host.bridge.addSignal("quizGamePlayerBuzzed", ".communication", 86 host.bridge.addSignal("quizGamePlayerBuzzed", ".plugin",
87 signature = 'ssbs', 87 signature = 'ssbs',
88 doc = { 'summary': "A player just pressed the buzzer", 88 doc = { 'summary': "A player just pressed the buzzer",
89 'param_0': "room_jid: jid of game's room", 89 'param_0': "room_jid: jid of game's room",
90 'param_1': "player: player who pushed the buzzer", 90 'param_1': "player: player who pushed the buzzer",
91 'param_2': "pause: should the game be paused ?", 91 'param_2': "pause: should the game be paused ?",
92 'param_3': '%(doc_profile)s'}) 92 'param_3': '%(doc_profile)s'})
93 host.bridge.addSignal("quizGamePlayerSays", ".communication", 93 host.bridge.addSignal("quizGamePlayerSays", ".plugin",
94 signature = 'sssis', 94 signature = 'sssis',
95 doc = { 'summary': "A player just pressed the buzzer", 95 doc = { 'summary': "A player just pressed the buzzer",
96 'param_0': "room_jid: jid of game's room", 96 'param_0': "room_jid: jid of game's room",
97 'param_1': "player: player who pushed the buzzer", 97 'param_1': "player: player who pushed the buzzer",
98 'param_2': "text: what the player say", 98 'param_2': "text: what the player say",
99 'param_3': "delay: how long, in seconds, the text must appear", 99 'param_3': "delay: how long, in seconds, the text must appear",
100 'param_4': '%(doc_profile)s'}) 100 'param_4': '%(doc_profile)s'})
101 host.bridge.addSignal("quizGameAnswerResult", ".communication", 101 host.bridge.addSignal("quizGameAnswerResult", ".plugin",
102 signature = 'ssba{si}s', 102 signature = 'ssba{si}s',
103 doc = { 'summary': "Result of the just given answer", 103 doc = { 'summary': "Result of the just given answer",
104 'param_0': "room_jid: jid of game's room", 104 'param_0': "room_jid: jid of game's room",
105 'param_1': "player: player who gave the answer", 105 'param_1': "player: player who gave the answer",
106 'param_2': "good_answer: True if the answer is right", 106 'param_2': "good_answer: True if the answer is right",
107 'param_3': "score: dict of score with player as key", 107 'param_3': "score: dict of score with player as key",
108 'param_4': '%(doc_profile)s'}) 108 'param_4': '%(doc_profile)s'})
109 host.bridge.addSignal("quizGameTimerExpired", ".communication", 109 host.bridge.addSignal("quizGameTimerExpired", ".plugin",
110 signature = 'ss', 110 signature = 'ss',
111 doc = { 'summary': "Nobody answered the question in time", 111 doc = { 'summary': "Nobody answered the question in time",
112 'param_0': "room_jid: jid of game's room", 112 'param_0': "room_jid: jid of game's room",
113 'param_1': '%(doc_profile)s'}) 113 'param_1': '%(doc_profile)s'})
114 host.bridge.addSignal("quizGameTimerRestarted", ".communication", 114 host.bridge.addSignal("quizGameTimerRestarted", ".plugin",
115 signature = 'sis', 115 signature = 'sis',
116 doc = { 'summary': "Nobody answered the question in time", 116 doc = { 'summary': "Nobody answered the question in time",
117 'param_0': "room_jid: jid of game's room", 117 'param_0': "room_jid: jid of game's room",
118 'param_1': "time_left: time left before timer expiration", 118 'param_1': "time_left: time left before timer expiration",
119 'param_2': '%(doc_profile)s'}) 119 'param_2': '%(doc_profile)s'})