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

feat: add neutral token drops data #72

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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