Ejemplo n.º 1
0
 private void GetPlayerMiscAbnormalities(Int64 AbnormalityBaseAddress)
 {
     // Gets the player abnormalities caused by consumables and blights
     // Blights
     foreach (XmlNode Blight in AbnormalityData.GetBlightAbnormalities())
     {
         int  BuffOffset = int.Parse(Blight.Attributes["Offset"].Value, System.Globalization.NumberStyles.HexNumber);
         bool IsDebuff   = bool.Parse(Blight.Attributes["IsDebuff"].Value);
         int  ID         = int.Parse(Blight.Attributes["ID"].Value);
         GetAbnormality("DEBUFF", AbnormalityBaseAddress + BuffOffset, ID, $"DE_{ID}", IsDebuff);
     }
     foreach (XmlNode MiscBuff in AbnormalityData.GetMiscAbnormalities())
     {
         int  BuffOffset      = int.Parse(MiscBuff.Attributes["Offset"].Value, System.Globalization.NumberStyles.HexNumber);
         bool IsDebuff        = bool.Parse(MiscBuff.Attributes["IsDebuff"].Value);
         int  ID              = int.Parse(MiscBuff.Attributes["ID"].Value);
         bool HasConditions   = bool.Parse(MiscBuff.Attributes["HasConditions"].Value);
         bool IsInfinite      = false;
         int  ConditionOffset = 0;
         if (HasConditions)
         {
             IsInfinite      = bool.Parse(MiscBuff.Attributes["IsInfinite"].Value);
             ConditionOffset = int.Parse(MiscBuff.Attributes["ConditionOffset"].Value);
         }
         GetAbnormality("MISC", AbnormalityBaseAddress + BuffOffset, ID, $"MISC_{ID}", IsDebuff, HasConditions, ConditionOffset, IsInfinite);
     }
 }
Ejemplo n.º 2
0
 private void GetPlayerPalicoAbnormalities(Int64 AbnormalityBaseAddress)
 {
     // Gets the player abnormalities caused by palico's skills
     foreach (XmlNode PalBuff in AbnormalityData.GetPalicoAbnormalities())
     {
         int  BuffOffset = int.Parse(PalBuff.Attributes["Offset"].Value, System.Globalization.NumberStyles.HexNumber);
         bool IsDebuff   = bool.Parse(PalBuff.Attributes["IsDebuff"].Value);
         int  ID         = int.Parse(PalBuff.Attributes["ID"].Value);
         GetAbnormality("PALICO", AbnormalityBaseAddress + BuffOffset, ID, $"PAL_{ID}", IsDebuff);
     }
 }
Ejemplo n.º 3
0
 private void GetPlayerHuntingHornAbnormalities(Int64 AbnormalityBaseAddress)
 {
     // Gets the player abnormalities caused by HH
     foreach (XmlNode HHBuff in AbnormalityData.GetHuntingHornAbnormalities())
     {
         int  BuffOffset = int.Parse(HHBuff.Attributes["Offset"].Value, System.Globalization.NumberStyles.HexNumber);
         bool IsDebuff   = bool.Parse(HHBuff.Attributes["IsDebuff"].Value);
         int  ID         = int.Parse(HHBuff.Attributes["ID"].Value);
         int  Stack      = int.Parse(HHBuff.Attributes["Stack"].Value);
         GetAbnormality("HUNTINGHORN", AbnormalityBaseAddress + BuffOffset, ID, $"HH_{ID}", IsDebuff, DoubleBuffStack: Stack, ParentOffset: BuffOffset);
     }
 }
Ejemplo n.º 4
0
        private void GetAbnormality(string Type, Int64 AbnormalityAddress, int AbnormNumber, string AbnormInternalID, bool IsDebuff, bool HasConditions = false, int ConditionOffset = 0, bool IsInfinite = false, int DoubleBuffStack = 0, int ParentOffset = 0)
        {
            float Duration = Scanner.READ_FLOAT(AbnormalityAddress);
            byte  Stack;

            // Palico and misc buffs don't stack
            switch (Type)
            {
            case "HUNTINGHORN":
                Stack = Scanner.READ_BYTE(AbnormalityAddress + (0x12C - (0x3 * ((ParentOffset - 0x38) / 4))));
                break;

            case "MISC":
                if (HasConditions)
                {
                    Stack = (byte)(Scanner.READ_BYTE(AbnormalityAddress + ConditionOffset));
                    if (Stack == (byte)0)
                    {
                        HasConditions = false;
                    }
                }
                else
                {
                    Stack = 0;
                }
                break;

            default:
                Stack = 0;
                break;
            }
            if ((int)Duration <= 0 && !HasConditions)
            {
                // Check if there's an abnormality with that ID
                if (Abnormalities[AbnormInternalID] != null)
                {
                    Abnormalities.Remove(AbnormInternalID);
                }
                else
                {
                    return;
                }
            }
            else
            {
                if ((int)Duration <= 0 && !IsInfinite)
                {
                    if (Abnormalities[AbnormInternalID] != null)
                    {
                        Abnormalities.Remove(AbnormInternalID);
                    }
                    return;
                }
                if (Stack < DoubleBuffStack)
                {
                    return;
                }
                // Check for existing abnormalities before making a new one
                if (Abnormalities[AbnormInternalID] != null)
                {
                    Abnormalities[AbnormInternalID].UpdateAbnormalityInfo(Type, AbnormInternalID, Duration, Stack, AbnormNumber, IsDebuff, IsInfinite, AbnormalityData.GetAbnormalityIconByID(Type, AbnormNumber));
                }
                else
                {
                    Abnormality NewAbnorm = new Abnormality();
                    NewAbnorm.UpdateAbnormalityInfo(Type, AbnormInternalID, Duration, Stack, AbnormNumber, IsDebuff, IsInfinite, AbnormalityData.GetAbnormalityIconByID(Type, AbnormNumber));
                    Abnormalities.Add(AbnormInternalID, NewAbnorm);
                }
            }
        }