|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Orm\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping\Column; |
|
8
|
|
|
use Doctrine\ORM\Mapping\Entity; |
|
9
|
|
|
use Doctrine\ORM\Mapping\GeneratedValue; |
|
10
|
|
|
use Doctrine\ORM\Mapping\Id; |
|
11
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
|
12
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
13
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
14
|
|
|
use Override; |
|
|
|
|
|
|
15
|
|
|
use Stu\Component\Map\MapEnum; |
|
|
|
|
|
|
16
|
|
|
use Stu\Orm\Repository\LayerRepository; |
|
17
|
|
|
|
|
18
|
|
|
#[Table(name: 'stu_layer')] |
|
19
|
|
|
#[Entity(repositoryClass: LayerRepository::class)] |
|
20
|
|
|
class Layer implements LayerInterface |
|
21
|
|
|
{ |
|
22
|
|
|
#[Id] |
|
23
|
|
|
#[Column(type: 'integer')] |
|
24
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
25
|
|
|
private int $id; |
|
26
|
|
|
|
|
27
|
|
|
#[Column(type: 'string')] |
|
28
|
|
|
private string $name; |
|
29
|
|
|
|
|
30
|
|
|
#[Column(type: 'integer')] |
|
31
|
|
|
private int $width; |
|
32
|
|
|
|
|
33
|
|
|
#[Column(type: 'integer')] |
|
34
|
|
|
private int $height; |
|
35
|
|
|
|
|
36
|
|
|
#[Column(type: 'boolean')] |
|
37
|
|
|
private bool $is_hidden; |
|
38
|
|
|
|
|
39
|
|
|
#[Column(type: 'boolean', nullable: true)] |
|
40
|
|
|
private ?bool $is_finished = null; |
|
41
|
|
|
|
|
42
|
|
|
#[Column(type: 'boolean', nullable: true)] |
|
43
|
|
|
private ?bool $is_encoded = null; |
|
44
|
|
|
|
|
45
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
46
|
|
|
private ?int $award_id = null; |
|
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
#[Column(type: 'text', nullable: true)] |
|
49
|
|
|
private ?string $description = null; |
|
50
|
|
|
|
|
51
|
|
|
#[Column(type: 'boolean', nullable: true)] |
|
52
|
|
|
private ?bool $is_colonizable = null; |
|
53
|
|
|
|
|
54
|
|
|
#[Column(type: 'boolean', nullable: true)] |
|
55
|
|
|
private ?bool $is_noobzone = null; |
|
56
|
|
|
|
|
57
|
|
|
#[ManyToOne(targetEntity: 'Award')] |
|
58
|
|
|
#[JoinColumn(name: 'award_id', referencedColumnName: 'id')] |
|
59
|
|
|
private ?AwardInterface $award = null; |
|
60
|
|
|
|
|
61
|
|
|
|
|
62
|
16 |
|
#[Override] |
|
63
|
|
|
public function getId(): int |
|
64
|
|
|
{ |
|
65
|
16 |
|
return $this->id; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
8 |
|
#[Override] |
|
69
|
|
|
public function getName(): string |
|
70
|
|
|
{ |
|
71
|
8 |
|
return $this->name; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
7 |
|
#[Override] |
|
75
|
|
|
public function getWidth(): int |
|
76
|
|
|
{ |
|
77
|
7 |
|
return $this->width; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
7 |
|
#[Override] |
|
81
|
|
|
public function getHeight(): int |
|
82
|
|
|
{ |
|
83
|
7 |
|
return $this->height; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
#[Override] |
|
87
|
|
|
public function isHidden(): bool |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->is_hidden; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
#[Override] |
|
93
|
|
|
public function isFinished(): bool |
|
94
|
|
|
{ |
|
95
|
|
|
if ($this->is_finished === null) { |
|
96
|
|
|
return false; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
return $this->is_finished; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
5 |
|
#[Override] |
|
103
|
|
|
public function isEncoded(): bool |
|
104
|
|
|
{ |
|
105
|
5 |
|
if ($this->is_encoded === null) { |
|
106
|
|
|
return false; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
5 |
|
return $this->is_encoded; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
#[Override] |
|
113
|
|
|
public function getAward(): ?AwardInterface |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->award; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
#[Override] |
|
119
|
|
|
public function getDescription(): ?string |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->description; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
#[Override] |
|
125
|
|
|
public function setDescription(?string $description): LayerInterface |
|
126
|
|
|
{ |
|
127
|
|
|
$this->description = $description; |
|
128
|
|
|
|
|
129
|
|
|
return $this; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
#[Override] |
|
133
|
|
|
public function isColonizable(): bool |
|
134
|
|
|
{ |
|
135
|
|
|
if ($this->is_colonizable === null) { |
|
136
|
|
|
return false; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
return $this->is_colonizable; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
#[Override] |
|
143
|
|
|
public function isNoobzone(): bool |
|
144
|
|
|
{ |
|
145
|
|
|
if ($this->is_noobzone === null) { |
|
146
|
|
|
return false; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
return $this->is_noobzone; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
4 |
|
#[Override] |
|
153
|
|
|
public function getSectorsHorizontal(): int |
|
154
|
|
|
{ |
|
155
|
4 |
|
return (int)ceil($this->getWidth() / MapEnum::FIELDS_PER_SECTION); |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
4 |
|
#[Override] |
|
159
|
|
|
public function getSectorsVertical(): int |
|
160
|
|
|
{ |
|
161
|
4 |
|
return (int)ceil($this->getHeight() / MapEnum::FIELDS_PER_SECTION); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
4 |
|
#[Override] |
|
165
|
|
|
public function getSectorCount(): int |
|
166
|
|
|
{ |
|
167
|
4 |
|
return $this->getSectorsVertical() * $this->getSectorsHorizontal(); |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
1 |
|
#[Override] |
|
171
|
|
|
public function getSectorId(int $mapCx, int $mapCy): int |
|
172
|
|
|
{ |
|
173
|
1 |
|
return $mapCx + ($mapCy - 1) * $this->getSectorsHorizontal(); |
|
174
|
|
|
} |
|
175
|
|
|
} |
|
176
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths