diff --git a/calculator.cpp b/calculator.cpp index 18f6efa..24188f4 100644 --- a/calculator.cpp +++ b/calculator.cpp @@ -218,8 +218,13 @@ void Calculator::Alg_Hamming() { while(item_triangle.at(i).count() > 1) { - Item tm = item_triangle[i].takeFirst(); - flow[flow_step++] = ItemPool::preForge(tm, item_triangle[i].takeFirst(), additional_mode); + Item a = item_triangle[i].takeFirst(); + Item b = item_triangle[i].takeFirst(); + flow[flow_step++] = ItemPool::preForge(a, b, additional_mode); + } + if (item_triangle.at(i).count() == 1 && i + 1 < item_triangle.count()) + { + item_triangle[i + 1].append(item_triangle[i].takeFirst()); } } Step s = flow[flow_step - 1]; diff --git a/itempool.cpp b/itempool.cpp index a94c828..74472fe 100644 --- a/itempool.cpp +++ b/itempool.cpp @@ -338,9 +338,9 @@ Step ItemPool::preForge(Item A, Item B, ForgeMode mode) cost += Basic::ench_table[Basic::searchTable(B.ench[i].name)].multiplier[0] * combine(B.ench[i].name, A.ench[q].lvl, B.ench[i].lvl); } else { if (B.name == ID_ECB) - cost += Basic::ench_table[Basic::searchTable(B.ench[i].name)].multiplier[1] * (combine(B.ench[i].name, A.ench[q].lvl, B.ench[i].lvl - A.ench[i].lvl)); + cost += Basic::ench_table[Basic::searchTable(B.ench[i].name)].multiplier[1] * (combine(B.ench[i].name, A.ench[q].lvl, B.ench[i].lvl) - A.ench[i].lvl); else - cost += Basic::ench_table[Basic::searchTable(B.ench[i].name)].multiplier[0] * (combine(B.ench[i].name, A.ench[q].lvl, B.ench[i].lvl - A.ench[i].lvl)); + cost += Basic::ench_table[Basic::searchTable(B.ench[i].name)].multiplier[0] * (combine(B.ench[i].name, A.ench[q].lvl, B.ench[i].lvl) - A.ench[i].lvl); } } else { if (B.name == ID_ECB) @@ -406,10 +406,6 @@ Item ItemPool::forge(Item A, Item B) int q = Basic::searchEnch(A.ench, A_el, B.ench[i].name); if (q != -1) { A.ench[q].lvl = combine(B.ench[i].name, A.ench[q].lvl, B.ench[q].lvl); - // if(A.ench[q].lvl == B.ench[i].lvl && A.ench[q].lvl != Basic::ench_table[Basic::searchTable(A.ench[q].name)].mlvl) - // A.ench[q].lvl++; - // else if(A.ench[q].lvl < B.ench[i].lvl) - // A.ench[q].lvl = B.ench[i].lvl; } else { int k = 0; while (k < INIT_LENGTH && A.ench[k].name != "") diff --git a/mainwindow.cpp b/mainwindow.cpp index e2a90e5..5caadc2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -11,6 +11,8 @@ #include #include +#include +#include using namespace std; @@ -204,7 +206,33 @@ MainWindow::MainWindow(QWidget *parent) FileOperate fo; fo.saveExport(); }); + connect(ui->OutputItem, &QPushButton::clicked, this, [=](){ + QString info; + info += "- Name: " + Basic::OutputItem.name.replace('\n', ' ') + "\n"; + info += "- Durability: " + QString::number(Basic::OutputItem.duration) + "\n"; + info += "- Penalty: " + QString::number(Basic::OutputItem.penalty) + "\n"; + info += "- Enchs: \n"; + for (int i = 0; i < INIT_LENGTH; i++) + { + if (Basic::OutputItem.ench[i].name.isEmpty()) + break; + info += "\t- " + Basic::OutputItem.ench[i].name + " " + Basic::IntToRoman(Basic::OutputItem.ench[i].lvl) + "\n"; + } + QDialog dialog(this); + dialog.setWindowTitle("Details"); + QPoint p = this->geometry().center(); + dialog.setGeometry(p.x() - 256, p.y() - 256, 512, 512); + QVBoxLayout layout(&dialog); + layout.setContentsMargins(8, 8, 8, 8); + QTextEdit text(&dialog); + layout.addWidget(&text); + text.setMarkdown(info); + text.setReadOnly(true); + dialog.setModal(true); + dialog.show(); + dialog.exec(); + }); //Initialze & Load Files initialize();