view plugins/server/base_plugin.py @ 248:1df5912db00c beta tip

Traipse Beta 'OpenRPG' {101205-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log New Earthdawn Dieroller New IronClaw roller, sheet, and image New ShapeShifter PC Sheet Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner Update to Dieroller. Cleaner, more effecient expression system Update to Hidden Die plugin, allows for non standard dice rolls Update to location.py, allows for more portable references when starting Traipse Update to the Features node Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to Server, removing wxPython dependencies where not needed Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug Fix to Gametree for XSLT Sheets Fix to Gametree for locating gametree files Fix to Send to Chat from Gametree Fix to Gametree, renaming and remapping operates correctly Fix to aliaslib, prevents error caused when SafeHTML is sent None
author sirebral
date Sun, 05 Dec 2010 10:53:30 -0600
parents 4385a7d0efd1
children
line wrap: on
line source

import sys
import os

class BasePluginClass(object):
    def __init__(self):
        self.__name = ""
        self.__author = ""
        self.__help = ""
        self.__file = __file__
        self.__activated = False
        self.__inputpriority = -1 # -1 = not used; 99 = priority doesn't matter
                                  # Any other number is priority, lowest number
                                  # executes first
        self.__outputpriority = -1# -1 = not used; 99 = priority doesn't matter
                                  # Any other number is priority, lowest number
                                  # executes first
        self.__pollpriority = -1  # -1 = not used; 99 = priority doesn't matter
                                  # Any other number is priority, lowest number
                                  # executes first


    def preParseIncoming(self, xml_dom, data):
        return xml_dom, data

    def postParseIncoming(self, data):
        return data

    def getPlayer(self):
        return None

    def setPlayer(self, playerData):
        return

    def preParseOutgoing(self):
        return []


    def _getName(self):
        return self.__name

    def _setName(self, val):
        if isinstance(val, basestring):
            self.__name = val
        else:
            self.__name = str(val)


    def _getAuthor(self):
        return self.__author

    def _setAuthor(self, val):
        if isinstance(val, basestring):
            self.__author = val
        else:
            self.__author = str(val)


    def _getHelp(self):
        return self.__help

    def _setHelp(self, val):
        if isinstance(val, basestring):
            self.__help = val
        else:
            self.__help = str(val)


    def _getFile(self):
        return self.__file

    def _setFile(self, val):
        if isinstance(val, basestring):
            self.__file = val
        else:
            self.__file = str(val)


    def _getActivated(self):
        return self.__activated

    def _setActivated(self, val):
        if isinstance(val, bool):
            self.__activated = val
        elif isinstance(val, int):
            if val <= 0:
                self.__activated = False
            else:
                self.__activated = True
        else:
            self.__activated = False


    def _getInputPriority(self):
        return self.__activated

    def _setInputPriority(self, val):
        if isinstance(val, int) and val in xrange(-1, 100):
            self.__inputpriority = val
        else:
            self.__inputpriority = -1


    def _getOutputPriority(self):
        return self.__activated

    def _setOutputPriority(self, val):
        if isinstance(val, int) and val in xrange(-1, 100):
            self.__outputpriority = val
        else:
            self.__outputpriority = -1


    def _getPollPriority(self):
        return self.__pollpriority

    def _setPollPriority(self, val):
        if isinstance(val, int) and val in xrange(-1, 100):
            self.__pollpriority = val
        else:
            self.__pollpriority = -1

    Name = property(_getName, _setName)
    Author = property(_getAuthor, _setAuthor)
    Help = property(_getHelp, _setHelp)
    File = property(_getFile, _setFile)
    Activated = property(_getActivated, _setActivated)
    InputPriority = property(_getInputPriority, _setInputPriority)
    OutputPriority = property(_getOutputPriority, _setOutputPriority)
    PollPriority = property(_getPollPriority, _setPollPriority)