aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-11-18speed up Log::agent_by_addrDaniel Schadt
We know that the way we construct the Log, the agents are always sorted by their address. This invariant cannot be broken, as the only way to construct a Log is in evtclib itself, and there is no way to obtain a mutable view on the agent vector or change the address of an agent. Since Log::agent_by_addr is used by other functions, this speedup (even if it is small) can show in a lot of different places. Note that if we change the interface of Log in the future to allow creating logs from different sources that processing::process, we need to make sure we adjust this function.
2021-11-18switch order of operands in SH analyzerDaniel Schadt
Comparing the int is a very cheap operation, and it is also a very good indicator already that we've found the right event. Due to the short circuiting behaviour of &&, it is better to check that first before doing the Log::is_boss check - which is relatively costly. Remember that we do this check for every buff application event! This brings a speedup of around 50x: new: 654.1±25.18µs old: 34.9±0.69ms
2021-11-17derive most traits for Agent and SkillDaniel Schadt
2021-11-17Implement FromStr for GameModeDaniel Schadt
This may be useful for downstream applications and it fits into the pattern of implementing it for Boss/Encounter.
2021-11-17Move game_mode to EncounterDaniel Schadt
If we already have an Encounter, it might be nice to determine the game mode from it as well - without needing to go through the whole log first. This is especially useful for raidgrep, where we can use the early filters - which don't have access to the whole Log item.
2021-11-16Add GameMode and Log::game_modeDaniel Schadt
For a lot of applications, it can be useful to distinguish between logs made in raids, fractals, ... Note that we probably don't want further categorization (as for example done in ezau).
2021-11-16Small documentation fix for EncounterDaniel Schadt
2021-11-16Add Statues of GrenthDaniel Schadt
2021-11-13Implement the River of Souls encounterDaniel Schadt
2021-11-13add tests for Trio parsingDaniel Schadt
2021-11-13add bandit trio encounter & boss IDsDaniel Schadt
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-13Add a "is_generic" to detect WvW logsDaniel Schadt
The wording on the evtc README is > an npcid of 1 indicates log is generic - triggers by squadmember > entering combat and not as a result of a boss species id. It is not quite clear whether "generic" implies WvW or if there are PvE generic logs as well if you manage to set up arcdps in the right way. Therefore, the wording in evtclib is rather unspecific as well.
2021-11-12remove superfluous semicolonsDaniel Schadt
2021-11-12small lint fixesDaniel Schadt
2021-11-12Fix player name parsing logicDaniel Schadt
The old code seemed to choke on WvW players, as the subgroup-calculating code did 0 - b'0', which underflowed. The proper way to parse a subgroup is not to take a single character anyway, because subgroups can be bigger than 10. The new code fixes that by properly extracting the "subgroup str literal" and then parsing it as an integer, with some special logic to detect an "empty" subgroup as it is in WvW.
2021-11-12Add kitty golem encounters from the training areaDaniel Schadt
2020-12-11add CBTR_BREAKBAR enum variantDaniel 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-10-23speed up agent-by-addr searchDaniel Schadt
When this function was written, it was done under the assumption that a) There are not a lot of agents, so linear search is fast enough and b) We just want it to work for now However, it turns out that there can be a lot of agents, close to 1000 for the Qadim log for example. This means that there is quite some time saving that we can do here, as get_agent_by_addr is used a lot in set_agent_awares and set_agent_masters, so speeding this part up is good! We could build a HashMap, mapping the address to the agent (index), but that would mean that we have to carry the hash map around. This patch provides a simpler yet already good improvement: We invest a bit of time after converting all agents to sort them by their address (as the agent order is implementation defined anyway), so we can later use a binary search to get the right agent. It's not O(1), as a hash map would be, but it works in logarithmic time and already provides a big benefit: Before process Qadim time: [39.444 ms 39.501 ms 39.561 ms] After process Qadim time: [18.699 ms 18.744 ms 18.788 ms] change: [-52.672% -52.546% -52.413%] (p = 0.00 < 0.05) That is half of the processing time saved by a 3 line patch!
2020-10-23use iterator methods instead of for loopsDaniel Schadt
No particular reason other than it's more idiomatic and shorter. inline has been added to get_agent_by_addr since it "feels" like a short function that can and should be inlined, but it doesn't matter too much.
2020-10-04add Encounter::from_header_idDaniel Schadt
It makes sense to expose this logic as a function, as other programs like raidgrep might want to use the same logic when dealing with partial evtc files.
2020-10-01implement sequence deserialization for AgentDaniel Schadt
2020-10-01remove another redundant static qualifierDaniel Schadt
2020-10-01remove redundant static qualifierDaniel Schadt
2020-10-01fix documentation linksDaniel Schadt
2020-10-01add Agent serialization testsDaniel Schadt
2020-10-01move Agent definition to a separate fileDaniel Schadt
Just like with Event, we now have Agent defined in its own submodule. The amount of code that it entailed was a lot, so it made sense to split it off, especially with the deserialization being another big chunk of Agent related code in lib.rs The main issue was that the processing submodule accessed private fields of the Agent struct, which is now no longer possible (since processing is no longer a submodule of the module in which Agent is defined). Therefore, some simple crate-public setters for those fields have been added. Those setters are not public because we do not want outside crates to mess with the innards of Agent (yet). Although with (de)serialization being a thing, we need to ensure that we can handle nonsensical values anyway, since we can no longer guarantee that we have full control over all of the values, even without setters.
2020-10-01manually implement Deserialize for AgentDaniel Schadt
The rationale is included in the comment below. The gist is that we want to avoid deserializing Agent<Player> (and others) directly, as that would circumvent the checks. As a small bonus, we now skip the phantom_data field in serialization, as that's just an implementation detail that other consumers shouldn't worry about.
2020-09-29return Outcome::Success if a raid was rewardedDaniel Schadt
If the reward has been given out, we can be 99.9% sure that the fight succeeded, in which case we don't need to do any other convuluted checking. This has the benefit of catching some false-negatives (edge cases in success detection), at the cost of making the detection a bit ... weirder, in the sense that a log's success might now depend on whether it was the first kill in the week or not. However, given that our sucess detection works pretty well overall, I'd say it's worth to catch a few more false-negatives and try to classify as many logs correctly as possible. At least, this does not introduce any false-positives.
2020-09-28fix formattingDaniel Schadt
2020-09-28optionally implement serde::{Des,S}erializeDaniel Schadt
2020-09-28add Log::build_idDaniel Schadt
2020-09-28rename Log::npcs to Log::charactersDaniel Schadt
2020-09-28add Log::gadgetsDaniel Schadt
2020-09-28fix formattingDaniel Schadt
2020-09-28implement Display & FromStr for BossDaniel Schadt
2020-09-23more documentation for BossDaniel Schadt
2020-09-23add Encounter::bosses and Boss::encounterDaniel Schadt
Those functions can be used to simplify the special case handling that was done in lib.rs on encounters that have multiple bosses.
2020-09-23re-introduce BossDaniel Schadt
This is now the enum that contains the IDs of the single bosses, like Nikare and Kenut. This means we can do away with the NIKARE_ID and such. The enum is not publicly re-exported, as we re-export Encounter (which is more of a replacement of the old Boss). Special casing still remains (mostly in lib.rs), but we should be able to do away with this now with a more general Encounter::bosses and Boss::encounter methods.
2020-09-23rename Boss to EncounterDaniel Schadt
This is the first step in differentiating between Encounters and Bosses. It sounds a bit weird at first, but there are some events without any bosses (like the River of Souls), and some events which have multiple bosses (like Twin Largos or the kodan strike mission). If we want to support this better, without relying on extra IDs, special casing and constants (like NIKARE_ID), we should differentiate between Encounters and Bosses.
2020-09-23fix docstring typoDaniel Schadt
2020-09-23use Log::is_boss instead of manually checkingDaniel Schadt
2020-09-23fix lintsDaniel Schadt
2020-09-23add Sunqua Peak/Ai ID and analyzer logicDaniel Schadt
2020-09-21fix CM detection for new Skorvald logsDaniel Schadt
The Sunqua Peak patch released on 2020-09-15 shifted fractals around (notably moving the old CMs to 98 & 99), which messed with the boss health in those fractals. As a result, the Skorvald CM detection (which relied on the health of Skorvald being higher in CM) was broken. This patch introduces a fallback mechanism which relies on the split-phase anomalies, as those are still different in the CM. It should be 100% accurate, as long as players actually make it to the split phase. Before that, we currently have to assume that the fight is non-CM, even if it's a log from a CM wiping before first split phase. There is some discussion in the Elite-Insights Discord here[1] about this change. [1]: https://discordapp.com/channels/456611641526845473/718866714527399976/755914037354692648