Exemplo n.º 1
0
 def activate(self, clientId):
     """
     convenience function. pushes menu cmdMap and prompt, and displays menu
     """
     pushCmdHandler(clientId, self.cmdMap)
     pushPrompt(clientId, lambda x: self.prompt)
     sendToClient(clientId, self.menu)
Exemplo n.º 2
0
 def activate( self, clientId ):
     """
     convenience function. pushes menu cmdMap and prompt, and displays menu
     """
     pushCmdHandler( clientId, self.cmdMap )
     pushPrompt( clientId, lambda x: self.prompt )
     sendToClient( clientId, self.menu( clientId ) )
Exemplo n.º 3
0
def zoneListCmd( clientId, remaining ):
    zoneTemplates = zoneList()

    zones = "{!{FGZone Templates:{FC" + endl
    for zt in zoneTemplates:
        zones += " " + str(zt) + endl

    sendToClient( clientId, zones )
Exemplo n.º 4
0
def mobListCmd(clientId, remaining):
    mobTemplates = mobList()

    mobs = "{!{FGMob Templates:{FC" + endl
    for mt in mobTemplates:
        mobs += " " + str(mt) + endl

    sendToClient(clientId, mobs)
Exemplo n.º 5
0
def zoneListCmd(clientId, remaining):
    zoneTemplates = zoneList()

    zones = "{!{FGZone Templates:{FC" + endl
    for zt in zoneTemplates:
        zones += " " + str(zt) + endl

    sendToClient(clientId, zones)
Exemplo n.º 6
0
def mobListCmd( clientId, remaining ):
    mobTemplates = mobList()

    mobs = "{!{FGMob Templates:{FC" + endl
    for mt in mobTemplates:
        mobs += " " + str(mt) + endl

    sendToClient( clientId, mobs )
Exemplo n.º 7
0
def mobEditCmd(clientId, remaining):
    if remaining:
        (token, remaining) = first_token(remaining)
        templateId = toInt(token)

        if templateId:
            mobTemplate = getMobTemplate(templateId)

            if mobTemplate:
                _editMob(clientId, mobTemplate)
                return

        _invalidMobId(clientId, token)

    # MobTemplateSelector
    sendToClient(clientId, "MobTemplateSelector not impl")
Exemplo n.º 8
0
def zoneEditCmd( clientId, remaining):
    if remaining:
        (token, remaining) = first_token(remaining)
        templateId = toInt(token)

        if templateId:
            zoneTemplate = getZoneTemplate( templateId )

            if zoneTemplate:
                _editZone( clientId, zoneTemplate )
                return
            
        _invalidZoneId( clientId, token )

    # ZoneTemplateSelector
    sendToClient( clientId, "ZoneTemplateSelector not impl" )
Exemplo n.º 9
0
def zoneEditCmd(clientId, remaining):
    if remaining:
        (token, remaining) = first_token(remaining)
        templateId = toInt(token)

        if templateId:
            zoneTemplate = getZoneTemplate(templateId)

            if zoneTemplate:
                _editZone(clientId, zoneTemplate)
                return

        _invalidZoneId(clientId, token)

    # ZoneTemplateSelector
    sendToClient(clientId, "ZoneTemplateSelector not impl")
Exemplo n.º 10
0
def defaultInvalidSelectionCallback(clientId, menuStr):
    sendToClient(clientId, menuStr)
Exemplo n.º 11
0
def welcomeCallback(clientId):
    sendToClient(clientId, welcomeMessage % rootCmdMap.commands())
Exemplo n.º 12
0
def cmdChat(clientId, remaining):
    if not remaining or len(remaining) == 0:
        sendToClient(clientId, "Usage: chat msg\r\n")
        return

    cmdChatFromMsg(clientId, remaining)
Exemplo n.º 13
0
def cmdColumnsDemo( clientId, remaining ):
    sendToClient( clientId, "\r\n{!{FYColumns Demo:\r\n\r\n" + toColumns( [ rootCmdMap.commands(), "no color\r\n{!bold\r\n{FMfore magenta\r\n" + rootCmdMap.commands(), demoMsg ], [9, 15, 40], True ) + noSeps )
Exemplo n.º 14
0
def defaultInvalidSelectionCallback( clientId, menuFunc ):
    sendToClient( clientId, menuFunc( clientId ) )
Exemplo n.º 15
0
def submitEdit(clientId, text):
    sendToClient(clientId, endl + "{!{FUYou edited:%s{@%s" % (endl, text) + endl)
