示例#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)
示例#2
0
文件: form.py 项目: taishan90/mud
 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 ) )
示例#3
0
def zoneListCmd( clientId, remaining ):
    zoneTemplates = zoneList()

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

    sendToClient( clientId, zones )
示例#4
0
def mobListCmd(clientId, remaining):
    mobTemplates = mobList()

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

    sendToClient(clientId, mobs)
示例#5
0
文件: zoneList.py 项目: taishan90/mud
def zoneListCmd(clientId, remaining):
    zoneTemplates = zoneList()

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

    sendToClient(clientId, zones)
示例#6
0
def mobListCmd( clientId, remaining ):
    mobTemplates = mobList()

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

    sendToClient( clientId, mobs )
示例#7
0
文件: mobEdit.py 项目: taishan90/mud
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")
示例#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" )
示例#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")
示例#10
0
def defaultInvalidSelectionCallback(clientId, menuStr):
    sendToClient(clientId, menuStr)
示例#11
0
def welcomeCallback(clientId):
    sendToClient(clientId, welcomeMessage % rootCmdMap.commands())
示例#12
0
文件: chat.py 项目: taishan90/mud
def cmdChat(clientId, remaining):
    if not remaining or len(remaining) == 0:
        sendToClient(clientId, "Usage: chat msg\r\n")
        return

    cmdChatFromMsg(clientId, remaining)
示例#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 )
示例#14
0
文件: form.py 项目: taishan90/mud
def defaultInvalidSelectionCallback( clientId, menuFunc ):
    sendToClient( clientId, menuFunc( clientId ) )
示例#15
0
文件: edit.py 项目: ryanberckmans/mud
def submitEdit(clientId, text):
    sendToClient(clientId, endl + "{!{FUYou edited:%s{@%s" % (endl, text) + endl)
示例#16
0
文件: menu.py 项目: ryanberckmans/mud
 def use( self, clientId ):
     sendToClient( clientId, self.menuStr )
     pushCmdHandler( clientId, self.menuMap )
示例#17
0
文件: text.py 项目: ryanberckmans/mud
def textCallback( clientId, text ):
    sendToClient( clientId, "{!{FUYou typed:{FG %s" % text )
    popPrompt( clientId )
示例#18
0
文件: chat.py 项目: ryanberckmans/mud
def cmdChat( clientId, remaining ):
    if not remaining or len(remaining) == 0:
        sendToClient( clientId, "Usage: chat msg\r\n")
        return

    cmdChatFromMsg( clientId, remaining )
示例#19
0
文件: mobEdit.py 项目: taishan90/mud
def _invalidMobId(clientId, token):
    sendToClient(clientId, "Invalid mob id '%s'" % token)
示例#20
0
def _activate( clientId, textEditor ):
    pushCmdHandler( clientId, textEditor.cmdMap )
    pushPrompt( clientId, lambda clientId: _prompt )
    sendToClient( clientId, textEditor.menu )
示例#21
0
def submenuSelectionCallback(clientId):
    sendToClient(clientId, menu(clientId))
示例#22
0
def submenuSelectionCallback(clientId):
    sendToClient(clientId, menu(clientId))
示例#23
0
def textCallback(clientId, text):
    sendToClient(clientId, "{!{FUYou typed:{FG %s" % text)
    popPrompt(clientId)
示例#24
0
def _defaultInvalidSelectionCallback( clientId, menu ):
    sendToClient( clientId, menu )
示例#25
0
def _editMobShortNameCallback(clientId, mobTemplateForm, mobShortName):
    mobTemplateForm.mobTemplate.sname = mobShortName
    popPrompt(clientId)
    sendToClient(clientId, mobTemplateForm.form.menu(clientId))
示例#26
0
def _displayText( clientId, textEditor ):
    sendToClient( clientId, textEditor.text + endl + textEditor.menu )
示例#27
0
def _invalidZoneId(clientId, token):
    sendToClient(clientId, "Invalid zone id '%s'" % token)
示例#28
0
文件: edit.py 项目: taishan90/mud
def submitEdit( clientId, text ):
    sendToClient( clientId, endl + "{!{FUYou edited:%s{@%s" % (endl, text) + endl )
示例#29
0
def welcomeCallback( clientId ):
    sendToClient( clientId, welcomeMessage % rootCmdMap.commands() )
示例#30
0
def _invalidZoneId( clientId, token ):
    sendToClient( clientId, "Invalid zone id '%s'" % token )
示例#31
0
def _activate(clientId, textEditor):
    pushCmdHandler(clientId, textEditor.cmdMap)
    pushPrompt(clientId, lambda clientId: _prompt)
    sendToClient(clientId, textEditor.menu)
示例#32
0
def _editZoneNameCallback(clientId, zoneTemplateForm, zoneName):
    zoneTemplateForm.zoneTemplate.name = zoneName
    popPrompt(clientId)
    sendToClient(clientId, zoneTemplateForm.form.menu(clientId))
示例#33
0
def _displayText(clientId, textEditor):
    sendToClient(clientId, textEditor.text + endl + textEditor.menu)
示例#34
0
def _editZoneNameCallback( clientId, zoneTemplateForm, zoneName ):
    zoneTemplateForm.zoneTemplate.name = zoneName
    popPrompt( clientId )
    sendToClient( clientId, zoneTemplateForm.form.menu( clientId ) )
示例#35
0
def _editMobShortNameCallback(clientId, mobTemplateForm, mobShortName):
    mobTemplateForm.mobTemplate.sname = mobShortName
    popPrompt(clientId)
    sendToClient(clientId, mobTemplateForm.form.menu(clientId))
示例#36
0
 def use(self, clientId):
     sendToClient(clientId, self.menuStr)
     pushCmdHandler(clientId, self.menuMap)
示例#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)