Exemple #1
0
        public void ExamineObject(ObjectGuid examinationId)
        {
            // TODO: Throttle this request?. The live servers did this, likely for a very good reason, so we should, too.

            if (examinationId.Full == 0)
            {
                // Deselect the formerly selected Target
                // selectedTarget = ObjectGuid.Invalid;
                RequestedAppraisalTarget = null;
                CurrentAppraisalTarget   = null;
                return;
            }

            // The object can be in two spots... on the player or on the landblock
            // First check the player
            // search packs
            WorldObject wo = GetInventoryItem(examinationId);

            // search wielded items
            if (wo == null)
            {
                wo = GetWieldedItem(examinationId);
            }

            // search interactive objects
            if (wo == null)
            {
                if (interactiveWorldObjects.ContainsKey(examinationId))
                {
                    wo = interactiveWorldObjects[examinationId];
                }
            }

            // if local, examine it
            if (wo != null)
            {
                wo.Examine(Session);
            }
            else
            {
                // examine item on landblock
                wo = CurrentLandblock?.GetObject(examinationId);
                if (wo != null)
                {
                    wo.Examine(Session);
                }
            }

            RequestedAppraisalTarget = examinationId.Full;
            CurrentAppraisalTarget   = examinationId.Full;
        }
Exemple #2
0
        public void ExamineObject(ObjectGuid examinationId)
        {
            // TODO: Throttle this request?. The live servers did this, likely for a very good reason, so we should, too.

            if (examinationId.Full == 0)
            {
                // Deselect the formerly selected Target
                // selectedTarget = ObjectGuid.Invalid;
                RequestedAppraisalTarget = null;
                CurrentAppraisalTarget   = null;
                return;
            }

            // The object can be in two spots... on the player or on the landblock
            // First check the player
            // search packs
            WorldObject wo = GetInventoryItem(examinationId);

            // search wielded items
            if (wo == null)
            {
                wo = GetWieldedItem(examinationId);
            }

            // search interactive objects
            if (wo == null)
            {
                if (interactiveWorldObjects.ContainsKey(examinationId))
                {
                    wo = interactiveWorldObjects[examinationId];
                }
            }

            // if local, examine it
            if (wo != null)
            {
                wo.Examine(Session);
            }
            else
            {
                // examine item on landblock
                wo = CurrentLandblock?.GetObject(examinationId);
                if (wo != null)
                {
                    wo.Examine(Session);
                }
                else
                {
                    // search creature equipped weapons on nearby landblocks
                    wo = CurrentLandblock?.GetWieldedObject(examinationId);
                    if (wo != null)
                    {
                        wo.Examine(Session);
                    }
                    else
                    {
                        // At this point, the object wasn't found.
                        // It could be that the object was teleported away before this request was processed
                        // It could also be a decal plugin requesting information for an object that is no longer in range

                        //log.Warn($"{Name} tried to appraise object {examinationId.Full:X8}, couldn't find it");
                    }
                }
            }

            RequestedAppraisalTarget = examinationId.Full;
            CurrentAppraisalTarget   = examinationId.Full;
        }