Moin Leute,
aktuell bin ich dabei meine GK Datenbank auszubauen. Das Ganze basiert auf das System von Martin.
Ähnlich läuft es aktuell beim PD Keybinder.
Da ich jedoch der Meinung bin, dass jeder Zugriff auf dieses System haben sollte, stelle ich euch hier jetzt meine zur Verfügung.
Anwendungsbeispiel:
Das Ganze wird im JSON Format ausgegeben. Wie ihr das Ganze verarbeitet, ist euer Ding.
Wenn ihr ein GK habt was fehlt, gebt mir bescheid (GK.Virtuelle Wellt) und WO das Haus steht.
Code
gk(id, store := "", showGK := false) {
global
gkresult := URLDownloadToVar("http://176.96.138.103/api/gk.php?gk=" . id)
if (gkresult == "ERROR_CONNECTION") {
SendInfo("Fehler bei der Verbindung zum Server.")
} else if (gkresult == "ERROR_BAD_LINK") {
SendInfo("Fehlerhafte Parameterübergabe.")
} else if (gkresult == "ERROR_ACCESS_DENIED") {
SendInfo("Zugriff verweigert, das Passwort ist falsch.")
} else if (gkresult == "ERROR_WRONG_FORMAT") {
SendInfo("Fehlerhaftes Format.")
} else if (gkresult == "ERROR_NOT_FOUND") {
SendInfo("Der Komplex wurde nicht in der Datenbank gefunden.")
} else {
if (store == "") {
SendInfo("Gebäudekomplex " . cSecond . id . cWhite . ":")
}
try {
data := JSON.Load(gkresult)
} catch {
SendInfo("Es ist ein unbekannter Fehler aufgetreten.")
return
}
for index, storerob in data {
name := storerob["name"]
location := ""
if (storerob["type"] == "public") {
color := "{12C0EB}"
location := " (" . calculateZone(storerob["x"], storerob["y"], 0.0) . ", " . calculateCity(storerob["x"], storerob["y"], 0.0) . ")"
} else if (storerob["type"] == "house") {
if (name == "Nobody") {
color := "{09B814}"
name := "Haus (frei)"
} else if (name == "Auktion im CP") {
color := "{B83109}"
name := "Haus (" . name . ")"
} else {
color := "{09B814}"
name := "Haus von " . name
}
location := " (" . calculateZone(storerob["x"], storerob["y"], 0.0) . ", " . calculateCity(storerob["x"], storerob["y"], 0.0) . ")"
} else if (storerob["type"] == "faction") {
color := "{117ABB}"
location := " (" . calculateZone(storerob["x"], storerob["y"], 0.0) . ", " . calculateCity(storerob["x"], storerob["y"], 0.0) . ")"
} else if (storerob["type"] == "vehicle") {
color := "{FF00FF}"
}
if (storerob["x"] == -5000 || storerob["y"] == -5000) {
location := ""
}
if (store != "") {
if (store == "BS" && name == "Burger Shot") {
} else if (store == "SM" && name == "24/7") {
} else if (store == "CB" && name == "Clucking Bell") {
} else if (store == "CS" && name == "Binco") {
} else if (store == "PS" && name == "Well Stacked Pizza") {
} else if (store == "DN" && name == "Donut Laden"){
} else {
continue
}
SendInfo("GK " . id . ": (ID: " . storerob["type"] . "." . storerob["id"] . ") " . color . name . location)
if (showGK) {
Sleep, 50
showGK(storerob["type"] . "." . storerob["id"], true)
}
} else {
SendInfo("[" . storerob["type"] . "." . storerob["id"] . "] " . color . name . location)
}
}
}
}
showGK(gk, ignoreExisting := false) {
global
if (RegExMatch(gk, "^(public|house|faction)\.(\d+)$", regex_)) {
gkresult := UrlDownloadToVar("http://176.96.138.103/api/gk.php?id=" . gk)
if (gkresult == "ERROR_CONNECTION") {
SendInfo("Fehler bei der Verbindung zum Server.")
} else if (gkresult == "ERROR_BAD_LINK") {
SendInfo("Fehlerhafte Parameterübergabe.")
} else if (gkresult == "ERROR_ACCESS_DENIED") {
SendInfo("Zugriff verweigert, das Passwort ist falsch.")
} else if (gkresult == "ERROR_WRONG_FORMAT") {
SendInfo("Fehlerhaftes Format.")
} else if (gkresult == "ERROR_NOT_FOUND") {
SendInfo("Der Komplex wurde nicht in der Datenbank gefunden.")
} else {
try {
data := JSON.Load(gkresult)
} catch {
SendInfo("Es ist ein unbekannter Fehler aufgetreten.")
return
}
if (isMarkerCreated() && !ignoreExisting) {
SendInfo("Möchtest du den CP neu setzen? Du kannst mit '" . cSecond . "X" . cWhite . "' bestätigen.")
KeyWait, X, D, T10
if (ErrorLevel) {
return
}
}
zPos := data["z"]
if (zPos == -1) {
zPos := 20
}
if (SetCheckpoint(data["x"], data["y"], zPos, 3)) {
SendInfo("Checkpoint für das Gebäudekomplex " . csecond . gk . cWhite . " gesetzt.")
} else {
SendInfo("Beim Setzen des Checkpoints ist ein Fehler aufgetreten.")
}
}
} else {
SendInfo("Falsches Format, Beispiel: " . csecond . "public.12")
}
}
Alles anzeigen