Example #1
0
        public static ActorItem ResolveActorFromBytes(byte[] source, bool isCurrentUser = false, ActorItem entry = null)
        {
            entry = entry ?? new ActorItem();
            var defaultBaseOffset         = MemoryHandler.Instance.Structures.ActorItem.DefaultBaseOffset;
            var defaultStatOffset         = MemoryHandler.Instance.Structures.ActorItem.DefaultStatOffset;
            var defaultStatusEffectOffset = MemoryHandler.Instance.Structures.ActorItem.DefaultStatusEffectOffset;

            try {
                entry.MapTerritory = 0;
                entry.MapIndex     = 0;
                entry.MapID        = 0;
                entry.TargetID     = 0;
                entry.Name         = MemoryHandler.Instance.GetStringFromBytes(source, MemoryHandler.Instance.Structures.ActorItem.Name);
                entry.ID           = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.ID);
                entry.UUID         = string.IsNullOrEmpty(entry.UUID)
                                 ? Guid.NewGuid().ToString()
                                 : entry.UUID;
                entry.NPCID1  = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.NPCID1);
                entry.NPCID2  = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.NPCID2);
                entry.OwnerID = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.OwnerID);
                entry.TypeID  = source[MemoryHandler.Instance.Structures.ActorItem.Type];
                entry.Type    = (Actor.Type)entry.TypeID;

                entry.TargetTypeID = source[MemoryHandler.Instance.Structures.ActorItem.TargetType];
                entry.TargetType   = (Actor.TargetType)entry.TargetTypeID;

                entry.GatheringStatus = source[MemoryHandler.Instance.Structures.ActorItem.GatheringStatus];
                entry.Distance        = source[MemoryHandler.Instance.Structures.ActorItem.Distance];

                entry.X                  = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.ActorItem.X + defaultBaseOffset);
                entry.Z                  = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.ActorItem.Z + defaultBaseOffset);
                entry.Y                  = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.ActorItem.Y + defaultBaseOffset);
                entry.Heading            = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.ActorItem.Heading + defaultBaseOffset);
                entry.HitBoxRadius       = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.ActorItem.HitBoxRadius + defaultBaseOffset);
                entry.Fate               = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.Fate + defaultBaseOffset); // ??
                entry.TargetFlags        = source[MemoryHandler.Instance.Structures.ActorItem.TargetFlags];                                        // ??
                entry.GatheringInvisible = source[MemoryHandler.Instance.Structures.ActorItem.GatheringInvisible];                                 // ??
                entry.ModelID            = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.ModelID);
                entry.ActionStatusID     = source[MemoryHandler.Instance.Structures.ActorItem.ActionStatus];
                entry.ActionStatus       = (Actor.ActionStatus)entry.ActionStatusID;

                // 0x17D - 0 = Green name, 4 = non-agro (yellow name)
                entry.IsGM   = BitConverter.TryToBoolean(source, MemoryHandler.Instance.Structures.ActorItem.IsGM); // ?
                entry.IconID = source[MemoryHandler.Instance.Structures.ActorItem.Icon];
                entry.Icon   = (Actor.Icon)entry.IconID;

                entry.StatusID = source[MemoryHandler.Instance.Structures.ActorItem.Status];
                entry.Status   = (Actor.Status)entry.StatusID;

                entry.ClaimedByID = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.ClaimedByID);
                var targetID   = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.TargetID);
                var pcTargetID = targetID;

                entry.JobID = source[MemoryHandler.Instance.Structures.ActorItem.Job + defaultStatOffset];
                entry.Job   = (Actor.Job)entry.JobID;

                entry.Level            = source[MemoryHandler.Instance.Structures.ActorItem.Level + defaultStatOffset];
                entry.GrandCompany     = source[MemoryHandler.Instance.Structures.ActorItem.GrandCompany + defaultStatOffset];
                entry.GrandCompanyRank = source[MemoryHandler.Instance.Structures.ActorItem.GrandCompanyRank + defaultStatOffset];
                entry.Title            = source[MemoryHandler.Instance.Structures.ActorItem.Title + defaultStatOffset];
                entry.HPCurrent        = BitConverter.TryToInt32(source, MemoryHandler.Instance.Structures.ActorItem.HPCurrent + defaultStatOffset);
                entry.HPMax            = BitConverter.TryToInt32(source, MemoryHandler.Instance.Structures.ActorItem.HPMax + defaultStatOffset);
                entry.MPCurrent        = BitConverter.TryToInt32(source, MemoryHandler.Instance.Structures.ActorItem.MPCurrent + defaultStatOffset);
                entry.MPMax            = 10000;
                entry.TPCurrent        = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.ActorItem.TPCurrent + defaultStatOffset);
                entry.TPMax            = 1000;
                entry.GPCurrent        = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.ActorItem.GPCurrent + defaultStatOffset);
                entry.GPMax            = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.ActorItem.GPMax + defaultStatOffset);
                entry.CPCurrent        = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.ActorItem.CPCurrent + defaultStatOffset);
                entry.CPMax            = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.ActorItem.CPMax + defaultStatOffset);

                // entry.Race = source[0x2578]; // ??
                // entry.Sex = (Actor.Sex) source[0x2579]; //?
                entry.AgroFlags       = source[MemoryHandler.Instance.Structures.ActorItem.AgroFlags];
                entry.CombatFlags     = source[MemoryHandler.Instance.Structures.ActorItem.CombatFlags];
                entry.DifficultyRank  = source[MemoryHandler.Instance.Structures.ActorItem.DifficultyRank];
                entry.CastingID       = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.ActorItem.CastingID);        // 0x2C94);
                entry.CastingTargetID = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.ActorItem.CastingTargetID); // 0x2CA0);
                entry.CastingProgress = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.ActorItem.CastingProgress); // 0x2CC4);
                entry.CastingTime     = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.ActorItem.CastingTime);     // 0x2DA8);
                entry.Coordinate      = new Coordinate(entry.X, entry.Z, entry.Y);
                if (targetID > 0)
                {
                    entry.TargetID = (int)targetID;
                }
                else
                {
                    if (pcTargetID > 0)
                    {
                        entry.TargetID = (int)pcTargetID;
                    }
                }

                if (entry.CastingTargetID == 3758096384)
                {
                    entry.CastingTargetID = 0;
                }

                entry.MapIndex = 0;
                var limit = 60;
                switch (entry.Type)
                {
                case Actor.Type.PC:
                    limit = 30;
                    break;
                }

                int    statusSize     = MemoryHandler.Instance.Structures.StatusItem.SourceSize;
                byte[] statusesSource = new byte[limit * statusSize];

                List <StatusItem> foundStatuses = new List <StatusItem>();

                Buffer.BlockCopy(source, defaultStatusEffectOffset, statusesSource, 0, limit * statusSize);
                for (var i = 0; i < limit; i++)
                {
                    bool isNewStatus = false;

                    byte[] statusSource = new byte[statusSize];
                    Buffer.BlockCopy(statusesSource, i * statusSize, statusSource, 0, statusSize);

                    short StatusID = BitConverter.TryToInt16(statusSource, MemoryHandler.Instance.Structures.StatusItem.StatusID);
                    uint  CasterID = BitConverter.TryToUInt32(statusSource, MemoryHandler.Instance.Structures.StatusItem.CasterID);

                    var statusEntry = entry.StatusItems.FirstOrDefault(x => x.CasterID == CasterID && x.StatusID == StatusID);

                    if (statusEntry == null)
                    {
                        statusEntry = new StatusItem();
                        isNewStatus = true;
                    }

                    statusEntry.TargetEntity = entry;
                    statusEntry.TargetName   = entry.Name;
                    statusEntry.StatusID     = StatusID;
                    statusEntry.Stacks       = statusSource[MemoryHandler.Instance.Structures.StatusItem.Stacks];
                    statusEntry.Duration     = BitConverter.TryToSingle(statusSource, MemoryHandler.Instance.Structures.StatusItem.Duration);
                    statusEntry.CasterID     = CasterID;

                    try {
                        ActorItem pc      = PCWorkerDelegate.GetActorItem(statusEntry.CasterID);
                        ActorItem npc     = NPCWorkerDelegate.GetActorItem(statusEntry.CasterID);
                        ActorItem monster = MonsterWorkerDelegate.GetActorItem(statusEntry.CasterID);
                        statusEntry.SourceEntity = (pc ?? npc) ?? monster;
                    }
                    catch (Exception ex) {
                        MemoryHandler.Instance.RaiseException(Logger, ex, true);
                    }

                    try {
                        Models.XIVDatabase.StatusItem statusInfo = StatusEffectLookup.GetStatusInfo((uint)statusEntry.StatusID);
                        if (statusInfo != null)
                        {
                            statusEntry.IsCompanyAction = statusInfo.CompanyAction;
                            var statusKey = statusInfo.Name.English;
                            switch (MemoryHandler.Instance.GameLanguage)
                            {
                            case "French":
                                statusKey = statusInfo.Name.French;
                                break;

                            case "Japanese":
                                statusKey = statusInfo.Name.Japanese;
                                break;

                            case "German":
                                statusKey = statusInfo.Name.German;
                                break;

                            case "Chinese":
                                statusKey = statusInfo.Name.Chinese;
                                break;

                            case "Korean":
                                statusKey = statusInfo.Name.Korean;
                                break;
                            }

                            statusEntry.StatusName = statusKey;
                        }
                    }
                    catch (Exception) {
                        statusEntry.StatusName = "UNKNOWN";
                    }

                    if (statusEntry.IsValid())
                    {
                        if (isNewStatus)
                        {
                            entry.StatusItems.Add(statusEntry);
                        }

                        foundStatuses.Add(statusEntry);
                    }
                }

                entry.StatusItems.RemoveAll(x => !foundStatuses.Contains(x));

                // handle empty names
                if (string.IsNullOrEmpty(entry.Name))
                {
                    if (entry.Type == Actor.Type.EventObject)
                    {
                        entry.Name = $"{nameof(entry.EventObjectTypeID)}: {entry.EventObjectTypeID}";
                    }
                    else
                    {
                        entry.Name = $"{nameof(entry.TypeID)}: {entry.TypeID}";
                    }
                }
            }
            catch (Exception ex) {
                MemoryHandler.Instance.RaiseException(Logger, ex, true);
            }

            CleanXPValue(ref entry);

            if (isCurrentUser)
            {
                PCWorkerDelegate.CurrentUser = entry;
            }

            return(entry);
        }
