@ianlucas/cs2-lib 9.6.0 → 9.7.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,6 +120,29 @@ export type CS2ItemTranslationByLanguage = Record<string, CS2ItemTranslationMap>
120
120
  * leaf is the glTF mesh name after its last `.` (`body_hd`, `body_legacy`, `viewmodel`).
121
121
  */
122
122
  export type CS2ModelMaterials = Record<string, Record<string, string[]>>;
123
+ /**
124
+ * A skeleton animation clips are authored against, shared by every model rigged to it: `character`
125
+ * by every agent, `viewmodel` by the first-person arms and weapon rig (a glove's arms, a weapon's
126
+ * moving parts), `chicken` by the chick and every grown pet, and `egg` by the egg.
127
+ */
128
+ export type CS2ModelAnimationSkeleton = "character" | "chicken" | "egg" | "viewmodel";
129
+ /**
130
+ * A published animation clip: three.js `AnimationClip` JSON whose tracks are matched to a model's
131
+ * joints by bone name, in raw model space.
132
+ */
133
+ export interface CS2ModelAnimation {
134
+ /** The clip's path on the CDN; see `CS2EconomyInstance.getAnimationUrl`. */
135
+ path: string;
136
+ /** The skeleton the clip is authored against, which a model has to be rigged to to play it. */
137
+ skeleton: CS2ModelAnimationSkeleton;
138
+ }
139
+ /**
140
+ * Clip name -> the published clip. A name is the clip's path in the game's `animation/anims/`
141
+ * folder, without the extension: `chicken/world/chick_idle01`,
142
+ * `ui_anims/additive_anims/t/t_idle_layer01`, and `ui_anims/additive_anims/t/t_idle_layer01+non_additive`
143
+ * for the absolute copy of an additive clip.
144
+ */
145
+ export type CS2ModelAnimations = Record<string, CS2ModelAnimation>;
123
146
  export interface CS2UnlockedItem {
124
147
  attributes: {
125
148
  containerId: number;
@@ -1,6 +1,6 @@
1
1
  import { Interface } from "./utils.mjs";
2
2
  import { CS2RarityColor, CS2_RARITY_ORDER } from "./economy-container.mjs";
3
- import { CS2Bounds, CS2ContainerType, CS2Item, CS2ItemTeam, CS2ItemTranslation, CS2ItemTranslationMap, CS2ItemType, CS2ItemWear, CS2StatTrakMode, CS2UnlockedItem } from "./economy-types.mjs";
3
+ import { CS2Bounds, CS2ContainerType, CS2Item, CS2ItemTeam, CS2ItemTranslation, CS2ItemTranslationMap, CS2ItemType, CS2ItemWear, CS2ModelAnimationSkeleton, CS2ModelAnimations, CS2StatTrakMode, CS2UnlockedItem } from "./economy-types.mjs";
4
4
  import { CS2Team } from "./teams.mjs";
5
5
  //#region src/economy.d.ts
6
6
  type CS2EconomyItemPredicate = Partial<CS2EconomyItem> & {
@@ -12,9 +12,11 @@ export declare class CS2EconomyInstance {
12
12
  items: Map<number, CS2EconomyItem>;
13
13
  itemsAsArray: CS2EconomyItem[];
14
14
  stickers: Set<CS2EconomyItem>;
15
+ private animations;
15
16
  private charmDetachment;
16
17
  private stickerDisplayCases;
17
- load({ assetsBaseUrl, items, language }: {
18
+ load({ animations, assetsBaseUrl, items, language }: {
19
+ animations?: CS2ModelAnimations;
18
20
  assetsBaseUrl?: string;
19
21
  items: CS2Item[];
20
22
  language?: CS2ItemTranslationMap;
@@ -50,6 +52,10 @@ export declare class CS2EconomyInstance {
50
52
  hasStickerDisplayCase(sticker: number | CS2EconomyItem): boolean;
51
53
  expectUnlockedItem(item: number | CS2EconomyItem, { id }: ReturnType<InstanceType<typeof CS2EconomyItem>["unlockContainer"]>): void;
52
54
  resolveUrl(path?: string): string;
55
+ getAnimationUrl(name: string): string | undefined;
56
+ getAnimationSkeleton(name: string): CS2ModelAnimationSkeleton | undefined;
57
+ getAnimationNames(skeleton?: CS2ModelAnimationSkeleton): string[];
58
+ private getAnimation;
53
59
  }
54
60
  export declare class CS2EconomyItem implements Interface<CS2Item & CS2ItemTranslation & {
55
61
  contents: CS2EconomyItem[] | undefined;
package/dist/economy.mjs CHANGED
@@ -1 +1 @@
1
- import{CS2ContainerType as e,CS2ItemTeam as t,CS2ItemType as n,CS2ItemWear as r,CS2StatTrakMode as i}from"./economy-types.mjs";import{assert as a,compare as o,ensure as s,isFactorPrecise as c,safe as l,truncateToFactor as u}from"./utils.mjs";import{CS2_CONTAINER_ITEMS as d,CS2_DISPLAY_ITEMS as f,CS2_EQUIPMENT_ITEMS as p,CS2_GRAPHIC_ART_ITEMS as m,CS2_KEYCHAINABLE_ITEMS as h,CS2_MACHINEGUN_MODEL_KEYS as g,CS2_MAX_CHARM_DETACHMENT_CHARGES as _,CS2_MAX_FACTORY_NEW_WEAR as v,CS2_MAX_FIELD_TESTED_WEAR as y,CS2_MAX_KEYCHAIN_SEED as b,CS2_MAX_MINIMAL_WEAR_WEAR as x,CS2_MAX_PET_SEED as S,CS2_MAX_SEED as C,CS2_MAX_WELL_WORN_WEAR as w,CS2_MIDTIER_LOADOUT_CATEGORIES as T,CS2_MISC_LOADOUT_CATEGORIES as E,CS2_NAMETAGGABLE_ITEMS as D,CS2_NAMETAG_RE as O,CS2_PAINTABLE_ITEMS as k,CS2_PATCHABLE_ITEMS as A,CS2_PET_BREED_UPGRADE_LEVELS as j,CS2_PET_CHICK_UPGRADE_LEVELS as M,CS2_PET_EGG_UPGRADE_LEVELS as N,CS2_PET_UPGRADE_LEVELS as P,CS2_RIFLE_LOADOUT_CATEGORIES as F,CS2_SEEDABLE_ITEMS as I,CS2_SNIPER_RIFLE_MODEL_KEYS as L,CS2_STATTRAKABLE_ITEMS as R,CS2_STICKERABLE_ITEMS as z,CS2_TEAMS_BOTH as B,CS2_TEAMS_CT as V,CS2_TEAMS_T as H,CS2_WEAR_FACTOR as U}from"./economy-constants.mjs";import{CS2RarityColorName as W,CS2RarityColorOrder as G,CS2RaritySoundName as K,CS2_RARITY_ORDER as q,randomFloat as J,randomInt as Y}from"./economy-container.mjs";function X(e){return function(t){return o(e.type,t.type)&&o(e.isDefault,t.isDefault)&&o(e.modelKey,t.modelKey)&&o(e.isBase,t.isBase)&&o(e.loadoutCategory,t.loadoutCategory)&&(e.usableByTeam===void 0||t.teams===void 0||t.teams.includes(e.usableByTeam))}}var Z=class{baseUrl=`https://cdn.cstrike.app`;categories=new Set;items=new Map;itemsAsArray=[];stickers=new Set;charmDetachment;stickerDisplayCases=new Map;load({assetsBaseUrl:e,items:t,language:n}){this.baseUrl=e??this.baseUrl,this.categories.clear(),this.items.clear(),this.stickers.clear(),this.itemsAsArray=[],this.charmDetachment=void 0,this.stickerDisplayCases.clear();for(let e of t){let t=new Q(this,e,n===void 0?{name:String(e.id)}:s(n[e.id]));this.items.set(e.id,t),t.isSticker()&&(this.stickers.add(t),n!==void 0&&this.categories.add(s(t.categoryName))),t.isStickerDisplayCase()&&this.stickerDisplayCases.set(s(t.displayedStickerId),t),this.itemsAsArray.push(t)}}getById(e){return s(this.items.get(e))}get(e){return typeof e==`number`?this.getById(e):e}findItem(e){return s(this.itemsAsArray.find(X(e)))}filterItems(e){let t=this.itemsAsArray.filter(X(e));return a(t.length>0),t}validateWear(e,t){return e===void 0||(a(c(e,U)),a(e>=0&&e<=1),t!==void 0&&(a(t.hasWear()),a(t.wearMin===void 0||e>=t.wearMin),a(t.wearMax===void 0||e<=t.wearMax)),!0)}safeValidateWear(e,t){return l(()=>this.validateWear(e,t))}validateSeed(e,t){return e===void 0||(a(Number.isFinite(e)),a(Number.isInteger(e)),a(t===void 0||t.hasSeed()),a(e>=(t?.getMinimumSeed()??1)&&e<=(t?.getMaximumSeed()??1e3)),!0)}safeValidateSeed(e,t){return l(()=>this.validateSeed(e,t))}validateStyle(e,t){return e===void 0||(a(Number.isInteger(e)),a(e>=1),a(t===void 0||t.hasStyle()&&e<=t.getStyleCount()),!0)}safeValidateStyle(e,t){return l(()=>this.validateStyle(e,t))}validateUpgradeLevel(e,t){return e===void 0||a((t?.getUpgradeLevels()??P).includes(e)),!0}safeValidateUpgradeLevel(e,t){return l(()=>this.validateUpgradeLevel(e,t))}trimNameTag(e){let t=e?.trim();return t===``?void 0:t}validateNameTag(e,t){return e!==void 0&&e!==``&&(a(t===void 0||t.hasNameTag()),a(O.test(e))),!0}safeValidateNameTag(e,t){return l(()=>this.validateNameTag(e,t))}requireNameTag(e,t){return a(e===void 0||e.length>0),this.validateNameTag(e,t)}safeRequireNameTag(e,t){return l(()=>this.requireNameTag(e,t))}validateCharges(e,t){return e===void 0||(a(t===void 0||t.hasCharges()),a(Number.isInteger(e)),a(e>=1&&e<=(t?.getMaximumCharges()??2**53-1)),!0)}safeValidateCharges(e,t){return l(()=>this.validateCharges(e,t))}validateStatTrak(e,t){return e===void 0||(a(t===void 0||t.hasStatTrak()),a(Number.isInteger(e)),a(e>=0&&e<=999999),!0)}safeValidateStatTrak(e,t){return l(()=>this.validateStatTrak(e,t))}validateContainerAndKey(e,t){return e=this.get(e),e.expectContainer(),t=t===void 0?void 0:this.get(t),t===void 0?a(e.keyIds===void 0):(t.expectKey(),a(e.keyIds!==void 0),a(e.keyIds.includes(t.id))),!0}safeValidateContainerAndKey(e,t){return l(()=>this.validateContainerAndKey(e,t))}getWearFromValue(e){switch(!0){case e<=v:return r.FactoryNew;case e<=x:return r.MinimalWear;case e<=y:return r.FieldTested;case e<=w:return r.WellWorn;default:return r.BattleScarred}}getStickerCategories(){return Array.from(this.categories).sort()}getStickers(){return Array.from(this.stickers)}getCharmDetachment(){return this.charmDetachment??=s(this.itemsAsArray.find(e=>e.isCharmDetachment())),this.charmDetachment}getStickerDisplayCase(e){return s(this.stickerDisplayCases.get(this.get(e).expectSticker().id))}hasStickerDisplayCase(e){return this.stickerDisplayCases.has(this.get(e).expectSticker().id)}expectUnlockedItem(e,{id:t}){e=this.get(e).expectContainer(),a(e.contentIds?.includes(t)||e.specialIds?.includes(t))}resolveUrl(e){return`${this.baseUrl}${e}`}},Q=class{economy;item;language;alternateName;categoryName;collectionDescription;collectionImagePath;collectionKey;collectionName;containerType;contentIds;definitionIndex;description;displayedStickerId;hasColliderData;id=null;imagePath;isBase;isDefault;isLegacyModel;keychainPositionXMax;keychainPositionXMin;keychainPositionYMax;keychainPositionYMin;keychainPositionZMax;keychainPositionZMin;keyIds;legacyKeychainPositionXMax;legacyKeychainPositionXMin;legacyKeychainPositionYMax;legacyKeychainPositionYMin;legacyKeychainPositionZMax;legacyKeychainPositionZMin;legacyStickerOffsetXMax;legacyStickerOffsetXMin;legacyStickerOffsetYMax;legacyStickerOffsetYMin;legacyStickerSchemaCount;loadoutCategory;materialPath;modelKey;modelPath;name=null;parentId;previewSeed;rarityColor=null;specialIds;specialsImagePath;statTrakMode;stickerOffsetXMax;stickerOffsetXMin;stickerOffsetYMax;stickerOffsetYMin;stickerSchemaCount;styleCount;team;tintIndex;tournamentDescription;type=null;variantIndex;wearMax;wearMin;constructor(e,t,r){this.economy=e,this.item=t,this.language=r,Object.assign(this,t),Object.assign(this,r),a(typeof this.id==`number`),a(this.name),a(this.type),a(t.type===n.Stub||typeof this.rarityColor==`string`)}get contents(){return this.expectContainer(),s(this.contentIds).map(e=>this.economy.get(e))}get displayedSticker(){return this.displayedStickerId===void 0?void 0:this.economy.get(this.displayedStickerId)}get parent(){return this.parentId===void 0?void 0:this.economy.items.has(this.parentId)?this.economy.get(this.parentId):void 0}get specials(){return this.expectContainer(),this.specialIds?.map(e=>this.economy.get(e))}get teams(){switch(this.team){case t.Both:return B;case t.T:return H;case t.CT:return V;default:return}}isC4(){return this.loadoutCategory===`c4`}isPistol(){return this.loadoutCategory===`secondary`}isSMG(){return this.loadoutCategory===`smg`}isRifle(){return this.loadoutCategory===`rifle`}isHeavy(){return this.loadoutCategory===`heavy`}isEquipment(){return this.loadoutCategory===`equipment`}isSniperRifle(){return this.modelKey!==void 0&&L.includes(this.modelKey)}isMachinegun(){return this.modelKey!==void 0&&g.includes(this.modelKey)}isInMidTiers(){return this.loadoutCategory!==void 0&&T.includes(this.loadoutCategory)}isInRifles(){return this.loadoutCategory!==void 0&&F.includes(this.loadoutCategory)}isInMisc(){return this.loadoutCategory!==void 0&&E.includes(this.loadoutCategory)}isInEquipments(){return p.includes(this.type)}isInGraphicArts(){return m.includes(this.type)}isInContainers(){return d.includes(this.type)}isInDisplay(){return f.includes(this.type)}isPaintable(){return k.includes(this.type)}isAgent(){return this.type===n.Agent}isCollectible(){return this.type===n.Collectible}isContainer(){return this.type===n.Container}isGloves(){return this.type===n.Gloves}isGraffiti(){return this.type===n.Graffiti}isKey(){return this.type===n.Key}isKeychain(){return this.type===n.Keychain}isMelee(){return this.type===n.Melee}isMusicKit(){return this.type===n.MusicKit}isPatch(){return this.type===n.Patch}isPet(){return this.type===n.Pet}isSticker(){return this.type===n.Sticker}isStub(){return this.type===n.Stub}isTool(){return this.type===n.Tool}isWeapon(){return this.type===n.Weapon}isStorageUnit(){return this.isTool()&&this.definitionIndex===1201}isNameTag(){return this.isTool()&&this.definitionIndex===1200}isStatTrakSwapTool(){return this.isTool()&&this.definitionIndex===1324}isChickenEgg(){return this.isTool()&&this.definitionIndex===4948}isChickenFeed(){return this.isTool()&&this.definitionIndex===4949}isPetEgg(){return this.isPet()&&this.variantIndex===1}isPetChick(){return this.isPet()&&this.variantIndex===2}isNameablePet(){return this.isPet()&&!this.isPetEgg()}isContract(){return this.isTool()&&this.definitionIndex===62}isCharmDetachment(){return this.isTool()&&this.definitionIndex===65}isCharmDetachmentPack(){return this.isTool()&&this.definitionIndex===4950}isStickerSlab(){return this.isTool()&&this.definitionIndex===1355}isStickerDisplayCase(){return this.isKeychain()&&this.displayedStickerId!==void 0}isWeaponCase(){return this.containerType===e.WeaponCase}isStickerCapsule(){return this.containerType===e.StickerCapsule}isGraffitiBox(){return this.containerType===e.GraffitiBox}isSouvenirCase(){return this.containerType===e.SouvenirCase}expectAgent(){return a(this.isAgent()),this}expectContainer(){return a(this.isContainer()),this}expectKey(){return a(this.isKey()),this}expectKeychain(){return a(this.isKeychain()),this}expectPatch(){return a(this.isPatch()),this}expectPet(){return a(this.isPet()),this}expectSticker(){return a(this.isSticker()),this}expectStorageUnit(){return a(this.isStorageUnit()),this}expectNameTag(){return a(this.isNameTag()),this}expectStatTrakSwapTool(){return a(this.isStatTrakSwapTool()),this}expectCharmDetachmentPack(){return a(this.isCharmDetachmentPack()),this}expectStickerSlab(){return a(this.isStickerSlab()),this}expectStickerDisplayCase(){return a(this.isStickerDisplayCase()),this}hasWear(){return k.includes(this.type)&&!this.isDefault&&this.variantIndex!==0}hasSeed(){return I.includes(this.type)&&!this.isDefault&&this.variantIndex!==0}hasStickers(){return z.includes(this.type)}hasKeychains(){return h.includes(this.type)}hasPatches(){return A.includes(this.type)&&!this.isDefault}hasNameTag(){return D.includes(this.type)||this.isStorageUnit()||this.isNameablePet()}hasStyle(){return this.isPet()&&this.getStyleCount()>0}hasUpgradeLevel(){return this.isPet()}hasStatTrak(){return R.includes(this.type)&&!this.isDefault}hasCharges(){return this.isGraffiti()||this.isCharmDetachment()}hasDisplayCase(){return this.economy.hasStickerDisplayCase(this)}getDisplayCase(){return this.economy.getStickerDisplayCase(this)}getImageUrl(e){a(this.imagePath);let t=this.economy.resolveUrl(this.imagePath);if(this.hasWear()&&e!==void 0)switch(!0){case e<1/3:return t.replace(`.webp`,`_light.webp`);case e<2/3:return t.replace(`.webp`,`_medium.webp`);default:return t.replace(`.webp`,`_heavy.webp`)}return t}getCollectionImageUrl(){return this.economy.resolveUrl(this.collectionImagePath)}getSpecialsImageUrl(){return this.expectContainer(),a(this.specialIds),a(this.specialsImagePath),this.economy.resolveUrl(this.specialsImagePath)}getMaterialUrl(){return this.economy.resolveUrl(this.materialPath??this.parent?.materialPath)}getModelPath(){return this.modelPath??this.parent?.modelPath}getModelUrl(){return this.economy.resolveUrl(this.getModelPath())}getModelDataUrl(){return this.economy.resolveUrl(this.getModelPath()?.replace(/\.glb$/,`.json`))}getColliderDataUrl(){if(this.hasColliderData??this.parent?.hasColliderData)return this.economy.resolveUrl(this.getModelPath()?.replace(/\.glb$/,`.collider.json`))}getMinimumWear(){return this.wearMin??0}getMaximumWear(){return this.wearMax??1}getMinimumSeed(){return this.isKeychain()||this.isPet(),1}getMaximumSeed(){return this.isKeychain()?b:this.isPet()?S:C}getStyleCount(){return this.styleCount??0}getUpgradeLevels(){return this.isPet()?this.isPetEgg()?N:this.isPetChick()?M:j:[]}getDefaultUpgradeLevel(){return this.getUpgradeLevels().at(-1)}getPreviewSeed(){return this.previewSeed??5e4}getDefaultCharges(){return this.isGraffiti()?50:1}getMaximumCharges(){return this.isGraffiti()?50:_}getStickerSchemaCount(){let e=this.parent??this;return(this.isLegacyModel?e.legacyStickerSchemaCount:e.stickerSchemaCount)??5}getStickerOffsetBounds(){let e=this.parent??this,t=this.isLegacyModel;return{x:{min:t?e.legacyStickerOffsetXMin:e.stickerOffsetXMin,max:t?e.legacyStickerOffsetXMax:e.stickerOffsetXMax},y:{min:t?e.legacyStickerOffsetYMin:e.stickerOffsetYMin,max:t?e.legacyStickerOffsetYMax:e.stickerOffsetYMax}}}getKeychainPositionBounds(){let e=this.parent??this,t=this.isLegacyModel;return{x:{min:t?e.legacyKeychainPositionXMin:e.keychainPositionXMin,max:t?e.legacyKeychainPositionXMax:e.keychainPositionXMax},y:{min:t?e.legacyKeychainPositionYMin:e.keychainPositionYMin,max:t?e.legacyKeychainPositionYMax:e.keychainPositionYMax},z:{min:t?e.legacyKeychainPositionZMin:e.keychainPositionZMin,max:t?e.legacyKeychainPositionZMax:e.keychainPositionZMax}}}groupContents(){let e={},t=this.specials;for(let t of this.contents){let n=W[t.rarityColor];e[n]||(e[n]=[]),e[n].push(t)}if(t!==void 0)for(let n of t){let t=`special`;e[t]||(e[t]=[]),e[t].push(n)}return e}listContents(e=!1){let t=this.specials;return[...this.contents,...!e&&t!==void 0?t:[]].sort((e,t)=>(G[e.rarityColor]??0)-(G[t.rarityColor]??0))}unlockContainer(e){let t=this.groupContents(),n=Object.keys(t),r=q.filter(e=>n.includes(e)),a=e?.computeOdds?.(r)??r.map((e,t)=>.8/5**t),o=a.reduce((e,t)=>e+t,0),c=r.map((e,t)=>[e,s(a[t])/o]),l=Math.random(),[d]=s(c[0]),f=0;for(let[e,t]of c)if(f+=t,l<=f){d=e;break}let p=s(t[d]),m=s(p[Math.floor(Math.random()*p.length)]);return{attributes:{containerId:this.id,seed:m.hasSeed()?Y(1,C):void 0,statTrak:m.hasStatTrak()&&this.statTrakMode!==i.Excluded&&(this.statTrakMode===i.Guaranteed||Math.random()<=.1)?0:void 0,wear:m.hasWear()?u(J(m.wearMin??0,m.wearMax??1),U):void 0},id:m.id,rarity:K[m.rarityColor],special:d===`special`}}};const $=new Z;export{$ as CS2Economy,Z as CS2EconomyInstance,Q as CS2EconomyItem};
1
+ import{CS2ContainerType as e,CS2ItemTeam as t,CS2ItemType as n,CS2ItemWear as r,CS2StatTrakMode as i}from"./economy-types.mjs";import{assert as a,compare as o,ensure as s,isFactorPrecise as c,safe as l,truncateToFactor as u}from"./utils.mjs";import{CS2_CONTAINER_ITEMS as d,CS2_DISPLAY_ITEMS as f,CS2_EQUIPMENT_ITEMS as p,CS2_GRAPHIC_ART_ITEMS as m,CS2_KEYCHAINABLE_ITEMS as h,CS2_MACHINEGUN_MODEL_KEYS as g,CS2_MAX_CHARM_DETACHMENT_CHARGES as _,CS2_MAX_FACTORY_NEW_WEAR as v,CS2_MAX_FIELD_TESTED_WEAR as y,CS2_MAX_KEYCHAIN_SEED as b,CS2_MAX_MINIMAL_WEAR_WEAR as x,CS2_MAX_PET_SEED as S,CS2_MAX_SEED as C,CS2_MAX_WELL_WORN_WEAR as w,CS2_MIDTIER_LOADOUT_CATEGORIES as T,CS2_MISC_LOADOUT_CATEGORIES as E,CS2_NAMETAGGABLE_ITEMS as D,CS2_NAMETAG_RE as O,CS2_PAINTABLE_ITEMS as k,CS2_PATCHABLE_ITEMS as A,CS2_PET_BREED_UPGRADE_LEVELS as j,CS2_PET_CHICK_UPGRADE_LEVELS as M,CS2_PET_EGG_UPGRADE_LEVELS as N,CS2_PET_UPGRADE_LEVELS as P,CS2_RIFLE_LOADOUT_CATEGORIES as F,CS2_SEEDABLE_ITEMS as I,CS2_SNIPER_RIFLE_MODEL_KEYS as L,CS2_STATTRAKABLE_ITEMS as R,CS2_STICKERABLE_ITEMS as z,CS2_TEAMS_BOTH as B,CS2_TEAMS_CT as V,CS2_TEAMS_T as H,CS2_WEAR_FACTOR as U}from"./economy-constants.mjs";import{CS2RarityColorName as W,CS2RarityColorOrder as G,CS2RaritySoundName as K,CS2_RARITY_ORDER as q,randomFloat as J,randomInt as Y}from"./economy-container.mjs";function X(e){return function(t){return o(e.type,t.type)&&o(e.isDefault,t.isDefault)&&o(e.modelKey,t.modelKey)&&o(e.isBase,t.isBase)&&o(e.loadoutCategory,t.loadoutCategory)&&(e.usableByTeam===void 0||t.teams===void 0||t.teams.includes(e.usableByTeam))}}var Z=class{baseUrl=`https://cdn.cstrike.app`;categories=new Set;items=new Map;itemsAsArray=[];stickers=new Set;animations={};charmDetachment;stickerDisplayCases=new Map;load({animations:e,assetsBaseUrl:t,items:n,language:r}){this.animations=e??{},this.baseUrl=t??this.baseUrl,this.categories.clear(),this.items.clear(),this.stickers.clear(),this.itemsAsArray=[],this.charmDetachment=void 0,this.stickerDisplayCases.clear();for(let e of n){let t=new Q(this,e,r===void 0?{name:String(e.id)}:s(r[e.id]));this.items.set(e.id,t),t.isSticker()&&(this.stickers.add(t),r!==void 0&&this.categories.add(s(t.categoryName))),t.isStickerDisplayCase()&&this.stickerDisplayCases.set(s(t.displayedStickerId),t),this.itemsAsArray.push(t)}}getById(e){return s(this.items.get(e))}get(e){return typeof e==`number`?this.getById(e):e}findItem(e){return s(this.itemsAsArray.find(X(e)))}filterItems(e){let t=this.itemsAsArray.filter(X(e));return a(t.length>0),t}validateWear(e,t){return e===void 0||(a(c(e,U)),a(e>=0&&e<=1),t!==void 0&&(a(t.hasWear()),a(t.wearMin===void 0||e>=t.wearMin),a(t.wearMax===void 0||e<=t.wearMax)),!0)}safeValidateWear(e,t){return l(()=>this.validateWear(e,t))}validateSeed(e,t){return e===void 0||(a(Number.isFinite(e)),a(Number.isInteger(e)),a(t===void 0||t.hasSeed()),a(e>=(t?.getMinimumSeed()??1)&&e<=(t?.getMaximumSeed()??1e3)),!0)}safeValidateSeed(e,t){return l(()=>this.validateSeed(e,t))}validateStyle(e,t){return e===void 0||(a(Number.isInteger(e)),a(e>=1),a(t===void 0||t.hasStyle()&&e<=t.getStyleCount()),!0)}safeValidateStyle(e,t){return l(()=>this.validateStyle(e,t))}validateUpgradeLevel(e,t){return e===void 0||a((t?.getUpgradeLevels()??P).includes(e)),!0}safeValidateUpgradeLevel(e,t){return l(()=>this.validateUpgradeLevel(e,t))}trimNameTag(e){let t=e?.trim();return t===``?void 0:t}validateNameTag(e,t){return e!==void 0&&e!==``&&(a(t===void 0||t.hasNameTag()),a(O.test(e))),!0}safeValidateNameTag(e,t){return l(()=>this.validateNameTag(e,t))}requireNameTag(e,t){return a(e===void 0||e.length>0),this.validateNameTag(e,t)}safeRequireNameTag(e,t){return l(()=>this.requireNameTag(e,t))}validateCharges(e,t){return e===void 0||(a(t===void 0||t.hasCharges()),a(Number.isInteger(e)),a(e>=1&&e<=(t?.getMaximumCharges()??2**53-1)),!0)}safeValidateCharges(e,t){return l(()=>this.validateCharges(e,t))}validateStatTrak(e,t){return e===void 0||(a(t===void 0||t.hasStatTrak()),a(Number.isInteger(e)),a(e>=0&&e<=999999),!0)}safeValidateStatTrak(e,t){return l(()=>this.validateStatTrak(e,t))}validateContainerAndKey(e,t){return e=this.get(e),e.expectContainer(),t=t===void 0?void 0:this.get(t),t===void 0?a(e.keyIds===void 0):(t.expectKey(),a(e.keyIds!==void 0),a(e.keyIds.includes(t.id))),!0}safeValidateContainerAndKey(e,t){return l(()=>this.validateContainerAndKey(e,t))}getWearFromValue(e){switch(!0){case e<=v:return r.FactoryNew;case e<=x:return r.MinimalWear;case e<=y:return r.FieldTested;case e<=w:return r.WellWorn;default:return r.BattleScarred}}getStickerCategories(){return Array.from(this.categories).sort()}getStickers(){return Array.from(this.stickers)}getCharmDetachment(){return this.charmDetachment??=s(this.itemsAsArray.find(e=>e.isCharmDetachment())),this.charmDetachment}getStickerDisplayCase(e){return s(this.stickerDisplayCases.get(this.get(e).expectSticker().id))}hasStickerDisplayCase(e){return this.stickerDisplayCases.has(this.get(e).expectSticker().id)}expectUnlockedItem(e,{id:t}){e=this.get(e).expectContainer(),a(e.contentIds?.includes(t)||e.specialIds?.includes(t))}resolveUrl(e){return`${this.baseUrl}${e}`}getAnimationUrl(e){let t=this.getAnimation(e);return t&&this.resolveUrl(t.path)}getAnimationSkeleton(e){return this.getAnimation(e)?.skeleton}getAnimationNames(e){return Object.entries(this.animations).filter(([,t])=>e===void 0||t.skeleton===e).map(([e])=>e)}getAnimation(e){return Object.hasOwn(this.animations,e)?this.animations[e]:void 0}},Q=class{economy;item;language;alternateName;categoryName;collectionDescription;collectionImagePath;collectionKey;collectionName;containerType;contentIds;definitionIndex;description;displayedStickerId;hasColliderData;id=null;imagePath;isBase;isDefault;isLegacyModel;keychainPositionXMax;keychainPositionXMin;keychainPositionYMax;keychainPositionYMin;keychainPositionZMax;keychainPositionZMin;keyIds;legacyKeychainPositionXMax;legacyKeychainPositionXMin;legacyKeychainPositionYMax;legacyKeychainPositionYMin;legacyKeychainPositionZMax;legacyKeychainPositionZMin;legacyStickerOffsetXMax;legacyStickerOffsetXMin;legacyStickerOffsetYMax;legacyStickerOffsetYMin;legacyStickerSchemaCount;loadoutCategory;materialPath;modelKey;modelPath;name=null;parentId;previewSeed;rarityColor=null;specialIds;specialsImagePath;statTrakMode;stickerOffsetXMax;stickerOffsetXMin;stickerOffsetYMax;stickerOffsetYMin;stickerSchemaCount;styleCount;team;tintIndex;tournamentDescription;type=null;variantIndex;wearMax;wearMin;constructor(e,t,r){this.economy=e,this.item=t,this.language=r,Object.assign(this,t),Object.assign(this,r),a(typeof this.id==`number`),a(this.name),a(this.type),a(t.type===n.Stub||typeof this.rarityColor==`string`)}get contents(){return this.expectContainer(),s(this.contentIds).map(e=>this.economy.get(e))}get displayedSticker(){return this.displayedStickerId===void 0?void 0:this.economy.get(this.displayedStickerId)}get parent(){return this.parentId===void 0?void 0:this.economy.items.has(this.parentId)?this.economy.get(this.parentId):void 0}get specials(){return this.expectContainer(),this.specialIds?.map(e=>this.economy.get(e))}get teams(){switch(this.team){case t.Both:return B;case t.T:return H;case t.CT:return V;default:return}}isC4(){return this.loadoutCategory===`c4`}isPistol(){return this.loadoutCategory===`secondary`}isSMG(){return this.loadoutCategory===`smg`}isRifle(){return this.loadoutCategory===`rifle`}isHeavy(){return this.loadoutCategory===`heavy`}isEquipment(){return this.loadoutCategory===`equipment`}isSniperRifle(){return this.modelKey!==void 0&&L.includes(this.modelKey)}isMachinegun(){return this.modelKey!==void 0&&g.includes(this.modelKey)}isInMidTiers(){return this.loadoutCategory!==void 0&&T.includes(this.loadoutCategory)}isInRifles(){return this.loadoutCategory!==void 0&&F.includes(this.loadoutCategory)}isInMisc(){return this.loadoutCategory!==void 0&&E.includes(this.loadoutCategory)}isInEquipments(){return p.includes(this.type)}isInGraphicArts(){return m.includes(this.type)}isInContainers(){return d.includes(this.type)}isInDisplay(){return f.includes(this.type)}isPaintable(){return k.includes(this.type)}isAgent(){return this.type===n.Agent}isCollectible(){return this.type===n.Collectible}isContainer(){return this.type===n.Container}isGloves(){return this.type===n.Gloves}isGraffiti(){return this.type===n.Graffiti}isKey(){return this.type===n.Key}isKeychain(){return this.type===n.Keychain}isMelee(){return this.type===n.Melee}isMusicKit(){return this.type===n.MusicKit}isPatch(){return this.type===n.Patch}isPet(){return this.type===n.Pet}isSticker(){return this.type===n.Sticker}isStub(){return this.type===n.Stub}isTool(){return this.type===n.Tool}isWeapon(){return this.type===n.Weapon}isStorageUnit(){return this.isTool()&&this.definitionIndex===1201}isNameTag(){return this.isTool()&&this.definitionIndex===1200}isStatTrakSwapTool(){return this.isTool()&&this.definitionIndex===1324}isChickenEgg(){return this.isTool()&&this.definitionIndex===4948}isChickenFeed(){return this.isTool()&&this.definitionIndex===4949}isPetEgg(){return this.isPet()&&this.variantIndex===1}isPetChick(){return this.isPet()&&this.variantIndex===2}isNameablePet(){return this.isPet()&&!this.isPetEgg()}isContract(){return this.isTool()&&this.definitionIndex===62}isCharmDetachment(){return this.isTool()&&this.definitionIndex===65}isCharmDetachmentPack(){return this.isTool()&&this.definitionIndex===4950}isStickerSlab(){return this.isTool()&&this.definitionIndex===1355}isStickerDisplayCase(){return this.isKeychain()&&this.displayedStickerId!==void 0}isWeaponCase(){return this.containerType===e.WeaponCase}isStickerCapsule(){return this.containerType===e.StickerCapsule}isGraffitiBox(){return this.containerType===e.GraffitiBox}isSouvenirCase(){return this.containerType===e.SouvenirCase}expectAgent(){return a(this.isAgent()),this}expectContainer(){return a(this.isContainer()),this}expectKey(){return a(this.isKey()),this}expectKeychain(){return a(this.isKeychain()),this}expectPatch(){return a(this.isPatch()),this}expectPet(){return a(this.isPet()),this}expectSticker(){return a(this.isSticker()),this}expectStorageUnit(){return a(this.isStorageUnit()),this}expectNameTag(){return a(this.isNameTag()),this}expectStatTrakSwapTool(){return a(this.isStatTrakSwapTool()),this}expectCharmDetachmentPack(){return a(this.isCharmDetachmentPack()),this}expectStickerSlab(){return a(this.isStickerSlab()),this}expectStickerDisplayCase(){return a(this.isStickerDisplayCase()),this}hasWear(){return k.includes(this.type)&&!this.isDefault&&this.variantIndex!==0}hasSeed(){return I.includes(this.type)&&!this.isDefault&&this.variantIndex!==0}hasStickers(){return z.includes(this.type)}hasKeychains(){return h.includes(this.type)}hasPatches(){return A.includes(this.type)&&!this.isDefault}hasNameTag(){return D.includes(this.type)||this.isStorageUnit()||this.isNameablePet()}hasStyle(){return this.isPet()&&this.getStyleCount()>0}hasUpgradeLevel(){return this.isPet()}hasStatTrak(){return R.includes(this.type)&&!this.isDefault}hasCharges(){return this.isGraffiti()||this.isCharmDetachment()}hasDisplayCase(){return this.economy.hasStickerDisplayCase(this)}getDisplayCase(){return this.economy.getStickerDisplayCase(this)}getImageUrl(e){a(this.imagePath);let t=this.economy.resolveUrl(this.imagePath);if(this.hasWear()&&e!==void 0)switch(!0){case e<1/3:return t.replace(`.webp`,`_light.webp`);case e<2/3:return t.replace(`.webp`,`_medium.webp`);default:return t.replace(`.webp`,`_heavy.webp`)}return t}getCollectionImageUrl(){return this.economy.resolveUrl(this.collectionImagePath)}getSpecialsImageUrl(){return this.expectContainer(),a(this.specialIds),a(this.specialsImagePath),this.economy.resolveUrl(this.specialsImagePath)}getMaterialUrl(){return this.economy.resolveUrl(this.materialPath??this.parent?.materialPath)}getModelPath(){return this.modelPath??this.parent?.modelPath}getModelUrl(){return this.economy.resolveUrl(this.getModelPath())}getModelDataUrl(){return this.economy.resolveUrl(this.getModelPath()?.replace(/\.glb$/,`.json`))}getColliderDataUrl(){if(this.hasColliderData??this.parent?.hasColliderData)return this.economy.resolveUrl(this.getModelPath()?.replace(/\.glb$/,`.collider.json`))}getMinimumWear(){return this.wearMin??0}getMaximumWear(){return this.wearMax??1}getMinimumSeed(){return this.isKeychain()||this.isPet(),1}getMaximumSeed(){return this.isKeychain()?b:this.isPet()?S:C}getStyleCount(){return this.styleCount??0}getUpgradeLevels(){return this.isPet()?this.isPetEgg()?N:this.isPetChick()?M:j:[]}getDefaultUpgradeLevel(){return this.getUpgradeLevels().at(-1)}getPreviewSeed(){return this.previewSeed??5e4}getDefaultCharges(){return this.isGraffiti()?50:1}getMaximumCharges(){return this.isGraffiti()?50:_}getStickerSchemaCount(){let e=this.parent??this;return(this.isLegacyModel?e.legacyStickerSchemaCount:e.stickerSchemaCount)??5}getStickerOffsetBounds(){let e=this.parent??this,t=this.isLegacyModel;return{x:{min:t?e.legacyStickerOffsetXMin:e.stickerOffsetXMin,max:t?e.legacyStickerOffsetXMax:e.stickerOffsetXMax},y:{min:t?e.legacyStickerOffsetYMin:e.stickerOffsetYMin,max:t?e.legacyStickerOffsetYMax:e.stickerOffsetYMax}}}getKeychainPositionBounds(){let e=this.parent??this,t=this.isLegacyModel;return{x:{min:t?e.legacyKeychainPositionXMin:e.keychainPositionXMin,max:t?e.legacyKeychainPositionXMax:e.keychainPositionXMax},y:{min:t?e.legacyKeychainPositionYMin:e.keychainPositionYMin,max:t?e.legacyKeychainPositionYMax:e.keychainPositionYMax},z:{min:t?e.legacyKeychainPositionZMin:e.keychainPositionZMin,max:t?e.legacyKeychainPositionZMax:e.keychainPositionZMax}}}groupContents(){let e={},t=this.specials;for(let t of this.contents){let n=W[t.rarityColor];e[n]||(e[n]=[]),e[n].push(t)}if(t!==void 0)for(let n of t){let t=`special`;e[t]||(e[t]=[]),e[t].push(n)}return e}listContents(e=!1){let t=this.specials;return[...this.contents,...!e&&t!==void 0?t:[]].sort((e,t)=>(G[e.rarityColor]??0)-(G[t.rarityColor]??0))}unlockContainer(e){let t=this.groupContents(),n=Object.keys(t),r=q.filter(e=>n.includes(e)),a=e?.computeOdds?.(r)??r.map((e,t)=>.8/5**t),o=a.reduce((e,t)=>e+t,0),c=r.map((e,t)=>[e,s(a[t])/o]),l=Math.random(),[d]=s(c[0]),f=0;for(let[e,t]of c)if(f+=t,l<=f){d=e;break}let p=s(t[d]),m=s(p[Math.floor(Math.random()*p.length)]);return{attributes:{containerId:this.id,seed:m.hasSeed()?Y(1,C):void 0,statTrak:m.hasStatTrak()&&this.statTrakMode!==i.Excluded&&(this.statTrakMode===i.Guaranteed||Math.random()<=.1)?0:void 0,wear:m.hasWear()?u(J(m.wearMin??0,m.wearMax??1),U):void 0},id:m.id,rarity:K[m.rarityColor],special:d===`special`}}};const $=new Z;export{$ as CS2Economy,Z as CS2EconomyInstance,Q as CS2EconomyItem};
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EnumValues, Interface, MapValue, RecordValue, assert, clamp, compare, countDecimals, ensure, fail, float, isFactorPrecise, isNotUndefined, roundToFactor, safe, truncateToFactor } from "./utils.mjs";
2
2
  import { CS2Rarity, CS2RarityColor, CS2RarityColorName, CS2RarityColorOrder, CS2RarityKeys, CS2RaritySoundName, CS2_BASE_ODD, CS2_RARITIES, CS2_RARITY_COLOR_DEFAULT, CS2_RARITY_ORDER, CS2_STATTRAK_ODD, randomBoolean, randomFloat, randomInt } from "./economy-container.mjs";
3
- import { CS2Bounds, CS2ContainerType, CS2Item, CS2ItemTeam, CS2ItemTranslation, CS2ItemTranslationByLanguage, CS2ItemTranslationMap, CS2ItemType, CS2ItemWear, CS2ModelMaterials, CS2StatTrakMode, CS2UnlockedItem } from "./economy-types.mjs";
3
+ import { CS2Bounds, CS2ContainerType, CS2Item, CS2ItemTeam, CS2ItemTranslation, CS2ItemTranslationByLanguage, CS2ItemTranslationMap, CS2ItemType, CS2ItemWear, CS2ModelAnimation, CS2ModelAnimationSkeleton, CS2ModelAnimations, CS2ModelMaterials, CS2StatTrakMode, CS2UnlockedItem } from "./economy-types.mjs";
4
4
  import { CS2Team, toggleCS2Team } from "./teams.mjs";
5
5
  import { CS2_CHARM_DETACHMENT_PACK_CHARGES, CS2_CHARM_DETACHMENT_PACK_TOOL_DEFINITION_INDEX, CS2_CHARM_DETACHMENT_TOOL_DEFINITION_INDEX, CS2_CHICKEN_EGG_TOOL_DEFINITION_INDEX, CS2_CHICKEN_FEED_TOOL_DEFINITION_INDEX, CS2_CONTAINER_ITEMS, CS2_CONTRACT_TOOL_DEFINITION_INDEX, CS2_DEFAULT_MAX_WEAR, CS2_DEFAULT_MIN_WEAR, CS2_DISPLAY_ITEMS, CS2_EQUIPMENT_ITEMS, CS2_FALLBACK_PREVIEW_SEED, CS2_GRAPHIC_ART_ITEMS, CS2_KEYCHAINABLE_ITEMS, CS2_KEYCHAIN_POSITION_FACTOR, CS2_MACHINEGUN_MODEL_KEYS, CS2_MAX_BATTLE_SCARRED_WEAR, CS2_MAX_CHARM_DETACHMENT_CHARGES, CS2_MAX_FACTORY_NEW_WEAR, CS2_MAX_FIELD_TESTED_WEAR, CS2_MAX_GRAFFITI_CHARGES, CS2_MAX_KEYCHAINS, CS2_MAX_KEYCHAIN_SEED, CS2_MAX_MINIMAL_WEAR_WEAR, CS2_MAX_PATCHES, CS2_MAX_PET_SEED, CS2_MAX_SEED, CS2_MAX_STATTRAK, CS2_MAX_STICKERS, CS2_MAX_STICKER_ROTATION, CS2_MAX_STICKER_WEAR, CS2_MAX_WEAR, CS2_MAX_WELL_WORN_WEAR, CS2_MIDTIER_LOADOUT_CATEGORIES, CS2_MIN_BATTLE_SCARRED_WEAR, CS2_MIN_CHARGES, CS2_MIN_FACTORY_NEW_WEAR, CS2_MIN_FIELD_TESTED_WEAR, CS2_MIN_KEYCHAIN_SEED, CS2_MIN_MINIMAL_WEAR_WEAR, CS2_MIN_PET_SEED, CS2_MIN_PET_STYLE, CS2_MIN_SEED, CS2_MIN_STATTRAK, CS2_MIN_STICKER_ROTATION, CS2_MIN_STICKER_WEAR, CS2_MIN_WEAR, CS2_MIN_WELL_WORN_WEAR, CS2_MISC_LOADOUT_CATEGORIES, CS2_NAMETAGGABLE_ITEMS, CS2_NAMETAG_RE, CS2_NAMETAG_TOOL_DEFINITION_INDEX, CS2_PAINTABLE_ITEMS, CS2_PATCHABLE_ITEMS, CS2_PET_BREED_UPGRADE_LEVELS, CS2_PET_CHICK_UPGRADE_LEVEL, CS2_PET_CHICK_UPGRADE_LEVELS, CS2_PET_CHICK_VARIANT_INDEX, CS2_PET_EGG_UPGRADE_LEVEL, CS2_PET_EGG_UPGRADE_LEVELS, CS2_PET_EGG_VARIANT_INDEX, CS2_PET_HEN_UPGRADE_LEVEL, CS2_PET_PULLET_UPGRADE_LEVEL, CS2_PET_UPGRADE_LEVELS, CS2_RIFLE_LOADOUT_CATEGORIES, CS2_SEEDABLE_ITEMS, CS2_SNIPER_RIFLE_MODEL_KEYS, CS2_STATTRAKABLE_ITEMS, CS2_STATTRAK_SWAP_TOOL_DEFINITION_INDEX, CS2_STICKERABLE_ITEMS, CS2_STICKER_OFFSET_FACTOR, CS2_STICKER_ROTATION_STEP, CS2_STICKER_SCRAPE_FACTOR, CS2_STICKER_SLAB_TOOL_DEFINITION_INDEX, CS2_STICKER_WEAR_FACTOR, CS2_STORAGE_UNIT_TOOL_DEFINITION_INDEX, CS2_TEAMS_BOTH, CS2_TEAMS_CT, CS2_TEAMS_T, CS2_WEAR_FACTOR } from "./economy-constants.mjs";
6
6
  import { CS2Economy, CS2EconomyInstance, CS2EconomyItem } from "./economy.mjs";
@@ -14,4 +14,4 @@ import { CS2KeyValues } from "./keyvalues.mjs";
14
14
  import { CS2KeyValues3 } from "./keyvalues3.mjs";
15
15
  import { CS2Map, CS2_ALL_MAPS, CS2_ANCIENT_MAP, CS2_ANUBIS_MAP, CS2_CACHE_MAP, CS2_DUST2_MAP, CS2_INFERNO_MAP, CS2_MIRAGE_MAP, CS2_NUKE_MAP, CS2_OVERPASS_MAP, CS2_TRAIN_MAP, CS2_VERTIGO_MAP, getMapnameName } from "./maps.mjs";
16
16
  import { CS2Veto, CS2VetoAction, CS2VetoEvent, CS2VetoMap, CS2VetoTeam, CS2VetoType } from "./veto.mjs";
17
- export { CS2BaseInventoryItem, CS2Bounds, CS2ContainerType, CS2Economy, CS2EconomyInstance, CS2EconomyItem, CS2Inventory, CS2InventoryData, CS2InventoryDecodeError, CS2InventoryDecoded, CS2InventoryDrop, CS2InventoryDropReason, CS2InventoryError, CS2InventoryItem, CS2InventoryLoadChanges, CS2InventoryMigration, CS2InventoryMigrationError, CS2InventoryOptions, CS2InventoryRule, CS2InventoryRuleName, CS2InventorySpec, CS2InventoryStorageDrops, CS2InventoryVersionError, CS2Item, CS2ItemTeam, CS2ItemTranslation, CS2ItemTranslationByLanguage, CS2ItemTranslationMap, CS2ItemType, CS2ItemWear, CS2KeyValues, CS2KeyValues3, CS2Map, CS2ModelMaterials, CS2Rarity, CS2RarityColor, CS2RarityColorName, CS2RarityColorOrder, CS2RarityKeys, CS2RaritySoundName, CS2StatTrakMode, CS2Team, CS2UnlockedItem, CS2Veto, CS2VetoAction, CS2VetoEvent, CS2VetoMap, CS2VetoTeam, CS2VetoType, CS2_ALL_MAPS, CS2_ANCIENT_MAP, CS2_ANUBIS_MAP, CS2_BASE_ODD, CS2_CACHE_MAP, CS2_CHARM_DETACHMENT_PACK_CHARGES, CS2_CHARM_DETACHMENT_PACK_TOOL_DEFINITION_INDEX, CS2_CHARM_DETACHMENT_TOOL_DEFINITION_INDEX, CS2_CHICKEN_EGG_TOOL_DEFINITION_INDEX, CS2_CHICKEN_FEED_TOOL_DEFINITION_INDEX, CS2_CONTAINER_ITEMS, CS2_CONTRACT_TOOL_DEFINITION_INDEX, CS2_DEFAULT_MAX_WEAR, CS2_DEFAULT_MIN_WEAR, CS2_DISPLAY_ITEMS, CS2_DUST2_MAP, CS2_EQUIPMENT_ITEMS, CS2_FALLBACK_PREVIEW_SEED, CS2_GRAPHIC_ART_ITEMS, CS2_INFERNO_MAP, CS2_INVENTORY_EQUIPPABLE_ITEMS, CS2_INVENTORY_RULES, CS2_INVENTORY_TIMESTAMP, CS2_INVENTORY_VERSION, CS2_ITEMS, CS2_KEYCHAINABLE_ITEMS, CS2_KEYCHAIN_POSITION_FACTOR, CS2_MACHINEGUN_MODEL_KEYS, CS2_MAX_BATTLE_SCARRED_WEAR, CS2_MAX_CHARM_DETACHMENT_CHARGES, CS2_MAX_FACTORY_NEW_WEAR, CS2_MAX_FIELD_TESTED_WEAR, CS2_MAX_GRAFFITI_CHARGES, CS2_MAX_KEYCHAINS, CS2_MAX_KEYCHAIN_SEED, CS2_MAX_MINIMAL_WEAR_WEAR, CS2_MAX_PATCHES, CS2_MAX_PET_SEED, CS2_MAX_SEED, CS2_MAX_STATTRAK, CS2_MAX_STICKERS, CS2_MAX_STICKER_ROTATION, CS2_MAX_STICKER_WEAR, CS2_MAX_WEAR, CS2_MAX_WELL_WORN_WEAR, CS2_MIDTIER_LOADOUT_CATEGORIES, CS2_MIN_BATTLE_SCARRED_WEAR, CS2_MIN_CHARGES, CS2_MIN_FACTORY_NEW_WEAR, CS2_MIN_FIELD_TESTED_WEAR, CS2_MIN_INVENTORY_VERSION, CS2_MIN_KEYCHAIN_SEED, CS2_MIN_MINIMAL_WEAR_WEAR, CS2_MIN_PET_SEED, CS2_MIN_PET_STYLE, CS2_MIN_SEED, CS2_MIN_STATTRAK, CS2_MIN_STICKER_ROTATION, CS2_MIN_STICKER_WEAR, CS2_MIN_WEAR, CS2_MIN_WELL_WORN_WEAR, CS2_MIRAGE_MAP, CS2_MISC_LOADOUT_CATEGORIES, CS2_NAMETAGGABLE_ITEMS, CS2_NAMETAG_RE, CS2_NAMETAG_TOOL_DEFINITION_INDEX, CS2_NUKE_MAP, CS2_OVERPASS_MAP, CS2_PAINTABLE_ITEMS, CS2_PATCHABLE_ITEMS, CS2_PET_BREED_UPGRADE_LEVELS, CS2_PET_CHICK_UPGRADE_LEVEL, CS2_PET_CHICK_UPGRADE_LEVELS, CS2_PET_CHICK_VARIANT_INDEX, CS2_PET_EGG_UPGRADE_LEVEL, CS2_PET_EGG_UPGRADE_LEVELS, CS2_PET_EGG_VARIANT_INDEX, CS2_PET_HEN_UPGRADE_LEVEL, CS2_PET_PULLET_UPGRADE_LEVEL, CS2_PET_UPGRADE_LEVELS, CS2_RARITIES, CS2_RARITY_COLOR_DEFAULT, CS2_RARITY_ORDER, CS2_RIFLE_LOADOUT_CATEGORIES, CS2_SEEDABLE_ITEMS, CS2_SNIPER_RIFLE_MODEL_KEYS, CS2_STATTRAKABLE_ITEMS, CS2_STATTRAK_ODD, CS2_STATTRAK_SWAP_TOOL_DEFINITION_INDEX, CS2_STICKERABLE_ITEMS, CS2_STICKER_OFFSET_FACTOR, CS2_STICKER_ROTATION_STEP, CS2_STICKER_SCRAPE_FACTOR, CS2_STICKER_SLAB_TOOL_DEFINITION_INDEX, CS2_STICKER_WEAR_FACTOR, CS2_STORAGE_UNIT_TOOL_DEFINITION_INDEX, CS2_TEAMS_BOTH, CS2_TEAMS_CT, CS2_TEAMS_T, CS2_TRAIN_MAP, CS2_VERTIGO_MAP, CS2_WEAR_FACTOR, EnumValues, Interface, MapValue, RecordValue, assert, assertAddable, assertInventoryItem, assertKeychains, assertPatches, assertStickers, checkAddable, checkAttachable, checkInventoryItem, checkKeychains, checkPatches, checkStickerSchema, checkStickers, checkStorage, clamp, compare, countDecimals, decodeInventoryData, ensure, fail, float, getDropReason, getMapnameName, getNextStickerSchema, getNextUid, getTimestamp, isFactorPrecise, isNotUndefined, isStorableInStorageUnit, migrations, randomBoolean, randomFloat, randomInt, reconcileInventoryItems, repairInventoryItem, roundToFactor, safe, snapStickerRotation, stickerMapToArray, toStickerMap, toggleCS2Team, truncateToFactor, validateStickerRotation };
17
+ export { CS2BaseInventoryItem, CS2Bounds, CS2ContainerType, CS2Economy, CS2EconomyInstance, CS2EconomyItem, CS2Inventory, CS2InventoryData, CS2InventoryDecodeError, CS2InventoryDecoded, CS2InventoryDrop, CS2InventoryDropReason, CS2InventoryError, CS2InventoryItem, CS2InventoryLoadChanges, CS2InventoryMigration, CS2InventoryMigrationError, CS2InventoryOptions, CS2InventoryRule, CS2InventoryRuleName, CS2InventorySpec, CS2InventoryStorageDrops, CS2InventoryVersionError, CS2Item, CS2ItemTeam, CS2ItemTranslation, CS2ItemTranslationByLanguage, CS2ItemTranslationMap, CS2ItemType, CS2ItemWear, CS2KeyValues, CS2KeyValues3, CS2Map, CS2ModelAnimation, CS2ModelAnimationSkeleton, CS2ModelAnimations, CS2ModelMaterials, CS2Rarity, CS2RarityColor, CS2RarityColorName, CS2RarityColorOrder, CS2RarityKeys, CS2RaritySoundName, CS2StatTrakMode, CS2Team, CS2UnlockedItem, CS2Veto, CS2VetoAction, CS2VetoEvent, CS2VetoMap, CS2VetoTeam, CS2VetoType, CS2_ALL_MAPS, CS2_ANCIENT_MAP, CS2_ANUBIS_MAP, CS2_BASE_ODD, CS2_CACHE_MAP, CS2_CHARM_DETACHMENT_PACK_CHARGES, CS2_CHARM_DETACHMENT_PACK_TOOL_DEFINITION_INDEX, CS2_CHARM_DETACHMENT_TOOL_DEFINITION_INDEX, CS2_CHICKEN_EGG_TOOL_DEFINITION_INDEX, CS2_CHICKEN_FEED_TOOL_DEFINITION_INDEX, CS2_CONTAINER_ITEMS, CS2_CONTRACT_TOOL_DEFINITION_INDEX, CS2_DEFAULT_MAX_WEAR, CS2_DEFAULT_MIN_WEAR, CS2_DISPLAY_ITEMS, CS2_DUST2_MAP, CS2_EQUIPMENT_ITEMS, CS2_FALLBACK_PREVIEW_SEED, CS2_GRAPHIC_ART_ITEMS, CS2_INFERNO_MAP, CS2_INVENTORY_EQUIPPABLE_ITEMS, CS2_INVENTORY_RULES, CS2_INVENTORY_TIMESTAMP, CS2_INVENTORY_VERSION, CS2_ITEMS, CS2_KEYCHAINABLE_ITEMS, CS2_KEYCHAIN_POSITION_FACTOR, CS2_MACHINEGUN_MODEL_KEYS, CS2_MAX_BATTLE_SCARRED_WEAR, CS2_MAX_CHARM_DETACHMENT_CHARGES, CS2_MAX_FACTORY_NEW_WEAR, CS2_MAX_FIELD_TESTED_WEAR, CS2_MAX_GRAFFITI_CHARGES, CS2_MAX_KEYCHAINS, CS2_MAX_KEYCHAIN_SEED, CS2_MAX_MINIMAL_WEAR_WEAR, CS2_MAX_PATCHES, CS2_MAX_PET_SEED, CS2_MAX_SEED, CS2_MAX_STATTRAK, CS2_MAX_STICKERS, CS2_MAX_STICKER_ROTATION, CS2_MAX_STICKER_WEAR, CS2_MAX_WEAR, CS2_MAX_WELL_WORN_WEAR, CS2_MIDTIER_LOADOUT_CATEGORIES, CS2_MIN_BATTLE_SCARRED_WEAR, CS2_MIN_CHARGES, CS2_MIN_FACTORY_NEW_WEAR, CS2_MIN_FIELD_TESTED_WEAR, CS2_MIN_INVENTORY_VERSION, CS2_MIN_KEYCHAIN_SEED, CS2_MIN_MINIMAL_WEAR_WEAR, CS2_MIN_PET_SEED, CS2_MIN_PET_STYLE, CS2_MIN_SEED, CS2_MIN_STATTRAK, CS2_MIN_STICKER_ROTATION, CS2_MIN_STICKER_WEAR, CS2_MIN_WEAR, CS2_MIN_WELL_WORN_WEAR, CS2_MIRAGE_MAP, CS2_MISC_LOADOUT_CATEGORIES, CS2_NAMETAGGABLE_ITEMS, CS2_NAMETAG_RE, CS2_NAMETAG_TOOL_DEFINITION_INDEX, CS2_NUKE_MAP, CS2_OVERPASS_MAP, CS2_PAINTABLE_ITEMS, CS2_PATCHABLE_ITEMS, CS2_PET_BREED_UPGRADE_LEVELS, CS2_PET_CHICK_UPGRADE_LEVEL, CS2_PET_CHICK_UPGRADE_LEVELS, CS2_PET_CHICK_VARIANT_INDEX, CS2_PET_EGG_UPGRADE_LEVEL, CS2_PET_EGG_UPGRADE_LEVELS, CS2_PET_EGG_VARIANT_INDEX, CS2_PET_HEN_UPGRADE_LEVEL, CS2_PET_PULLET_UPGRADE_LEVEL, CS2_PET_UPGRADE_LEVELS, CS2_RARITIES, CS2_RARITY_COLOR_DEFAULT, CS2_RARITY_ORDER, CS2_RIFLE_LOADOUT_CATEGORIES, CS2_SEEDABLE_ITEMS, CS2_SNIPER_RIFLE_MODEL_KEYS, CS2_STATTRAKABLE_ITEMS, CS2_STATTRAK_ODD, CS2_STATTRAK_SWAP_TOOL_DEFINITION_INDEX, CS2_STICKERABLE_ITEMS, CS2_STICKER_OFFSET_FACTOR, CS2_STICKER_ROTATION_STEP, CS2_STICKER_SCRAPE_FACTOR, CS2_STICKER_SLAB_TOOL_DEFINITION_INDEX, CS2_STICKER_WEAR_FACTOR, CS2_STORAGE_UNIT_TOOL_DEFINITION_INDEX, CS2_TEAMS_BOTH, CS2_TEAMS_CT, CS2_TEAMS_T, CS2_TRAIN_MAP, CS2_VERTIGO_MAP, CS2_WEAR_FACTOR, EnumValues, Interface, MapValue, RecordValue, assert, assertAddable, assertInventoryItem, assertKeychains, assertPatches, assertStickers, checkAddable, checkAttachable, checkInventoryItem, checkKeychains, checkPatches, checkStickerSchema, checkStickers, checkStorage, clamp, compare, countDecimals, decodeInventoryData, ensure, fail, float, getDropReason, getMapnameName, getNextStickerSchema, getNextUid, getTimestamp, isFactorPrecise, isNotUndefined, isStorableInStorageUnit, migrations, randomBoolean, randomFloat, randomInt, reconcileInventoryItems, repairInventoryItem, roundToFactor, safe, snapStickerRotation, stickerMapToArray, toStickerMap, toggleCS2Team, truncateToFactor, validateStickerRotation };