Mercurial > libervia-backend
diff src/plugins/plugin_misc_tarot.py @ 718:074970227bc0
plugin tools: turn src/plugin/games.py into a plugin and move it to src/plugins/plugin_misc_room_game.py
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 21 Nov 2013 18:23:08 +0100 |
parents | 358018c5c398 |
children | 56aa0e98c92e |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_tarot.py Thu Nov 21 15:49:53 2013 +0100 +++ b/src/plugins/plugin_misc_tarot.py Thu Nov 21 18:23:08 2013 +0100 @@ -24,7 +24,6 @@ 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 @@ "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')]