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)
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 ) )
def zoneListCmd( clientId, remaining ): zoneTemplates = zoneList() zones = "{!{FGZone Templates:{FC" + endl for zt in zoneTemplates: zones += " " + str(zt) + endl sendToClient( clientId, zones )
def mobListCmd(clientId, remaining): mobTemplates = mobList() mobs = "{!{FGMob Templates:{FC" + endl for mt in mobTemplates: mobs += " " + str(mt) + endl sendToClient(clientId, mobs)
def zoneListCmd(clientId, remaining): zoneTemplates = zoneList() zones = "{!{FGZone Templates:{FC" + endl for zt in zoneTemplates: zones += " " + str(zt) + endl sendToClient(clientId, zones)
def mobListCmd( clientId, remaining ): mobTemplates = mobList() mobs = "{!{FGMob Templates:{FC" + endl for mt in mobTemplates: mobs += " " + str(mt) + endl sendToClient( clientId, mobs )
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")
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" )
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")
def defaultInvalidSelectionCallback(clientId, menuStr): sendToClient(clientId, menuStr)
def welcomeCallback(clientId): sendToClient(clientId, welcomeMessage % rootCmdMap.commands())
def cmdChat(clientId, remaining): if not remaining or len(remaining) == 0: sendToClient(clientId, "Usage: chat msg\r\n") return cmdChatFromMsg(clientId, remaining)
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 )
def defaultInvalidSelectionCallback( clientId, menuFunc ): sendToClient( clientId, menuFunc( clientId ) )
def submitEdit(clientId, text): sendToClient(clientId, endl + "{!{FUYou edited:%s{@%s" % (endl, text) + endl)
def use( self, clientId ): sendToClient( clientId, self.menuStr ) pushCmdHandler( clientId, self.menuMap )
def textCallback( clientId, text ): sendToClient( clientId, "{!{FUYou typed:{FG %s" % text ) popPrompt( clientId )
def cmdChat( clientId, remaining ): if not remaining or len(remaining) == 0: sendToClient( clientId, "Usage: chat msg\r\n") return cmdChatFromMsg( clientId, remaining )
def _invalidMobId(clientId, token): sendToClient(clientId, "Invalid mob id '%s'" % token)
def _activate( clientId, textEditor ): pushCmdHandler( clientId, textEditor.cmdMap ) pushPrompt( clientId, lambda clientId: _prompt ) sendToClient( clientId, textEditor.menu )
def submenuSelectionCallback(clientId): sendToClient(clientId, menu(clientId))
def submenuSelectionCallback(clientId): sendToClient(clientId, menu(clientId))
def textCallback(clientId, text): sendToClient(clientId, "{!{FUYou typed:{FG %s" % text) popPrompt(clientId)
def _defaultInvalidSelectionCallback( clientId, menu ): sendToClient( clientId, menu )
def _editMobShortNameCallback(clientId, mobTemplateForm, mobShortName): mobTemplateForm.mobTemplate.sname = mobShortName popPrompt(clientId) sendToClient(clientId, mobTemplateForm.form.menu(clientId))
def _displayText( clientId, textEditor ): sendToClient( clientId, textEditor.text + endl + textEditor.menu )
def _invalidZoneId(clientId, token): sendToClient(clientId, "Invalid zone id '%s'" % token)
def submitEdit( clientId, text ): sendToClient( clientId, endl + "{!{FUYou edited:%s{@%s" % (endl, text) + endl )
def welcomeCallback( clientId ): sendToClient( clientId, welcomeMessage % rootCmdMap.commands() )
def _invalidZoneId( clientId, token ): sendToClient( clientId, "Invalid zone id '%s'" % token )
def _activate(clientId, textEditor): pushCmdHandler(clientId, textEditor.cmdMap) pushPrompt(clientId, lambda clientId: _prompt) sendToClient(clientId, textEditor.menu)
def _editZoneNameCallback(clientId, zoneTemplateForm, zoneName): zoneTemplateForm.zoneTemplate.name = zoneName popPrompt(clientId) sendToClient(clientId, zoneTemplateForm.form.menu(clientId))
def _displayText(clientId, textEditor): sendToClient(clientId, textEditor.text + endl + textEditor.menu)
def _editZoneNameCallback( clientId, zoneTemplateForm, zoneName ): zoneTemplateForm.zoneTemplate.name = zoneName popPrompt( clientId ) sendToClient( clientId, zoneTemplateForm.form.menu( clientId ) )
def _editMobShortNameCallback(clientId, mobTemplateForm, mobShortName): mobTemplateForm.mobTemplate.sname = mobShortName popPrompt(clientId) sendToClient(clientId, mobTemplateForm.form.menu(clientId))
def use(self, clientId): sendToClient(clientId, self.menuStr) pushCmdHandler(clientId, self.menuMap)
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)