Example #2
0
        public static PartyMember ResolvePartyMemberFromBytes(byte[] source, ActorItem actorItem = null)
        {
            if (actorItem != null)
            {
                var entry = new PartyMember {
                    X            = actorItem.X,
                    Y            = actorItem.Y,
                    Z            = actorItem.Z,
                    Coordinate   = actorItem.Coordinate,
                    ID           = actorItem.ID,
                    UUID         = actorItem.UUID,
                    Name         = actorItem.Name,
                    Job          = actorItem.Job,
                    Level        = actorItem.Level,
                    HPCurrent    = actorItem.HPCurrent,
                    HPMax        = actorItem.HPMax,
                    MPCurrent    = actorItem.MPCurrent,
                    MPMax        = actorItem.MPMax,
                    HitBoxRadius = actorItem.HitBoxRadius,
                };
                entry.StatusItems.AddRange(actorItem.StatusItems);
                CleanXPValue(ref entry);
                return(entry);
            }
            else
            {
                var defaultStatusEffectOffset = MemoryHandler.Instance.Structures.PartyMember.DefaultStatusEffectOffset;
                var entry = new PartyMember();
                try {
                    entry.X            = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.PartyMember.X);
                    entry.Z            = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.PartyMember.Z);
                    entry.Y            = BitConverter.TryToSingle(source, MemoryHandler.Instance.Structures.PartyMember.Y);
                    entry.Coordinate   = new Coordinate(entry.X, entry.Z, entry.Z);
                    entry.ID           = BitConverter.TryToUInt32(source, MemoryHandler.Instance.Structures.PartyMember.ID);
                    entry.UUID         = Guid.NewGuid().ToString();
                    entry.Name         = MemoryHandler.Instance.GetStringFromBytes(source, MemoryHandler.Instance.Structures.PartyMember.Name);
                    entry.JobID        = source[MemoryHandler.Instance.Structures.PartyMember.Job];
                    entry.Job          = (Actor.Job)entry.JobID;
                    entry.HitBoxRadius = 0.5f;

                    entry.Level     = source[MemoryHandler.Instance.Structures.PartyMember.Level];
                    entry.HPCurrent = BitConverter.TryToInt32(source, MemoryHandler.Instance.Structures.PartyMember.HPCurrent);
                    entry.HPMax     = BitConverter.TryToInt32(source, MemoryHandler.Instance.Structures.PartyMember.HPMax);
                    entry.MPCurrent = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.PartyMember.MPCurrent);
                    entry.MPMax     = BitConverter.TryToInt16(source, MemoryHandler.Instance.Structures.PartyMember.MPMax);
                    const int limit = 15;

                    int    statusSize     = MemoryHandler.Instance.Structures.StatusItem.SourceSize;
                    byte[] statusesSource = new byte[limit * statusSize];

                    List <StatusItem> foundStatuses = new List <StatusItem>();

                    Buffer.BlockCopy(source, defaultStatusEffectOffset, statusesSource, 0, limit * statusSize);
                    for (var i = 0; i < limit; i++)
                    {
                        bool isNewStatus = false;

                        byte[] statusSource = new byte[statusSize];
                        Buffer.BlockCopy(statusesSource, i * statusSize, statusSource, 0, statusSize);

                        short StatusID = BitConverter.TryToInt16(statusSource, MemoryHandler.Instance.Structures.StatusItem.StatusID);
                        uint  CasterID = BitConverter.TryToUInt32(statusSource, MemoryHandler.Instance.Structures.StatusItem.CasterID);

                        var statusEntry = entry.StatusItems.FirstOrDefault(x => x.CasterID == CasterID && x.StatusID == StatusID);

                        if (statusEntry == null)
                        {
                            statusEntry = new StatusItem();
                            isNewStatus = true;
                        }

                        statusEntry.TargetEntity = null;
                        statusEntry.TargetName   = entry.Name;
                        statusEntry.StatusID     = StatusID;
                        statusEntry.Stacks       = statusSource[MemoryHandler.Instance.Structures.StatusItem.Stacks];
                        statusEntry.Duration     = BitConverter.TryToSingle(statusSource, MemoryHandler.Instance.Structures.StatusItem.Duration);
                        statusEntry.CasterID     = CasterID;

                        foundStatuses.Add(statusEntry);

                        try {
                            ActorItem pc      = PCWorkerDelegate.GetActorItem(statusEntry.CasterID);
                            ActorItem npc     = NPCWorkerDelegate.GetActorItem(statusEntry.CasterID);
                            ActorItem monster = MonsterWorkerDelegate.GetActorItem(statusEntry.CasterID);
                            statusEntry.SourceEntity = (pc ?? npc) ?? monster;
                        }
                        catch (Exception ex) {
                            MemoryHandler.Instance.RaiseException(Logger, ex, true);
                        }

                        try {
                            if (statusEntry.StatusID > 0)
                            {
                                Models.XIVDatabase.StatusItem statusInfo = StatusEffectLookup.GetStatusInfo((uint)statusEntry.StatusID);
                                statusEntry.IsCompanyAction = statusInfo.CompanyAction;
                                var statusKey = statusInfo.Name.English;
                                switch (MemoryHandler.Instance.GameLanguage)
                                {
                                case "French":
                                    statusKey = statusInfo.Name.French;
                                    break;

                                case "Japanese":
                                    statusKey = statusInfo.Name.Japanese;
                                    break;

                                case "German":
                                    statusKey = statusInfo.Name.German;
                                    break;

                                case "Chinese":
                                    statusKey = statusInfo.Name.Chinese;
                                    break;

                                case "Korean":
                                    statusKey = statusInfo.Name.Korean;
                                    break;
                                }

                                statusEntry.StatusName = statusKey;
                            }
                        }
                        catch (Exception) {
                            statusEntry.StatusName = "UNKNOWN";
                        }

                        if (statusEntry.IsValid())
                        {
                            if (isNewStatus)
                            {
                                entry.StatusItems.Add(statusEntry);
                            }

                            foundStatuses.Add(statusEntry);
                        }
                    }

                    entry.StatusItems.RemoveAll(x => !foundStatuses.Contains(x));
                }
                catch (Exception ex) {
                    MemoryHandler.Instance.RaiseException(Logger, ex, true);
                }

                CleanXPValue(ref entry);
                return(entry);
            }
        }
