feat: add additional firearm attributes and DPS calculation to FirearmsPage

This commit is contained in:
2026-04-09 14:17:38 +08:00
parent 7f50fafee8
commit 63f9885aa2
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -18,6 +18,10 @@ const firearmTypeText: Record<FirearmType, string> = {
const allTypeValue = "ALL" const allTypeValue = "ALL"
type FirearmTypeFilter = FirearmType | typeof allTypeValue type FirearmTypeFilter = FirearmType | typeof allTypeValue
function asDps(fireRate: number, damage: number) {
return ((fireRate / 60) * damage).toFixed(2)
}
export default function FirearmsPage() { export default function FirearmsPage() {
const [page, setPage] = useState<number>(1) const [page, setPage] = useState<number>(1)
const [typeFilter, setTypeFilter] = useState<FirearmTypeFilter>(allTypeValue) const [typeFilter, setTypeFilter] = useState<FirearmTypeFilter>(allTypeValue)
@@ -79,6 +83,14 @@ export default function FirearmsPage() {
<strong></strong> <strong></strong>
{firearm.level} {firearm.level}
</Typography.Text> </Typography.Text>
<Typography.Text>
<strong></strong>
{asDps(firearm.fireRate, firearm.armourDamage)}
</Typography.Text>
<Typography.Text>
<strong></strong>
{asDps(firearm.fireRate, firearm.bodyDamage)}
</Typography.Text>
<Typography.Paragraph <Typography.Paragraph
style={{ marginBottom: 0 }} style={{ marginBottom: 0 }}
type="secondary" type="secondary"
+4
View File
@@ -23,6 +23,10 @@ export interface Firearm {
name: string name: string
type: FirearmType type: FirearmType
level: string level: string
calibre: string
fireRate: number
armourDamage: number
bodyDamage: number
review: string review: string
} }