:coffee: fund my caffeine addiction :coffee:
A library to get TF2 item data from game memory, intended as a successor to TF2ItemsInfo and TF2IDB. No more parsing the schema file and maintaining your own structure for plugin support.
I got bored one day and thought about rewriting a few of my internal plugins so they didn't depend on external tooling anymore.
There's a semi-guide on porting from existing libraries to this one, as well as a WIP plugin that implements the natives from those libraries.
tf_econ_data.smx
to addons/sourcemod/plugins/
.tf2.econ_data.txt
to addons/sourcemod/gamedata/
.tf_econ_data.inc
to addons/sourcemod/scripting/include/
(or the appropriate path for your compiler toolchain / project).SDKCall
boilerplate yourself.other_particles
and killstreak_eyeglows
.)Note that the abstractions are intentionally low; this plugin doesn't implement higher-level functions in SourcePawn to do things like:
Dump the taunt defindices for a given class:
int g_iTauntSlot = -1;
public void OnAllPluginsLoaded() {
// you could use a hardcoded value of 11 if you want to bet on valve not changing indices
g_iTauntSlot = TF2Econ_TranslateLoadoutSlotNameToIndex("taunt");
if (g_iTauntSlot == -1) {
SetFailState("Failed to determine index for slot name '%s'", "taunt");
}
ArrayList tauntList = TF2Econ_GetItemList(FilterClassTaunts, TFClass_Scout);
for (int i = 0; i < tauntList.Length; i++) {
int defindex = tauntList.Get(i);
PrintToServer("%d", defindex);
}
delete tauntList;
}
/**
* Returns true if the given item is available for the given playerClass as a taunt.
*/
public bool FilterClassTaunts(int defindex, TFClassType playerClass) {
return TF2Econ_GetItemSlot(defindex, playerClass) == g_iTauntSlot;
}