def garageerror(gui, veh): gui.clear_screen() back = gui.hintergrund() back.pack() gd = functions.get_gamedata() Label(back, text="Die Garage von " + gd["place"] + "ist voll.", bg="Gold2", fg="red", font=gui_content.ch_fontsize("32")).grid(row=1, column=1, columnspan=2, sticky=NSEW) Button(back, text="Fahrzeug " + veh["name"] + " zerstören.", command=partial(hub, gui), font=gui_content.ch_fontsize("16"), bg="green").grid(row=2, column=1, sticky=NSEW) Button(back, text="Zu einem anderen Ort fahren.", command=partial(enterveh, gui, veh), font=gui_content.ch_fontsize("16"), bg="green").grid(row=2, column=2, sticky=NSEW) back.grid_rowconfigure(0, weight=1) back.grid_rowconfigure(3, weight=1) back.grid_columnconfigure(0, weight=1) back.grid_columnconfigure(3, weight=1)
def open(event, id, func, gui): gui.clear_screen() hintergrund = gui.hintergrund() hintergrund.pack() cons = get_cons() # print(cons); container = cons[id] gui.hook.onContainerOpen.fire(id, container) Label(hintergrund, text=container["name"], font=gui_content.ch_fontsize("24"), bg="green").place(y=functions.pro_size(1, 1), x=functions.pro_size(50, 0), anchor=N) Button(hintergrund, text="Zurück", command=partial(exit, event, id, func, gui), font=gui_content.ch_fontsize("16"), bg="green").place(y=functions.pro_size(5, 1), x=functions.pro_size(50, 0), anchor=N) Button(hintergrund, text="Container", command=partial(open, event, id, func, gui), bg="red", font=gui_content.ch_fontsize("16")).place( y=functions.pro_size(5, 1), x=functions.pro_size(45, 0), anchor=N) Button(hintergrund, text="Inventar", command=partial(inve, event, id, func, gui), font=gui_content.ch_fontsize("16")).place( y=functions.pro_size(5, 1), x=functions.pro_size(55, 0), anchor=N) inventar1 = Canvas(hintergrund, width=functions.pro_size(90, 0), height=functions.pro_size(80, 1)) inventar1.place(anchor=N, x=functions.pro_size(50, 0), y=functions.pro_size(10, 1)) inventar = functions.VerticalScrolledFrame(inventar1) inventar.place(width=functions.pro_size(90, 0), height=functions.pro_size(80, 1)) inventar_content = container["inv"] if len(inventar_content.items()) == 0: Label(inventar.interior, text="Keine Items", fg="black", font=gui_content.ch_fontsize("32")).place( x=functions.pro_size(50, 0), y=functions.pro_size(50, 1), anchor=CENTER) else: xrow = 0 for inv, value in inventar_content.items(): xrow += 1 newcanvas = {} newcanvas[xrow] = Canvas(inventar.interior, bg="green", width=functions.pro_size(90, 0), height=functions.pro_size(9, 1)) newcanvas[xrow].grid(row=xrow) Label(newcanvas[xrow], text=inv, font=gui_content.ch_fontsize("40"), bg="green", fg="white").place(x=functions.pro_size(1, 0), y=functions.pro_size(4.5, 1), anchor=W) Label(newcanvas[xrow], text="Anzahl: " + str(value), fg="white", bg="green").place(y=functions.pro_size(9, 1), x=functions.pro_size(88, 0), anchor=SE) if value > 0: Button(newcanvas[xrow], text="1", fg="white", bg="green", command=partial(move, event, id, func, -1, inv, 1, gui)).place(y=functions.pro_size(9, 1), x=functions.pro_size(84, 0), anchor=SE) if value > 9: Button(newcanvas[xrow], text="10", fg="white", bg="green", command=partial(move, event, id, func, -1, inv, 10, gui)).place(y=functions.pro_size(9, 1), x=functions.pro_size(83, 0), anchor=SE) if value > 99: Button(newcanvas[xrow], text="100", fg="white", bg="green", command=partial(move, event, id, func, -1, inv, 100, gui)).place(y=functions.pro_size(9, 1), x=functions.pro_size(82, 0), anchor=SE) Button(newcanvas[xrow], text="A", fg="white", bg="green", command=partial(move, event, id, func, -1, inv, value, gui)).place(y=functions.pro_size(9, 1), x=functions.pro_size(85, 0), anchor=SE) Label(newcanvas[xrow], text="Übertragen:", fg="white", bg="green").place(y=functions.pro_size(9, 1), x=functions.pro_size(80, 0), anchor=SE)
def questmenu(title, decline=False, accept=False, finish=False, cancelfunc=False, confunc=False): from data.getgui import gui if not decline: decline = gui.new_text if not accept: accept = gui.new_text if not finish: finish = gui.new_text if not cancelfunc: cancelfunc = gui.new_text if not confunc: confunc = gui.new_text gd = functions.get_gamedata() id = gd["quests"]["bind"][gui.last_event[0] + "+" + gui.last_event[1] + "+" + title] quest = get_quests()[id] reached = False active = False if id in gd["quests"]["active"]: reached = True for item, amount in quest["requirements"].items(): if event_functions.check_item(item) < amount: reached = False active = True gui.clear_screen() back = gui.hintergrund() back.pack() Text = Canvas(back, bg="Gold2", highlightthickness=0, width=functions.pro_size(80, 0)) Text.place(x=functions.pro_size(10, 0), y=functions.pro_size(10, 1)) Label(Text, text="Quest:", font=gui_content.ch_fontsize(12), bg="Gold2").grid(row=0, columnspan=3, sticky=W) Label(Text, text=quest["title"], font=gui_content.ch_fontsize(32), bg="Gold2").grid(row=1, columnspan=3, sticky=W) Label(Text, text=quest["description"], font=gui_content.ch_fontsize(16), bg="Gold2").grid(row=2, columnspan=3, sticky=W) Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=3, columnspan=3, sticky=W) Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=4, columnspan=3, sticky=W) Label(Text, text="Zu beschaffende Items:", font=gui_content.ch_fontsize(16), bg="Gold2").grid(row=50, sticky=W) i = 49 for item, amount in quest["requirements"].items(): i += 1 Label(Text, text=item + " x " + str(amount), font=gui_content.ch_fontsize(16), bg="Gold2").grid(row=i, column=2, sticky=W) i += 1 Label(Text, text="Erhaltene Items zum Erfüllen der Quest:", font=gui_content.ch_fontsize(16), bg="Gold2").grid(row=i, columnspan=2, sticky=W) i -= 1 for item, amount in quest["tools"].items(): i += 1 Label(Text, text=item + " x " + str(amount), font=gui_content.ch_fontsize(16), bg="Gold2").grid(row=i, column=2, sticky=W) i += 1 Label(Text, text="Belohnungen:", font=gui_content.ch_fontsize(16), bg="Gold2").grid(row=i, sticky=W) i -= 1 for item, amount in quest["rewards"].items(): i += 1 Label(Text, text=item + " x " + str(amount), font=gui_content.ch_fontsize(16), bg="Gold2").grid(row=i, column=2, sticky=W) i += 1 Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=i, columnspan=3, sticky=W) Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=(i + 1), columnspan=3, sticky=W) Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=(i + 2), columnspan=3, sticky=W) Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=(i + 3), columnspan=3, sticky=W) Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=(i + 4), columnspan=3, sticky=W) Label(Text, text="a", font=gui_content.ch_fontsize(16), bg="Gold2", fg="Gold2").grid(row=(i + 5), columnspan=3, sticky=W) i += 6 nobutton = True if not active: if not gd["quests"]["active"]: Button(Text, text="Annehmen", command=partial(acceptquest, accept, quest), bg="green", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, column=0, padx=5, pady=5) Button(Text, text="Ablehnen", command=partial(declinequest, decline, quest), bg="red", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, padx=5, pady=5, column=1) nobutton = False else: Button(Text, text="Beende zuerst deine aktuelle Quest!", state=DISABLED, bg="red", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, padx=5, pady=5, column=0) elif reached: Button(Text, text="Erreicht!", state=DISABLED, bg="green", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, padx=5, pady=5, column=0) Button(Text, text="Belohnung abholen", command=partial(get, quest, finish), bg="green", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, padx=5, pady=5, column=1) else: Button(Text, text="Aktiv", state=DISABLED, bg="blue", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, padx=5, pady=5, column=0) Button(Text, text="Abbrechen", command=partial(cancel, quest, cancelfunc), bg="red", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, padx=5, pady=5, column=1) if nobutton: Button(Text, text="Weiter", command=confunc, bg="white", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=i, padx=5, pady=5, column=10)
def enterveh(gui, vehicle, self=True, key=-1, returnfunc=False): if isinstance(self, bool): gui.clear_screen() hintergrund = gui.hintergrund() hintergrund.pack() ishub = False else: print("Baum") self.clear_screen1() hintergrund = self.hintergrund ishub = True gui.placeback = self if not returnfunc: func = False else: func = True if key == -2: Label( hintergrund, text= "Dein GPS ist voll. Bitte wähle einen Eintrag, den du ersetzen möchtest.", font=gui_content.ch_fontsize("24"), bg="red").place(y=functions.pro_size(1, 1), x=functions.pro_size(50, 0), anchor=N) else: Label(hintergrund, text="GPS-Einträge", font=gui_content.ch_fontsize("16"), bg="green").place(y=functions.pro_size(1, 1), x=functions.pro_size(50, 0), anchor=N) if not func: if ishub: Button(hintergrund, text="Abbrechen", command=self.hub_menu, font=gui_content.ch_fontsize("16"), bg="green").place(y=functions.pro_size(6, 1), x=functions.pro_size(50, 0), anchor=N) else: Button(hintergrund, text="Abbrechen", command=partial(hub, gui, False, True), font=gui_content.ch_fontsize("16"), bg="green").place(y=functions.pro_size(6, 1), x=functions.pro_size(50, 0), anchor=N) else: Button(hintergrund, text="Abbrechen", command=returnfunc, font=gui_content.ch_fontsize("16"), bg="green").place(y=functions.pro_size(6, 1), x=functions.pro_size(50, 0), anchor=N) inventar1 = Canvas(hintergrund, width=functions.pro_size(90, 0), height=functions.pro_size(80, 1)) inventar1.place(anchor=N, x=functions.pro_size(50, 0), y=functions.pro_size(10, 1)) inventar = functions.VerticalScrolledFrame(inventar1) inventar.place(width=functions.pro_size(90, 0), height=functions.pro_size(80, 1)) inventar_content = get_gps() if len(inventar_content) == 0: Label(inventar.interior, text="Leer", fg="black", font=gui_content.ch_fontsize("32")).place( x=functions.pro_size(50, 0), y=functions.pro_size(50, 1), anchor=CENTER) else: xrow = 0 for value in inventar_content: xrow += 1 newcanvas = {} newcanvas[xrow] = Canvas(inventar.interior, bg="green", width=functions.pro_size(90, 0), height=functions.pro_size(9, 1)) newcanvas[xrow].grid(row=xrow) Label(newcanvas[xrow], text=value, font=gui_content.ch_fontsize("40"), bg="green", fg="white").place(x=functions.pro_size(1, 0), y=functions.pro_size(4.5, 1), anchor=W) if not key == -2: Button(newcanvas[xrow], text="Reisen [" + str(vehicle["steps"]) + "]", command=partial(travel, gui, value, vehicle, key), fg="white", bg="green").place(y=functions.pro_size(9, 1), x=functions.pro_size(88, 0), anchor=SE) else: Button(newcanvas[xrow], text="Ersetzen", command=partial(savetogps, vehicle, (xrow - 1)), fg="white", bg="red").place(y=functions.pro_size(9, 1), x=functions.pro_size(88, 0), anchor=SE)
def garage(gui): gui.clear_screen() hintergrund = gui.hintergrund() hintergrund.pack() Label(hintergrund, text="Garage von " + functions.get_gamedata()["place"], font=gui_content.ch_fontsize("16"), bg="green").place(y=functions.pro_size(1, 1), x=functions.pro_size(50, 0), anchor=N) Button(hintergrund, text="Zurück", command=partial(hub, gui, False, True), font=gui_content.ch_fontsize("16"), bg="green").place(y=functions.pro_size(5, 1), x=functions.pro_size(50, 0), anchor=N) inventar1 = Canvas(hintergrund, width=functions.pro_size(90, 0), height=functions.pro_size(80, 1)) inventar1.place(anchor=N, x=functions.pro_size(50, 0), y=functions.pro_size(10, 1)) inventar = functions.VerticalScrolledFrame(inventar1) inventar.place(width=functions.pro_size(90, 0), height=functions.pro_size(80, 1)) inventar_content = get_place( functions.get_gamedata()["place"])["garage"]["storage"] if len(inventar_content) == 0: Label(inventar.interior, text="Leer", font=gui_content.ch_fontsize("32")).place( x=functions.pro_size(50, 0), y=functions.pro_size(50, 1), anchor=CENTER) else: xrow = 0 for value in inventar_content: xrow += 1 newcanvas = {} newcanvas[xrow] = Canvas(inventar.interior, bg="green", width=functions.pro_size(90, 0), height=functions.pro_size(9, 1)) newcanvas[xrow].grid(row=xrow) Label(newcanvas[xrow], text=value["name"], font=gui_content.ch_fontsize("40"), bg="green", fg="white").place(x=functions.pro_size(1, 0), y=functions.pro_size(4.5, 1), anchor=W) Button(newcanvas[xrow], text="Benutzen", command=partial(enterveh, gui, value, True, (xrow - 1)), fg="white", bg="green").place(y=functions.pro_size(9, 1), x=functions.pro_size(88, 0), anchor=SE)
def hub(gui, travel=False, returned=False): gui.alreadyruns = True gui.clear_screen() back = gui.hintergrund() back.pack() gd = functions.get_gamedata() if travel: print(gd["travel"]["steps"]) if gd["travel"]["steps"] <= 0: print("Destination Reached.") enterplace(gui, gd["travel"]["destination"], True, True) else: gd["travel"]["steps"] -= 1 functions.save_gamedata(gd) print("Travel") event(gui, gd["travel"]["vehicle"]["events"]) else: try: place = get_place(gd["place"]) except KeyError: gui.game("hub", "system") try: exec("print(\"" + str(gd["place_hub_timer"]) + "\")") except: # print(sys.exc_info()); gd["place_hub_timer"] = 0 print(gd["place_hub_timer"]) if not returned: if not gd["place_hub_timer"] == 0: if not gd["place_hub_timer"] >= (place["options"]["hubtimer"] + 1): gd["place_hub_timer"] += 1 functions.save_gamedata(gd) print("Random") event(gui, place["options"]["events"]["random"]) else: print( str(place["options"]["hubtimer"] + 1) + "/" + str(gd["place_hub_timer"])) gd["place_hub_timer"] = 0 functions.save_gamedata(gd) gd["place_hub_timer"] += 1 functions.save_gamedata(gd) Text = Canvas(back, bg="Gold2", highlightthickness=0) Text.place(x=functions.pro_size(10, 0), y=functions.pro_size(10, 1)) Label(Text, text="Willkommen " + place["word"] + " " + gd["place"], font=gui_content.ch_fontsize(32), bg="Gold2").grid(row=1, columnspan=3, sticky=W) Button(Text, text="Garage", command=partial(garage, gui), font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=2, padx=5, pady=5) if not place["storage"]["disable"]: Button(Text, text="Lager", command=partial(storage, gui), font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=2, column=1, padx=5, pady=5) else: Button(Text, text="Lager", state=DISABLED, command=partial(storage, gui), font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=2, column=1, padx=5, pady=5) if not gd["place"] in get_gps(): Button(Text, text="Ort Speichern", command=partial(savetogps, gui, place), font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=2, column=2, padx=5, pady=5) else: Button(Text, text="Ort Gespeichert.", command=partial(print, ""), font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0), bg="green").grid(row=2, column=2, padx=5, pady=5) if len(place["options"]["events"]["clickable"]) > 0: Label(Text, text="Aktionen:", font=gui_content.ch_fontsize(20), bg="Gold2").grid(row=3, sticky=W, columnspan=3) key = 0 for value in place["options"]["events"]["clickable"]: row = math.floor(key / 6) + 4 column = (key % 6) if key < 61: Button(Text, text=value[2], command=partial(clickable, gui, value), font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0), height=functions.pro_size(.05, 1)).grid(row=row, column=column, padx=5, pady=5) elif key == 61: Label(Text, text="Maximum von 60 Aktionen überschritten.", font=gui_content.ch_fontsize(20), bg="Gold2", fg="red").grid(row=14, sticky=W, columnspan=6) key += 1 Label(Text, text=place["description"], font=gui_content.ch_fontsize(20), bg="Gold2").grid(row=15, sticky=W, columnspan=3) Button(Text, text=gd["place"] + " verlassen", command=partial(leave, gui), bg="red", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=16, padx=5, pady=5) if len(place["options"]["events"]["random"]) > 0: Button(Text, text="Weitergehen", command=partial(event, gui, place["options"]["events"]["random"]), bg="green", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=16, column=1, padx=5, pady=5) else: Button(Text, text="Weitergehen", state=DISABLED, command=partial(event, gui), bg="green", font=gui_content.ch_fontsize("16"), width=functions.pro_size(1, 0)).grid(row=16, column=1, padx=5, pady=5)