Ver Fonte

Fixed an issue with stat indexes. Fixed an issue with main stats at future rune levels. The GUI now passes options to exclude teams or se only runes in inventory.

Iñigo Valentin há 4 anos atrás
pai
commit
a82a8cf845

+ 6 - 0
src/RuneOptimizer/optimize/optimize.c

@@ -1247,6 +1247,12 @@ int present_option(struct Unit *unit, Result *result){
                     break;
                 }
             }
+            // Populate all empty stat lines
+            while (curr_slot <= 4){
+                sprintf(tmp, "|                            |  ");
+                strcat(present[curr_slot + 3], tmp);
+                curr_slot ++;
+            }
             sqlite3_finalize(stats_res);
         }
         else{

+ 5 - 5
src/RuneOptimizer/optimize/optimize.h

@@ -118,11 +118,11 @@ char stat_names[][13] = {
   "NULL", "HP_FLAT", "HP",  "ATK_FLAT", "ATK", "DEF_FLAT",
   "DEF",  "NULL",    "SPD", "CRR",      "CRD", "RES",      "ACC"
 };
-char set_names[][24] = {
-  "NULL",    "ENERGY",        "GUARD",   "SWIFT",    "BLADE",   "RAGE",
-  "FOCUS",   "ENDURE",        "FATAL",   "NULL",     "DESPAIR", "VAMPIRE",
-  "VIOLENT", "NEMESIS",       "WILL",    "SHIELD",   "REVENGE", "DESTROY",
-  "FIGHT",   "DETERMINATION", "ENHANCE", "ACCURACY", "TOLERANCE"
+char set_names[][25] = {
+  "NULL",    "ENERGY",  "GUARD",         "SWIFT",   "BLADE",    "RAGE",
+  "FOCUS",   "ENDURE",  "FATAL",         "NULL",    "DESPAIR",  "VAMPIRE",
+  "NULL",    "VIOLENT", "NEMESIS",       "WILL",    "SHIELD",   "REVENGE",
+  "DESTROY", "FIGHT",   "DETERMINATION", "ENHANCE", "ACCURACY", "TOLERANCE"
 };
 
 /**

+ 32 - 32
src/RuneOptimizer/update/update.c

@@ -291,22 +291,22 @@ int update_json(
         sqlite3_bind_int(res, 25, rune.lv12_hp_flat);
         sqlite3_bind_int(res, 26, rune.lv12_atk_flat);
         sqlite3_bind_int(res, 27, rune.lv12_def_flat);
-        sqlite3_bind_int(res, 29, rune.lv12_spd);
-        sqlite3_bind_int(res, 30, rune.lv12_crr);
-        sqlite3_bind_int(res, 31, rune.lv12_crd);
-        sqlite3_bind_int(res, 32, rune.lv12_acc);
-        sqlite3_bind_int(res, 33, rune.lv12_res);
-        sqlite3_bind_int(res, 34, rune.lv15_hp_percent);
-        sqlite3_bind_int(res, 35, rune.lv15_atk_percent);
-        sqlite3_bind_int(res, 36, rune.lv15_def_percent);
-        sqlite3_bind_int(res, 37, rune.lv15_hp_flat);
-        sqlite3_bind_int(res, 38, rune.lv15_atk_flat);
-        sqlite3_bind_int(res, 39, rune.lv15_def_flat);
-        sqlite3_bind_int(res, 40, rune.lv15_spd);
-        sqlite3_bind_int(res, 41, rune.lv15_crr);
-        sqlite3_bind_int(res, 42, rune.lv15_crd);
-        sqlite3_bind_int(res, 43, rune.lv15_acc);
-        sqlite3_bind_int(res, 44, rune.lv15_res);
+        sqlite3_bind_int(res, 28, rune.lv12_spd);
+        sqlite3_bind_int(res, 29, rune.lv12_crr);
+        sqlite3_bind_int(res, 30, rune.lv12_crd);
+        sqlite3_bind_int(res, 31, rune.lv12_acc);
+        sqlite3_bind_int(res, 32, rune.lv12_res);
+        sqlite3_bind_int(res, 33, rune.lv15_hp_percent);
+        sqlite3_bind_int(res, 34, rune.lv15_atk_percent);
+        sqlite3_bind_int(res, 35, rune.lv15_def_percent);
+        sqlite3_bind_int(res, 36, rune.lv15_hp_flat);
+        sqlite3_bind_int(res, 37, rune.lv15_atk_flat);
+        sqlite3_bind_int(res, 38, rune.lv15_def_flat);
+        sqlite3_bind_int(res, 39, rune.lv15_spd);
+        sqlite3_bind_int(res, 40, rune.lv15_crr);
+        sqlite3_bind_int(res, 41, rune.lv15_crd);
+        sqlite3_bind_int(res, 42, rune.lv15_acc);
+        sqlite3_bind_int(res, 43, rune.lv15_res);
         if (SQLITE_DONE != sqlite3_step(res)){
             fprintf(
             stderr,
@@ -631,22 +631,22 @@ int update_json(
             sqlite3_bind_int(res, 25, rune.lv12_hp_flat);
             sqlite3_bind_int(res, 26, rune.lv12_atk_flat);
             sqlite3_bind_int(res, 27, rune.lv12_def_flat);
-            sqlite3_bind_int(res, 29, rune.lv12_spd);
-            sqlite3_bind_int(res, 30, rune.lv12_crr);
-            sqlite3_bind_int(res, 31, rune.lv12_crd);
-            sqlite3_bind_int(res, 32, rune.lv12_acc);
-            sqlite3_bind_int(res, 33, rune.lv12_res);
-            sqlite3_bind_int(res, 34, rune.lv15_hp_percent);
-            sqlite3_bind_int(res, 35, rune.lv15_atk_percent);
-            sqlite3_bind_int(res, 36, rune.lv15_def_percent);
-            sqlite3_bind_int(res, 37, rune.lv15_hp_flat);
-            sqlite3_bind_int(res, 38, rune.lv15_atk_flat);
-            sqlite3_bind_int(res, 39, rune.lv15_def_flat);
-            sqlite3_bind_int(res, 40, rune.lv15_spd);
-            sqlite3_bind_int(res, 41, rune.lv15_crr);
-            sqlite3_bind_int(res, 42, rune.lv15_crd);
-            sqlite3_bind_int(res, 43, rune.lv15_acc);
-            sqlite3_bind_int(res, 44, rune.lv15_res);
+            sqlite3_bind_int(res, 28, rune.lv12_spd);
+            sqlite3_bind_int(res, 29, rune.lv12_crr);
+            sqlite3_bind_int(res, 30, rune.lv12_crd);
+            sqlite3_bind_int(res, 31, rune.lv12_acc);
+            sqlite3_bind_int(res, 32, rune.lv12_res);
+            sqlite3_bind_int(res, 33, rune.lv15_hp_percent);
+            sqlite3_bind_int(res, 34, rune.lv15_atk_percent);
+            sqlite3_bind_int(res, 35, rune.lv15_def_percent);
+            sqlite3_bind_int(res, 36, rune.lv15_hp_flat);
+            sqlite3_bind_int(res, 37, rune.lv15_atk_flat);
+            sqlite3_bind_int(res, 38, rune.lv15_def_flat);
+            sqlite3_bind_int(res, 39, rune.lv15_spd);
+            sqlite3_bind_int(res, 40, rune.lv15_crr);
+            sqlite3_bind_int(res, 41, rune.lv15_crd);
+            sqlite3_bind_int(res, 42, rune.lv15_acc);
+            sqlite3_bind_int(res, 43, rune.lv15_res);
             if (SQLITE_DONE != sqlite3_step(res)){
                 fprintf(
                 stderr,

+ 16 - 0
src/RuneOptimizer/update/update.h

@@ -116,6 +116,14 @@ struct DB_Rune {
 // Values for main stats.
 // Nested by stat, stars, level(0->12, 1->15)
 int main_stats_values[13][7][2] = {
+  { //NULL (unused)
+      {0, 0},
+      {0, 0},
+      {0, 0},
+      {0, 0},
+      {0, 0},
+      {0, 0}
+  },
   { //HP_FLAT
       {0, 0}, // 0 stars (unused)
       {580, 804}, // 1 stars
@@ -170,6 +178,14 @@ int main_stats_values[13][7][2] = {
       {37, 51}, // 5 stars
       {47, 63} // 6 stars
   },
+  { //NULL (unused)
+      {0, 0},
+      {0, 0},
+      {0, 0},
+      {0, 0},
+      {0, 0},
+      {0, 0}
+  },
   { //SPD
       {0, 0}, // 0 stars (unused)
       {13, 18}, // 1 stars

+ 4 - 4
src/RuneOptimizerGUI/RuneOptimizer.py

@@ -48,10 +48,10 @@ stat_names = [
   "DEF%", "NULL", "SPD ", "CRR ", "CRD ", "RES ", "ACC "
 ]
 set_names = [
-  "NULL",    "ENERGY",        "GUARD",   "SWIFT",    "BLADE",   "RAGE",
-  "FOCUS",   "ENDURE",        "FATAL",   "NULL",     "DESPAIR", "VAMPIRE",
-  "VIOLENT", "NEMESIS",       "WILL",    "SHIELD",   "REVENGE", "DESTROY",
-  "FIGHT",   "DETERMINATION", "ENHANCE", "ACCURACY", "TOLERANCE"
+  "NULL",    "ENERGY",  "GUARD",         "SWIFT",   "BLADE",    "RAGE",
+  "FOCUS",   "ENDURE",  "FATAL",         "NULL",    "DESPAIR",  "VAMPIRE",
+  "NULL",    "VIOLENT", "NEMESIS",       "WILL",    "SHIELD",   "REVENGE",
+  "DESTROY", "FIGHT",   "DETERMINATION", "ENHANCE", "ACCURACY", "TOLERANCE"
 ]
 
 

+ 12 - 1
src/RuneOptimizerGUI/classes/PanelOptimizer.py

@@ -55,6 +55,8 @@ class PanelOptimizer(wx.Panel):
     unitStats : int[10]
         The current stats of the selected unit. (default is
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).
+    teamIds : string[]
+        IDs of all teams, indexed by the order they appear in the team selector.
 
     Methods
     -------
@@ -87,6 +89,7 @@ class PanelOptimizer(wx.Panel):
     inventory = None
     teams = None
     unitStats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+    teamIds = []
 
     def __init__(self, parent, id=wx.ID_ANY):
         """Initializes the panel.
@@ -440,8 +443,8 @@ class PanelOptimizer(wx.Panel):
           FROM teams
           ORDER BY priority DESC;
         """)
-        i = 0
         for row in cursor:
+            self.teamIds.append(row[0])
             teams.append(str(row[1]) + " (" + str(row[2]) + ")")
         teamsBox = wx.StaticBox(
           parent=self, label="Exclude runes from units in teams",
@@ -773,6 +776,14 @@ class PanelOptimizer(wx.Panel):
         command += (" --min-ehp " + str(self.minStatSlid[8].GetValue()))
         command += (" --min-dmg " + str(self.minStatSlid[9].GetValue()))
 
+        if self.inventory.GetValue():
+            command += " --storage"
+        if len(self.teams.GetCheckedItems()) > 0:
+            command += " --no-teams "
+            for team in self.teams.GetCheckedItems():
+                command += str(self.teamIds[team]) + ","
+            command = command[:-1]
+
 
         command += (" --gui ")
         command = os.path.dirname(os.path.realpath(__file__)) + "/../../" + command

+ 8 - 10
src/RuneOptimizerGUI/classes/RuneOptimizerFrame.py

@@ -231,17 +231,15 @@ class RuneOptimizerFrame(wx.Frame):
         """
 
         with DialogUpdateJson(self) as dlg:
-            dlg.ShowModal()
+            if dlg.ShowModal() == wx.ID_OK:
                 # do something here
-            print("UPDATE: " + str(dlg.updateDone))
-            print("ERROR: " + str(dlg.updateError))
-            if (dlg.updateDone == True and dlg.updateError == False):
-                print("Update succesfull!")
-            #print('UPDATE!')
-            #print(dlg.fileSelector.GetPath())
-            # TODO
-            # Validate file, prepare command and pass it to RuneOptimizer.
-            # Then, redraw almost all windows
+                print("UPDATE: " + str(dlg.updateDone))
+                print("ERROR: " + str(dlg.updateError))
+                if (dlg.updateDone == True and dlg.updateError == False):
+                    print("Update succesfull!")
+
+            else:
+                print('DONT UPDATE!')
 
     def updateFromSwdb(self, event):
         """