Exemple #1
0
 def hintergrund(self):
     b = Canvas(self.content_frame,
                bg="Gold2",
                width=functions.pro_size(100, 0),
                height=functions.pro_size(100, 1),
                highlightthickness=0)
     self.hook.onScreenReload.fire(b)
     return b
Exemple #2
0
	def hub_menu(self):
		gd = functions.get_gamedata();
		self.clear_screen1();
		menu = Canvas(self.hintergrund, bg="gold2", highlightthickness=0);
		menu.place(x=functions.pro_size(5,0), y=functions.pro_size(5,1));
		Button(menu, text="Inventar", command=self.inventory, width=functions.pro_size(1,0), font=gui_content.ch_fontsize(16)).grid(row=1);
		check=True;
		try:
			exec("print(\""+str(gd["travel"])+"\")");
		except:
			check=False;
		if check:
			Label(menu, text="Aktuelle Reise: \nZiel: "+gd["travel"]["destination"]+"\nAnkunft in: "+str(gd["travel"]["steps"]), bg="Gold2", font=gui_content.ch_fontsize(16)).grid(row=1,column=1,sticky=W);
		else:
			Label(menu, text="Aktuelle Reise: \nKeine", bg="Gold2", font=gui_content.ch_fontsize(16)).grid(row=1,column=1,sticky=W);
			Button(menu, text="Ort ansteuern", command=self.travel, font=gui_content.ch_fontsize(16)).grid(row=2,column=1,sticky=W);
		Button(menu, text="Fraktions-Übersicht", command=self.factions, font=gui_content.ch_fontsize(16)).grid(row=1,column=2,sticky=W);
		
		Button(self.hintergrund, text="Weiter gehen", command=self.hintergrund.quit, font=gui_content.ch_fontsize("16")).place(x=functions.pro_size(50,0), y=functions.pro_size(85,1), anchor=CENTER);
Exemple #3
0
	def useitem(self, item):
		hintergrund = self.hintergrund;

		Text = Canvas(hintergrund, bg="Gold2", highlightthickness=0, width=functions.pro_size(28,0), height=functions.pro_size(28,1));
		Text.place(x=functions.pro_size(36,0), y=functions.pro_size(36,1));
		Text2 = Canvas(hintergrund, bg="Gold2", highlightthickness=0, width=functions.pro_size(20,0), height=functions.pro_size(20,1));
		Text2.place(x=functions.pro_size(40,0), y=functions.pro_size(40,1));

		Button(Text2, text="Zurück", command=self.inventory).grid(row=0,column=1,padx=5,pady=5);
		x = 1;
		y = 1;
		if not hasattr(self.gui, "itemevents"):
			setattr(self.gui, "itemevents", {});
		if not item in self.gui.itemevents:
			self.gui.itemevents[item]={};
		for button, event in self.gui.itemevents[item].items():
			notbutton=False;
			if "place" in event:
				if not event["place"] == functions.get_gamedata()["place"]:
					notbutton=True;
			if not notbutton:
				Button(Text2, text=button, command=partial(self.useitem2, item, event[1], event[0])).grid(row=y,column=x,padx=5,pady=5);
			x+=1;
			if x == 6:
				x = 1;
				y += 1;
