Skip to content

Commit

Permalink
Support AddedCombatant
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Dec 15, 2023
1 parent 0525ae2 commit ebef0c0
Show file tree
Hide file tree
Showing 35 changed files with 173 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import gg.xp.reevent.events.Event;
import gg.xp.xivsupport.timelines.cbevents.CbEventFmt;
import gg.xp.xivsupport.timelines.cbevents.CbEventType;
import gg.xp.xivsupport.timelines.intl.LanguageReplacements;

import java.util.HashMap;
Expand All @@ -12,12 +13,14 @@ public class FileEventSyncController implements EventSyncController {

private final Class<? extends Event> eventType;
private final Predicate<Event> predicate;
private final CbEventType type;
private final String originalType;
private final Map<String, String> original;

public FileEventSyncController(Class<? extends Event> eventType, Predicate<Event> predicate, String originalType, Map<String, String> original) {
public FileEventSyncController(Class<? extends Event> eventType, Predicate<Event> predicate, CbEventType type, String originalType, Map<String, String> original) {
this.eventType = eventType;
this.predicate = predicate;
this.type = type;
this.originalType = originalType;
this.original = new HashMap<>(original);
}
Expand All @@ -44,7 +47,7 @@ public EventSyncController translateWith(LanguageReplacements replacements) {
if (modified.equals(original)) {
return this;
}
return CbEventFmt.parse(originalType, modified);
return CbEventFmt.parse(type, modified);
}

@Override
Expand All @@ -54,6 +57,6 @@ public String toTextFormat() {

@Override
public String toString() {
return eventType.getSimpleName() + original;
return type.displayName() + original;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private CbEventFmt() {
}

public static EventSyncController parseRaw(String type, String conditionsRaw) {
CbEventTypes eventDef = CbEventTypes.valueOf(type);
CbEventType eventDef = CbEventType.valueOf(type);
Map<String, String> conditions;
try {
conditions = mapper.readValue(conditionsRaw, new TypeReference<>() {
Expand All @@ -41,13 +41,12 @@ public static EventSyncController parseRaw(String type, String conditionsRaw) {
throw new RuntimeException("Error reading JSON: " + conditionsRaw, e);
}
Predicate<Event> condition = eventDef.make(conditions);
return new FileEventSyncController(eventDef.eventType(), condition, type, conditions);
return new FileEventSyncController(eventDef.eventType(), condition, eventDef, type, conditions);
}

public static EventSyncController parse(String type, Map<String, String> conditions) {
CbEventTypes eventDef = CbEventTypes.valueOf(type);
public static EventSyncController parse(CbEventType eventDef, Map<String, String> conditions) {
Predicate<Event> condition = eventDef.make(conditions);
return new FileEventSyncController(eventDef.eventType(), condition, type, conditions);
return new FileEventSyncController(eventDef.eventType(), condition, eventDef, eventDef.name(), conditions);
}

public static String format(String originalType, Map<String, String> originalValues) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import gg.xp.reevent.events.Event;
import gg.xp.xivsupport.events.actlines.events.AbilityUsedEvent;
import gg.xp.xivsupport.events.actlines.events.ChatLineEvent;
import gg.xp.xivsupport.events.actlines.events.RawAddCombatantEvent;
import gg.xp.xivsupport.events.actlines.events.SystemLogMessageEvent;
import gg.xp.xivsupport.events.actlines.events.XivStateRecalculatedEvent;
import gg.xp.xivsupport.events.state.InCombatChangeEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -20,7 +22,7 @@
import static gg.xp.xivsupport.timelines.cbevents.CbConversions.named;
import static gg.xp.xivsupport.timelines.cbevents.CbConversions.strConv;

public enum CbEventTypes {
public enum CbEventType {
/*
Further design notes:
Expand Down Expand Up @@ -67,6 +69,11 @@ public enum CbEventTypes {
new CbfMap<>("param0", "event.param0", intConv(SystemLogMessageEvent::getParam0, 16)),
new CbfMap<>("param1", "event.param1", intConv(SystemLogMessageEvent::getParam1, 16)),
new CbfMap<>("param2", "event.param2", intConv(SystemLogMessageEvent::getParam2, 16))
)),
// TODO: finally do more work on XivStateImpl to have it emit added/removed events
// In the meantime, the raw ACT versions should work fine.
AddedCombatant(RawAddCombatantEvent.class, List.of(
new CbfMap<>("name", "event.entity.name", named(RawAddCombatantEvent::getEntity))
))


Expand All @@ -76,7 +83,7 @@ public enum CbEventTypes {

private final Holder<?> data;

<X extends Event> CbEventTypes(Class<X> eventType, List<CbfMap<? super X>> fieldMappings) {
<X extends Event> CbEventType(Class<X> eventType, List<CbfMap<? super X>> fieldMappings) {
this.data = new Holder<X>(eventType, fieldMappings);
}

Expand All @@ -94,9 +101,13 @@ public Predicate<Event> make(Map<String, String> values) {
return this.data.make(values);
}

public String displayName() {
return eventType().getSimpleName();
}


private static class Holder<X extends Event> implements CbEventDesc<X> {
private static final Logger log = LoggerFactory.getLogger(CbEventTypes.class);
private static final Logger log = LoggerFactory.getLogger(CbEventType.class);
private final Class<X> eventType;
private final Map<String, CbConversion<? super X>> condMap;
private final List<CbfMap<? super X>> fieldMap;
Expand Down
8 changes: 4 additions & 4 deletions timelines/src/main/resources/timeline/a11s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ hideall "--sync--"
40.6 "Spin Crusher" Ability { id: "1A85", source: "Cruise Chaser" }

# skippable
45.8 "E.D.D. Add" sync / 03:........:E\.D\.D\.:/ window 50,5
45.8 "E.D.D. Add" AddedCombatant { name: "E\\.D\\.D\\." } window 50,5

# If we jump to this laser sword immediately after first, the timing is:
# 9.2 (first sword) 21.7 (second sword)
Expand Down Expand Up @@ -135,7 +135,7 @@ hideall "--sync--"
450.9 "Laser X Sword" Ability { id: "1A7F", source: "Cruise Chaser" }

# maybe skippable
458.7 "E.D.D. Add" sync / 03:........:E\.D\.D\.:/
458.7 "E.D.D. Add" AddedCombatant { name: "E\\.D\\.D\\." }
462.0 "Photon (dps)" Ability { id: "1A73", source: "Cruise Chaser" }
470.2 "Whirlwind" Ability { id: "1A84", source: "Cruise Chaser" }

Expand All @@ -151,7 +151,7 @@ hideall "--sync--"
505.2 "Transform" Ability { id: "1A49", source: "Cruise Chaser" }
513.0 "--sync--" Ability { id: "1A4A", source: "Cruise Chaser" }
517.8 "Blassty Blaster" Ability { id: "1A69", source: "Cruise Chaser" }
520.8 "Multifield x3" sync / 03:........:Multifield:/
520.8 "Multifield x3" AddedCombatant { name: "Multifield" }
523.9 "Transform" Ability { id: "1A4E", source: "Cruise Chaser" }
529.9 "Perfect Landing" Ability { id: "1A6B", source: "Cruise Chaser" }

Expand Down Expand Up @@ -194,7 +194,7 @@ hideall "--sync--"
683.0 "--targetable--"

693.2 "Laser X Sword" Ability { id: "1A7F", source: "Cruise Chaser" }
697.2 "E.D.D. Add" sync / 03:........:E\.D\.D\.:/
697.2 "E.D.D. Add" AddedCombatant { name: "E\\.D\\.D\\." }
705.4 "Photon (dps)" Ability { id: "1A73", source: "Cruise Chaser" }
714.6 "Left/Right Laser Sword" Ability { id: "1A7[A9]", source: "Cruise Chaser" }
722.7 "Photon (healer)" Ability { id: "1A73", source: "Cruise Chaser" }
Expand Down
2 changes: 1 addition & 1 deletion timelines/src/main/resources/timeline/a12s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ hideall "--sync--"
124.9 "Almost Holy" Ability { id: "19F7", source: "The General's Wing" }
133.2 "Almost Holy" Ability { id: "19F7", source: "The General's Wing" }

139.2 "The General's Might (W)" sync / 03:........:The General's Might:/ window 150,5
139.2 "The General's Might (W)" AddedCombatant { name: "The General's Might" } window 150,5
139.2 "The General's Time (E)"
141.6 "Almost Holy?" Ability { id: "19F7", source: "The General's Wing" }
150.4 "Smash" Ability { id: "19F3", source: "The General's Might" } window 151,3
Expand Down
18 changes: 9 additions & 9 deletions timelines/src/main/resources/timeline/a2s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ hideall "--sync--"


# Wave 2 (timed push)
20.3 "--Wave 2--" sync / 03:........:Gordian Hardmind:/ window 21,5
20.3 "--Wave 2--" AddedCombatant { name: "Gordian Hardmind" } window 21,5
20.3 "Sniper, Soldier x2 (NW)"
20.3 "Hardmind (SW)"

42.0 "Brainhurt Breakblock" Ability { id: "FCC", source: "Gordian Hardmind" }


# Wave 3 (timed push)
80.2 "--Wave 3--" sync / 03:........:Gordian Hardhelm:/ window 70,70
80.2 "--Wave 3--" AddedCombatant { name: "Gordian Hardhelm" } window 70,70
80.2 "Hardhelm, Soldier (SW)"
80.2 "Hardmind, Sniper, Soldier 2x (N)"

Expand All @@ -35,7 +35,7 @@ hideall "--sync--"


# Wave 4 (triggered push)
2000.0 "--Wave 4--" sync / 03:........:Boomtype Magitek Gobwalker G-VII:/ window 2000,0
2000.0 "--Wave 4--" AddedCombatant { name: "Boomtype Magitek Gobwalker G-VII" } window 2000,0
2000.0 "Gobwalker (NE)"
2000.0 "Sniper x2, Soldier x2 (mid)"

Expand All @@ -46,7 +46,7 @@ hideall "--sync--"


# Wave 5 (timed push)
2095.5 "--Wave 5--" sync / 03:........:Magitek Gobwidow G-IX:/ window 2070,100
2095.5 "--Wave 5--" AddedCombatant { name: "Magitek Gobwidow G-IX" } window 2070,100
2095.5 "Gobwidow (N)"
2095.5 "Gobwidow (S)"
2095.5 "Soldier x2 (SW)"
Expand All @@ -62,7 +62,7 @@ hideall "--sync--"


# Wave 6 (timed push)
2168.0 "--Wave 6--" sync / 03:........:Jagd Doll:/ window 2170,100
2168.0 "--Wave 6--" AddedCombatant { name: "Jagd Doll" } window 2170,100
2168.0 "Jagd Doll (NE)"
2168.0 "Gobwalker (N)"
2168.0 "Hardhelm (SW)"
Expand Down Expand Up @@ -94,7 +94,7 @@ hideall "--sync--"


# Wave 7 (triggered push)
3000.0 "--Wave 7--" sync / 03:........:Jagd Doll:/ window 825,0
3000.0 "--Wave 7--" AddedCombatant { name: "Jagd Doll" } window 825,0
3000.0 "Jagd Doll x4 (mid)"

3006.2 "Kaltstrahl" #Ability { id: "FD4", source: "Jagd Doll" }
Expand All @@ -112,7 +112,7 @@ hideall "--sync--"

# Wave 8 (timed push)
# TODO: include additional jagd doll stuff into here?
3080.7 "--Wave 8--" sync / 03:........:Gordian Sniper:/ window 1075,100
3080.7 "--Wave 8--" AddedCombatant { name: "Gordian Sniper" } window 1075,100
3080.7 "Sniper x3, Soldier (SW)"
3080.7 "Hardmind (N)"
3080.7 "Hardhelm (SE)"
Expand All @@ -126,7 +126,7 @@ hideall "--sync--"


# Wave 9 (triggered push)
4000.0 "--Wave 9--" sync / 03:........:Magitek Gobwidow G-IX:/ window 1900,0
4000.0 "--Wave 9--" AddedCombatant { name: "Magitek Gobwidow G-IX" } window 1900,0
4000.0 "Gobwidow (NW)"
4000.0 "Gobwidow, Jagd Doll (SW)"
4000.0 "Gobwalker (NE)"
Expand Down Expand Up @@ -165,7 +165,7 @@ hideall "--sync--"


# Enrage
5000.0 "--sync--" sync / 03:........:Giant Bomb:/ window 5000,0
5000.0 "--sync--" AddedCombatant { name: "Giant Bomb" } window 5000,0
5010.0 "Massive Explosion Enrage" Ability { id: "FDD", source: "Giant Bomb" }

# Technically this loops, and has a special dialog where Quickthinx says:
Expand Down
2 changes: 1 addition & 1 deletion timelines/src/main/resources/timeline/a6s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ hideall "Ballistic Missile"

## Brawler Orb Phase
1500.0 "--sync--" sync / 22:........:Brawler:........:Brawler:00/ window 500,0
1503.4 "Power Plasma Alpha x2" sync / 03:........:Power Plasma Alpha:/ window 500,5
1503.4 "Power Plasma Alpha x2" AddedCombatant { name: "Power Plasma Alpha" } window 500,5
1503.4 "Power Plasma Gamma x2"

1508.6 "Attachment" Ability { id: "1601", source: "Brawler" }
Expand Down
6 changes: 3 additions & 3 deletions timelines/src/main/resources/timeline/a7s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ hideall "--sync--"
249 "Stun Heart"
249 "Sizzlebeam"
258 "Sizzlespark" #can be skipped
266 "Bomb x1" sync / 03:........:Bomb:/ window 50 jump 561
266 "Bomb x1" AddedCombatant { name: "Bomb" } window 50 jump 561
267 ""
267 ""
267 ""
Expand Down Expand Up @@ -126,7 +126,7 @@ hideall "--sync--"

############################################
################# Version 1 - Phase 3
561 "Bomb x1" sync / 03:........:Bomb:/ window 50,20
561 "Bomb x1" AddedCombatant { name: "Bomb" } window 50,20
567 "Jails" #Green Prey & Red Tether
570 "Zoomdoom" Ability { id: "15BE", source: "Quickthinx Allthoughts" } window 60
570 "Doll"
Expand Down Expand Up @@ -171,7 +171,7 @@ hideall "--sync--"
903 "Stun Heart"
909 "Sizzlespark"
917 "Sizzlespark"
923 "Bombs / Sizzlebeam" sync / 03:........:Bomb:/ window 20 jump 1326
923 "Bombs / Sizzlebeam" AddedCombatant { name: "Bomb" } window 20 jump 1326
924 "" Ability { id: "15EE", source: "Quickthinx Allthoughts" } window 20 jump 1526
924 ""
924 ""
Expand Down
6 changes: 3 additions & 3 deletions timelines/src/main/resources/timeline/a8n.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ hideall "Brute Force"
# so we just do one full rotation and hope for the best.
# If it would have looped past here, there are bigger problems!
200.0 "--sync--" sync / 22:........:Onslaughter:........:Onslaughter:00/ window 200,0
203.8 "--sync--" sync / 03:........:Brawler:/ window 150,30
203.8 "--sync--" AddedCombatant { name: "Brawler" } window 150,30
206.2 "--targetable--"
214.3 "Magicked Mark" Ability { id: "173B", source: "Brawler" }
214.3 "Brute Force" Ability { id: "1744", source: "Vortexer" }
Expand Down Expand Up @@ -87,7 +87,7 @@ hideall "Brute Force"

# CUTE ROBOTS 2
# One full rotation plus a tail again, for the same reasons. Don't be slow!
500.0 "--sync--" sync / 03:........:Blaster:/ window 300,30
500.0 "--sync--" AddedCombatant { name: "Blaster" } window 300,30
502.1 "--targetable--"
510.3 "Magicked Mark" Ability { id: "173F", source: "Swindler" }
510.3 "Brute Force" Ability { id: "1738", source: "Blaster" }
Expand Down Expand Up @@ -119,7 +119,7 @@ hideall "Brute Force"
618.7 "Mind Blast"

# GO, GO, MEGAZORD MODE (BRUTE JUSTICE)
800.0 "--sync--" sync / 03:........:Brute Justice:/ window 300,30
800.0 "--sync--" AddedCombatant { name: "Brute Justice" } window 300,30
810.3 "--sync--" Ability { id: "1758", source: "Brute Justice" } window 610.3,30
813.0 "--targetable--"
826.9 "Double Rocket Punch" Ability { id: "174E", source: "Brute Justice" } window 26,30
Expand Down
2 changes: 1 addition & 1 deletion timelines/src/main/resources/timeline/a8s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ hideall "Brute Force"

### Phase 2: Robots
300.0 "--sync--" sync / 22:........:Onslaughter:........:Onslaughter:00/ window 300,0
303.0 "--sync--" sync / 03:........:Blaster:/ window 303,30
303.0 "--sync--" AddedCombatant { name: "Blaster" } window 303,30
304.0 "Blaster (north)"
304.0 "Brawler (middle)"
306.2 "--targetable--"
Expand Down
8 changes: 4 additions & 4 deletions timelines/src/main/resources/timeline/a9s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ hideall "--sync--"
2014.3 "Power Generator x2 (NE)"
2014.3 "Lava (NE)" duration 42
2023.4 "Scrap" Ability { id: "1A39", source: "Refurbisher 0" }
2034.4 "--rocks fall--" #sync / 03:........:Scrap:/
2034.4 "--rocks fall--" #AddedCombatant { name: "Scrap" }
2039.6 "Scrap Burst" Ability { id: "1A3A", source: "Refurbisher 0" }
2048.8 "Scrap" Ability { id: "1A39", source: "Refurbisher 0" }
2055.9 "Scrap" Ability { id: "1A39", source: "Refurbisher 0" }
Expand Down Expand Up @@ -83,15 +83,15 @@ hideall "--sync--"
2173.9 "Lava (SW)" duration 15
2180.2 "Acid Rain" #Ability { id: "1C0A", source: "Refurbisher 0" }
2189.3 "Lava (SE)" duration 15
2195.1 "--rocks fall--" #sync / 03:........:Scrap:/
2195.1 "--rocks fall--" #AddedCombatant { name: "Scrap" }
2200.3 "Scrap Burst" Ability { id: "1A3A", source: "Refurbisher 0" }

# Phase 4
2215.5 "Stockpile" Ability { id: "1A38", source: "Refurbisher 0" }
2226.5 "Power Generator x1 (SW)"
2226.5 "Alarum x1 (SW)"
2226.5 "Lava (SW)" duration 42
2238.7 "--rocks fall--" #sync / 03:........:Scrap:/
2238.7 "--rocks fall--" #AddedCombatant { name: "Scrap" }
2243.9 "Scrap Burst" Ability { id: "1A3A", source: "Refurbisher 0" }
2253.1 "Scrap" Ability { id: "1A39", source: "Refurbisher 0" }
2260.2 "Scrap" Ability { id: "1A39", source: "Refurbisher 0" }
Expand Down Expand Up @@ -124,7 +124,7 @@ hideall "--sync--"
2376.4 "Scrap Bomb" Ability { id: "1A3E", source: "Refurbisher 0" }
2384.6 "Scrap" Ability { id: "1A39", source: "Refurbisher 0" }
2403.3 "Explosion (NW/SE)" Ability { id: "1A35", source: "Bomb" }
2398.5 "--rocks fall--" #sync / 03:........:Scrap:/
2398.5 "--rocks fall--" #AddedCombatant { name: "Scrap" }
2403.7 "Scrap Burst" Ability { id: "1A3A", source: "Refurbisher 0" }

# Phase 7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ hideall "--sync--"
3092.6 "Height Of Chaos"

# Intermission 1 at HP < 80%
3100.0 "--sync--" sync / 03:........:Firesphere:/ window 100,5
3100.0 "--sync--" AddedCombatant { name: "Firesphere" } window 100,5

3110.0 "Ancient Circle Appears"
3115.1 "Ancient Circle" Ability { id: "1102", source: "Ascian Prime" }
Expand All @@ -442,7 +442,7 @@ hideall "--sync--"
3260.0 "Shadow Flare"

# Intermission 2 at HP < 40%
3300.0 "--sync--" sync / 03:........:Firesphere:/ window 200,5
3300.0 "--sync--" AddedCombatant { name: "Firesphere" } window 200,5

3304.6 "Ancient Circle Appears"
3309.7 "Ancient Circle" Ability { id: "1102", source: "Ascian Prime" }
Expand Down
4 changes: 2 additions & 2 deletions timelines/src/main/resources/timeline/aloalo_island.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ hideall "--sync--"
2437.0 label "ketuduke-0304"
2437.0 "--sync--" StartsUsing { id: "8A92", source: "Ketuduke" }
2442.0 "Roar" Ability { id: "8A92", source: "Ketuduke" }
# 2142.7 "--sync--" sync / 03:[^:]*:Aloalo Zaratan:/ # path 03
# 2142.7 "--sync--" sync / 03:[^:]*:Aloalo Ogrebon:/ # path 04
# 2142.7 "--sync--" AddedCombatant { name: "Aloalo Zaratan" } # path 03
# 2142.7 "--sync--" AddedCombatant { name: "Aloalo Ogrebon" } # path 04
2454.8 "Bubble Net" Ability { id: "8A93", source: "Ketuduke" }
2465.4 "Updraft" Ability { id: "8D0F", source: "Ketuduke" }
2467.6 "Hundred Lashings?" Ability { id: "8A97", source: "Aloalo Zaratan" } # path 03
Expand Down
4 changes: 2 additions & 2 deletions timelines/src/main/resources/timeline/amaurot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ hideall "--sync--"
523.0 "Shrill Shriek" Ability { id: "3CCF", source: "Terminus Bellwether" } window 523,5
525.0 "--untargetable--"
525.0 "Adds (N)"
561.3 "Adds (SW)" sync / 03:........:Terminus Roiler:/ window 60,60
610.9 "Adds (S)" sync / 03:........:Terminus Pursuer:/ window 100,100
561.3 "Adds (SW)" AddedCombatant { name: "Terminus Roiler" } window 60,60
610.9 "Adds (S)" AddedCombatant { name: "Terminus Pursuer" } window 100,100
800.0 "--sync--" StartsUsing { id: "3CD0", source: "Terminus Bellwether" } window 300,00
840.0 "Burst" Ability { id: "3CD0", source: "Terminus Bellwether" } window 40,40

Expand Down
Loading

0 comments on commit ebef0c0

Please sign in to comment.