Skip to content

Commit

Permalink
Plugins:
Browse files Browse the repository at this point in the history
* Move proc flags to enums.json
* Swap detail name-value to value-name
* Fixed some output mistakes
  • Loading branch information
sidsukana committed May 29, 2018
1 parent 21e1242 commit 011015f
Show file tree
Hide file tree
Showing 25 changed files with 492 additions and 450 deletions.
25 changes: 25 additions & 0 deletions QSW/plugins/spellinfo/pre-tbc-cmangos/enums.json
Original file line number Diff line number Diff line change
Expand Up @@ -948,5 +948,30 @@
{ "key": "SPELL_AURA_MOD_RATING", "value": 189},
{ "key": "SPELL_AURA_MOD_FACTION_REPUTATION_GAIN", "value": 190},
{ "key": "SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED", "value": 191}
],
"ProcFlags":
[
{ "key": "Killed by aggressor that receive experience or honor", "value": "0x00000001"},
{ "key": "Kill that yields experience or honor", "value": "0x00000002"},
{ "key": "Successful melee attack", "value": "0x00000004"},
{ "key": "Taken damage from melee strike hit", "value": "0x00000008"},
{ "key": "Successful attack by Spell that use melee weapon", "value": "0x00000010"},
{ "key": "Taken damage by Spell that use melee weapon", "value": "0x00000020"},
{ "key": "Successful Ranged attack (and wand spell cast)", "value": "0x00000040"},
{ "key": "Taken damage from ranged attack", "value": "0x00000080"},
{ "key": "Successful Ranged attack by Spell that use ranged weapon", "value": "0x00000100"},
{ "key": "Taken damage by Spell that use ranged weapon", "value": "0x00000200"},
{ "key": "Successful spell hit", "value": "0x00000400"},
{ "key": "Taken spell hit", "value": "0x00000800"},
{ "key": "Successful spell cast", "value": "0x00001000"},
{ "key": "Taken spell hit", "value": "0x00002000"},
{ "key": "Successful cast positive spell", "value": "0x00004000"},
{ "key": "Taken positive spell hit", "value": "0x00008000"},
{ "key": "Successful damage from harmful spell cast", "value": "0x00010000"},
{ "key": "Taken spell damage", "value": "0x00020000"},
{ "key": "Deal periodic damage", "value": "0x00040000"},
{ "key": "Taken periodic damage", "value": "0x00080000"},
{ "key": "Taken any damage", "value": "0x00100000"},
{ "key": "On trap activation", "value": "0x00200000"}
]
}
59 changes: 7 additions & 52 deletions QSW/plugins/spellinfo/pre-tbc-cmangos/spellinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,6 @@ Indexes m_metaSpellIndexes;
Indexes m_internalSpells;
QStringList m_modifiedStrings;

QMap<quint32, QString> procFlags = {
{ 0x00000001, "00 Killed by aggressor that receive experience or honor" },
{ 0x00000002, "01 Kill that yields experience or honor" },
{ 0x00000004, "02 Successful melee attack" },
{ 0x00000008, "03 Taken damage from melee strike hit" },
{ 0x00000010, "04 Successful attack by Spell that use melee weapon" },
{ 0x00000020, "05 Taken damage by Spell that use melee weapon" },
{ 0x00000040, "06 Successful Ranged attack (and wand spell cast)" },
{ 0x00000080, "07 Taken damage from ranged attack" },
{ 0x00000100, "08 Successful Ranged attack by Spell that use ranged weapon" },
{ 0x00000200, "09 Taken damage by Spell that use ranged weapon" },
{ 0x00000400, "10 Successful spell hit" },
{ 0x00000800, "11 Taken spell hit" },
{ 0x00001000, "12 Successful spell cast" },
{ 0x00002000, "13 Taken spell hit" },
{ 0x00004000, "14 Successful cast positive spell" },
{ 0x00008000, "15 Taken positive spell hit" },
{ 0x00010000, "16 Successful damage from harmful spell cast" },
{ 0x00020000, "17 Taken spell damage" },
{ 0x00040000, "18 Deal periodic damage" },
{ 0x00080000, "19 Taken periodic damage" },
{ 0x00100000, "20 Taken any damage" },
{ 0x00200000, "21 On trap activation" },
};

