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
|
|
@ -24,7 +24,6 @@ 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
|
||||
import random
|
||||
|
||||
|
|
@ -37,18 +36,24 @@ PLUGIN_INFO = {
|
|||
"import_name": "Tarot",
|
||||
"type": "Misc",
|
||||
"protocols": [],
|
||||
"dependencies": ["XEP-0045", "XEP-0249"],
|
||||
"dependencies": ["XEP-0045", "XEP-0249", "ROOM-GAME"],
|
||||
"main": "Tarot",
|
||||
"handler": "yes",
|
||||
"description": _("""Implementation of Tarot card game""")
|
||||
}
|
||||
|
||||
|
||||
class Tarot(RoomGame):
|
||||
class Tarot(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 Tarot initialization"))
|
||||
RoomGame.__init__(self, host, PLUGIN_INFO, (NS_CG, CG_TAG),
|
||||
self.inheritFromRoomGame(host)
|
||||
RoomGame._init_(self, host, PLUGIN_INFO, (NS_CG, CG_TAG),
|
||||
game_init={'hand_size': 18, 'init_player': 0, 'current_player': None, 'contrat': None, 'stage': None},
|
||||
player_init={'score': 0})
|
||||
self.contrats = [_('Passe'), _('Petite'), _('Garde'), _('Garde Sans'), _('Garde Contre')]
|
||||
|
|
|
|||
Loading…
Reference in a new issue