Rename variable

This commit is contained in:
Kalle
2022-09-10 23:16:44 +03:00
parent 62f0521bd0
commit 3d837a95fe
7 changed files with 15 additions and 16 deletions

View File

@@ -10,7 +10,7 @@ import {
clothesGearIds,
headGearIds,
shoesGearIds,
weaponIds,
mainWeaponIds,
} from "~/modules/in-game-lists";
import { gearImageUrl, weaponImageUrl } from "~/utils/urls";
import { Image } from "./Image";
@@ -195,10 +195,10 @@ export function WeaponCombobox({
}: Pick<
ComboboxProps<ComboboxBaseOption>,
"inputName" | "onChange" | "className" | "id" | "required"
> & { initialWeaponId?: typeof weaponIds[number] }) {
> & { initialWeaponId?: typeof mainWeaponIds[number] }) {
const { t } = useTranslation("weapons");
const idToWeapon = (id: typeof weaponIds[number]) => ({
const idToWeapon = (id: typeof mainWeaponIds[number]) => ({
value: String(id),
label: t(`${id}`),
imgPath: weaponImageUrl(id),
@@ -207,9 +207,9 @@ export function WeaponCombobox({
return (
<Combobox
inputName={inputName}
options={weaponIds.map(idToWeapon)}
options={mainWeaponIds.map(idToWeapon)}
initialValue={initialWeaponId ? idToWeapon(initialWeaponId) : undefined}
placeholder={t(`${weaponIds[0]}`)}
placeholder={t(`${mainWeaponIds[0]}`)}
onChange={onChange}
className={className}
id={id}

View File

@@ -12,7 +12,7 @@ import {
headGearIds,
modesShort,
shoesGearIds,
weaponIds,
mainWeaponIds,
} from "~/modules/in-game-lists";
import {
lastCompletedVoting,
@@ -503,7 +503,7 @@ function adminBuilds() {
const randomOrderHeadGear = shuffle(headGearIds.slice());
const randomOrderClothesGear = shuffle(clothesGearIds.slice());
const randomOrderShoesGear = shuffle(shoesGearIds.slice());
const randomOrderWeaponIds = shuffle(weaponIds.slice());
const randomOrderWeaponIds = shuffle(mainWeaponIds.slice());
const randomAbility = (legalTypes: AbilityType[]) => {
const randomOrderAbilities = shuffle([...abilities]);

View File

@@ -1,6 +1,6 @@
export { stages } from "./stages";
export { modes, modesShort } from "./modes";
export { weaponIds, subWeaponIds } from "./weapon-ids";
export { mainWeaponIds, subWeaponIds } from "./weapon-ids";
export { headGearIds, clothesGearIds, shoesGearIds } from "./gear-ids";
export { abilitiesShort, abilities } from "./abilities";
export type {

View File

@@ -1,7 +1,7 @@
import type { abilities } from "./abilities";
import type { modes } from "./modes";
import type { stages } from "./stages";
import type { subWeaponIds, weaponIds } from "./weapon-ids";
import type { subWeaponIds, mainWeaponIds } from "./weapon-ids";
export type ModeShort = typeof modes[number]["short"];
@@ -11,7 +11,7 @@ export type Ability = typeof abilities[number]["name"];
export type AbilityWithUnknown = typeof abilities[number]["name"] | "UNKNOWN";
export type AbilityType = typeof abilities[number]["type"];
export type MainWeaponId = typeof weaponIds[number];
export type MainWeaponId = typeof mainWeaponIds[number];
export type SubWeaponId = typeof subWeaponIds[number];
export type BuildAbilitiesTuple = [

View File

@@ -1,5 +1,4 @@
// xxx: rename to mainWeaponIds
export const weaponIds = [
export const mainWeaponIds = [
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 200, 210, 220, 230, 240, 250, 300, 310,
400, 1000, 1010, 1020, 1030, 1100, 1110, 2000, 2010, 2020, 2030, 2040, 2050,
2060, 3000, 3010, 3020, 3030, 3040, 4000, 4010, 4020, 4030, 4040, 5000, 5010,

View File

@@ -23,7 +23,7 @@ import {
headGearIds,
modesShort,
shoesGearIds,
weaponIds,
mainWeaponIds,
} from "~/modules/in-game-lists";
import type {
BuildAbilitiesTuple,
@@ -67,7 +67,7 @@ const newBuildActionSchema = z.object({
z
.number()
.refine((val) =>
weaponIds.includes(val as typeof weaponIds[number])
mainWeaponIds.includes(val as typeof mainWeaponIds[number])
)
)
)

View File

@@ -8,7 +8,7 @@
import {
type SubWeaponId,
subWeaponIds,
weaponIds,
mainWeaponIds,
} from "~/modules/in-game-lists";
// xxx: missing id 8010
import weapons from "./dicts/WeaponInfoMain.json";
@@ -206,7 +206,7 @@ function resolveOverwrites(params: any) {
}
function mainWeaponShouldBeSkipped(weapon: MainWeapon) {
if (!weaponIds.includes(weapon.Id as any)) return true;
if (!mainWeaponIds.includes(weapon.Id as any)) return true;
if (weapon.Season > CURRENT_SEASON) return true;
return false;