SM-TFUtils icon indicating copy to clipboard operation
SM-TFUtils copied to clipboard

Support for CTFPlayer::GetLoadoutItem and CTFPlayerInventory::GetItemInLoadout

Open doclic opened this issue 3 years ago • 3 comments

CTFPlayerInventory::GetItemInLoadout gets the player's equipped item in the specified class's specified loadout slot. CTFPlayer::GetLoadoutItem calls CTFPlayerInventory::GetItemInLoadout but also checks to see if the item is banned in the competitive whitelist, in which case, the base/stock item is returned. I think natives to use those 2 functions would be useful.

doclic avatar Aug 13 '22 22:08 doclic

I can't think of a really compelling use case for them since you'd still need to do something with the CEconItemView* you get, but regardless it's very much outside the scope of Econ Data.

It might be a little more fitting in TF2 Utils, so I'll transfer this issue there. If you're looking for gamedata to use yourself, CTFPlayer::GetLoadoutItem() is used in Custom Weapons X.

nosoop avatar Aug 14 '22 06:08 nosoop

One functionality that could fit in Econ Data would be the competitive allowlist; that is actually set as an item definition property.

I wouldn't be against adding first-class support for that there aside from the potential maintenance burden, though TF2Econ_GetItemDefinitionAddress() is provided so users can access whatever properties they'd like without having to go through me.

nosoop avatar Aug 14 '22 07:08 nosoop

Okay, I understand, thanks for the quick answer!

doclic avatar Aug 14 '22 09:08 doclic