Skip to content

Commit d21650d

Browse files
authored
Merge pull request #2 from Citrinate/1.2
Update to V1.2.0.0
2 parents 500294a + 55240bd commit d21650d

5 files changed

Lines changed: 49 additions & 9 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cs2script",
3-
"version": "1.1.0.3",
3+
"version": "1.2.0.0",
44
"type": "module",
55
"scripts": {
66
"build": "node build.js",

src/components/store_table.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ export default class StoreTable extends Table {
2525
static TAB = {
2626
GENERAL: 0,
2727
TOOLS: 1,
28-
TOURNAMENT_CAPSULES: 2,
29-
TOURNAMENT_SOUVENIRS: 3
28+
KEYS: 2,
29+
TOURNAMENT_CAPSULES: 3,
30+
TOURNAMENT_SOUVENIRS: 4,
31+
OTHER: 5
3032
};
3133

3234
constructor(store) {
@@ -266,6 +268,13 @@ export default class StoreTable extends Table {
266268
this.#ChangeTab(event.currentTarget, StoreTable.TAB.TOOLS);
267269
}
268270
}),
271+
CreateElement("a", {
272+
class: "cs2s_table_footer_action_link cs2s_table_footer_action_link_no_icon",
273+
text: "Keys",
274+
onclick: (event) => {
275+
this.#ChangeTab(event.currentTarget, StoreTable.TAB.KEYS);
276+
}
277+
}),
269278
this.#store.items.find(item => item.tournament_id) && CreateElement("a", {
270279
class: "cs2s_table_footer_action_link cs2s_table_footer_action_link_no_icon",
271280
text: "Tournament",
@@ -279,6 +288,13 @@ export default class StoreTable extends Table {
279288
onclick: (event) => {
280289
this.#ChangeTab(event.currentTarget, StoreTable.TAB.TOURNAMENT_SOUVENIRS);
281290
}
291+
}),
292+
CreateElement("a", {
293+
class: "cs2s_table_footer_action_link cs2s_table_footer_action_link_no_icon",
294+
text: "Other",
295+
onclick: (event) => {
296+
this.#ChangeTab(event.currentTarget, StoreTable.TAB.OTHER);
297+
}
282298
})
283299
]
284300
}),
@@ -428,6 +444,10 @@ export default class StoreTable extends Table {
428444
return false;
429445
}
430446

447+
if (this.#tab === StoreTable.TAB.KEYS && item.type != "Key") {
448+
return false;
449+
}
450+
431451
if (this.#tab === StoreTable.TAB.TOURNAMENT_CAPSULES && (!item.tournament_id || item.requires_supplemental_data)) {
432452
return false;
433453
}
@@ -436,6 +456,15 @@ export default class StoreTable extends Table {
436456
return false;
437457
}
438458

459+
if (this.#tab === StoreTable.TAB.OTHER && (
460+
typeof item.layout_weight !== "undefined"
461+
|| item.layout_format == "single"
462+
|| item.type == "Key"
463+
|| item.tournament_id
464+
)) {
465+
return false;
466+
}
467+
439468
if (this.#searchQuery && this.#searchQuery.length > 0) {
440469
for (const word of this.#searchQuery) {
441470
if (!item.name_normalized.includes(word)) {

src/cs2/items/assets/inventory_asset.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,21 @@ export default class InventoryAsset extends Asset {
143143
return;
144144
}
145145

146-
// Update float element with percentile info
147-
if (floatElement && this._inspectData.wear && this._wearData) {
148-
floatElement.innerText = this._inspectData.wear.toFixed(this.#isTradeProtected ? 2 : 6);
149-
floatElement.append(" ", this._GetPercentileElement());
146+
if (this._inspectData.wear && this._wearData) {
147+
if (floatElement) {
148+
// Update float element with percentile info
149+
floatElement.innerText = this._inspectData.wear.toFixed(this.#isTradeProtected ? 2 : 6);
150+
floatElement.append(" ", this._GetPercentileElement());
151+
} else {
152+
// Display float data for the first time (Steam only provides float values for the first 75 inventory items)
153+
floatElement = CreateElement("div", {
154+
class: `cs2s_asset_wear cs2s_asset_wear_${Asset.GetWear(this._inspectData.wear).name.toLowerCase()}`,
155+
text: this._inspectData.wear.toFixed(this.#isTradeProtected ? 2 : 6)
156+
});
157+
floatElement.append(" ", this._GetPercentileElement());
158+
159+
this._asset.element.append(floatElement);
160+
}
150161
}
151162
}
152163

src/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@
706706
}
707707

708708
.cs2s_table_name_column {
709-
width: 350px;
709+
width: 375px;
710710
}
711711

712712
.cs2s_table_collection_column {

src/userscript.meta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const userscriptHeader =
66
// @name Counter-Strike 2 Script
77
// @namespace https://github.com/Citrinate
88
// @author Citrinate
9-
// @description Manage your CS2 storage units and inspect items
9+
// @description Interact with Counter-Strike 2
1010
// @license Apache-2.0
1111
// @version ${pkg.version}
1212
// @match https://steamcommunity.com/id/*/inventory*

0 commit comments

Comments
 (0)