From 5e8c6ff8e655e103fb35c82f4173cec092e7cee8 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 27 Jul 2022 12:31:46 -0300 Subject: Advanced Qeditor - It automatically generates a whole "quest" --- 00_init.rpy | 11 ++++- qeditor.rpy | 5 +- qeditor_adv.rpy | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 qeditor_adv.rpy diff --git a/00_init.rpy b/00_init.rpy index c43e4fc..64549e8 100644 --- a/00_init.rpy +++ b/00_init.rpy @@ -27,6 +27,13 @@ init -3 python: persistent.allfiles=[] allfiles=[] + # Elements + Ele_Fire =1 + Ele_Water =2 + Ele_Nature =3 + Ele_Light =4 + Ele_Shadow =5 + def ParseEle(ele): if ele == 0: return "Neutral" @@ -124,11 +131,11 @@ init -3 python: #page.close() return surf - except Exception, e: + except Exception: if renpy.config.missing_image_callback: im = renpy.config.missing_image_callback(self.loc) if im is None: - raise e + raise return im.load() raise diff --git a/qeditor.rpy b/qeditor.rpy index e9a730c..b8e038c 100644 --- a/qeditor.rpy +++ b/qeditor.rpy @@ -1,4 +1,4 @@ -######################################################################################## +################################################################################# # This file is part of Spheres. # Copyright (C) 2019 Jesusalva @@ -15,7 +15,7 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -######################################################################################## +################################################################################# # Editor labels for developers screen quest_editor(): modal True @@ -204,6 +204,7 @@ screen quest_editor(): textbutton _("Close") action Return() textbutton _("New Quest") action Function(qeditor_new) textbutton _("New S.") action Function(qeditor_new, 1) + textbutton _("Auto-New") action Call("qeditor_supernew") ## Right-click and escape refresh screen key "game_menu" action Function(RestartInteraction)#Return() diff --git a/qeditor_adv.rpy b/qeditor_adv.rpy new file mode 100644 index 0000000..a199f59 --- /dev/null +++ b/qeditor_adv.rpy @@ -0,0 +1,150 @@ +################################################################################# +# This file is part of Spheres. +# Copyright (C) 2022 Jesusalva + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +################################################################################# +# Editor labels for developers +label qeditor_supernew: + python: + elemt = 0 + bosse = 0 + queid = len(allquests) + waves = 3 + + avail = [] + mobid = [] + subid = 0 + bosid = 0 + + menu: + "Please select the predominant element:" + "Fire": + $ elemt = Ele_Fire + "Water": + $ elemt = Ele_Water + "Nature": + $ elemt = Ele_Nature + "Light": + $ elemt = Ele_Light + "Shadow": + $ elemt = Ele_Shadow + + $ elemt_txt = ParseEle(elemt) + menu: + "Please select the BOSS element (current: [elemt_txt]):" + "Fire": + $ bosse = Ele_Fire + "Water": + $ bosse = Ele_Water + "Nature": + $ bosse = Ele_Nature + "Light": + $ bosse = Ele_Light + "Shadow": + $ bosse = Ele_Shadow + + $ queid = int(renpy.input("Please define the quest ID, default = [queid], special = 90000", allow="0123456789")) + menu: + "Please select the theme" + "The Empire": + python: + avail=[950001, 950002, 950003, 950004, 950005] + subid=renpy.random.choice(avail) + avail.remove(subid) + bosid=renpy.random.choice(avail) + avail.remove(bosid) + mobid=avail + #"The Bandits": + #"The Elves": + #"The Dark Horde": + #"The Darklanders": + #"The Rebels": + #"The Land of Fire": + "The Wizard Order": + python: + avail=[950700, 950701, 950702] + subid=renpy.random.choice(avail) + avail.remove(subid) + bosid=renpy.random.choice(avail) + avail.remove(bosid) + mobid=avail + #"The Dwarves": + "Custom": + python: + bosid=int(renpy.input("Please define boss ID", allow="0123456789")) + subid=int(renpy.input("Please define extra ID", allow="0123456789")) + avail=renpy.input("Please define mobs ID (comma-separated) (boss=[bosid], sub=[subid])", allow="0123456789,").split(",") + mobid=[] + for i in avail: + mobid.append(int(i)) + + # Generate the struct and save it + # TODO: If renpy.exists() with 96 then upgrade else do nothing? + python: + qeid = int(queid) + qefl = 1 + if qeid > 90000: + qeid = queid - 90000 + qefl = 4 + + allquests.append({ + "quest_id": queid, + "difficulty": qeid*5, # FIXME too steep + "requeriment": qeid-1, + "cost": 1+(qeid / 5), + "flags": qefl, + "music": "bgm03", + "bg": "battle", + "loot": [ + ["1010", int(1000+(qeid/5*25))], + ["1020", int(100+(qeid/5*10))], + ["1030", int(10+(qeid/5))] + ], + "waves": []}) + + # Generate waves + #current=dl_search(allquests, "quest_id", queid) + current=len(allquests)-1 + qedit=allquests[current] + it = ifte(qeid % 5 == 0, 4, 3) # 4 waves every 5 fights + i = 0 + while i < it: + qedit["waves"].append([]) + j = 0 + k = ifte((i+1) == it, 1, ifte((i+1) == 2, 2, 3)) + while j < k: + j+=1 + if k == 1: + tmp_sp = bosid + 10000 # FIXME + elif k == 2: + tmp_sp = subid + else: + tmp_sp = renpy.random.choice(mobid) + if k == 1: + tmp_nm = "BOSS" # FIXME + else: + tmp_nm = "Enemy %d" % j # FIXME + qedit["waves"][i].append({ + "name": tmp_nm, + "sprite": int(tmp_sp), + "attribute": int(ifte((i+1) == it, bosse, elemt)), + "boss": ifte((i+1) == it, True, False) + }) + i += 1 + + renpy.notify("New quest added: %d" % queid) + return + -- cgit v1.2.3-60-g2f50