public Entity getByDtName(final String dtClassName) { Iterator<Entity> iter = getAllByDtName(dtClassName); return iter.hasNext() ? iter.next() : null; }
public Iterator<Entity> getAllByDtName(final String dtClassName) { return getAllByPredicate( new Predicate<Entity>() { @Override public boolean apply(Entity e) { return dtClassName.equals(e.getDtClass().getDtName()); } }); }
@OnEntityEntered public void onEntityEntered(Context ctx, Entity e) { if (e.getDtClass().getDtName().equals("CDOTAWearableItem")) { Integer accountId = getEntityProperty(e, "m_iAccountID", null); Integer itemDefinitionIndex = getEntityProperty(e, "m_iItemDefinitionIndex", null); Integer ownerHandle = getEntityProperty(e, "m_hOwnerEntity", null); Entity owner = ctx.getProcessor(Entities.class).getByHandle(ownerHandle); //System.err.format("%s,%s\n", accountId, itemDefinitionIndex); if (accountId > 0) { // Get the owner (a hero entity) Integer playerId = getEntityProperty(owner, "m_iPlayerID", null); Long accountId64 = 76561197960265728L + accountId; Integer playerSlot = steamid_to_playerslot.get(accountId64); cosmeticsMap.put(itemDefinitionIndex, playerSlot); } } }
Entity grp = ctx.getProcessor(Entities.class).getByDtName("CDOTAGamerulesProxy"); Entity pr = ctx.getProcessor(Entities.class).getByDtName("CDOTA_PlayerResource"); Entity dData = ctx.getProcessor(Entities.class).getByDtName("CDOTA_DataDire"); Entity rData = ctx.getProcessor(Entities.class).getByDtName("CDOTA_DataRadiant"); Entity e = ctx.getProcessor(Entities.class).getByHandle(handle);
@Initializer(OnEntityUpdated.class) public void initOnEntityUpdated(final EventListener<OnEntityUpdated> listener) { listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern())); }
private Entity getEntity(String entityName) { return runner.getContext().getProcessor(Entities.class).getByDtName(getEngineDependentEntityName(entityName)); }
@OnMessage(CUserMessageSayText2.class) public void onAllChatS2(Context ctx, CUserMessageSayText2 message) { Entry entry = new Entry(time); entry.unit = String.valueOf(message.getParam1()); entry.key = String.valueOf(message.getParam2()); Entity e = ctx.getProcessor(Entities.class).getByIndex(message.getEntityindex()); entry.slot = getEntityProperty(e, "m_iPlayerID", null); entry.type = "chat"; output(entry); }
state = Util.clone(getBaseline(cls.getClassId())); fieldReader.readFields(stream, cls, state, debug); entity = new Entity(engineType, entityIndex, serial, cls, true, state);
private Entry buildWardEntry(Context ctx, Entity e) { Entry entry = new Entry(time); boolean isObserver = !e.getDtClass().getDtName().contains("TrueSight"); Integer x = getEntityProperty(e, "CBodyComponent.m_cellX", null); Integer y = getEntityProperty(e, "CBodyComponent.m_cellY", null); Integer z = getEntityProperty(e, "CBodyComponent.m_cellZ", null); Integer life_state = getEntityProperty(e, "m_lifeState", null); Integer[] pos = {x, y}; entry.x = x; entry.y = y; entry.z = z; entry.type = isObserver ? "obs" : "sen"; entry.entityleft = life_state == 1; entry.key = Arrays.toString(pos); entry.ehandle = e.getHandle(); if (entry.entityleft) { entry.type += "_left"; } Integer owner = getEntityProperty(e, "m_hOwnerEntity", null); Entity ownerEntity = ctx.getProcessor(Entities.class).getByHandle(owner); entry.slot = ownerEntity != null ? (Integer) getEntityProperty(ownerEntity, "m_iPlayerID", null) : null; return entry; } }
@Initializer(OnEntityDeleted.class) public void initOnEntityDeleted(final EventListener<OnEntityDeleted> listener) { listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern())); }
@OnMessage(CDOTAUserMsg_SpectatorPlayerUnitOrders.class) public void onSpectatorPlayerUnitOrders(Context ctx, CDOTAUserMsg_SpectatorPlayerUnitOrders message) { Entry entry = new Entry(time); entry.type = "actions"; //the entindex points to a CDOTAPlayer. This is probably the player that gave the order. Entity e = ctx.getProcessor(Entities.class).getByIndex(message.getEntindex()); entry.slot = getEntityProperty(e, "m_iPlayerID", null); //Integer handle = (Integer)getEntityProperty(e, "m_hAssignedHero", null); //Entity h = ctx.getProcessor(Entities.class).getByHandle(handle); //System.err.println(h.getDtClass().getDtName()); //break actions into types? entry.key = String.valueOf(message.getOrderType()); //System.err.println(message); output(entry); }
state = Util.clone(getBaseline(cls.getClassId())); fieldReader.readFields(stream, cls, state, debug); entity = new Entity(engineType, entityIndex, serial, cls, true, state);
private void logCreate(DotaUserMessages.CDOTAUserMsg_ParticleManager message) { int entityHandle = message.getCreateParticle().getEntityHandle(); // int entityIndex = Handle.indexForHandle(entityHandle); // int entitySerial = Handle.serialForHandle(entityHandle); Entity parent = entities.getByHandle(entityHandle); log.info("{} {} [index={}, entity={}({}), effect={}, attach={}]", getTick(), "PARTICLE_CREATE", message.getIndex(), entityHandle, parent == null ? "NOT_FOUND" : parent.getDtClass().getDtName(), message.getCreateParticle().getParticleNameIndex(), message.getCreateParticle().getAttachType() ); //log.info(message.toString()); }
@Initializer(OnEntityCreated.class) public void initOnEntityCreated(final EventListener<OnEntityCreated> listener) { listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern())); }
public Iterator<Entity> getAllByDtName(final String dtClassName) { return getAllByPredicate( new Predicate<Entity>() { @Override public boolean apply(Entity e) { return dtClassName.equals(e.getDtClass().getDtName()); } }); }
public Entity getByDtName(final String dtClassName) { Iterator<Entity> iter = getAllByDtName(dtClassName); return iter.hasNext() ? iter.next() : null; }
private void logUpdateEnt(DotaUserMessages.CDOTAUserMsg_ParticleManager message) { int entityHandle = message.getUpdateParticleEnt().getEntityHandle(); Entity parent = entities.getByHandle(entityHandle); log.info("{} {} [index={}, entity={}({}), controlPoint={}, attachmentType={}, attachment={}, includeWearables={}]", getTick(), "PARTICLE_UPDATE_ENT", message.getIndex(), entityHandle, parent == null ? "NOT_FOUND" : parent.getDtClass().getDtName(), message.getUpdateParticleEnt().getControlPoint(), ParticleAttachmentType.forId(message.getUpdateParticleEnt().getAttachType()), message.getUpdateParticleEnt().getAttachment(), message.getUpdateParticleEnt().getIncludeWearables() ); //log.info(message.toString()); }
@Initializer(OnEntityEntered.class) public void initOnEntityEntered(final EventListener<OnEntityEntered> listener) { listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern())); }
public Entity getByPredicate(Predicate<Entity> predicate) { Iterator<Entity> iter = getAllByPredicate(predicate); return iter.hasNext() ? iter.next() : null; }
return null; Entity eItem = entities.getByHandle(hItem); if(eItem == null) { throw new UnknownItemFoundException(String.format("Can't find item by its handle (%d)", hItem));