def submit(cmdr, is_beta, client, entry): if entry.get("event") in ("Location", "StartUp"): clientReport(cmdr, is_beta, client).start() if entry.get("event") in ("Fileheader"): emitter.post( "https://us-central1-canonn-api-236217.cloudfunctions.net/postGameVersion", event)
def post_traffic(system, entry): debug("posting traffic {} ".format(system)) try: emitter.post( "https://europe-west1-canonn-api-236217.cloudfunctions.net/postTraffic", { "system": system, "timestamp": entry.get("timestamp") }) except: plug.show_error("Failed to post traffic") debug("Failed to post traffic for {}".format(system))
def submit(cmdr, is_beta, system, station, entry, client): hyperdictionDetector.submit(cmdr, is_beta, system, station, entry, client) hdsystems = ("Electra", "Asterope", "Delphi", "Merope", "Celaeno", "Maia", "HR 1185", "HIP 23759", "Witch Head Sector DL-Y d17", "Pleiades Sector HR-W d1-79", "Pleione", "Witch Head Sector GW-W c1-4") if entry.get("event") == "StartJump" and entry.get( "JumpType") == "Hyperspace": #post traffic from reference systems if system in hdsystems: post_traffic(system, entry) post_distance(system, 'Merope', entry) post_distance(system, 'Witch Head Sector IR-W c1-9', entry) if entry["event"] == "Statistics" and entry.get("TG_ENCOUNTERS"): # there is no guarentee TG_ENCOUNTER_TOTAL_LAST_SYSTEM will have a value if entry.get("TG_ENCOUNTERS").get("TG_ENCOUNTER_TOTAL_LAST_SYSTEM"): lastsystem = entry.get("TG_ENCOUNTERS").get( "TG_ENCOUNTER_TOTAL_LAST_SYSTEM") gametime = entry.get("TG_ENCOUNTERS").get( "TG_ENCOUNTER_TOTAL_LAST_TIMESTAMP") year, remainder = gametime.split("-", 1) tgtime = "{}-{}".format(str(int(year) - 1286), remainder) if lastsystem == "Pleiades Sector IR-W d1-55": lastsystem = "Delphi" debug({"cmdr": cmdr, "system": lastsystem, "timestamp": tgtime}) x, y, z = Systems.edsmGetSystem(lastsystem) # we are going to submit the hyperdiction here. emitter.post( "https://europe-west1-canonn-api-236217.cloudfunctions.net/postHD", { "cmdr": cmdr, "system": lastsystem, "timestamp": tgtime, "x": x, "y": y, "z": z }) if lastsystem: if HDReport.hdsystems.get(lastsystem) == lastsystem: debug("Hyperdiction already recorded here - session ") else: HDReport(cmdr, is_beta, lastsystem, entry, client).start() gSubmitHD(cmdr, x, y, z, entry).start()
def journal_entry(cls, cmdr, is_beta, system, station, entry, state, x, y, z, body, lat, lon, client): if entry.get("event") == "SAASignalsFound": emitter.post("https://us-central1-canonn-api-236217.cloudfunctions.net/postSAA", { "cmdr": cmdr, "beta": is_beta, "system": system, "x": x, "y": y, "z": z, "entry": entry, "body": body, "lat": lat, "lon": lon, "client": client })
def run(self): if not clientReport.done: clientReport.done = True debug("sending client report") # configure the payload payload = self.setPayload() url = self.getUrl() self.send(payload, url) debug("Google Client Report") emitter.post( "https://us-central1-canonn-api-236217.cloudfunctions.net/submitCient", { "cmdr": payload.get("cmdrName"), "beta": payload.get("isBeta"), "client": payload.get("clientVersion"), "autoupdate": payload.get("AutoUpdateDisabled") })
def run(self): self.getExcluded() # don't bother sending USS if self.entry[ "event"] == "FSSSignalDiscovered" and not "$USS" in self.entry.get( "SignalName"): emitter.post( "https://europe-west1-canonn-api-236217.cloudfunctions.net/postFSSSignal", { "signalname": self.entry.get("SignalName"), "signalNameLocalised": self.entry.get("SignalName_Localised"), "cmdr": self.cmdr, "system": self.system, "x": self.x, "y": self.y, "z": self.z, "raw_json": self.entry, }) # is this a code entry and do we want to record it? # We dont want o record any that don't begin with $ and and with ; if self.entry["event"] == "FSSSignalDiscovered" and \ not fssEmitter.excludefss.get(self.entry.get("SignalName")) and \ not "$USS" in self.entry.get("SignalName") and \ not self.entry.get( "IsStation") and \ '$' in self.entry.get("SignalName"): url = self.getUrl() if "$Warzone_TG" in self.entry.get("SignalName"): payload = self.getAXPayload() self.gSubmitAXCZ(payload) self.modelreport = "axczfssreports" elif "$Fixed_Event_Life_Cloud" in self.entry.get("SignalName"): debug("Life Cloud") payload = self.getLcPayload() self.modelreport = "lcfssreports" else: payload = self.getFssPayload() self.modelreport = "reportfsses" self.send(payload, url)
def run(self): self.getExcluded() # is this a code entry and do we want to record it? if not codexEmitter.excludecodices.get(self.entry.get("Name").lower()) and not self.entry.get( "Category") == '$Codex_Category_StellarBodies;': self.getReportTypes(self.entry.get("EntryID")) url = self.getUrl() emitter.post("https://us-central1-canonn-api-236217.cloudfunctions.net/postCodex", { "cmdr": self.cmdr, "beta": self.is_beta, "system": self.system, "x": self.x, "y": self.y, "z": self.z, "entry": self.entry, "body": self.body, "lat": self.lat, "lon": self.lon, "client": self.client} ) jid = self.entry.get("EntryID") reportType = codexEmitter.reporttypes.get(str(jid)) if reportType: debug(reportType) if reportType.get("location") == "body": payload = self.getBodyPayload(reportType.get("type")) self.modelreport = reportType.get("endpoint") else: payload = self.getSystemPayload(reportType.get("type")) self.modelreport = reportType.get("endpoint") else: payload = self.getCodexPayload() self.modelreport = "reportcodices" debug("Send Reports {}/{}".format(url, self.modelreport)) self.send(payload, url)
def Music(cls, system, cmdr, timestamp): if cls.state == 2: debug("Hyperdiction Detected") cls.show() x, y, z = Systems.edsmGetSystem(system) emitter.post( "https://europe-west1-canonn-api-236217.cloudfunctions.net/postHDDetected", { "cmdr": cmdr, "system": system, "timestamp": timestamp, "x": x, "y": y, "z": z }) plug.show_error("Hyperdiction: Exit to main menu") else: debug("FSDJUMP resetting state back") cls.hide() cls.state == 0