Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of stickers from weapons by means of API #15

Open
k1de opened this issue Mar 28, 2018 · 13 comments
Open

Removal of stickers from weapons by means of API #15

k1de opened this issue Mar 28, 2018 · 13 comments

Comments

@k1de
Copy link

k1de commented Mar 28, 2018

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. :-*

@vankxr
Copy link

vankxr commented Feb 18, 2019

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.

@k1de
Copy link
Author

k1de commented Feb 19, 2019

@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
Copy link
Author

k1de commented Feb 21, 2019

@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?

@vankxr
Copy link

vankxr commented Feb 21, 2019

What does removeSticker do exactly?

@k1de
Copy link
Author

k1de commented Feb 21, 2019

@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 ,
	});
};

@vankxr
Copy link

vankxr commented Feb 21, 2019

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

@k1de
Copy link
Author

k1de commented Feb 21, 2019

@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

@vankxr
Copy link

vankxr commented Feb 21, 2019

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

@k1de
Copy link
Author

k1de commented Feb 21, 2019

@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

@skinfans
Copy link

@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?

@vankxr
Copy link

vankxr commented Jun 20, 2020

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

@venila
Copy link

venila commented Apr 29, 2021

Want to up this topic

This was referenced Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants