A corporation manager and dashboard for EVE Online
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

48 lignes
1.4 KiB

  1. # -*- coding: utf-8 -*-
  2. from flask import g
  3. from .._provided import config
  4. __all__ = ["get_current", "get_count", "get_summary", "get_unit"]
  5. def get_current():
  6. """Return the name of the currently selected campaign, or None."""
  7. if not config["enabled"]:
  8. return None
  9. setting = g.auth.get_character_modprop("campaigns", "current")
  10. if not setting or setting not in config["enabled"]:
  11. return config["enabled"][0]
  12. return setting
  13. def get_count(cname, opname):
  14. """Return the primary operation count for the given campaign/operation."""
  15. key = cname + "." + opname
  16. operation = config["campaigns"][cname]["operations"][opname]
  17. optype = operation["type"]
  18. qualifiers = operation["qualifiers"]
  19. ...
  20. import random
  21. return [random.randint(0, 500), random.randint(10000, 500000), random.randint(10000000, 50000000000)][random.randint(0, 2)]
  22. def get_summary(name, opname, limit=5):
  23. """Return a sample fraction of results for the given campaign/operation."""
  24. ...
  25. return []
  26. def get_unit(operation, num):
  27. """Return the correct form of the unit tracked by the given operation."""
  28. types = {
  29. "killboard": "ship|ships",
  30. "collection": "item|items"
  31. }
  32. if "unit" in operation:
  33. unit = operation["unit"]
  34. else:
  35. unit = types[operation["type"]]
  36. if "|" in unit:
  37. return unit.split("|")[0 if num == 1 else 1]
  38. return unit