bool SpellInfo::init()
{
if (!SkillLine::getDbc().load())
Expand Down Expand Up @@ -992,25 +967,25 @@ QVariantHash SpellInfo::getValues(quint32 id) const
if (spellInfo->targets)
{
values["targets"] = QString("0x" + QString("%0").arg(spellInfo->targets, 8, 16, QChar('0')).toUpper());
values["targetsNames"] = splitMask(spellInfo->targets, getEnums()["TargetFlag"]);
values["targetsNames"] = splitMaskToList(spellInfo->targets, getEnums()["TargetFlag"]);
}

if (spellInfo->targetCreatureType)
{
values["creatureType"] = QString("0x" + QString("%0").arg(spellInfo->targetCreatureType, 8, 16, QChar('0')).toUpper());
values["creatureTypeNames"] = splitMask(spellInfo->targetCreatureType, getEnums()["CreatureType"]);
values["creatureTypeNames"] = splitMaskToList(spellInfo->targetCreatureType, getEnums()["CreatureType"]);
}

if (spellInfo->stances)
{
values["stances"] = QString("0x" + QString("%0").arg(spellInfo->stances, 8, 16, QChar('0')).toUpper());
values["stancesNames"] = splitMask(spellInfo->stances, getEnums()["ShapeshiftForm"]);
values["stancesNames"] = splitMaskToList(spellInfo->stances, getEnums()["ShapeshiftForm"]);
}

if (spellInfo->stancesNot)
{
values["stancesNot"] = QString("0x" + QString("%0").arg(spellInfo->stancesNot, 8, 16, QChar('0')).toUpper());
values["stancesNotNames"] = splitMask(spellInfo->stancesNot, getEnums()["ShapeshiftForm"]);
values["stancesNotNames"] = splitMaskToList(spellInfo->stancesNot, getEnums()["ShapeshiftForm"]);
}

for (quint32 i = 0; i < SkillLineAbility::getRecordCount(); ++i)
Expand Down Expand Up @@ -1157,17 +1132,7 @@ QVariantHash SpellInfo::getValues(quint32 id) const
if (spellInfo->procFlags)
{
values["procFlags"] = QString("0x" + QString("%0").arg(spellInfo->procFlags, 8, 16, QChar('0')).toUpper());

QVariantList procNames;
for (auto proc = procFlags.begin(); proc != procFlags.end(); ++proc) {
if (spellInfo->procFlags & proc.key()) {
QVariantHash procName;
procName["name"] = proc.value();
procNames.append(procName);
}
}

values["procNames"] = procNames;
values["procNames"] = splitMaskToList(spellInfo->procFlags, getEnums()["ProcFlags"]);
}

QVariantList effectList;
Expand Down Expand Up @@ -1237,18 +1202,8 @@ QVariantHash SpellInfo::getValues(quint32 id) const

if (triggerSpell->procFlags)
{
effectValues["triggerProcFlags"] = triggerSpell->procCharges;

QVariantList procNames;
for (auto proc = procFlags.begin(); proc != procFlags.end(); ++proc) {
if (triggerSpell->procFlags & proc.key()) {
QVariantHash procName;
procName["name"] = proc.value();
procNames.append(procName);
}
}

effectValues["triggerProcNames"] = procNames;
effectValues["triggerProcFlags"] = QString("0x" + QString("%0").arg(triggerSpell->procFlags, 8, 16, QChar('0')).toUpper());
effectValues["triggerProcNames"] = splitMaskToList(triggerSpell->procFlags, getEnums()["ProcFlags"]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion QSW/plugins/spellinfo/pre-tbc-cmangos/structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace SpellCastTimes
{
quint32 id; // 0
qint32 castTime; // 1
float castTimePerLevel; // 2 unsure / per skill?
qint32 castTimePerLevel; // 2 unsure / per skill?
qint32 minCastTime; // 3 unsure
};

Expand Down
67 changes: 47 additions & 20 deletions QSW/plugins/spellinfo/pre-tbc-cmangos/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,32 +84,32 @@
{{#attr}}<li><details open><summary>Attributes: {{attr}}</summary>
<ul>
{{#attrNames}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/attrNames}}
</ul>
</details></li>{{/attr}}
{{#attrEx1}}<li><details open><summary>AttributesEx1: {{attrEx1}}</summary>
<ul>
{{#attrEx1Names}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/attrEx1Names}}
</ul></details></li>{{/attrEx1}}
{{#attrEx2}}<li><details open><summary>AttributesEx2: {{attrEx2}}</summary>
<ul>
{{#attrEx2Names}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/attrEx2Names}}
</ul></details></li>{{/attrEx2}}
{{#attrEx3}}<li><details open><summary>AttributesEx3: {{attrEx3}}</summary>
<ul>
{{#attrEx3Names}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/attrEx3Names}}
</ul></details></li>{{/attrEx3}}
{{#attrEx4}}<li><details open><summary>AttributesEx4: {{attrEx4}}</summary>
<ul>
{{#attrEx4Names}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/attrEx4Names}}
</ul></details></li>{{/attrEx4}}
</ul>
Expand All @@ -120,10 +120,35 @@
<div class='b-box-body'>
<div class='b-box'>
<ul>
{{#targetsRaw}}<li>TargetsMask: {{targets}} ({{targetsNames}})</li>{{/targetsRaw}}
{{#creatureTypeRaw}}<li>CreatureTypeMask: {{creatureType}} ({{creatureTypeNames}})</li>{{/creatureTypeRaw}}
{{#stancesRaw}}<li>StancesMask: {{stances}} ({{stancesNames}})</li>{{/stancesRaw}}
{{#stancesNotRaw}}<li>StancesNotMask: {{stancesNot}} ({{stancesNotNames}})</li>{{/stancesNotRaw}}

{{#targets}}<li><details open><summary>TargetsMask: {{targets}}</summary>
<ul>
{{#targetsNames}}
<li>{{value}} - {{name}}</li>
{{/targetsNames}}
</ul></details></li>{{/targets}}

{{#creatureType}}<li><details open><summary>CreatureTypeMask: {{creatureType}}</summary>
<ul>
{{#creatureTypeNames}}
<li>{{value}} - {{name}}</li>
{{/creatureTypeNames}}
</ul></details></li>{{/creatureType}}

{{#stances}}<li><details open><summary>StancesMask: {{stances}}</summary>
<ul>
{{#stancesNames}}
<li>{{value}} - {{name}}</li>
{{/stancesNames}}
</ul></details></li>{{/stances}}

{{#stancesNot}}<li><details open><summary>StancesNotMask: {{stancesNot}}</summary>
<ul>
{{#stancesNotNames}}
<li>{{value}} - {{name}}</li>
{{/stancesNotNames}}
</ul></details></li>{{/stancesNot}}

{{#skillId}}
<li>Skill: {{skillId}} ({{skillName}})</li>
<ul>
Expand Down Expand Up @@ -174,31 +199,32 @@
{{#interruptFlags}}<li><details open><summary>InterruptFlags: {{interruptFlags}}</summary>
<ul>
{{#interruptFlagsNames}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/interruptFlagsNames}}
</ul></li>{{/interruptFlags}}
</ul></details></li>{{/interruptFlags}}
{{#auraInterruptFlags}}<li><details open><summary>AuraIF: {{auraInterruptFlags}}</summary>
<ul>
{{#auraInterruptFlagsNames}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/auraInterruptFlagsNames}}
</ul></li>{{/auraInterruptFlags}}
</ul></details></li>{{/auraInterruptFlags}}
{{#channelInterruptFlags}}<li><details open><summary>ChannelIF: {{channelInterruptFlags}}</summary>
<ul>
{{#channelInterruptFlagsNames}}
<li>{{name}} - {{value}}</li>
<li>{{value}} - {{name}}</li>
{{/channelInterruptFlagsNames}}
</ul></li>{{/channelInterruptFlags}}
</ul></details></li>{{/channelInterruptFlags}}
{{#casterAuraState}}<li>CasterAuraState: {{casterAuraState}} ({{casterAuraStateName}})</li>{{/casterAuraState}}
{{#targetAuraState}}<li>TargetAuraState: {{targetAuraState}} ({{targetAuraStateName}})</li>{{/targetAuraState}}
{{#reqSpellFocus}}<li>RequiresSpellFocus: {{reqSpellFocus}}</li>{{/reqSpellFocus}}
{{#procFlags}}
<li><b>ProcFlags: {{procFlags}}, Chance: {{procChance}}, Charges: {{procCharges}}</b></li>
<li><details open><summary><b>ProcFlags: {{procFlags}}, Chance: {{procChance}}, Charges: {{procCharges}}</b></summary>
<ul>
{{#procNames}}
<li>{{name}}</li>
<li>{{value}} - {{name}}</li>
{{/procNames}}
</ul>
</details></li>
{{/procFlags}}
{{^procFlags}}
<li>Chance: {{procChance}}, Charges: {{procCharges}}</li>
Expand Down Expand Up @@ -237,12 +263,13 @@
<div style="display:block;" id="ttooltip" ondblclick="toggleRegExp(event)">{{#triggerToolTip}}<b>ToolTip:</b> {{triggerToolTip}}</br>{{/triggerToolTip}}</div>
<div style="display:none;" id="ttooltipRegExp" ondblclick="toggleRegExp(event)">{{#triggerToolTipRegExp}}<b>ToolTip:</b> {{triggerToolTipRegExp}}</br>{{/triggerToolTipRegExp}}</div>
{{#triggerProcFlags}}
<li><b>ProcFlags: {{triggerProcFlags}}, Chance: {{triggerProcChance}}, Charges: {{triggerProcCharges}}</b></li>
<li><details open><summary><b>ProcFlags: {{triggerProcFlags}}, Chance: {{triggerProcChance}}, Charges: {{triggerProcCharges}}</b></summary>
<ul>
{{#triggerProcNames}}
<li>{{name}}</li>
<li>{{value}} - {{name}}</li>
{{/triggerProcNames}}
</ul>
</details></li>
{{/triggerProcFlags}}
{{^triggerProcFlags}}
<li>Chance: {{triggerProcChance}}, Charges: {{triggerProcCharges}}</li>
Expand All @@ -264,7 +291,7 @@
{{/affectInfo}}
{{/id}}
{{^id}}
<li>NO EFFECT</li>
<li>NO EFFECT {{index}}</li>
{{/id}}
</ul>
{{/effect}}
Expand Down
25 changes: 25 additions & 0 deletions QSW/plugins/spellinfo/pre-tbc/enums.json
Original file line number Diff line number Diff line change
Expand Up @@ -948,5 +948,30 @@
{ "key": "SPELL_AURA_MOD_RATING", "value": 189},
{ "key": "SPELL_AURA_MOD_FACTION_REPUTATION_GAIN", "value": 190},
{ "key": "SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED", "value": 191}
],
"ProcFlags":
[
{ "key": "Killed by aggressor that receive experience or honor", "value": "0x00000001"},
{ "key": "Kill that yields experience or honor", "value": "0x00000002"},
{ "key": "Successful melee attack", "value": "0x00000004"},
{ "key": "Taken damage from melee strike hit", "value": "0x00000008"},
{ "key": "Successful attack by Spell that use melee weapon", "value": "0x00000010"},
{ "key": "Taken damage by Spell that use melee weapon", "value": "0x00000020"},
{ "key": "Successful Ranged attack (and wand spell cast)", "value": "0x00000040"},
{ "key": "Taken damage from ranged attack", "value": "0x00000080"},
{ "key": "Successful Ranged attack by Spell that use ranged weapon", "value": "0x00000100"},
{ "key": "Taken damage by Spell that use ranged weapon", "value": "0x00000200"},
{ "key": "Successful spell hit", "value": "0x00000400"},
{ "key": "Taken spell hit", "value": "0x00000800"},
{ "key": "Successful spell cast", "value": "0x00001000"},
{ "key": "Taken spell hit", "value": "0x00002000"},
{ "key": "Successful cast positive spell", "value": "0x00004000"},
{ "key": "Taken positive spell hit", "value": "0x00008000"},
{ "key": "Successful damage from harmful spell cast", "value": "0x00010000"},
{ "key": "Taken spell damage", "value": "0x00020000"},
{ "key": "Deal periodic damage", "value": "0x00040000"},
{ "key": "Taken periodic damage", "value": "0x00080000"},
{ "key": "Taken any damage", "value": "0x00100000"},
{ "key": "On trap activation", "value": "0x00200000"}
]
}
Loading

0 comments on commit 011015f

Please sign in to comment.