Skip to content

Commit

Permalink
Perf improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Dec 28, 2024
1 parent 6b9cd90 commit f584282
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public JailSolver(PersistenceProvider persistence, XivState state) {

@Override
public boolean enabled(EventContext context) {
// return true;
return overrideZoneLock.get() || context.getStateInfo().get(XivState.class).zoneIs(0x309L);
return overrideZoneLock.get() || state.dutyIs(KnownDuty.UWU);
}

@HandleEvents
Expand Down Expand Up @@ -145,8 +144,7 @@ public void jailedPlayerDied(EventContext context, EntityKilledEvent event) {
@HandleEvents
public void handleJailCast(EventContext context, AbilityUsedEvent event) {
// Check ability ID - we only care about these two
long id = event.getAbility().getId();
if (id != 0x2B6B && id != 0x2B6C) {
if (!event.abilityIdMatches(0x2B6B, 0x2B6C)) {
return;
}
XivCombatant target = event.getTarget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
@SuppressWarnings("unused")
public class Line38Parser extends AbstractACTLineParser<Line38Parser.Fields> {

private static final boolean enableStatusEffectParsing = true;
private final StatusEffectRepository buffs;

public Line38Parser(PicoContainer container, StatusEffectRepository buffs) {
Expand All @@ -37,7 +36,7 @@ protected Event convert(FieldMapper<Fields> fields, int lineNumber, ZonedDateTim
XivCombatant target = fields.getEntity(Fields.id, Fields.name, Fields.targetCurHp, Fields.targetMaxHp, Fields.targetCurMp, Fields.targetMaxMp, Fields.targetX, Fields.targetY, Fields.targetZ, Fields.targetHeading, Fields.targetShieldPct);
// To save processing time, only bother with this if the target has no buffs whatsoever currently on them
// TODO: is this the best way of doing this?
if (enableStatusEffectParsing && !buffs.targetHasAnyStatus(target)) {
if (!buffs.targetHasAnyStatus(target)) {
List<String> split = fields.getRawLineSplit();
// Last field is hash
List<String> remaining = split.subList(Fields.firstFlag.ordinal() + 2, split.size() - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public void removeCombatant(EventContext context, RawRemoveCombatantEvent event)
}
}

// TODO: this has a performance impact
@HandleEvents
public void workaroundForActNotRemovingCombatants(EventContext context, XivStateRecalculatedEvent event) {
Set<Long> combatantsThatExist = state.getCombatants().keySet();
Expand Down

0 comments on commit f584282

Please sign in to comment.