Exemplo n.º 16
0
 def use( self, clientId ):
     sendToClient( clientId, self.menuStr )
     pushCmdHandler( clientId, self.menuMap )
Exemplo n.º 17
0
def textCallback( clientId, text ):
    sendToClient( clientId, "{!{FUYou typed:{FG %s" % text )
    popPrompt( clientId )
Exemplo n.º 18
0
def cmdChat( clientId, remaining ):
    if not remaining or len(remaining) == 0:
        sendToClient( clientId, "Usage: chat msg\r\n")
        return

    cmdChatFromMsg( clientId, remaining )
Exemplo n.º 19
0
def _invalidMobId(clientId, token):
    sendToClient(clientId, "Invalid mob id '%s'" % token)
Exemplo n.º 20
0
def _activate( clientId, textEditor ):
    pushCmdHandler( clientId, textEditor.cmdMap )
    pushPrompt( clientId, lambda clientId: _prompt )
    sendToClient( clientId, textEditor.menu )
Exemplo n.º 21
0
def submenuSelectionCallback(clientId):
    sendToClient(clientId, menu(clientId))
Exemplo n.º 22
0
def submenuSelectionCallback(clientId):
    sendToClient(clientId, menu(clientId))
Exemplo n.º 23
0
def textCallback(clientId, text):
    sendToClient(clientId, "{!{FUYou typed:{FG %s" % text)
    popPrompt(clientId)
Exemplo n.º 24
0
def _defaultInvalidSelectionCallback( clientId, menu ):
    sendToClient( clientId, menu )
Exemplo n.º 25
0
def _editMobShortNameCallback(clientId, mobTemplateForm, mobShortName):
    mobTemplateForm.mobTemplate.sname = mobShortName
    popPrompt(clientId)
    sendToClient(clientId, mobTemplateForm.form.menu(clientId))
Exemplo n.º 26
0
def _displayText( clientId, textEditor ):
    sendToClient( clientId, textEditor.text + endl + textEditor.menu )
Exemplo n.º 27
0
def _invalidZoneId(clientId, token):
    sendToClient(clientId, "Invalid zone id '%s'" % token)
Exemplo n.º 28
0
def submitEdit( clientId, text ):
    sendToClient( clientId, endl + "{!{FUYou edited:%s{@%s" % (endl, text) + endl )
Exemplo n.º 29
0
def welcomeCallback( clientId ):
    sendToClient( clientId, welcomeMessage % rootCmdMap.commands() )
Exemplo n.º 30
0
def _invalidZoneId( clientId, token ):
    sendToClient( clientId, "Invalid zone id '%s'" % token )
Exemplo n.º 31
0
def _activate(clientId, textEditor):
    pushCmdHandler(clientId, textEditor.cmdMap)
    pushPrompt(clientId, lambda clientId: _prompt)
    sendToClient(clientId, textEditor.menu)
Exemplo n.º 32
0
def _editZoneNameCallback(clientId, zoneTemplateForm, zoneName):
    zoneTemplateForm.zoneTemplate.name = zoneName
    popPrompt(clientId)
    sendToClient(clientId, zoneTemplateForm.form.menu(clientId))
Exemplo n.º 33
0
def _displayText(clientId, textEditor):
    sendToClient(clientId, textEditor.text + endl + textEditor.menu)
Exemplo n.º 34
0
def _editZoneNameCallback( clientId, zoneTemplateForm, zoneName ):
    zoneTemplateForm.zoneTemplate.name = zoneName
    popPrompt( clientId )
    sendToClient( clientId, zoneTemplateForm.form.menu( clientId ) )
Exemplo n.º 35
0
def _editMobShortNameCallback(clientId, mobTemplateForm, mobShortName):
    mobTemplateForm.mobTemplate.sname = mobShortName
    popPrompt(clientId)
    sendToClient(clientId, mobTemplateForm.form.menu(clientId))
Exemplo n.º 36
0
 def use(self, clientId):
     sendToClient(clientId, self.menuStr)
     pushCmdHandler(clientId, self.menuMap)
Exemplo n.º 37
0
def cmdColumnsDemo(clientId, remaining):
    sendToClient(
        clientId, "\r\n{!{FYColumns Demo:\r\n\r\n" + toColumns([
            rootCmdMap.commands(), "no color\r\n{!bold\r\n{FMfore magenta\r\n"
            + rootCmdMap.commands(), demoMsg
        ], [9, 15, 40], True) + noSeps)