-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathenchlistwidget.cpp
66 lines (57 loc) · 1.32 KB
/
enchlistwidget.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "enchlistwidget.h"
#include "ui_enchlistwidget.h"
EnchListWidget::EnchListWidget(QWidget *parent)
: QWidget{parent}
, ui(new Ui::EnchListWidget)
{
ui->setupUi(this);
connect(ui->cb, &QCheckBox::stateChanged, this, &EnchListWidget::stateChanged);
connect(ui->sb, &QSpinBox::valueChanged, this, &EnchListWidget::valueChanged);
}
EnchListWidget::~EnchListWidget()
{
delete ui;
}
void EnchListWidget::setEnch(EnchTable ench)
{
ui->cb->setChecked(false);
ui->name->setText(ench.name);
ui->sb->setMaximum(ench.mlvl);
ui->sb->setValue(1);
}
Ench EnchListWidget::ench()
{
Ench e;
e.name = ui->name->text();
e.lvl = ui->sb->value();
return e;
}
void EnchListWidget::setChecked(bool a)
{
ui->cb->setChecked(a);
}
bool EnchListWidget::isChecked()
{
return ui->cb->isChecked();
}
void EnchListWidget::checkRepulsion()
{
int p = Basic::searchTable(ui->name->text());
if(p == -1)
return;
for(int i = 0; i < Basic::origin_ench_l; i++)
{
for(int j = 0; j < Basic::ench_table[p].repulsion->count(); j++)
{
if(Basic::origin_ench[i].name == Basic::ench_table[p].repulsion[j])
{
setEnabled(false);
return;
}
}
}
if(!isEnabled())
{
setEnabled(true);
}
}