fix prop search

This commit is contained in:
Robin Appelman 2022-09-03 17:45:41 +02:00
commit d360ffec68
8 changed files with 19 additions and 19 deletions

View file

@ -32,7 +32,7 @@ interface AppState {
header: Header | null,
progress: number,
packets: PacketMeta[],
prop_names: Map<number, { table: string, prop: string }>,
prop_names: Map<string, { table: string, prop: string }>,
class_names: Map<number, string>,
active: Packet | null,
activeIndex: number | null,

View file

@ -4,7 +4,7 @@ import {filterEntity, filterMessage, isSearchEmpty, SearchFilter} from "../searc
export interface MessageInfoProps {
msg: Message,
prop_names: Map<number, { table: String, prop: String }>,
prop_names: Map<string, { table: String, prop: String }>,
class_names: Map<number, String>,
search: SearchFilter
}
@ -78,7 +78,7 @@ function formatPropValue(value: SendPropValue): string {
}
}
function formatEntity(entity: PacketEntity, prop_names: Map<number, { table: String, prop: String }>, class_names: Map<number, String>,): string {
function formatEntity(entity: PacketEntity, prop_names: Map<string, { table: String, prop: String }>, class_names: Map<number, String>,): string {
let class_name = class_names.get(entity.server_class);
// let baseline = entity.baseline_props.map(prop => {
// let names = prop_names.get(prop.identifier);

2
www/src/parser.d.ts vendored
View file

@ -3212,7 +3212,7 @@ export type GameEventValue =
Boolean: boolean;
};
export type GameEventTypeId = number;
export type SendPropIdentifier = number;
export type SendPropIdentifier = string;
export type SendPropValue = Vector | VectorXY | number | number | string | SendPropValue[];
export type EntityId = number;
export type ClassId = number;

View file

@ -9,6 +9,6 @@ export type RequestMessageData = {type: "data", data: ArrayBuffer}
export type ResponseMessageData = { type: "progress", progress: number }
| { type: "packet", packet: Packet }
| { type: "done", packets: PacketMeta[], header: Header, prop_names: { identifier: number, table: string, prop: string }[], class_names: { identifier: number, name: string }[] }
| { type: "done", packets: PacketMeta[], header: Header, prop_names: { identifier: string, table: string, prop: string }[], class_names: { identifier: number, name: string }[] }
| { type: "packet_names", packet: {} }
| { type: "search_result", matches: number[] };

View file

@ -6,13 +6,13 @@ import {Message, Packet, SendProp, StringTable} from "./parser";
export interface SearchFilter {
entity: number,
search: string,
prop_ids: number[],
prop_ids: string[],
class_ids: number[],
}
export interface SearchBarProps {
onSearch: (search: SearchFilter) => void,
prop_names: Map<number, { table: string, prop: string }>,
prop_names: Map<string, { table: string, prop: string }>,
class_names: Map<number, string>,
}
@ -91,7 +91,7 @@ export function filterPacket(
}
}
function filterPropNames(prop_names: Map<number, { table: string, prop: string }>, filter: string): number[] {
function filterPropNames(prop_names: Map<string, { table: string, prop: string }>, filter: string): string[] {
if (filter.length === 0) {
return [];
}
@ -166,7 +166,7 @@ export function filterEntity(class_id: number, props: SendProp[], search: Search
return true;
}
return search.class_ids.includes(class_id) || props.some(prop => search.prop_ids.includes(prop.identifier))
return search.class_ids.includes(class_id) || props.some(prop => search.prop_ids.includes(`${prop.identifier}`))
|| props.some(prop => prop.value == search.search);
}

View file

@ -8,7 +8,7 @@ import {PacketMeta, PacketType} from "./index"
interface TableProps {
packets: PacketMeta[],
prop_names: Map<number, { table: string, prop: string }>,
prop_names: Map<string, { table: string, prop: string }>,
class_names: Map<number, string>,
onClick: (i: number) => void,
activeIndex: number | null,
@ -79,7 +79,7 @@ export function PacketRow({packet}: RowProps) {
interface DetailProps {
packet: Packet,
prop_names: Map<number, { table: string, prop: string }>,
prop_names: Map<string, { table: string, prop: string }>,
class_names: Map<number, string>,
search: SearchFilter,
}