Skip to content

Commit

Permalink
Merge pull request #72 from Antosik/feat/neutral-token
Browse files Browse the repository at this point in the history
feat: add neutral token drops data
  • Loading branch information
howardchung authored Aug 25, 2024
2 parents 385b818 + cac8c41 commit 9a39bf2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions processors/parseSchema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ export default {
randomed: false,
repicked: false,
pred_vict: false,
neutral_tokens_log: [],
})),
};
3 changes: 2 additions & 1 deletion processors/populate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function populate(e, container, meta) {
} else if (
e.type === 'purchase_log' ||
e.type === 'kills_log' ||
e.type === 'runes_log'
e.type === 'runes_log' ||
e.type === 'neutral_tokens_log'
) {
arrEntry = {
time: e.time,
Expand Down
6 changes: 6 additions & 0 deletions processors/processExpand.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,12 @@ function processExpand(entries, meta) {
cosmetics(e) {
expand(e);
},
neutral_token(e) {
expand({
...e,
type: 'neutral_tokens_log',
});
},
};
for (let i = 0; i < entries.length; i += 1) {
const e = entries[i];
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/opendota/Parse.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ public Integer getPlayerSlotFromEntity(Context ctx, Entity e) {
if (slot == null) {
slot = getEntityProperty(e, "m_iPlayerID", null);
}
if (slot == null) {
slot = getEntityProperty(e, "m_iPlayerOwnerID", null);
}
if (slot != null) {
slot /= 2;
}
Expand Down Expand Up @@ -473,7 +476,9 @@ public void onCombatLogEntry(Context ctx, CombatLogEntry cle) {

@OnEntityEntered
public void onEntityEntered(Context ctx, Entity e) {
if (e.getDtClass().getDtName().equals("CDOTAWearableItem")) {
String entityName = e.getDtClass().getDtName();

if (entityName.equals("CDOTAWearableItem")) {
Integer accountId = getEntityProperty(e, "m_iAccountID", null);
Integer itemDefinitionIndex = getEntityProperty(e, "m_iItemDefinitionIndex", null);
// System.err.format("%s,%s\n", accountId, itemDefinitionIndex);
Expand All @@ -483,6 +488,12 @@ public void onEntityEntered(Context ctx, Entity e) {
Integer playerSlot = steamid_to_playerslot.get(accountId64);
cosmeticsMap.put(itemDefinitionIndex, playerSlot);
}
} else if (entityName.startsWith("CDOTA_Item_Tier") && entityName.endsWith("Token")) {
Entry entry = new Entry(time);
entry.type = "neutral_token";
entry.slot = getPlayerSlotFromEntity(ctx, e);
entry.key = entityName.substring("CDOTA_Item_".length()); // Tier1Token
output(entry);
}
}

Expand Down

0 comments on commit 9a39bf2

Please sign in to comment.