Пример #1
0
        private void GetMonsterParts()
        {
            if (!this.IsAlive)
            {
                return;
            }
            Int64 MonsterPartAddress = MonsterAddress + Address.Offsets.MonsterPartsOffset + Address.Offsets.FirstMonsterPartOffset;
            int   nMaxParts          = MonsterData.GetMaxPartsByMonsterID(this.ID);
            int   nRemovableParts    = MonsterData.GetMaxRemovablePartsByMonsterID(this.ID);
            byte  TimesBroken;
            float Health;
            float MaxHealth;
            Int64 RemovablePartAddress = MonsterAddress + Address.Offsets.RemovablePartsOffset;

            for (int PartID = 0; PartID < nMaxParts; PartID++)
            {
                if (MonsterData.IsPartRemovable(ID, PartID))
                {
                    if (Parts.Count < PartID && Parts[PartID].PartAddress > 0)
                    {
                        TimesBroken = Scanner.READ_BYTE(Parts[PartID].PartAddress + 0x18);
                        MaxHealth   = Scanner.READ_FLOAT(Parts[PartID].PartAddress + 0x10);
                        Health      = Scanner.READ_FLOAT(Parts[PartID].PartAddress + 0x0C);

                        Parts[PartID].SetPartInfo(this.ID, PartID, TimesBroken, MaxHealth, Health);
                    }
                    else
                    {
                        for (int RemovablePartIndex = 0; RemovablePartIndex < 32; RemovablePartIndex++)
                        {
                            if (Scanner.READ_INT(RemovablePartAddress) <= 10)
                            {
                                RemovablePartAddress += 8;
                            }

                            bool IsAValidPart = Scanner.READ_INT(RemovablePartAddress + 0x6C) < nRemovableParts;

                            if (IsAValidPart && Scanner.READ_INT(RemovablePartAddress + 0x0C) > 0)
                            {
                                TimesBroken = Scanner.READ_BYTE(RemovablePartAddress + 0x18);
                                MaxHealth   = Scanner.READ_FLOAT(RemovablePartAddress + 0x10);
                                Health      = Scanner.READ_FLOAT(RemovablePartAddress + 0x0C);

                                Parts[PartID].SetPartInfo(this.ID, PartID, TimesBroken, MaxHealth, Health);
                                Parts[PartID].PartAddress = RemovablePartAddress;
                                Parts[PartID].IsRemovable = true;

                                // Some monsters have the same removable part value in the next removable part struct
                                // so we skip the ones with the same values.
                                while (Scanner.READ_FLOAT(RemovablePartAddress + 0x78 + 0x0C) == Health && Scanner.READ_FLOAT(RemovablePartAddress + 0x78 + 0x10) == MaxHealth && Scanner.READ_INT(RemovablePartAddress + 0x78 + 0x8) == Scanner.READ_INT(RemovablePartAddress + 0x8))
                                {
                                    RemovablePartAddress += Address.Offsets.NextRemovablePart;
                                }

                                RemovablePartAddress += Address.Offsets.NextRemovablePart;
                                break;
                            }

                            RemovablePartAddress += Address.Offsets.NextRemovablePart;
                            continue;
                        }
                    }
                    continue;
                }

                TimesBroken = Scanner.READ_BYTE(MonsterPartAddress + Address.Offsets.MonsterPartBrokenCounterOffset);
                MaxHealth   = Scanner.READ_FLOAT(MonsterPartAddress + 0x4); // Total health is 4 bytes ahead
                Health      = Scanner.READ_FLOAT(MonsterPartAddress);

                Parts[PartID].SetPartInfo(this.ID, PartID, TimesBroken, MaxHealth, Health);

                if (Parts[PartID].Group == null)
                {
                    Parts[PartID].Group = MonsterData.GetPartGroupByPartIndex(this.ID, PartID);
                }
                MonsterPartAddress += Address.Offsets.NextMonsterPartOffset;
            }
        }
Пример #2
0
        private void GetMonsterAilments()
        {
            if (!this.IsAlive)
            {
                return;
            }
            if (Ailments.Count > 0)
            {
                foreach (Ailment status in Ailments)
                {
                    if (status.Address == 0)
                    {
                        continue;
                    }

                    float maxBuildup      = Math.Max(0, Scanner.READ_FLOAT(status.Address + 0x1C8));
                    float currentBuildup  = Math.Max(0, Scanner.READ_FLOAT(status.Address + 0x1B8));
                    float maxDuration     = Math.Max(0, Scanner.READ_FLOAT(status.Address + 0x19C));
                    float currentDuration = Math.Max(0, Scanner.READ_FLOAT(status.Address + 0x1F8));
                    byte  counter         = Scanner.READ_BYTE(status.Address + 0x200);
                    status.SetAilmentInfo(status.ID, currentDuration, maxDuration, currentBuildup, maxBuildup, counter);
                }
            }
            else
            {
                Int64 StatusAddress = Scanner.READ_LONGLONG(MonsterAddress + 0x78);
                StatusAddress = Scanner.READ_LONGLONG(StatusAddress + 0x57A8);
                Int64 aHolder = StatusAddress;
                while (aHolder != 0)
                {
                    aHolder = Scanner.READ_LONGLONG(aHolder + 0x10);
                    if (aHolder != 0)
                    {
                        StatusAddress = aHolder;
                    }
                }
                Int64 StatusPtr = StatusAddress + 0x40;
                while (StatusPtr != 0x0)
                {
                    Int64 MonsterInStatus = Scanner.READ_LONGLONG(StatusPtr + 0x188);
                    if (MonsterInStatus == MonsterAddress)
                    {
                        int ID = Scanner.READ_INT(StatusPtr + 0x198);
                        System.Xml.XmlNode AilmentInfo = MonsterData.GetAilmentByIndex(ID);
                        bool IsSkippable = AilmentInfo == null ? true : AilmentInfo.Attributes["Skip"].Value == "True";
                        if (IsSkippable && !UserSettings.PlayerConfig.HunterPie.Debug.ShowUnknownStatuses)
                        {
                            StatusPtr = Scanner.READ_LONGLONG(StatusPtr + 0x18);
                            continue;
                        }
                        else
                        {
                            float maxBuildup      = Math.Max(0, Scanner.READ_FLOAT(StatusPtr + 0x1C8));
                            float currentBuildup  = Math.Max(0, Scanner.READ_FLOAT(StatusPtr + 0x1B8));
                            float maxDuration     = Math.Max(0, Scanner.READ_FLOAT(StatusPtr + 0x19C));
                            float currentDuration = Math.Max(0, Scanner.READ_FLOAT(StatusPtr + 0x1F8));
                            byte  counter         = Scanner.READ_BYTE(StatusPtr + 0x200);

                            Ailment mAilment = new Ailment {
                                Address = StatusPtr
                            };
                            mAilment.SetAilmentInfo(ID, currentDuration, maxDuration, currentBuildup, maxBuildup, counter);
                            Ailments.Add(mAilment);
                        }
                    }
                    StatusPtr = Scanner.READ_LONGLONG(StatusPtr + 0x18);
                }
            }
        }
Пример #3
0
 private void GetMonsterWeaknesses()
 {
     Weaknesses = MonsterData.GetMonsterWeaknessById(this.ID);
 }