|
@@ -16,28 +16,28 @@ public class Inventory {
|
16
|
16
|
if (items[i].getQuality() > 0) {
|
17
|
17
|
//level 3 - item type
|
18
|
18
|
if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
19
|
|
- items[i].setQuality(items[i].getQuality() - 1);
|
|
19
|
+ updateQuality(items[i], -1);
|
20
|
20
|
}
|
21
|
21
|
}
|
22
|
22
|
//level 1 - item type
|
23
|
23
|
} else {
|
24
|
24
|
//level 2 - quality
|
25
|
25
|
if (items[i].getQuality() < 50) {
|
26
|
|
- items[i].setQuality(items[i].getQuality() + 1);
|
|
26
|
+ updateQuality(items[i], 1);
|
27
|
27
|
//level 3 - item type
|
28
|
28
|
if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
|
29
|
29
|
//level 4 - sell in date
|
30
|
30
|
if (items[i].getSellIn() < 11) {
|
31
|
31
|
//level 5 - quality
|
32
|
32
|
if (items[i].getQuality() < 50) {
|
33
|
|
- items[i].setQuality(items[i].getQuality() + 1);
|
|
33
|
+ updateQuality(items[i], 1);
|
34
|
34
|
}
|
35
|
35
|
}
|
36
|
36
|
//level 4 - sell in date
|
37
|
37
|
if (items[i].getSellIn() < 6) {
|
38
|
38
|
//level 5 - quality
|
39
|
39
|
if (items[i].getQuality() < 50) {
|
40
|
|
- items[i].setQuality(items[i].getQuality() + 1);
|
|
40
|
+ updateQuality(items[i], 1);
|
41
|
41
|
}
|
42
|
42
|
}
|
43
|
43
|
}
|
|
@@ -47,7 +47,7 @@ public class Inventory {
|
47
|
47
|
|
48
|
48
|
//level 1 - item type
|
49
|
49
|
if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
50
|
|
- items[i].setSellIn(items[i].getSellIn() - 1);
|
|
50
|
+ updateSellIn(items[i]);
|
51
|
51
|
}
|
52
|
52
|
|
53
|
53
|
|
|
@@ -82,4 +82,8 @@ public class Inventory {
|
82
|
82
|
public void updateQuality(Item item, int amount){
|
83
|
83
|
item.setQuality(item.getQuality() + amount);
|
84
|
84
|
}
|
|
85
|
+
|
|
86
|
+ public void updateSellIn(Item item){
|
|
87
|
+ item.setSellIn(item.getSellIn() - 1);
|
|
88
|
+ }
|
85
|
89
|
}
|