node-globaloffensive icon indicating copy to clipboard operation
node-globaloffensive copied to clipboard

Removal of stickers from weapons by means of API

Open k1de opened this issue 7 years ago • 13 comments

Hello, dear DoctorMcKay and all readers. Is there a way to remove stickers from the skin by API, if not, will it be implemented? This feature would greatly facilitate the life of me and not only.

Thank you for your attention and your work. :-*

k1de avatar Mar 28 '18 16:03 k1de

Removing a sticker is just scratching it until it disappears (wear 100%) iirc. If that's the case you can take a look at this proto https://github.com/SteamDatabase/Protobufs/blob/f4d88b86687f841a2798fd9fe57dd4099ef04beb/csgo/base_gcmessages.proto#L176 The attr_defidx is 114 for sticker in slot 1, 118 for slot 2, 122 for slot 3 and 126 for slot 4. the attr_value should be set to 0x3F800000 (bit representation of 1 in float) if you want to scratch it completely. If you just want to change the wear to something else you should encode the wear float value in the that field.

vankxr avatar Feb 18 '19 23:02 vankxr

@vankxr , thank you very much for your answer, which EGCItemMSG should I use to send CMsgModifyAttribute proto? I am tried: ApplySticker: 1086, ItemAcknowledged: 1087.

k1de avatar Feb 19 '19 16:02 k1de

https://github.com/SteamDatabase/Protobufs/blob/f4d88b86687f841a2798fd9fe57dd4099ef04beb/csgo/econ_gcmessages.proto#L89

vankxr avatar Feb 19 '19 21:02 vankxr

@vankxr , man, I made some changes to node-globaloffensive https://github.com/k1de/node-globaloffensive/commit/d5e0fd7e37df8f5940fd626925cde078766bcb52 I use

csgo.on('connectedToGC', () => {
  csgo.removeSticker(15533389229,114,1)
})

but nothing happens

Sending GC message ClientHello Sending hello, setting timer for next attempt to 2000 ms Got handled GC message ClientWelcome Unknown SO type 2 with 1 items Unknown SO type 7 with 1 items Unknown SO type 45 with 4 items GC connection established Got unhandled GC message 9194 Got handled GC message MatchmakingGC2ClientHello Sending GC message ModifyItemAttribute

What am I doing wrong?

k1de avatar Feb 21 '19 15:02 k1de

What does removeSticker do exactly?

vankxr avatar Feb 21 '19 15:02 vankxr

@vankxr , just this

GlobalOffensive.prototype.removeSticker = function(item_id, attr_defidx, attr_value) {
	this._send(Language.ModifyItemAttribute, Protos.CMsgModifyItemAttribute, {
		item_id ,
		attr_defidx ,
		attr_value ,
	});
};

k1de avatar Feb 21 '19 15:02 k1de

Removing a sticker is just scratching it until it disappears (wear 100%) iirc. If that's the case you can take a look at this proto https://github.com/SteamDatabase/Protobufs/blob/f4d88b86687f841a2798fd9fe57dd4099ef04beb/csgo/base_gcmessages.proto#L176 The attr_defidx is 114 for sticker in slot 1, 118 for slot 2, 122 for slot 3 and 126 for slot 4. the attr_value should be set to 0x3F800000 (bit representation of 1 in float) if you want to scratch it completely. If you just want to change the wear to something else you should encode the wear float value in the that field.

Read this again. You are sending the wrong attr_value.

To get the bit representation of an arbitrary float value you can use: var buf = Buffer.alloc(4); buf.writeFloatLE(arbitrary_float); attr_value = buf.readUInt32LE(0);

PS: My bad lol I did not see you linked your fork

vankxr avatar Feb 21 '19 15:02 vankxr

@vankxr , unfortunately it didn't help https://github.com/k1de/node-globaloffensive/commit/dd5d6219955b22736ea3cbf7315880e84f632d00

Sending GC message ClientHello Sending hello, setting timer for next attempt to 2000 ms Sending GC message ClientHello Sending hello, setting timer for next attempt to 4000 ms Got handled GC message ClientWelcome Unknown SO type 2 with 1 items Unknown SO type 7 with 1 items Unknown SO type 45 with 4 items GC connection established { item_id: 15533389229, attr_defidx: 114, attr_value: 1065353216 } Sending GC message ModifyItemAttribute

k1de avatar Feb 21 '19 17:02 k1de

Can you try this one: https://github.com/SteamDatabase/Protobufs/blob/f4d88b86687f841a2798fd9fe57dd4099ef04beb/csgo/base_gcmessages.proto#L168 https://github.com/SteamDatabase/Protobufs/blob/f4d88b86687f841a2798fd9fe57dd4099ef04beb/csgo/econ_gcmessages.proto#L84

sticker_item_id = 0 item_item_id = your item id sticker_slot = slot (starting from 0, ending at 3) baseitem_defidx = 0 sticker_wear = 1

vankxr avatar Feb 21 '19 17:02 vankxr

@vankxr , again failed https://github.com/k1de/node-globaloffensive/commit/360f3af2bb069c16838bdbb237b1caaf2602ba0e

Sending GC message ClientHello Sending hello, setting timer for next attempt to 2000 ms Got handled GC message ClientWelcome Unknown SO type 2 with 1 items Unknown SO type 7 with 1 items Unknown SO type 45 with 4 items GC connection established { sticker_item_id: 0, item_item_id: 15533389229, sticker_slot: 1, baseitem_defidx: 0, sticker_wear: 1 } Sending GC message ApplySticker Got handled GC message MatchmakingGC2ClientHello Got unhandled GC message 9194

k1de avatar Feb 21 '19 18:02 k1de

@vankxr, Many thanks for the information above! The solution to this issue is still relevant for us. Could you help us to create the correct request template?

skinfans avatar Jun 20 '20 13:06 skinfans

I'm currently not at home. I can hook the GC interface in the game and scratch some weapon to see what happens, but I don't think I have one atm. I'll see on Monday

vankxr avatar Jun 20 '20 14:06 vankxr

Want to up this topic

venila avatar Apr 29 '21 19:04 venila