Beispiel #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[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;

                                // Nergigante has the same values twice in a row, so we skip it to get
                                // the removable tail values
                                if (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);
                MonsterPartAddress += Address.Offsets.NextMonsterPartOffset;
            }
        }
Beispiel #2
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;
            }
        }