Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.85 KB | None | 0 0
  1. import re
  2. import sys
  3. from evennia import ObjectDB, AccountDB
  4. from evennia import default_cmds
  5. from evennia.utils import create, evtable, make_iter
  6. from evennia.comms.models import Msg
  7. from typeclasses.accounts import Account
  8. from world.utils import parse_switches, itemize
  9.  
  10.    
  11. class CmdJobs(default_cmds.MuxCommand):
  12.  
  13.     key = "@jobs"
  14.     lock = "cmd:all()"
  15.     help_category = "Comms"
  16.     switchtab = ("new", "delete", "category", "priority", "assign", "status", "list", "lock", "complete")
  17.  
  18.     def _create_job():
  19.         pass
  20.    
  21.     def _delete_job():
  22.         pass
  23.  
  24.     def do_new(self):
  25.         self.caller.msg("NEW")
  26.  
  27.     def do_delete(self):
  28.         self.caller.msg("DELETE")
  29.  
  30.     def do_category(self):
  31.         self.caller.msg("CATEGORY")
  32.  
  33.     def do_priority(self):
  34.         self.caller.msg("PRIORITY")
  35.        
  36.     def do_assign(self):
  37.         self.caller.msg("ASSIGN")
  38.        
  39.     def do_status(self):
  40.         self.caller.msg("STATUS")
  41.        
  42.     def do_list(self):
  43.         self.caller.msg("LIST")
  44.        
  45.     def do_lock(self):
  46.         self.caller.msg("LOCK")
  47.                
  48.     def do_complete(self):
  49.         self.caller.msg("COMPLETE")
  50.  
  51.     # The actual command handler!      
  52.     def func(self):
  53.         # Cache this
  54.         caller = self.caller
  55.  
  56.         if not self.switches:
  57.             caller.msg("Usage: @jobs[/switch] <args>")
  58.             return
  59.        
  60.         switch = parse_switches(self):
  61.         if not switch:
  62.             return
  63.                  
  64.         # Lookup the name of the handler based on the switch
  65.         method = getattr(self, "do_%s" % switch)
  66.        
  67.         # Make sure it exists and is callable
  68.         if method and callable(method):
  69.             # Call it!
  70.             method()
  71.         else:
  72.             # Report the error.
  73.             caller.msg("JOBS: No such handler.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement