Skip to content
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ related events), where applicable:
- `offset_y` - Float, `null` if not applicable
- `casket_id` - If this item is contained in a casket (storage unit), this is a string containing that casket's item ID
- `casket_contained_item_count` - If this item is a casket (storage unit), this is a count of how many items it contains
- `charm` - If a charm (sometimes referred to as keychain) is attached to the item, this object contains details about the charm.
- `charm_id` - The ID of the charm
- `offset_x` - Float
- `offset_y` - Float
- `offset_z` - Float
- `pattern` - The charm's pattern (1-100,000)

Note that if any of the above attributes are not applicable, then they will not exist in the item object.

Expand Down
17 changes: 17 additions & 0 deletions handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,23 @@ GlobalOffensive.prototype._processSOEconItem = function(item) {
item.stickers = stickers;
}

// charms
let charmIdBytes = getAttributeValueBytes(299);
let charmOffsetXBytes = getAttributeValueBytes(300);
let charmOffsetYBytes = getAttributeValueBytes(301);
let charmOffsetZBytes = getAttributeValueBytes(302);
let charmPatternBytes = getAttributeValueBytes(306);

if (charmIdBytes && charmOffsetXBytes && charmOffsetYBytes && charmOffsetZBytes && charmPatternBytes) {
item.charm = {
charm_id: charmIdBytes.readUInt32LE(0),
offset_x: charmOffsetXBytes.readFloatLE(0),
offset_y: charmOffsetYBytes.readFloatLE(0),
offset_z: charmOffsetZBytes.readFloatLE(0),
pattern: charmPatternBytes.readUInt32LE(0),
};
}

// def_index-specific attribute parsing
switch (item.def_index) {
case 1201:
Expand Down