Example #3
0
        public PartyMember ResolvePartyMemberFromBytes(byte[] source, ActorItem actorItem = null)
        {
            this._foundStatuses.Clear();

            if (actorItem != null)
            {
                PartyMember memberFromActorItem = new PartyMember {
                    X            = actorItem.X,
                    Y            = actorItem.Y,
                    Z            = actorItem.Z,
                    Coordinate   = actorItem.Coordinate,
                    ID           = actorItem.ID,
                    UUID         = actorItem.UUID,
                    Name         = actorItem.Name,
                    Job          = actorItem.Job,
                    Level        = actorItem.Level,
                    HPCurrent    = actorItem.HPCurrent,
                    HPMax        = actorItem.HPMax,
                    MPCurrent    = actorItem.MPCurrent,
                    HitBoxRadius = actorItem.HitBoxRadius,
                };
                memberFromActorItem.StatusItems.AddRange(actorItem.StatusItems);
                this.CleanXPValue(ref memberFromActorItem);
                return(memberFromActorItem);
            }

            int         defaultStatusEffectOffset = this._memoryHandler.Structures.PartyMember.DefaultStatusEffectOffset;
            PartyMember entry = new PartyMember();

            try {
                const int limit      = 15;
                int       statusSize = this._memoryHandler.Structures.StatusItem.SourceSize;

                byte[] statusesMap = this._memoryHandler.BufferPool.Rent(statusSize * limit);
                byte[] statusMap   = this._memoryHandler.BufferPool.Rent(statusSize);

                try {
                    entry.X            = SharlayanBitConverter.TryToSingle(source, this._memoryHandler.Structures.PartyMember.X);
                    entry.Z            = SharlayanBitConverter.TryToSingle(source, this._memoryHandler.Structures.PartyMember.Z);
                    entry.Y            = SharlayanBitConverter.TryToSingle(source, this._memoryHandler.Structures.PartyMember.Y);
                    entry.Coordinate   = new Coordinate(entry.X, entry.Z, entry.Z);
                    entry.ID           = SharlayanBitConverter.TryToUInt32(source, this._memoryHandler.Structures.PartyMember.ID);
                    entry.UUID         = Guid.NewGuid().ToString();
                    entry.Name         = this._memoryHandler.GetStringFromBytes(source, this._memoryHandler.Structures.PartyMember.Name);
                    entry.JobID        = source[this._memoryHandler.Structures.PartyMember.Job];
                    entry.Job          = (Actor.Job)entry.JobID;
                    entry.HitBoxRadius = 0.5f;
                    entry.Level        = source[this._memoryHandler.Structures.PartyMember.Level];
                    entry.HPCurrent    = SharlayanBitConverter.TryToInt32(source, this._memoryHandler.Structures.PartyMember.HPCurrent);
                    entry.HPMax        = SharlayanBitConverter.TryToInt32(source, this._memoryHandler.Structures.PartyMember.HPMax);
                    entry.MPCurrent    = SharlayanBitConverter.TryToInt16(source, this._memoryHandler.Structures.PartyMember.MPCurrent);

                    Buffer.BlockCopy(source, defaultStatusEffectOffset, statusesMap, 0, limit * statusSize);
                    for (int i = 0; i < limit; i++)
                    {
                        bool isNewStatus = false;

                        Buffer.BlockCopy(statusesMap, i * statusSize, statusMap, 0, statusSize);

                        short statusID = SharlayanBitConverter.TryToInt16(statusMap, this._memoryHandler.Structures.StatusItem.StatusID);
                        uint  casterID = SharlayanBitConverter.TryToUInt32(statusMap, this._memoryHandler.Structures.StatusItem.CasterID);

                        StatusItem statusEntry = entry.StatusItems.FirstOrDefault(x => x.CasterID == casterID && x.StatusID == statusID);

                        if (statusEntry == null)
                        {
                            statusEntry = new StatusItem();
                            isNewStatus = true;
                        }

                        statusEntry.TargetEntity = null;
                        statusEntry.TargetName   = entry.Name;
                        statusEntry.StatusID     = statusID;
                        statusEntry.Stacks       = statusMap[this._memoryHandler.Structures.StatusItem.Stacks];
                        statusEntry.Duration     = SharlayanBitConverter.TryToSingle(statusMap, this._memoryHandler.Structures.StatusItem.Duration);
                        statusEntry.CasterID     = casterID;

                        this._foundStatuses.Add(statusEntry);

                        try {
                            ActorItem pc      = this._pcWorkerDelegate.GetActorItem(statusEntry.CasterID);
                            ActorItem npc     = this._npcWorkerDelegate.GetActorItem(statusEntry.CasterID);
                            ActorItem monster = this._monsterWorkerDelegate.GetActorItem(statusEntry.CasterID);
                            statusEntry.SourceEntity = (pc ?? npc) ?? monster;
                        }
                        catch (Exception ex) {
                            this._memoryHandler.RaiseException(Logger, ex);
                        }

                        try {
                            if (statusEntry.StatusID > 0)
                            {
                                Models.XIVDatabase.StatusItem statusInfo = StatusEffectLookup.GetStatusInfo((uint)statusEntry.StatusID);
                                statusEntry.IsCompanyAction = statusInfo.CompanyAction;
                                string statusKey = statusInfo.Name.English;
                                switch (this._memoryHandler.Configuration.GameLanguage)
                                {
                                case GameLanguage.French:
                                    statusKey = statusInfo.Name.French;
                                    break;

                                case GameLanguage.Japanese:
                                    statusKey = statusInfo.Name.Japanese;
                                    break;

                                case GameLanguage.German:
                                    statusKey = statusInfo.Name.German;
                                    break;

                                case GameLanguage.Chinese:
                                    statusKey = statusInfo.Name.Chinese;
                                    break;

                                case GameLanguage.Korean:
                                    statusKey = statusInfo.Name.Korean;
                                    break;
                                }

                                statusEntry.StatusName = statusKey;
                            }
                        }
                        catch (Exception) {
                            statusEntry.StatusName = Constants.UNKNOWN_LOCALIZED_NAME;
                        }

                        if (statusEntry.IsValid())
                        {
                            if (isNewStatus)
                            {
                                entry.StatusItems.Add(statusEntry);
                            }

                            this._foundStatuses.Add(statusEntry);
                        }
                    }
                }
                catch (Exception ex) {
                    this._memoryHandler.RaiseException(Logger, ex);
                }
                finally {
                    this._memoryHandler.BufferPool.Return(statusesMap);
                    this._memoryHandler.BufferPool.Return(statusMap);
                }

                entry.StatusItems.RemoveAll(x => !this._foundStatuses.Contains(x));
            }
            catch (Exception ex) {
                this._memoryHandler.RaiseException(Logger, ex);
            }

            this.CleanXPValue(ref entry);

            return(entry);
        }