Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-3">
<input [formControlName]="'TextID'" type="number" class="form-control form-control-sm" id="name" placeholder="TextID" />
</div>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-2">
<input [formControlName]="'text0_0'" class="form-control form-control-sm" id="text0_0" placeholder="text0_0" />
</div>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-2">
<input [formControlName]="'text0_1'" class="form-control form-control-sm" id="text0_1" placeholder="text0_1" />
</div>
</ng-container>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-2">
<input [formControlName]="'limit'" class="form-control form-control-sm" id="limit" placeholder="Limit" />
Expand Down
28 changes: 28 additions & 0 deletions src/app/features/gossip/select-gossip/select-gossip.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,32 @@ export class SelectGossipService extends SelectService<GossipMenu> {
constructor(readonly queryService: MysqlQueryService, public handlerService: GossipHandlerService) {
super(queryService, handlerService, GOSSIP_MENU_TABLE, GOSSIP_MENU_ID, null, GOSSIP_MENU_SEARCH_FIELDS);
}

onSearch(): void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more importantly, why overriding this method instead of just editing GOSSIP_MENU_SEARCH_FIELDS in gossip-menu.type.ts

console.log(this.queryForm.getRawValue().fields);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log

const {
limit,
fields: { MenuID, TextID, text0_0, text0_1 },
} = this.queryForm.getRawValue();

this.subscriptions.push(
this.queryService
.query<GossipMenu>(
"SELECT * FROM `gossip_menu` WHERE (`MenuID` LIKE '%" +
(MenuID ?? '') +
"%') AND (`TextID` LIKE '%" +
(TextID ?? '') +
"%') AND `TextID` IN (SELECT `ID` FROM `npc_text` WHERE `text0_0` LIKE '%" +
(text0_0 ?? '') +
"%' AND `text0_1` LIKE '%" +
(text0_1 ?? '') +
"%') LIMIT " +
(limit ?? 50) +
';',
)
.subscribe((data) => {
this.rows = data;
}),
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget the tests for this

}
4 changes: 3 additions & 1 deletion src/app/shared/types/gossip-menu.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { TableRow } from './general';
export const GOSSIP_MENU_TABLE = 'gossip_menu';
export const GOSSIP_MENU_ID = 'MenuID';
export const GOSSIP_MENU_ID_2 = 'TextID';
export const GOSSIP_MENU_SEARCH_FIELDS = [GOSSIP_MENU_ID, GOSSIP_MENU_ID_2];
export const NPC_TEXT_0 = 'text0_0';
export const NPC_TEXT_1 = 'text0_1';
export const GOSSIP_MENU_SEARCH_FIELDS = [GOSSIP_MENU_ID, GOSSIP_MENU_ID_2, NPC_TEXT_0, NPC_TEXT_1];
export const GOSSIP_MENU_CUSTOM_STARTING_ID = 62_000;

export class GossipMenu extends TableRow {
Expand Down