示例#1
0
        public void HandleOutgoing(InterceptedEventArgs e)
        {
            bool ignoreCurrent = true;

            try
            {
                e.Packet.Position = 0;
                if (_outAttaches.ContainsKey(e.Packet.Header))
                {
                    _outAttaches[e.Packet.Header](e);
                }

                if (DetectOutgoing)
                {
                    e.Packet.Position = 0;
                    HMessage previous = _outPrevious.Count > 0 ?
                                        _outPrevious.Pop() : e.Packet;

                    bool currentDetected  = OutDetected.ContainsKey(e.Packet.Header);
                    bool previousDetected = OutDetected.ContainsKey(previous.Header);

                    if (!currentDetected && !previousDetected)
                    {
                        ignoreCurrent = HandleOutgoing(e.Packet, previous);
                    }

                    if (ignoreCurrent)
                    {
                        e.Packet.Position     =
                            previous.Position = 0;

                        if (OutDetected.ContainsKey(e.Packet.Header))
                        {
                            OutDetected[e.Packet.Header](e);
                        }
                        else if (OutDetected.ContainsKey(previous.Header) && !previousDetected)
                        {
                            var args = new InterceptedEventArgs(null, e.Step - 1, previous);
                            OutDetected[previous.Header](args);
                        }
                    }
                }
            }
            finally
            {
                e.Packet.Position = 0;

                if (DetectOutgoing)
                {
                    _outPrevious.Push(e.Packet);
                }
            }
        }
示例#2
0
        protected virtual bool HandleOutgoing(HMessage current, HMessage previous)
        {
            if (current.Length == 6)
            {
                // Range: 6
                if (TryHandleAvatarMenuClick(current, previous))
                {
                    return(true);
                }
                if (TryHandleHostExitRoom(current, previous))
                {
                    return(true);
                }
            }
            else if (current.Length >= 36 && current.Length <= 50)
            {
                //Range: 36 - 50
                if (TryHandleHostRaiseSign(current, previous))
                {
                    return(true);
                }
                if (TryHandleHostNavigateRoom(current, previous))
                {
                    return(true);
                }
            }

            return(OutDetected.ContainsKey(current.Header) ||
                   OutDetected.ContainsKey(previous.Header));
        }
示例#3
0
        protected virtual void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }
            if (disposing)
            {
                _inPrevious.Clear();
                _outPrevious.Clear();

                InDetected.Clear();
                OutDetected.Clear();

                _inAttaches.Clear();
                _outAttaches.Clear();

                #region Unsubscribe Game Events
                SKore.Unsubscribe(ref HostBanPlayer);
                SKore.Unsubscribe(ref HostUpdateClothes);
                SKore.Unsubscribe(ref HostUpdateMotto);
                SKore.Unsubscribe(ref HostUpdateStance);
                SKore.Unsubscribe(ref HostClickPlayer);
                SKore.Unsubscribe(ref HostDance);
                SKore.Unsubscribe(ref HostGesture);
                SKore.Unsubscribe(ref HostKickPlayer);
                SKore.Unsubscribe(ref HostMoveFurniture);
                SKore.Unsubscribe(ref HostMutePlayer);
                SKore.Unsubscribe(ref HostRaiseSign);
                SKore.Unsubscribe(ref HostExitRoom);
                SKore.Unsubscribe(ref HostNavigateRoom);
                SKore.Unsubscribe(ref HostSay);
                SKore.Unsubscribe(ref HostShout);
                SKore.Unsubscribe(ref HostTradePlayer);
                SKore.Unsubscribe(ref HostWalk);

                SKore.Unsubscribe(ref FurnitureLoad);
                SKore.Unsubscribe(ref EntityAction);
                SKore.Unsubscribe(ref PlayerUpdate);
                SKore.Unsubscribe(ref PlayerDance);
                SKore.Unsubscribe(ref EntityLoad);
                SKore.Unsubscribe(ref FurnitureDrop);
                SKore.Unsubscribe(ref PlayerGesture);
                SKore.Unsubscribe(ref PlayerKickHost);
                SKore.Unsubscribe(ref FurnitureMove);
                #endregion
            }
            IsDisposed = true;
        }