plugin tools: turn src/plugin/games.py into a plugin and move it to src/plugins/plugin_misc_room_game.py
This commit is contained in:
parent
ea67ed7a61
commit
674a3e958d
1 changed files with 49 additions and 23 deletions
|
|
@ -28,7 +28,6 @@ import random
|
|||
from wokkel import data_form
|
||||
from sat.tools.xml_tools import dataForm2XML
|
||||
from sat.tools.frontends.games import TarotCard
|
||||
from sat.tools.plugins.games import RoomGame
|
||||
from time import time
|
||||
|
||||
|
||||
|
|
@ -40,18 +39,24 @@ PLUGIN_INFO = {
|
|||
"import_name": "Quiz",
|
||||
"type": "Game",
|
||||
"protocols": [],
|
||||
"dependencies": ["XEP-0045", "XEP-0249"],
|
||||
"dependencies": ["XEP-0045", "XEP-0249", "ROOM-GAME"],
|
||||
"main": "Quiz",
|
||||
"handler": "yes",
|
||||
"description": _("""Implementation of Quiz game""")
|
||||
}
|
||||
|
||||
|
||||
class Quiz(RoomGame):
|
||||
class Quiz(object):
|
||||
|
||||
def inheritFromRoomGame(self, host):
|
||||
global RoomGame
|
||||
RoomGame = host.plugins["ROOM-GAME"].__class__
|
||||
self.__class__ = type(self.__class__.__name__, (self.__class__, RoomGame, object), {})
|
||||
|
||||
def __init__(self, host):
|
||||
info(_("Plugin Quiz initialization"))
|
||||
RoomGame.__init__(self, host, PLUGIN_INFO, (NS_QG, QG_TAG), game_init={'stage': None}, player_init={'score': 0})
|
||||
self.inheritFromRoomGame(host)
|
||||
RoomGame._init_(self, host, PLUGIN_INFO, (NS_QG, QG_TAG), game_init={'stage': None}, player_init={'score': 0})
|
||||
host.bridge.addMethod("quizGameLaunch", ".plugin", in_sign='asss', out_sign='', method=self.prepareRoom) # args: players, room_jid, profile
|
||||
host.bridge.addMethod("quizGameCreate", ".plugin", in_sign='sass', out_sign='', method=self.createGame) # args: room_jid, players, profile
|
||||
host.bridge.addMethod("quizGameReady", ".plugin", in_sign='sss', out_sign='', method=self.playerReady) # args: player, referee, profile
|
||||
|
|
|
|||
Loading…
Reference in a new issue