Example #1
0
 public void SetConfig(HeelsConfig shoeConfig)
 {
     Config   = shoeConfig;
     IsActive = true;
     OnEnabled();
     Reset();
 }
Example #2
0
 public void SetConfig()
 {
     Config   = default;
     IsActive = false;
     OnDisabled();
     Reset();
 }
Example #3
0
    internal static void LoadXML(XDocument manifestDocument)
    {
        // Load XML and put all Heel Data on plugin's data dictionary.
        var heelData = manifestDocument?.Root?.Element("AI_HeelsData")?.Elements("heel");
        var guid     = manifestDocument?.Root?.Element("guid")?.Value;

        if (heelData == null)
        {
            return;
        }
        Logger.Log($"Registering Heelz Data for \"{guid}\"");
        foreach (var element in heelData)
        {
            var heelID = int.Parse(element.Attribute("id")?.Value ?? "-1");
            Logger.Log($"Registering Heel Config for clothe ID: {heelID}");

            if (heelID <= -1)
            {
                continue;
            }

            Logger.Log("Finding sideloader reference");
            var resolvedID = UniversalAutoResolver.TryGetResolutionInfo(heelID, "ChaFileClothes.ClothesShoes", guid);
            if (resolvedID != null)
            {
                Logger.Log($"Found Resolved ID: \"{heelID}\"=>\"{resolvedID.LocalSlot}\"");
                heelID = resolvedID.LocalSlot;
            }
            else
            {
                // Due to some limitation, I'm limiting heels registration to the sideloader items.
                Logger.Log($"Unable to resolve ID: {heelID}.");
                return;
            }

            if (Values.Configs.ContainsKey(heelID))
            {
                Logger.Log($"CONFLICTING HEEL DATA! Shoe ID {heelID} already has heel data.");
                return;
            }

            try
            {
                var newConfig = new HeelsConfig(element);

                if (heelID <= 0)
                {
                    Logger.Log($"Heelz refused to register heel ID: \"{heelID}\"");
                }
                else
                {
                    Values.Configs.Add(heelID, newConfig);
                    Logger.Log($"Registered new heel ID: \"{heelID}\"");
                }
            }
            catch (Exception e)
            {
                Logger.Log(e.ToString());
            }
        }
    }