Skip to content

Commit

Permalink
added new subevents, successfuly parsed icc25n
Browse files Browse the repository at this point in the history
  • Loading branch information
maruncz committed Oct 1, 2023
1 parent 68b855f commit efed66f
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 2 deletions.
31 changes: 31 additions & 0 deletions CombatLog/LogLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
57 changes: 57 additions & 0 deletions CombatLog/SubEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
38 changes: 37 additions & 1 deletion CombatLog/SubEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ using SpellBuilding = Range;

struct Environmental
{
Environmental(QStringList list);
EnvironmentalType type;
};

Expand Down Expand Up @@ -218,6 +219,7 @@ using Stolen = Dispell;

struct ExtraAttacks
{
ExtraAttacks(QStringList list);
uint32_t amount;
};

Expand Down Expand Up @@ -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;
Expand All @@ -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
8 changes: 7 additions & 1 deletion CombatLog/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit efed66f

Please sign in to comment.