def main(): cmdname = os.path.split(sys.argv[0])[-1] if len(sys.argv) != 2: print "%s: missing argument\nusage: %s on|off" % (cmdname, cmdname) sys.exit(1) if sys.argv[1].lower() == "on": if BattleNet.isActive(): print "already active" else: BattleNet.setActive() print "activated battle.net chat" elif sys.argv[1].lower() == "off": if not BattleNet.isActive(): print "already deactivated" else: BattleNet.setHidden() print "deactivated battle.net chat" elif sys.argv[1].lower() == "status": if BattleNet.isActive(): print "battle.net chat activated" else: print "battle.net chat deactivated" else: print "%s: ivalid argument %s\nusage: %s on|off" % (cmdname, sys.argv[1], cmdname) sys.exit(2)
def main(): BattleNet.setActive() parser = argparse.ArgumentParser(description=getDescription(), formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('account', metavar='ACCOUNT', type=WorldOfWarcraftLogin.validateAccountId, help='Account ID') parser.add_argument('char', metavar='CHAR', type=WorldOfWarcraftLogin.validateCharId, help='Char ID') parser.add_argument('professions', metavar='PROFESSION-CD', nargs='+', type=int, choices=range(len(PROFESSION_CDS)), help='Profession Cooldown ID') parser.add_argument('--hidden', '-s', dest='hidden', action='store_true', default=False, help='hide online status?') args = parser.parse_args() accId = args.account args = parser.parse_args() wow = WorldOfWarcraftLogin(args.account, args.char) wow.login(hidden=args.hidden) for pIdx in args.professions: (profession,skillname,additionalCommands) = PROFESSION_CDS[pIdx] if profession: wow.craft(profession,skillname) for cmd in additionalCommands: wow.command(cmd) wow.delay("Waiting for " + cmd, WOW_ADDITIONAL_COMMAND_DELAY) wow.logout()