Exemple #4
0
	def inventory(self):
		self.clear_screen1();
		hintergrund = self.hintergrund;
		
		Label(hintergrund, text="Inventar", 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=self.hub_menu, 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 = functions.get_inventory();
		if len(inventar_content) == 0:
			Label(inventar.interior, text="Keine Items", 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
				setattr(self, "inv_canvas"+str(xrow), Canvas(inventar.interior, bg="green", width=functions.pro_size(90,0), height=functions.pro_size(9,1)));
				getattr(self, "inv_canvas"+str(xrow)).grid(row=xrow);
				Label(getattr(self, "inv_canvas"+str(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(getattr(self, "inv_canvas"+str(xrow)), text="Anzahl: "+str(value), fg="white",bg="green").place(y=functions.pro_size(9,1), x=functions.pro_size(88,0), anchor=SE);
				Button(getattr(self, "inv_canvas"+str(xrow)), command=partial(self.useitem, inv), text="Verwenden", fg="white",bg="green").place(y=functions.pro_size(9,1), x=functions.pro_size(78,0), anchor=SE);
Exemple #5
0
def overlay(*back, **gui):
	if hasattr(gui["gui"], "last_event"):
		#Label(back[0], bg="White", width=functions.pro_size(1,0), height=functions.pro_size(1,1)).place(y=functions.pro_size(1,1), x=functions.pro_size(80,0), anchor=N)
		i=0;
		for text in gui["gui"].texts:
			i+=1;
			i2=(i-1)*2.5+1;
			if not i > 5:
				Label(back[0], bg="Gold2", text=text[0], font=gui_content.ch_fontsize("15"), fg=text[1]).place(y=functions.pro_size(i2,1),x=functions.pro_size(80,0), anchor=NW);
Exemple #6
0
def overview(gui, self):
    self.clear_screen1()
    back = self.hintergrund
    gd = functions.get_gamedata()
    fac = get_factions()
    Text = Canvas(back, bg="Gold2", highlightthickness=0)
    Text.place(x=functions.pro_size(10, 0), y=functions.pro_size(10, 1))
    Label(Text,
          text="Fraktions-Übersicht",
          font=gui_content.ch_fontsize(32),
          bg="Gold2").grid(row=0, sticky=W)
    Label(Text,
          text="Verhältnis",
          font=gui_content.ch_fontsize(32),
          bg="Gold2").grid(row=0, column=2, columnspan=4, sticky=W)
    Label(Text, text="Stärke", font=gui_content.ch_fontsize(32),
          bg="Gold2").grid(row=0, column=6, columnspan=4, sticky=W)
    Button(Text,
           text="Zurück",
           command=self.hub_menu,
           font=gui_content.ch_fontsize(26),
           bg="Gold2").grid(row=1, sticky=W)
    Label(Text,
          text="Fraktions",
          font=gui_content.ch_fontsize(32),
          bg="Gold2",
          fg="Gold2").grid(row=0, column=1, sticky=W)
    Label(Text,
          text="Fraktions",
          font=gui_content.ch_fontsize(32),
          bg="Gold2",
          fg="Gold2").grid(row=0, column=5, sticky=W)
    keywords = {
        -100: ["Tötung auf Sicht", "red4", "white"],
        -90: ["Extrem Aggressiv", "red2", "white"],
        -66: ["Extrem Misstrauisch", "firebrick2", "black"],
        -33: ["Misstrauisch", "IndianRed1", "black"],
        -3: ["Neutral", "beige", "black"],
        3: ["Akzeptiert", "PaleGreen1", "black"],
        33: ["Vertraut", "green2", "black"],
        66: ["Extrem Vertraut", "green4", "white"],
        90: ["Blind Vertraut", "dark green", "white"]
    }
    keywords2 = {
        -100: ["Kaum Existent", "red4", "white"],
        -90: ["Extrem geschwächt", "red2", "white"],
        -66: ["Sehr geschwächt", "firebrick2", "black"],
        -33: ["Geschwächt", "IndianRed1", "black"],
        -3: ["Neutral", "beige", "black"],
        3: ["Relevant", "PaleGreen1", "black"],
        33: ["Sehr stark", "green2", "black"],
        66: ["Dominant", "green4", "white"],
        90: ["Regierend", "dark green", "white"]
    }
    row = 1
    for name, data in fac.items():
        row += 1
        Label(Text,
              text=name + ":",
              font=gui_content.ch_fontsize(24),
              bg="Gold2",
              fg="black").grid(row=row, column=0, sticky=W)
        Label(Text,
              text=str(data["value"]) + "%",
              font=gui_content.ch_fontsize(24),
              bg="Gold2",
              fg="black").grid(row=row, column=1, sticky=E)
        for value, keyw in keywords.items():
            if data["value"] >= value:
                keyword = keyw
        for value, keyw in keywords2.items():
            if data["value2"] >= value:
                keyword2 = keyw
        Label(Text,
              text="[",
              font=gui_content.ch_fontsize(24),
              bg="Gold2",
              fg="black").grid(row=row, column=2, sticky=W)
        Label(Text,
              text=keyword[0],
              font=gui_content.ch_fontsize(24),
              bg=keyword[1],
              fg=keyword[2]).grid(row=row, column=3, sticky=W)
        Label(Text,
              text="]",
              font=gui_content.ch_fontsize(24),
              bg="Gold2",
              fg="black").grid(row=row, column=4, sticky=W)
        Label(Text,
              text=str(data["value2"]) + "%",
              font=gui_content.ch_fontsize(24),
              bg="Gold2",
              fg="black").grid(row=row, column=5, sticky=E)
        Label(Text,
              text="[",
              font=gui_content.ch_fontsize(24),
              bg="Gold2",
              fg="black").grid(row=row, column=6, sticky=W)
        Label(Text,
              text=keyword2[0],
              font=gui_content.ch_fontsize(24),
              bg=keyword2[1],
              fg=keyword2[2]).grid(row=row, column=7, sticky=W)
        Label(Text,
              text="]",
              font=gui_content.ch_fontsize(24),
              bg="Gold2",
              fg="black").grid(row=row, column=8, sticky=W)
Exemple #7
0
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)
Exemple #8
0
    def modmanager(self):
        class init():
            def __init__(self):
                true = True

        init = init()
        self.clear_screen()
        hintergrund = self.hintergrund()
        hintergrund.pack()

        hintergrund1 = Canvas(hintergrund,
                              width=functions.pro_size(90, 0),
                              height=functions.pro_size(80, 1))
        hintergrund1.place(y=functions.pro_size(15, 1),
                           x=functions.pro_size(5, 0))
        modlist = functions.VerticalScrolledFrame(hintergrund1)
        modlist.place(width=functions.pro_size(90, 0),
                      height=functions.pro_size(80, 1))

        folders = [f.path for f in os.scandir("events") if f.is_dir()]
        folder = [x[7:] for x in folders]

        def activate(self, mod):
            self.activemod = mod
            self.main_menu()

        xrow = 1
        setattr(
            init, "canvas" + str(xrow),
            Canvas(modlist.interior,
                   bg="blue",
                   width=functions.pro_size(45, 0),
                   height=functions.pro_size(10, 1)))
        getattr(init, "canvas" + str(xrow)).grid(row=xrow)
        Label(getattr(init, "canvas" + str(xrow)),
              bg="blue",
              text="main",
              font=gui_content.ch_fontsize("32")).place(x=5, y=5)
        if self.activemod == "main":
            Label(getattr(init, "canvas" + str(xrow)),
                  text="Activ",
                  font=gui_content.ch_fontsize("16"),
                  fg="yellow",
                  bg="blue").place(x=5, y=50)
        else:
            Button(getattr(init, "canvas" + str(xrow)),
                   text="Aktivieren",
                   bg="navy",
                   command=partial(activate, self, "main"),
                   fg="white",
                   font=gui_content.ch_fontsize("16")).place(
                       x=functions.pro_size(45, 0), y=5, anchor=NE)

        for f in folder:
            xrow += 1
            if f != "__pycache__":
                if f != "system":
                    if f != "main":
                        setattr(
                            init, "canvas" + str(xrow),
                            Canvas(modlist.interior,
                                   bg="blue",
                                   width=functions.pro_size(45, 0),
                                   height=functions.pro_size(10, 1)))
                        getattr(init, "canvas" + str(xrow)).grid(row=xrow)
                        Label(getattr(init, "canvas" + str(xrow)),
                              bg="blue",
                              text=f,
                              font=gui_content.ch_fontsize("32")).place(x=5,
                                                                        y=5)
                        if self.activemod == f:
                            Label(getattr(init, "canvas" + str(xrow)),
                                  text="Activ",
                                  font=gui_content.ch_fontsize("16"),
                                  fg="yellow",
                                  bg="blue").place(x=5, y=50)
                        else:
                            Button(getattr(init, "canvas" + str(xrow)),
                                   text="Aktivieren",
                                   bg="navy",
                                   command=partial(activate, self, f),
                                   fg="white",
                                   font=gui_content.ch_fontsize("16")).place(
                                       x=functions.pro_size(45, 0),
                                       y=5,
                                       anchor=NE)
Exemple #9
0
    def caracter_choose(self):
        self.clear_screen()
        caracters = functions.json_file_decode("content\persons.json")
        current_car = functions.json_file_decode("user\\avapersons.json")
        dic = functions.json_file_decode("user\\found_description.json")
        hintergrund1 = self.hintergrund()

        gio = Frame(hintergrund1)
        carder = functions.VerticalScrolledFrame(gio)
        carder.interior.config(height=functions.pro_size(30, 0))
        carder.config(bg="LightCyan3", bd=8, highlightbackground="orange3")

        def choose_caracter(gg):
            self.selected_caracter = gg
            print(self.selected_caracter)
            selected_caracter_name.config(text=self.selected_caracter)
            if not self.selected_caracter in dic:
                story = "<!Geschichte nicht erforscht!>"
            else:
                story = caracters[gg]["story"]
            selected_caracter_disc.config(text=self.language("Geschichte:") +
                                          " \n" + self.language(story))

        X = 0
        ypos = X
        ypos_pic = 10
        rowx = 1
        caracter_canvas = {}
        car_checkbox = {}
        xd = 0
        for key, value in caracters.items():
            if key in current_car:
                try:
                    value["img"]
                except:
                    value["img"] = "noimage"
                abil = ""
                for y in range(len(value["abilitys"])):
                    abil += value["abilitys"][y] + ", "
                abil = abil[:-2]
                yx = Canvas(carder.interior,
                            bg="green4",
                            height=100,
                            width=660,
                            bd=15,
                            highlightbackground="yellow")
                img = Canvas(yx, width=100, height=100)
                setattr(
                    self, "car" + str(X) + "_background_img",
                    PhotoImage(file="content\pictures\\background_car.gif"))
                setattr(
                    self, "car" + str(X) + "_img",
                    PhotoImage(file="content\pictures\\" + value["img"] +
                               ".gif"))
                #img.create_image(image=getattr(self, "car"+str(X)+"_img"), 90, 90)
                #img.create_image(100, 100, image=getattr(self, "car"+str(X)+"_background_img"))
                Label(yx,
                      text=self.language(key),
                      bg="green4",
                      font=gui_content.ch_fontsize("30")).place(x=110, y=10)
                Label(yx,
                      text=self.language("Spezies/Rasse") + ": " +
                      self.language(value["species"]),
                      font=gui_content.ch_fontsize("16"),
                      bg="green4").place(x=110, y=55)
                Label(yx,
                      text=self.language("Fähigkeiten") + ": " +
                      self.language(abil),
                      font=gui_content.ch_fontsize("16"),
                      bg="green4").place(x=110, y=80)

                setattr(self, "car" + str(X) + "_choose_caracter",
                        partial(choose_caracter, key))
                car_checkbox[X] = IntVar()
                gui_content.button(
                    yx, self.language("Select"), 600, 10,
                    getattr(self, "car" + str(X) + "_choose_caracter"),
                    gui_content.ch_fontsize("16"), ["green", "black"],
                    [90, 30])

                yx.pack()
                ypos += 210
                rowx += 1
                X += 1

        def start_game():
            self.gamedata = {}
            self.gamedata["caracters"] = {}
            self.gamedata["caracters"][self.selected_caracter] = {
                "hp":
                functions.get_persons_content()[self.selected_caracter]
                ["stdhp"]
            }
            functions.json_file_encode("user\gamedata.json", self.gamedata)
            self.hub_time = 2
            try:
                items = functions.get_persons_content()[
                    self.selected_caracter]["stditems"]
            except:
                items = {}
            items["coins"] = 300
            event_functions.add_items(items)
            self.hook.onStartGame.fire(self.selected_caracter)
            self.game("startgame", "system", [self.selected_caracter])

        selected_caracter_name = Label(hintergrund1,
                                       text="Niemand",
                                       font=gui_content.ch_fontsize("16"),
                                       bg="Gold2")
        selected_caracter_name.place(y=functions.pro_size(40, 1),
                                     x=functions.pro_size(50, 0),
                                     anchor=N)
        selected_caracter_disc = Message(hintergrund1,
                                         text="Geschichte: \n",
                                         bg="Gold2",
                                         font=gui_content.ch_fontsize("14"),
                                         width=600)
        selected_caracter_disc.place(y=functions.pro_size(50, 1),
                                     x=functions.pro_size(50, 0),
                                     anchor=N)

        Button(hintergrund1,
               text=self.language("Zurück"),
               command=self.main_menu,
               bg="red",
               bd=8,
               font=gui_content.ch_fontsize("20")).place(
                   anchor=W,
                   y=functions.pro_size(75, 1),
                   x=functions.pro_size(25, 0),
                   width=functions.pro_size(25, 1),
                   height=functions.pro_size(10, 0))
        Button(hintergrund1,
               text=self.language("START!!!!"),
               command=start_game,
               bg="green",
               bd=8,
               font=gui_content.ch_fontsize("20")).place(
                   anchor=E,
                   y=functions.pro_size(75, 1),
                   x=functions.pro_size(75, 0),
                   width=functions.pro_size(25, 1),
                   height=functions.pro_size(10, 0))

        hintergrund1.pack()
        gio.place(y=functions.pro_size(5, 1),
                  x=functions.pro_size(50, 0),
                  anchor=N)
        carder.pack()
        self.content_frame.mainloop()
Exemple #10
0
    def main_menu(self, event=None):
        self.clear_screen()
        hintergrund1 = self.hintergrund()
        Button(hintergrund1,
               text="DEBUG",
               command=self.debug,
               bd=0,
               bg="gold2",
               fg="gold2").place(y=0)
        Label(hintergrund1,
              font=gui_content.ch_fontsize("32"),
              text="Four Dragons of Apocalypse").place(y=75,
                                                       x=functions.pro_size(
                                                           50, 0),
                                                       anchor=CENTER)

        if self.activemod != "main":
            Label(hintergrund1,
                  text=self.activemod,
                  font=gui_content.ch_fontsize("24")).place(
                      y=125, x=functions.pro_size(50, 0), anchor=CENTER)

        Button(hintergrund1,
               text=self.language("Update"),
               bd=8,
               font=gui_content.ch_fontsize("16"),
               bg="blue",
               fg="white",
               command=self.update).place(anchor=NE,
                                          y=functions.pro_size(1, 1),
                                          x=functions.pro_size(99, 0))
        Button(hintergrund1,
               text=self.language("Start"),
               font=gui_content.ch_fontsize("20"),
               bg="green",
               fg="white",
               bd=8,
               command=self.caracter_choose).place(
                   anchor=CENTER,
                   y=functions.pro_size(20, 1),
                   x=functions.pro_size(50, 0),
                   width=functions.pro_size(25, 0),
                   height=functions.pro_size(10, 1))
        Button(hintergrund1,
               text=self.language("Mods"),
               font=gui_content.ch_fontsize("20"),
               bg="red",
               fg="white",
               bd=8,
               command=self.modmanager).place(anchor=CENTER,
                                              y=functions.pro_size(35, 1),
                                              x=functions.pro_size(50, 0),
                                              width=functions.pro_size(25, 0),
                                              height=functions.pro_size(10, 1))
        Button(hintergrund1,
               text=self.language("Beenden"),
               font=gui_content.ch_fontsize("20"),
               bg="blue",
               fg="white",
               bd=8,
               command=self.ending_game).place(anchor=CENTER,
                                               y=functions.pro_size(50, 1),
                                               x=functions.pro_size(50, 0),
                                               width=functions.pro_size(25, 0),
                                               height=functions.pro_size(
                                                   10, 1))
        Label(hintergrund1,
              text=self.language("Beta-Testers:") + "\n\n" +
              functions.read_file_content("data\BetaTester.txt"),
              bg="gold2",
              font=gui_content.ch_fontsize("16")).place(
                  y=functions.pro_size(100, 1),
                  x=functions.pro_size(0, 1),
                  anchor=SW)

        hintergrund1.pack()
        self.content_frame.mainloop()
Exemple #11
0
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)
Exemple #12
0
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)
Exemple #13
0
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)
Exemple #14
0
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)