Closed kerstenc closed 9 years ago
When the item is generic and needs no special implementation, it's class will be CDOTA_Item. To retrieve the name, annotate your processor class with
@UsesStringTable("EntityNames")
and retrieve the name of the entity with
Entities entities = ctx.getProcessor(Entities.class);
StringTables stringTables = ctx.getProcessor(StringTables.class);
Entity item = entities.getByHandle(itemHandle);
if (item != null) {
Integer idx = item.getProperty("m_pEntity.m_nameStringableIndex");
String name = stringTables.forName("EntityNames").getNameByIndex(idx);
}
and yes, that typo in "StringableIndex" was in my replay, might be fixed in yours :)
Thanks a million @spheenik! Worked like a charm :)
I am trying to get the heroes inventory at different times using the below code:
The issue that I'm having is that I'm getting a generic CDOTA_Item class for most of the items. Any reason why this might be happening?
Thanks in advance