コード例 #1
0
ファイル: MovementHandler.cs プロジェクト: uvbs/Asda2-Server
        /// <summary>
        /// Move from current position  to
        /// new position on the Transport (relative to transport)
        /// </summary>
        /// <param name="unit"></param>
        public static void SendMonsterMoveTransport(Unit unit, Vector3 from, Vector3 to)
        {
            if (!unit.IsAreaActive)
            {
                return;
            }
            using (RealmPacketOut realmPacketOut = new RealmPacketOut(RealmServerOpCode.SMSG_MONSTER_MOVE_TRANSPORT))
            {
                ITransportInfo transportInfo = unit.TransportInfo;
                unit.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                transportInfo.EntityId.WritePacked((BinaryWriter)realmPacketOut);
                realmPacketOut.Write((ushort)0);
                realmPacketOut.Write(from);
                realmPacketOut.Write(Utility.GetSystemTime());
                if (unit is Character)
                {
                    realmPacketOut.Write((byte)4);
                    realmPacketOut.Write(unit.TransportOrientation);
                    realmPacketOut.Write(8388608U);
                }
                else
                {
                    realmPacketOut.Write((byte)0);
                    realmPacketOut.Write(4096U);
                }

                realmPacketOut.Write(0);
                realmPacketOut.Write(1);
                realmPacketOut.Write(to);
                unit.SendPacketToArea(realmPacketOut, true, true, Locale.Any, new float?());
            }
        }
コード例 #2
0
ファイル: MovementHandler.cs プロジェクト: uvbs/Asda2-Server
        public static void SendEnterTransport(Unit unit)
        {
            ITransportInfo transportInfo = unit.TransportInfo;

            MovementHandler.SendMonsterMoveTransport(unit, transportInfo.Position - unit.Position,
                                                     unit.TransportPosition);
        }
