-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
48 lines (39 loc) · 1.37 KB
/
mainwindow.cpp
File metadata and controls
48 lines (39 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "formulasbase.h"
#include "QDebug"
// 1. Include your formulas here
#include "Formulas/formulas_530_17128.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// 2. Then add your formulas version here
ui->list->addItem("5.3.0 17128");
connect(ui->input, SIGNAL(textChanged(QString)), this, SLOT(CalculOffset(QString)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::CalculOffset(QString input)
{
FormulasBase *formulas = NULL;
quint16 opcode = input.toShort(0, input.contains("x") ? 16 : 10);
QString version = ui->list->currentText();
ui->dec->setText(QString::number(opcode));
// 3. Finally add your formulas handler here
if (version == "5.3.0 17128")
formulas = new Formulas_530_17128(opcode);
if (formulas && formulas->Version() == version)
{
ui->auth->setText("0x" + formulas->GetAuthOffset());
ui->jam->setText("0x" + formulas->GetJAMOffset());
ui->crypt->setText("0x" + formulas->GetCryptOffset());
ui->guild->setText("0x" + formulas->GetGuildOffset());
ui->quest->setText("0x" + formulas->GetQuestOffset());
ui->spell->setText("0x" + formulas->GetSpellOffset());
ui->movement->setText("0x" + formulas->GetMovementOffset());
}
}