Skip to content

Commit

Permalink
Merge pull request #267 from csfloat/feature/highlight-filter-patterns
Browse files Browse the repository at this point in the history
Implements Ability to Highlight Specific Charm Patterns
  • Loading branch information
Step7750 authored Nov 5, 2024
2 parents 849a246 + 8c42b66 commit 6e2da25
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/components/filter/filter_help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class FilterHelp extends FloatElement {
<b>Note: </b> If multiple filters match an item, it will be highlighted with the average colour<br><br>
<b>New: </b> You can now filter based on <a href="https://db.csfloat.com">FloatDB</a> ranks and item price!<br><br>
<b>New: </b> You can now filter based on charm patterns!<br><br>
<b>Examples: </b>
<ul>
Expand Down Expand Up @@ -41,6 +41,10 @@ export class FilterHelp extends FloatElement {
<ul>
<li>Matches items with floats ranked in the top 500 lowest for this skin on FloatDB</li>
</ul>
<li>pattern > 22000 and pattern < 25000 </li>
<ul>
<li>Matches items with charms that have patterns between 22,000 and 25,000</li>
</ul>
<li>match(float, "7355608") >= 1</li>
<ul>
<li>Matches items with floats that contain at least one match of the CS bomb code</li>
Expand Down Expand Up @@ -85,6 +89,11 @@ export class FilterHelp extends FloatElement {
<li>Phase of the item if it's a doppler, empty otherwise</li>
<li>Possible values are "1", "2", "3", "4", "Ruby", "Sapphire", "Black Pearl", "Emerald"</li>
</ul>
<li>pattern</li>
<ul>
<li>Pattern of an un-applied charm, or the first applied keychain on a charm.</li>
<li>Possible values range from 0 to 100,000</li>
</ul>
<li>minfloat</li>
<ul>
<li>The minimum float the skin can have (regardless of wear)</li>
Expand Down
1 change: 1 addition & 0 deletions src/lib/filter/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class Filter {
low_rank: 2,
high_rank: 2,
price: 10,
pattern: 11111,
});

if (!Filter.isValidReturnValue(result)) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/filter/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface InternalInputVars {
low_rank: number;
high_rank: number;
price?: number;
pattern?: number;
}

export interface SerializedFilter {
Expand Down
4 changes: 4 additions & 0 deletions src/lib/services/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class FilterService {
vars.price = price;
}

if (info.keychains?.length > 0) {
vars.pattern = info.keychains[0].pattern;
}

const colours = this.filters
.filter((e) => {
const result = e.run(vars);
Expand Down

0 comments on commit 6e2da25

Please sign in to comment.