コード例 #3
0
ファイル: MovementHandler.cs プロジェクト: uvbs/Asda2-Server
        /// <summary>
        ///
        /// </summary>
        /// <param name="packet">The packet to read the info from</param>
        /// <param name="chr">The active character in the client that send the movement packet</param>
        /// <param name="mover">The unit we want this movement info to affect</param>
        /// <param name="clientTime">Used to return the read client time</param>
        /// <returns>A boolean value used to determine broadcasting of this movement info to other clients</returns>
        public static bool ReadMovementInfo(RealmPacketIn packet, Character chr, Unit mover, out uint clientTime)
        {
            MovementFlags  movementFlags  = (MovementFlags)packet.ReadInt32();
            MovementFlags2 movementFlags2 = (MovementFlags2)packet.ReadInt16();

            clientTime = packet.ReadUInt32();
            Vector3 pt          = packet.ReadVector3();
            float   orientation = packet.ReadFloat();

            if (movementFlags.HasFlag((Enum)MovementFlags.OnTransport))
            {
                EntityId       id            = packet.ReadPackedEntityId();
                Vector3        vector3       = packet.ReadVector3();
                float          num1          = packet.ReadFloat();
                uint           num2          = packet.ReadUInt32();
                int            num3          = (int)packet.ReadByte();
                ITransportInfo transportInfo = mover.Map.GetObject(id) as ITransportInfo;
                bool           flag          = transportInfo is Vehicle;
                if (transportInfo == null)
                {
                    if (mover.Transport != null)
                    {
                        mover.Transport.RemovePassenger(mover);
                    }
                    return(false);
                }

                if (mover.TransportInfo != transportInfo)
                {
                    if (flag)
                    {
                        return(false);
                    }
                    ((Transport)transportInfo).AddPassenger(mover);
                }

                if (!flag)
                {
                    mover.TransportPosition    = vector3;
                    mover.TransportOrientation = num1;
                    mover.TransportTime        = num2;
                }
            }
            else if (mover.Transport != null)
            {
                mover.Transport.RemovePassenger(mover);
            }

            if (movementFlags.HasFlag((Enum)(MovementFlags.Swimming | MovementFlags.Flying)) ||
                movementFlags2.HasFlag((Enum)MovementFlags2.AlwaysAllowPitching))
            {
                if (movementFlags.HasFlag((Enum)MovementFlags.Flying) && !chr.CanFly)
                {
                    return(false);
                }
                float moveAngle = packet.ReadFloat();
                if (chr == mover)
                {
                    chr.MovePitch(moveAngle);
                }
            }

            int num4 = (int)packet.ReadUInt32();

            if (movementFlags.HasFlag((Enum)MovementFlags.Falling))
            {
                double num1 = (double)packet.ReadFloat();
                double num2 = (double)packet.ReadFloat();
                double num3 = (double)packet.ReadFloat();
                double num5 = (double)packet.ReadFloat();
            }

            if (packet.PacketId.RawId == 201U && chr == mover)
            {
                chr.OnFalling();
            }
            if (movementFlags.HasFlag((Enum)MovementFlags.Swimming) && chr == mover)
            {
                chr.OnSwim();
            }
            else if (chr.IsSwimming && chr == mover)
            {
                chr.OnStopSwimming();
            }
            if (movementFlags.HasFlag((Enum)MovementFlags.SplineElevation))
            {
                double num6 = (double)packet.ReadFloat();
            }

            bool flag1 = pt == mover.Position;

            if (!flag1 && mover.IsInWorld && !mover.SetPosition(pt, orientation))
            {
                return(false);
            }
            if (flag1)
            {
                mover.Orientation = orientation;
            }
            else
            {
                mover.OnMove();
            }
            mover.MovementFlags  = movementFlags;
            mover.MovementFlags2 = movementFlags2;
            if (flag1)
            {
                mover.Orientation = orientation;
            }
            else if (!mover.CanMove)
            {
                return(false);
            }
            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Creates solicit-response HTTP send port
        /// </summary>
        /// <param name="uri">Send port URI</param>
        /// <param name="portName">Send port name</param>
        /// <param name="receivePort">Name of the receive port to bind this send port to</param>
        /// <returns>True if successful, otherwise false</returns>
        public static bool CreateHttpSolicitResponsePort(string uri, string portName, string receivePort, string affiliateApplication, ref string retMsg)
        {
            IBtsCatalogExplorer explorer = null;

            try
            {
                string mgmtDBName   = "BizTalkMgmtDb";
                string mgmtDBServer = "localhost";

                ManagementClass groupSettings = new ManagementClass("root\\MicrosoftBizTalkServer:MSBTS_GroupSetting");
                foreach (ManagementObject obj in groupSettings.GetInstances())
                {
                    mgmtDBName   = (string)obj.Properties["MgmtDbName"].Value;
                    mgmtDBServer = (string)obj.Properties["MgmtDbServerName"].Value;
                }

                // Get BizTalk Explorer object
                explorer = new BtsCatalogExplorer();
                explorer.ConnectionString = "SERVER=" + mgmtDBServer + ";DATABASE=" + mgmtDBName + ";Integrated Security=SSPI";

                // Delete this port if it already exists
                foreach (ISendPort port in explorer.GetCollection(CollectionType.SendPort))
                {
                    if (port.Name.ToLower() == portName.ToLower())
                    {
                        port.Status = PortStatus.Bound;
                        explorer.RemoveSendPort(port);
                        break;
                    }
                }
                explorer.SaveChanges();

                // Add send port
                ISendPort transmitPort = explorer.AddNewSendPort(false, true);
                transmitPort.Name = portName;

                ITransportInfo TransInfo = transmitPort.PrimaryTransport;

                TransInfo.Address = uri;

                // Set protocol type
                foreach (IProtocolType protocol in explorer.GetCollection(CollectionType.ProtocolType))
                {
                    if (protocol.Name == "HTTP")
                    {
                        TransInfo.TransportType = protocol;
                    }
                }

                // Set the transport data
                string transportTypeData =
                    "<CustomProps>" +
                    "<Address vt=\"8\">" + TransInfo.Address + "</Address>" +
                    "<IsSolicitResponse vt=\"11\">1</IsSolicitResponse>" +
                    "<RequestTimeout vt=\"3\">120</RequestTimeout>" +
                    "<MaxRedirects vt=\"3\">0</MaxRedirects>" +
                    "<ContentType vt=\"8\">text/xml</ContentType>" +
                    "<URI vt=\"8\">" + TransInfo.Address + "</URI>" +
                    "<UseSSO vt=\"11\">1</UseSSO>" +
                    "<AffiliateApplicationName vt=\"8\">" + affiliateApplication + "</AffiliateApplicationName>" +
                    "<AuthenticationScheme vt=\"8\">Basic</AuthenticationScheme>" +
                    "</CustomProps>";

                // Set transport config
                TransInfo.TransportTypeData = transportTypeData;
                ITransportInfo transInfo = transmitPort.PrimaryTransport;

                // Set reference to transmit pipeline
                foreach (IPipeline pipe in explorer.GetCollection(CollectionType.Pipeline))
                {
                    if ((pipe.Type == PipelineType.Send) && (pipe.FullName == "Microsoft.BizTalk.DefaultPipelines.PassThruTransmit"))
                    {
                        transmitPort.SendPipeline = pipe;
                        break;
                    }
                }

                // For synchronous communications we should set up a receive pipeline
                foreach (IPipeline pipe in explorer.GetCollection(CollectionType.Pipeline))
                {
                    if ((pipe.Type == PipelineType.Receive) && (pipe.FullName == "Microsoft.BizTalk.DefaultPipelines.PassThruReceive"))
                    {
                        transmitPort.ReceivePipeline = pipe;
                        break;
                    }
                }

                // Set filter
                transmitPort.Filter =
                    "<Filter>" +
                    "<Group>" +
                    "<Statement Property=\"BTS.ReceivePortName\" Operator=\"0\" Value=\"" + receivePort + "\" />" +
                    "</Group>" +
                    "</Filter>";

                // Enlist and start send port
                transmitPort.Status = PortStatus.Started;

                // Remember this created send port
                explorer.SaveChanges();
            }
            catch (Exception e)
            {
                retMsg = e.Message.ToString();
                if (explorer != null)
                {
                    explorer.DiscardChanges();
                }
                return(false);
            }

            return(true);
        }
コード例 #5
0
ファイル: MovementHandler.cs プロジェクト: 0xFh/Asda2-Project
        public static void SendLeaveTransport(Unit unit)
        {
            ITransportInfo transportInfo = unit.TransportInfo;

            SendMonsterMoveTransport(unit, unit.TransportPosition, transportInfo.Position);
        }