Skip to content

Commit

Permalink
Added the 'sensemble' shortcut for when an Ensemble is directly-grant…
Browse files Browse the repository at this point in the history
…ed by SpellID alone

Parser: Refactored some Ensemble logic to fit more scenarios in which a TransmogSet data is determined
Parser: Added a bunch more WARN logging for situations where Ensembles end up with no data to help protect future erroneous situations
Ensemble: Stonebound Earthen Regalia converted to 'sensemble'
  • Loading branch information
ImUnicke committed Dec 23, 2024
1 parent 6e6801b commit c90eb23
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,48 +192,7 @@ root(ROOTS.Zones, m(KHAZ_ALGAR, bubbleDown({ ["timeline"] = { ADDED_11_0_7 } },
["races"] = { DARKIRON, DWARF, EARTHEN_ALLIANCE, EARTHEN_HORDE },
["g"] = {
i(234455), -- Storm-flecked Debris (QI!)
spell(1215408, { -- Ensemble: Stonebound Earthen Regalia
i(234668), -- Stonebound Archivist Vestment
i(234669), -- Stonebound Archivist's Robe
i(234670), -- Stonebound Archivist's Hood
i(234671), -- Stonebound Archivist's Sandals
i(234672), -- Stonebound Archivist's Cord
i(234673), -- Stonebound Archivist's Cuffs
i(234674), -- Stonebound Explorer's Kilt
i(234675), -- Stonebound Explorer's Visor
i(234676), -- Stonebound Explorer's Treads
i(234677), -- Stonebound Explorer's Waistcoat
i(234678), -- Stonebound Explorer's Cinch
i(234679), -- Stonebound Explorer's Handwraps
i(234680), -- Stonebound Peacekeeper's Chassis
i(234681), -- Stonebound Peacekeeper Warkilt
i(234682), -- Stonebound Peacekeeper Waistguard
i(234683), -- Stonebound Peacekeeper Waistcoat
i(234684), -- Stonebound Peacekeeper Gauntlets
i(234685), -- Stonebound Peacekeeper Pauldrons
i(234686), -- Stonebound Peacekeeper Sabatons
i(234687), -- Stonebound Peacekeeper Greathelm
i(234688), -- Stonebound Artisan Toolbelt
i(234689), -- Stonebound Artisan Waistcoat
i(234690), -- Stonebound Artisan Kilt
i(234691), -- Stonebound Artisan Handbraces
i(234692), -- Stonebound Artisan Footwraps
i(234693), -- Stonebound Artisan Collar
i(234694), -- Stonebound Machinist Wristchains
i(234695), -- Stonebound Machinist Robe
i(234696), -- Stonebound Machinist Helmet
i(234697), -- Stonebound Machinist Girdle
i(234698), -- Stonebound Machinist Cog
i(234699), -- Stonebound Machinist Chain
i(234700), -- Stonebound Machinist Anklewraps
i(234701), -- Stonebound Worker's Mantle
i(234702), -- Stonebound Worker's Kilt
i(234703), -- Stonebound Worker's Cuffs
i(234704), -- Stonebound Worker's Boots
i(234705), -- Stonebound Worker's Belt
i(234706), -- Stonebound Worker's Vest
i(234707), -- Stonebound Explorer's Tunic
i(234708), -- Stonebound Worker's Waistcoat
sensemble(1215408, { -- Ensemble: Stonebound Earthen Regalia
}),
},
}),
Expand Down Expand Up @@ -662,7 +621,7 @@ root(ROOTS.HiddenQuestTriggers, expansion(EXPANSION.TWW, bubbleDown({ ["timeline
q(86380), -- Sandy Snapdragon Treat
q(86377), -- Storminfused Snapdragon Treat
-- Ensemble
q(86669), -- Ensemble: Stonebound Earthen Regalia
-- q(86669), -- Ensemble: Stonebound Earthen Regalia (automated)
--
--It went live:
--it seems like questID fire per item drop for slot now
Expand Down
Binary file modified .contrib/Parser/Parser.exe
Binary file not shown.
5 changes: 5 additions & 0 deletions .contrib/Parser/lib/Functions/Shortcuts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,11 @@ spell = function(id, t) -- Create a SPELL Object
end
sp = spell; -- Create a SPELL Object (alternative shortcut)
title = function(id, t) -- Create a TITLE Object
sensemble = function(spellID, t) -- Create an Ensemble directly from SpellID
local i = sp(spellID, t);
i.type = "ensembleSpellID"
return i
end
return struct("titleID", id, t);
end
title_female = function(id, t) -- Create a TITLE Object for Female Characters
Expand Down
1 change: 1 addition & 0 deletions .contrib/Source Code/Parser/Framework/Framework.Objects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,7 @@ public static void Merge(IDictionary<string, object> item, string field, object
case "_factions":
case "extraTransmogSetSpells":
case "_tmogSetIDs":
case "_sourceIDs":
{
MergeIntegerArrayData(item, field, value);
break;
Expand Down
56 changes: 28 additions & 28 deletions .contrib/Source Code/Parser/Framework/Framework.Processing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,20 +1055,22 @@ private static void EmptyGroupCleanup(IDictionary<string, object> data)

private static void EnsembleCleanup(IDictionary<string, object> data)
{
if (!(data.TryGetValue("ensembleID", out long ensembleID) || data.TryGetValue("ensembleSpellID", out ensembleID))) return;

if (!data.TryGetValue("_sourceIDs", out List<long> sourceIDs)) return;

//if (ensembleID == 215356)
//{

//}
if (!data.TryGetValue("spellID", out long spellID) && !data.TryGetValue("ensembleSpellID", out spellID))
{
LogWarn($"Ensemble Cleanup failed to contain spellID and will be empty when exported!", data);
return;
}
if (!data.TryGetValue("_sourceIDs", out List<object> sourceIDs))
{
LogWarn($"Ensemble Cleanup failed to contain _sourceIDs and will be empty when exported!", data);
return;
}

// Ensembles will Source raw Items/Appearances which have no other currently-obtainable source
// Or will generate a symlink for the duplicated Items/Appearances
List<IDictionary<string, object>> symlinkSources = new List<IDictionary<string, object>>();
List<IDictionary<string, object>> rawSources = new List<IDictionary<string, object>>();
foreach (long sourceID in sourceIDs)
foreach (long sourceID in sourceIDs.AsTypedEnumerable<long>())
{
if (TryGetSOURCED("sourceID", sourceID, out List<IDictionary<string, object>> sources) && sources.AnyMatchingGroup(IsObtainableData))
{
Expand All @@ -1084,7 +1086,7 @@ private static void EnsembleCleanup(IDictionary<string, object> data)
IDictionary<string, object> source = tmogSetItems.FirstOrDefault()?.AsData();
if (source == null)
{
LogWarn($"Ensemble {ensembleID} sourcing SourceID {sourceID} which is not associated with a TransmogSetItem", data);
LogWarn($"Ensemble via SpellID {spellID} sourcing SourceID {sourceID} which is not associated with a TransmogSetItem", data);
source = new TransmogSetItem { ItemModifiedAppearanceID = sourceID }.AsData();
}
source["_generated"] = true;
Expand All @@ -1097,7 +1099,8 @@ private static void EnsembleCleanup(IDictionary<string, object> data)
}
}

RemoveWrongFilterSources(data, ensembleID, symlinkSources, rawSources);
// as of later 2024, Blizz seems to have fixed their logic for granting all Appearances in Ensembles, even when Class/Armor restricted! Huzzah
//RemoveWrongFilterSources(data, spellID, symlinkSources, rawSources);

// add the raw sources to the ensemble
foreach (IDictionary<string, object> source in rawSources)
Expand Down Expand Up @@ -2507,13 +2510,13 @@ private static void Incorporate_Ensemble(IDictionary<string, object> data)
{
foreach (SpellEffect spellEffect in spellEffects)
{
Incorporate_Item_SpellEffect(data, spellEffect);
Incorporate_SpellEffect(data, spellEffect);
}
}
else
{
data.TryGetValue("itemID", out long itemID);
LogWarn($"Ensemble Item {itemID} with Spell {spellID} missing Wago SpellEffect record(s)", data);
LogWarn($"Ensemble {itemID} with Spell {spellID} missing Wago SpellEffect record(s)", data);
}

if (data.TryGetValue("tmogSetID", out long tmogSetID) && TryGetTypeDBObject(tmogSetID, out TransmogSet tmogSet))
Expand Down Expand Up @@ -2560,23 +2563,17 @@ private static void Incorporate_Ensemble(IDictionary<string, object> data)
AddPostProcessing(EnsembleCleanup, data);
}

private static void Incorporate_Item_TransmogSetItems(IDictionary<string, object> data)
private static void Incorporate_Item_TransmogSetItems(IDictionary<string, object> data, long tmogSetID)
{
if (!data.TryGetValue("tmogSetID", out long tmogSetID))
{
LogWarn($"Ensemble Item cannot incorporate Transmog Set due to missing 'tmogSetID'", data);
return;
}

if (!TryGetTypeDBObjectCollection(tmogSetID, out List<TransmogSetItem> transmogSetItems))
{
LogDebugWarn($"Ensemble Type Item missing Wago TransmogSetItem record(s) for TransmogSetID {tmogSetID}", data);
LogDebugWarn($"Ensemble missing Wago TransmogSetItem record(s) for TransmogSetID {tmogSetID}", data);
return;
}

if (!data.TryGetValue("type", out string type) || !(type == "ensembleID" || type == "ensembleSpellID"))
{
LogDebugWarn($"Item with valid Ensemble information not set as 'iensemble'", data);
LogDebugWarn($"Valid Ensemble information not set as 'iensemble'/'sensemble'", data);
return;
}

Expand All @@ -2602,7 +2599,9 @@ private static void Incorporate_Item_TransmogSetItems(IDictionary<string, object
}
}

data["_sourceIDs"] = allSourceIDs.Distinct().ToList();
Objects.Merge(data, "_sourceIDs", allSourceIDs);
LogDebug($"INFO: Ensemble {type} with TransmogSet {tmogSetID} merged {allSourceIDs.Count} SourceIDs", data);

//foreach (long sourceID in )
//{
// Items.DetermineItemID(itemData);
Expand Down Expand Up @@ -2630,12 +2629,12 @@ private static void Incorporate_Item(IDictionary<string, object> data)

foreach (SpellEffect spellEffect in spellEffects)
{
Incorporate_Item_SpellEffect(data, spellEffect);
Incorporate_SpellEffect(data, spellEffect);
}
}
}

private static void Incorporate_Item_SpellEffect(IDictionary<string, object> data, SpellEffect spellEffect)
private static void Incorporate_SpellEffect(IDictionary<string, object> data, SpellEffect spellEffect)
{
// TODO: sometimes 1 Item can trigger 1 ItemEffect leading to multiple IsQuest SpellEffects...
// ref. /att i:181538 -> SpellID 336988
Expand Down Expand Up @@ -2682,13 +2681,14 @@ private static void Incorporate_Item_SpellEffect(IDictionary<string, object> dat
}
if (spellEffect.IsLearnedTransmogSet())
{
long tmogSetID = spellEffect.EffectMiscValue_0;
// don't override any custom data... sometimes blizz hotfixes ensembles but we don't get the updated data immediately from wago
if (!data.ContainsKey("tmogSetID"))
{
Objects.Merge(data, "tmogSetID", spellEffect.EffectMiscValue_0);
LogDebug($"INFO: Assigned Item 'tmogSetID' {spellEffect.EffectMiscValue_0}", data);
Objects.Merge(data, "tmogSetID", tmogSetID);
LogDebug($"INFO: Assigned 'tmogSetID' {tmogSetID}", data);
}
Incorporate_Item_TransmogSetItems(data);
Incorporate_Item_TransmogSetItems(data, tmogSetID);
}
}

Expand Down
Loading

0 comments on commit c90eb23

Please sign in to comment.