Skip to content

Commit

Permalink
feat: handle last shot and full reload in sounds section and explosio…
Browse files Browse the repository at this point in the history
…n damage properly in dps calculation
  • Loading branch information
1092384 committed Dec 24, 2024
1 parent 62fbfe8 commit a102647
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
13 changes: 8 additions & 5 deletions app/(wiki)/weapons/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@ import GridTable from "@/components/tables/GridTable";
import { getSuroiImageLink } from "@/lib/util/suroi";
import { Guns } from "@/vendor/suroi/common/src/definitions/guns";
import { Melees } from "@/vendor/suroi/common/src/definitions/melees";
import { Explosions } from "@/vendor/suroi/common/src/definitions/explosions";
import { Throwables } from "@/vendor/suroi/common/src/definitions/throwables";
import Link from "next/link";
import TableWithHeader from "@/components/tables/TableWithHeader";
import { FireMode } from "@/vendor/suroi/common/src/constants";

const dpsList: Array<[string, number, number]> = [];
for (const gun of Guns) {
const explosion = Explosions.definitions.find(
explosion => explosion.idString === gun.ballistics.onHitExplosion
);
dpsList.push([
gun.name,
Number(gun.fireMode === FireMode.Burst
? (
(1000
/ (gun.burstProperties.burstCooldown
+ gun.fireDelay * gun.burstProperties.shotsPerBurst))
* (gun.ballistics.damage * gun.burstProperties.shotsPerBurst)
* ((gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0)) * gun.burstProperties.shotsPerBurst)
).toFixed(2)
: (
gun.ballistics.damage
(gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0))
* (gun.bulletCount ?? 1)
* (1000 / gun.fireDelay)
).toFixed(2)),
Expand All @@ -30,12 +33,12 @@ for (const gun of Guns) {
(1000
/ (gun.burstProperties.burstCooldown
+ gun.fireDelay * gun.burstProperties.shotsPerBurst))
* (gun.ballistics.damage
* ((gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0))
* gun.burstProperties.shotsPerBurst
* gun.ballistics.obstacleMultiplier)
).toFixed(2)
: (
gun.ballistics.damage
(gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0))
* gun.ballistics.obstacleMultiplier
* (gun.bulletCount ?? 1)
* (1000 / gun.fireDelay)
Expand Down
26 changes: 22 additions & 4 deletions components/sidebars/GunDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ export default function GunDetails({ gun, explosion }: GunDetailsProps) {
(1000
/ (gun.burstProperties.burstCooldown
+ gun.fireDelay * gun.burstProperties.shotsPerBurst))
* (gun.ballistics.damage * gun.burstProperties.shotsPerBurst)
* ((gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0)) * gun.burstProperties.shotsPerBurst)
).toFixed(2)}
{gun.fireMode !== FireMode.Burst
&& (
gun.ballistics.damage
(gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0))
* (gun.bulletCount ?? 1)
* (1000 / gun.fireDelay)
).toFixed(2)}
Expand All @@ -134,13 +134,13 @@ export default function GunDetails({ gun, explosion }: GunDetailsProps) {
(1000
/ (gun.burstProperties.burstCooldown
+ gun.fireDelay * gun.burstProperties.shotsPerBurst))
* (gun.ballistics.damage
* ((gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0))
* gun.ballistics.obstacleMultiplier
* gun.burstProperties.shotsPerBurst)
).toFixed(2)}
{gun.fireMode !== FireMode.Burst
&& (
gun.ballistics.damage
(gun.ballistics.damage + (explosion?.damage ?? 0) + (explosion?.ballistics ? (explosion.ballistics.damage * explosion.shrapnelCount) : 0))
* gun.ballistics.obstacleMultiplier
* (gun.bulletCount ?? 1)
* (1000 / gun.fireDelay)
Expand Down Expand Up @@ -220,6 +220,15 @@ export default function GunDetails({ gun, explosion }: GunDetailsProps) {
""
)}_fire.mp3`}
/>
{gun.ballistics.lastShotFX && (
<InfoboxAudio
name="Last Shot"
src={`${SOUND_BASE_URL}/sfx/weapons/${gun.idString.replace(
"dual_",
""
)}_fire_last.mp3`}
/>
)}
<InfoboxAudio
name="Switch"
src={`${SOUND_BASE_URL}/sfx/weapons/${gun.idString.replace(
Expand All @@ -231,6 +240,15 @@ export default function GunDetails({ gun, explosion }: GunDetailsProps) {
name="Reload"
src={`${SOUND_BASE_URL}/sfx/weapons/${gun.idString}_reload.mp3`}
/>
{gun.reloadFullOnEmpty && (
<InfoboxAudio
name="Full Reload"
src={`${SOUND_BASE_URL}/sfx/weapons/${gun.idString.replace(
"dual_",
""
)}_reload_full.mp3`}
/>
)}
{gun.ballistics.onHitExplosion && (
<InfoboxAudio
name="Explosion"
Expand Down

0 comments on commit a102647

Please sign in to comment.