コード例 #1
0
 public void Add(string AbnormId, Abnormality Abnorm)
 {
     CurrentAbnormalities.Add(AbnormId, Abnorm);
     _OnNewAbnormality(CurrentAbnormalities[AbnormId]);
     CurrentAbnormalities[AbnormId].OnAbnormalityEnd += RemoveObsoleteAbnormality;
     // Logger.Debugger.Debug($"NEW ABNORMALITY: {Abnorm.Name} (ID: {Abnorm.Id})");
 }
コード例 #2
0
        private void GetAbnormality(string Type, Int64 AbnormalityAddress, int AbnormNumber, string AbnormInternalID, bool IsDebuff, bool HasConditions = false)
        {
            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 * AbnormNumber)));
                break;

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

            default:
                Stack = 0;
                break;
            }
            if ((int)Duration <= 0 && HasConditions != true)
            {
                // Check if there's an abnormality with that ID
                if (Abnormalities[AbnormInternalID] != null)
                {
                    Abnormalities.Remove(AbnormInternalID);
                }
                else
                {
                    return;
                }
            }
            else
            {
                // Check for existing abnormalities before making a new one
                if (Abnormalities[AbnormInternalID] != null)
                {
                    Abnormalities[AbnormInternalID].UpdateAbnormalityInfo(Type, AbnormInternalID, Duration, Stack, AbnormNumber, IsDebuff, (HasConditions && Duration == 0), Abnormalities.GetAbnormalityIconByID(Type, AbnormNumber));
                }
                else
                {
                    Abnormality NewAbnorm = new Abnormality();
                    NewAbnorm.UpdateAbnormalityInfo(Type, AbnormInternalID, Duration, Stack, AbnormNumber, IsDebuff, (HasConditions && Duration == 0), Abnormalities.GetAbnormalityIconByID(Type, AbnormNumber));
                    Abnormalities.Add(AbnormInternalID, NewAbnorm);
                }
            }
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: moyi7712/HunterPie
        private void UpdateAbnormality(AbnormalityInfo info, long baseAddress)
        {
            const int firstHornBuffOffset = 0x38;
            long      abnormalityAddress  = baseAddress + info.Offset;
            float     duration            = Scanner.READ_FLOAT(abnormalityAddress);

            bool hasConditions = info.HasConditions;
            byte stack         = 0;

            // Palico and misc buffs don't stack
            switch (info.Type)
            {
            case "HUNTINGHORN":
                stack = Scanner.READ_BYTE(baseAddress + 0x164 + (info.Offset - firstHornBuffOffset) / 4);
                break;

            case "MISC":
                if (info.HasConditions)
                {
                    stack         = Scanner.READ_BYTE(baseAddress + info.Offset + info.ConditionOffset);
                    hasConditions = stack > 0;
                }
                break;
            }

            if ((int)duration <= 0 && !(hasConditions && info.IsInfinite))
            {
                if (Abnormalities[info.InternalId] != null)
                {
                    Abnormalities.Remove(info.InternalId);
                }

                return;
            }

            if (stack < info.Stack)
            {
                return;
            }

            if (Abnormalities[info.InternalId] != null)
            {
                Abnormalities[info.InternalId].UpdateAbnormalityInfo(duration, stack);
            }
            else
            {
                var a = new Abnormality(info);
                a.UpdateAbnormalityInfo(duration, stack);
                Abnormalities.Add(info.InternalId, a);
            }
        }
コード例 #4
0
 public AbnormalityEventArgs(Abnormality abnorm)
 {
     this.Abnormality = abnorm;
 }
コード例 #5
0
 protected virtual void _OnAbnormalityRemove(Abnormality abnorm) => OnAbnormalityRemove?.Invoke(this, new AbnormalityEventArgs(abnorm));
コード例 #6
0
 protected virtual void _OnNewAbnormality(Abnormality abnorm) => OnNewAbnormality?.Invoke(this, new AbnormalityEventArgs(abnorm));
コード例 #7
0
ファイル: Args.cs プロジェクト: woshimj001/HunterPie
 public AbnormalityEventArgs(Abnormality abnorm) => Abnormality = abnorm;