From efed66f5081a23763c905e3504ea19393bd719f8 Mon Sep 17 00:00:00 2001 From: maruncz Date: Sun, 1 Oct 2023 14:03:44 +0200 Subject: [PATCH] added new subevents, successfuly parsed icc25n --- CombatLog/LogLine.cpp | 31 ++++++++++++++++++++++ CombatLog/SubEvents.cpp | 57 +++++++++++++++++++++++++++++++++++++++++ CombatLog/SubEvents.h | 38 ++++++++++++++++++++++++++- CombatLog/defs.h | 8 +++++- 4 files changed, 132 insertions(+), 2 deletions(-) diff --git a/CombatLog/LogLine.cpp b/CombatLog/LogLine.cpp index 53f2070..48f08be 100644 --- a/CombatLog/LogLine.cpp +++ b/CombatLog/LogLine.cpp @@ -204,6 +204,30 @@ SubEvent LogLine::subeventTypeFromString(QString s) { return SubEvent::ENCHANT_REMOVED; } + else if (s == "SPELL_EXTRA_ATTACKS") + { + return SubEvent::SPELL_EXTRA_ATTACKS; + } + else if (s == "DAMAGE_SPLIT") + { + return SubEvent::DAMAGE_SPLIT; + } + else if (s == "SPELL_STOLEN") + { + return SubEvent::SPELL_STOLEN; + } + else if (s == "ENVIRONMENTAL_DAMAGE") + { + return SubEvent::ENVIRONMENTAL_DAMAGE; + } + else if (s == "SPELL_AURA_REMOVED_DOSE") + { + return SubEvent::SPELL_AURA_REMOVED_DOSE; + } + else if (s == "RANGE_MISSED") + { + return SubEvent::RANGE_MISSED; + } throw CombatLogParserException( QString("unknown subEvent: %1").arg(s).toStdString()); @@ -248,6 +272,13 @@ variant_t LogLine::subeventValueFromString(SubEvent type, QStringList list) case SubEvent::SPELL_INSTAKILL: return {SpellInstakill{list}}; case SubEvent::SPELL_RESURRECT: return {SpellResurrect{list}}; case SubEvent::ENCHANT_REMOVED: return {EnchantRemoved{list}}; + case SubEvent::SPELL_EXTRA_ATTACKS: return {SpellExtraAttacks{list}}; + case SubEvent::DAMAGE_SPLIT: return {DamageSplit{list}}; + case SubEvent::SPELL_STOLEN: return {SpellStolen{list}}; + case SubEvent::ENVIRONMENTAL_DAMAGE: return {EnvironmentalDamage{list}}; + case SubEvent::SPELL_AURA_REMOVED_DOSE: + return {SpellAuraRemovedDose{list}}; + case SubEvent::RANGE_MISSED: return {RangeMissed{list}}; } throw CombatLogParserException( QString("unhandled subevent: %1").arg(list.at(0)).toStdString()); diff --git a/CombatLog/SubEvents.cpp b/CombatLog/SubEvents.cpp index 78bd8c3..d519785 100644 --- a/CombatLog/SubEvents.cpp +++ b/CombatLog/SubEvents.cpp @@ -451,3 +451,60 @@ bool SpellPeriodicMissed::operator==(const SpellPeriodicMissed &o) const return detail::prefix::SpellPeriodic::operator==(o) && detail::suffix::Missed::operator==(o); } + +detail::suffix::ExtraAttacks::ExtraAttacks(QStringList list) +{ + if (list.size() != 1) + { + throw CombatLogParserException( + QString("wrong list size, expected 3, got %1 : %2") + .arg(list.size()) + .arg(list.join(',')) + .toStdString()); + } + + amount = LineParser::parseDamageAmount(list.at(0)); +} + +detail::prefix::Environmental::Environmental(QStringList list) +{ + if (list.size() != 1) + { + throw CombatLogParserException( + QString("wrong list size, expected 3, got %1 : %2") + .arg(list.size()) + .arg(list.join(',')) + .toStdString()); + } + + type = [](QString s) -> EnvironmentalType + { + if (s == "DROWNING") + { + return EnvironmentalType::DROWNING; + } + else if (s == "FALLING") + { + return EnvironmentalType::FALLING; + } + else if (s == "FATIGUE") + { + return EnvironmentalType::FATIGUE; + } + else if (s == "FIRE") + { + return EnvironmentalType::FIRE; + } + else if (s == "LAVA") + { + return EnvironmentalType::LAVA; + } + else if (s == "SLIME") + { + return EnvironmentalType::SLIME; + } + + throw CombatLogParserException( + QString("unexpected EnvironmentalType: %1").arg(s).toStdString()); + }(list.at(0)); +} diff --git a/CombatLog/SubEvents.h b/CombatLog/SubEvents.h index f0dddf2..1795436 100644 --- a/CombatLog/SubEvents.h +++ b/CombatLog/SubEvents.h @@ -121,6 +121,7 @@ using SpellBuilding = Range; struct Environmental { + Environmental(QStringList list); EnvironmentalType type; }; @@ -218,6 +219,7 @@ using Stolen = Dispell; struct ExtraAttacks { + ExtraAttacks(QStringList list); uint32_t amount; }; @@ -514,13 +516,44 @@ struct SpellResurrect : public detail::prefix::Spell, } }; +struct SpellExtraAttacks : public detail::prefix::Spell, + public detail::suffix::ExtraAttacks +{ + SpellExtraAttacks(QStringList list) + : detail::prefix::Spell{list.mid(0, 3)}, detail::suffix::ExtraAttacks{ + list.mid(3)} + { + } +}; + +struct EnvironmentalDamage : public detail::prefix::Environmental, + public detail::suffix::Damage +{ + EnvironmentalDamage(QStringList list) + : detail::prefix::Environmental{list.mid(0, 1)}, detail::suffix::Damage{ + list.mid(1)} + { + } +}; + +struct SpellAuraRemovedDose : public detail::prefix::Spell, + public detail::suffix::AuraAppliedDose +{ + SpellAuraRemovedDose(QStringList list) + : detail::prefix::Spell{list.mid(0, 3)}, + detail::suffix::AuraRemovedDose{list.mid(3)} + { + } +}; + using variant_t = std::variant< std::monostate, SpellCastSucces, SpellDamage, SpellPeriodicDamage, SpellAuraApplied, SpellAuraRemoved, SpellAuraRefresh, SpellEnergize, SwingDamage, SpellPeriodicHeal, SpellAuraAppliedDose, SpellCastStart, SpellPeriodicEnergize, SpellHeal, SwingMissed, PartyKill, SpellCastFailed, EnchantApplied, SpellMissed, SpellInterrupt, SpellPeriodicMissed, - SpellDispel, SpellSummon, SpellPeriodicLeech, SpellResurrect>; + SpellDispel, SpellSummon, SpellPeriodicLeech, SpellResurrect, + SpellExtraAttacks, EnvironmentalDamage, SpellAuraRemovedDose>; using DamageShield = SpellDamage; using UnitDied = PartyKill; @@ -529,5 +562,8 @@ using SpellCreate = SpellSummon; using RangeDamage = SpellDamage; using SpellInstakill = SpellSummon; using EnchantRemoved = EnchantApplied; +using DamageSplit = SpellDamage; +using SpellStolen = SpellDispel; +using RangeMissed = SpellMissed; #endif // SUBEVENTS_H diff --git a/CombatLog/defs.h b/CombatLog/defs.h index 01a5e43..24718ec 100644 --- a/CombatLog/defs.h +++ b/CombatLog/defs.h @@ -36,7 +36,13 @@ enum class SubEvent RANGE_DAMAGE, SPELL_INSTAKILL, SPELL_RESURRECT, - ENCHANT_REMOVED + ENCHANT_REMOVED, + SPELL_EXTRA_ATTACKS, + DAMAGE_SPLIT, + SPELL_STOLEN, + ENVIRONMENTAL_DAMAGE, + SPELL_AURA_REMOVED_DOSE, + RANGE_MISSED }; #if 0