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:
souliane 2013-11-21 18:23:08 +01:00
commit 674a3e958d

View file

@ -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')]