aboutsummaryrefslogtreecommitdiff
path: root/src/event.rs
AgeCommit message (Collapse)Author
2024-08-26fix clippy suggestionsDaniel Schadt
2021-11-19small doc typo fixesDaniel Schadt
2021-11-18make EventKind non-exhaustiveDaniel Schadt
There are two reasons for this: First, we want to implement new events (and arcdps might add new events themselves) without having to release a new major version. Adding enum variants is usually a breaking change, because match blocks have to be adjusted to keep every variant included. This is the same reason why we made Encounter and Boss non-exhaustive as well. Secondly, the usual modus operandi is not to iterate through all events and do something for every event kind that you find, but rather to iterate through the events and look for the events that you find interesting. This means that most often, you will use a match with a "do-nothing" catch-all, an if-let or a matches!() anyway, in which case this change does not affect the code in a good or bad way.
2021-11-13Document panic in Log::boss and remove other panicDaniel Schadt
Overall, evtclib is doing quite well on the .unwrap()/.expect()/panic!() calls, except for some doctests (which can be changed at some point) and the actual tests. One case where we do panic (and should document it!) is Log::boss. The documentation has been added there. Another (rare if not impossible for proper evtc files) case was the conversion of the language event, which assumed that we will definitely be able to convert the u64 to the right language. In all normal cases this should be true, but if evtclib deals with untrusted input, we might not want to panic a whole program because someone smuggled in a malicious file.
2021-11-12small lint fixesDaniel Schadt
2020-12-11add buff stack id to BuffApplication eventDaniel Schadt
It turns out that arcDPS gives each boon stack an ID which is also re-used in the BuffRemoval or StackReset events.
2020-12-11add StackActive and StackReset eventsDaniel Schadt
As it turns out, the padding bytes are not just padding, but for some events they contain useful information. Therefore, we've adjusted the parser to save those bytes (if available).
2020-12-11add comment about ReplInfoDaniel Schadt
2020-12-11add BuffInitial event handlingDaniel Schadt
2020-12-08add CBTS_BARRIERUPDATE statechangeDaniel Schadt
2020-09-28optionally implement serde::{Des,S}erializeDaniel Schadt
2020-08-04fix endianness for CBTS_ERRORDaniel Schadt
Otherwise the text will be garbled (reversed and probably cut short).
2020-06-12implement CBTS_TAGDaniel Schadt
2020-05-21ignore unknown statechanges in parse_eventsDaniel Schadt
The reason why we "unwrap" the error so late is because we want to recover from this error, which means the file pointer has to be at the right position. Unwrapping early would leave the pointer in the middle of an event, which is not what we want. If we want to bullet-proof this, it might be good to read the whole event first into a buffer, and then read from that buffer instead.
2020-05-19implement Error statechangeDaniel Schadt
2020-05-19add CbtStateChange::UnknownDaniel Schadt
This is not defined by arcdps, but we'd have to adjust evtclib every time a new statechange is introduced. This way, we stay forward-compatible.
2020-05-19add BreakbarState, BreakbarPercent & Error statesDaniel Schadt
2020-05-02use getters for EventDaniel Schadt
2020-05-02add more documentationDaniel Schadt
2020-04-29fix long number literalDaniel Schadt
2020-04-29implement TryFrom for non-referencesDaniel Schadt
2020-04-29replace own from_raw with TryFrom implementationDaniel Schadt
Hooking into the standard Rust system is probably better in the long-run than having those separate from_raw methods on all of our objects. Most end users probably won't even need them, as they will use the higher level functionality provided by evtclib::process.
2020-04-29implement TeamChange, AttackTarget and TargetableDaniel Schadt
2020-04-28derive Hash for WeaponSet and ActivationDaniel Schadt
2020-04-28implement Position/Velocity/Facing/MapId eventsDaniel Schadt
2020-04-26use ? instead of manual if-letDaniel Schadt
2020-04-04add more eventsDaniel Schadt
The amount of non-properly-implemented events is growing
2019-05-15rewrite parsing support for guildDaniel Schadt
2019-05-15add support for Event::Guild parsingDaniel Schadt
2019-05-15add guild state changeDaniel Schadt
2019-02-16implement new state changesDaniel Schadt
2018-10-10add AttackTarget, Targetable, MapId statechangesDaniel Schadt
2018-10-10update to latest arcdpsDaniel Schadt
This comes with several changes: First, the revision header field is now properly parsed and saved, instead of just being hardcoded to zero. This is the first step in allowing newer log files to be parsed. To accommodate this, the Header struct has been extended with the "revision: u8" field. To be able to parse both formats, the CbtEvent struct has been changed. It is now the unification of both the new struct and the old struct, as the changes are pretty minor and mostly concern the parsing itself. The data types have been adjusted, and two fields have been added. Moving fields around does not concern CbtEvent at all. If the struct diverges more from this in the future, some splitting might be introduced, but for now, the change is pretty transparent to other code. During this process, the structs have lost their [repr(C]) property. It was never used, as the structs were not directly involved in C FFI. It has been a relic of the past from earlier iterations. Finally, the parsing function has been changed from parse_event to parse_event_rev0, with the addition of a parse_event_rev1. parse_events now takes the event parsing function as an additional parameter, and parse_file correctly choses the implementation based on the revision number.
2018-09-06add new enum valuesDaniel Schadt
2018-08-02add more wing 1 mechanicsDaniel Schadt
2018-07-09add rudimentary support for new state changesDaniel Schadt
The arcdps update has introduced new state change events, namely BuffInitial, Position and Velocity. It is now possible to track the movements of all players. Unfortunately, this meant that evtclib could not ready any logs created by the new arc version, as the new CbtStateChange was not read correctly. evtclib just returned "Invalid data". This fix adds the new enum variants to the CbtStateChange enum, making it again possible to read files. However, there are no high-level events for those yet, so the conversion will fail.
2018-06-13clean up a bitDaniel Schadt
2018-06-10first iteration of multiplexerDaniel Schadt
2018-05-31cargo fmtDaniel Schadt
2018-04-23more documentationDaniel Schadt
2018-04-23run rustfmtDaniel Schadt
2018-04-23apply clippy's suggestionsDaniel Schadt
2018-04-23add basic translation to more readable eventsDaniel Schadt
This basically implements the "event logic" as described in the README, though it produces easier-to-digest events. The test binary show 0 failed events on an example log, but of course, not all mechanics are used there, and the parsing logic may very well contain some errors.