Пример #1
0
 public void Load(VMFindLocationResultMarshal input, VMContext context)
 {
     RadianDirection = input.RadianDirection;
     Position = input.Position;
     Score = input.Score;
     FaceAnywhere = input.FaceAnywhere;
     Chair = context.VM.GetObjectById(input.Chair);
     RouteEntryFlags = input.RouteEntryFlags;
 }
Пример #2
0
 public VMFindLocationResult(VMFindLocationResultMarshal input, VMContext context)
 {
     Load(input, context);
 }
Пример #3
0
        public override void Deserialize(BinaryReader reader)
        {
            base.Deserialize(reader);

            var roomN = reader.ReadInt32();

            Rooms = new VMRoomPortal[roomN];
            for (int i = 0; i < roomN; i++)
            {
                Rooms[i] = new VMRoomPortal(reader);
            }

            if (reader.ReadBoolean())
            {
                CurrentPortal = new VMRoomPortal(reader);
            }

            var wtLen = reader.ReadInt32();

            if (wtLen > -1)
            {
                WalkTo = new Point[wtLen];
                for (int i = 0; i < wtLen; i++)
                {
                    WalkTo[i] = new Point(reader.ReadInt32(), reader.ReadInt32());
                }
            }

            WalkDirection   = reader.ReadDouble();
            TargetDirection = reader.ReadDouble();
            IgnoreRooms     = reader.ReadBoolean();

            State       = (VMRoutingFrameState)reader.ReadByte();
            PortalTurns = reader.ReadInt32();
            WaitTime    = reader.ReadInt32();
            Timeout     = reader.ReadInt32();
            Retries     = reader.ReadInt32();

            AttemptedChair = reader.ReadBoolean();
            TurnTweak      = reader.ReadSingle();
            TurnFrames     = reader.ReadInt32();

            MoveTotalFrames = reader.ReadInt32();
            MoveFrames      = reader.ReadInt32();
            Velocity        = reader.ReadInt32();

            CallFailureTrees = reader.ReadBoolean();

            var igrN = reader.ReadInt32();

            IgnoredRooms = new VMRoomPortal[igrN];
            for (int i = 0; i < igrN; i++)
            {
                IgnoredRooms[i] = new VMRoomPortal(reader);
            }

            var avaN = reader.ReadInt32();

            AvatarsToConsider = new short[avaN];
            for (int i = 0; i < avaN; i++)
            {
                AvatarsToConsider[i] = reader.ReadInt16();
            }

            PreviousPosition.Deserialize(reader);
            CurrentWaypoint.Deserialize(reader);

            RoomRouteInvalid = reader.ReadBoolean();

            if (reader.ReadBoolean())
            {
                Slot = SLOTItemSerializer.Deserialize(reader);
            }
            Target = reader.ReadInt16();

            var chLen = reader.ReadInt32();

            if (chLen > -1)
            {
                Choices = new VMFindLocationResultMarshal[chLen];
                for (int i = 0; i < chLen; i++)
                {
                    Choices[i] = new VMFindLocationResultMarshal();
                    Choices[i].Deserialize(reader);
                }
            }

            if (reader.ReadBoolean())
            {
                CurRoute = new VMFindLocationResultMarshal();
                CurRoute.Deserialize(reader);
            }

            if (Version > 29)
            {
                LastWalkStyle = reader.ReadInt16();
            }
        }
Пример #4
0
        public override void Deserialize(BinaryReader reader)
        {
            base.Deserialize(reader);

            var roomN = reader.ReadInt32();
            Rooms = new VMRoomPortal[roomN];
            for (int i=0; i< roomN; i++) Rooms[i] = new VMRoomPortal(reader);

            if (reader.ReadBoolean()) CurrentPortal = new VMRoomPortal(reader);

            var wtLen = reader.ReadInt32();
            if (wtLen > -1)
            {
                WalkTo = new Point[wtLen];
                for (int i = 0; i < wtLen; i++) WalkTo[i] = new Point(reader.ReadInt32(), reader.ReadInt32());
            }

            WalkDirection = reader.ReadDouble();
            TargetDirection = reader.ReadDouble();
            IgnoreRooms = reader.ReadBoolean();

            State = (VMRoutingFrameState)reader.ReadByte();
            PortalTurns = reader.ReadInt32();
            WaitTime = reader.ReadInt32();
            Timeout = reader.ReadInt32();
            Retries = reader.ReadInt32();

            AttemptedChair = reader.ReadBoolean();
            TurnTweak = reader.ReadSingle();
            TurnFrames = reader.ReadInt32();

            MoveTotalFrames = reader.ReadInt32();
            MoveFrames = reader.ReadInt32();
            Velocity = reader.ReadInt32();

            CallFailureTrees = reader.ReadBoolean();

            var igrN = reader.ReadInt32();
            IgnoredRooms = new VMRoomPortal[igrN];
            for (int i = 0; i < igrN; i++) IgnoredRooms[i] = new VMRoomPortal(reader);

            var avaN = reader.ReadInt32();
            AvatarsToConsider = new short[avaN];
            for (int i = 0; i < avaN; i++) AvatarsToConsider[i] = reader.ReadInt16();

            PreviousPosition.Deserialize(reader);
            CurrentWaypoint.Deserialize(reader);

            RoomRouteInvalid = reader.ReadBoolean();

            if (reader.ReadBoolean()) {
                Slot = SLOTItemSerializer.Deserialize(reader);
            }
            Target = reader.ReadInt16();

            var chLen = reader.ReadInt32();
            if (chLen > -1)
            {
                Choices = new VMFindLocationResultMarshal[chLen];
                for (int i = 0; i < chLen; i++)
                {
                    Choices[i] = new VMFindLocationResultMarshal();
                    Choices[i].Deserialize(reader);
                }
            }

            if (reader.ReadBoolean())
            {
                CurRoute = new VMFindLocationResultMarshal();
                CurRoute.Deserialize(reader);
            }
        }
Пример #5
0
        public override VMStackFrameMarshal Save()
        {
            var start = base.Save();

            var atC = new short[AvatarsToConsider.Count];
            int i = 0;
            foreach (var item in AvatarsToConsider)
            {
                atC[i++] = item.ObjectID;
            }

            VMFindLocationResultMarshal[] choices = null;

            if (Choices != null)
            {
                choices = new VMFindLocationResultMarshal[Choices.Count];
                i = 0;
                foreach (var item in Choices)
                {
                    choices[i++] = item.Save();
                }
            }

            return new VMRoutingFrameMarshal
            {
                RoutineID = start.RoutineID,
                InstructionPointer = start.InstructionPointer,
                Caller = start.Caller,
                Callee = start.Callee,
                StackObject = start.StackObject,
                CodeOwnerGUID = start.CodeOwnerGUID,
                Locals = start.Locals,
                Args = start.Args,
                //above is stack frame stuff

                Rooms = Rooms.ToArray(),
                CurrentPortal = CurrentPortal,

                WalkTo = (WalkTo==null)?null:WalkTo.ToArray(),
                WalkDirection = WalkDirection,
                TargetDirection = TargetDirection,
                IgnoreRooms = IgnoreRooms,

                State = State,
                PortalTurns = PortalTurns,
                WaitTime = WaitTime,
                Timeout = Timeout,
                Retries = Retries,

                AttemptedChair = AttemptedChair,
                TurnTweak = TurnTweak,
                TurnFrames = TurnFrames,

                MoveTotalFrames = MoveTotalFrames,
                MoveFrames = MoveFrames,
                Velocity = Velocity,

                CallFailureTrees = CallFailureTrees,

                IgnoredRooms = IgnoredRooms.ToArray(),
                AvatarsToConsider = atC,

                PreviousPosition = PreviousPosition,
                CurrentWaypoint = CurrentWaypoint,

                RoomRouteInvalid = RoomRouteInvalid,
                Slot = Slot, //NULLable
                Target = (Target == null) ? (short)0 : Target.ObjectID, //object id
                Choices = choices, //NULLable
                CurRoute = (CurRoute == null)?null:CurRoute.Save() //NULLable
            };
        }
        public override void Deserialize(BinaryReader reader)
        {
            base.Deserialize(reader);
            var bezierRouting = (Version > 31);

            var roomN = reader.ReadInt32();

            Rooms = new VMRoomPortal[roomN];
            for (int i = 0; i < roomN; i++)
            {
                Rooms[i] = new VMRoomPortal(reader);
            }

            if (reader.ReadBoolean())
            {
                CurrentPortal = new VMRoomPortal(reader);
            }

            var wtLen = reader.ReadInt32();

            Point[] points = null;
            if (wtLen > -1)
            {
                WalkTo = new VMIPathSegment[wtLen];
                if (bezierRouting)
                {
                    for (int i = 0; i < wtLen; i++)
                    {
                        WalkTo[i] = ReadGenericSegment(reader);
                    }
                }
                else
                {
                    //old point list. convert to line segments.
                    points = new Point[wtLen];
                    for (int i = 0; i < wtLen; i++)
                    {
                        points[i] = new Point(reader.ReadInt32(), reader.ReadInt32());
                    }
                }
            }

            WalkDirection   = reader.ReadDouble();
            TargetDirection = reader.ReadDouble();
            IgnoreRooms     = reader.ReadBoolean();

            State       = (VMRoutingFrameState)reader.ReadByte();
            PortalTurns = reader.ReadInt32();
            WaitTime    = reader.ReadInt32();
            Timeout     = reader.ReadInt32();
            Retries     = reader.ReadInt32();

            AttemptedChair = reader.ReadBoolean();
            TurnTweak      = reader.ReadSingle();
            TurnFrames     = reader.ReadInt32();

            MoveTotalFrames = reader.ReadInt32();
            MoveFrames      = reader.ReadInt32();
            Velocity        = reader.ReadInt32();

            CallFailureTrees = reader.ReadBoolean();

            var igrN = reader.ReadInt32();

            IgnoredRooms = new VMRoomPortal[igrN];
            for (int i = 0; i < igrN; i++)
            {
                IgnoredRooms[i] = new VMRoomPortal(reader);
            }

            var avaN = reader.ReadInt32();

            AvatarsToConsider = new short[avaN];
            for (int i = 0; i < avaN; i++)
            {
                AvatarsToConsider[i] = reader.ReadInt16();
            }

            LotTilePos CurrentWaypoint = new LotTilePos();

            PreviousPosition.Deserialize(reader);
            if (bezierRouting)
            {
                CurrentPath = ReadGenericSegment(reader);
            }
            else
            {
                //convert old format into new
                CurrentWaypoint.Deserialize(reader);
                CurrentPath = new VMPathLineSegment(
                    new Point(PreviousPosition.x * 0x8000, PreviousPosition.y * 0x8000),
                    new Point(CurrentWaypoint.x * 0x8000, CurrentWaypoint.y * 0x8000));
                if (points != null)
                {
                    if (points.Length > 0)
                    {
                        WalkTo    = new VMIPathSegment[points.Length];
                        WalkTo[0] = new VMPathLineSegment(
                            new Point(CurrentWaypoint.x * 0x8000, CurrentWaypoint.y * 0x8000),
                            new Point(points[0].X * 0x8000, points[0].Y * 0x8000));
                        for (int i = 1; i < WalkTo.Length; i++)
                        {
                            WalkTo[i] = new VMPathLineSegment(
                                new Point(points[i - 1].X * 0x8000, points[i - 1].Y * 0x8000),
                                new Point(points[i].X * 0x8000, points[i].Y * 0x8000));
                        }
                    }
                    else
                    {
                        WalkTo = new VMIPathSegment[0];
                    }
                }
                else
                {
                    WalkTo = null;
                }
            }

            CurrentPath.CalculateTotalFrames();
            CurrentPath.UpdateTotalFrames(MoveTotalFrames);
            CurrentPath.ResetToFrame(MoveFrames);

            RoomRouteInvalid = reader.ReadBoolean();

            if (reader.ReadBoolean())
            {
                Slot = SLOTItemSerializer.Deserialize(reader);
            }
            Target = reader.ReadInt16();

            var chLen = reader.ReadInt32();

            if (chLen > -1)
            {
                Choices = new VMFindLocationResultMarshal[chLen];
                for (int i = 0; i < chLen; i++)
                {
                    Choices[i] = new VMFindLocationResultMarshal();
                    Choices[i].Deserialize(reader);
                }
            }

            if (reader.ReadBoolean())
            {
                CurRoute = new VMFindLocationResultMarshal();
                CurRoute.Deserialize(reader);
            }

            if (Version > 29)
            {
                LastWalkStyle = reader.ReadInt16();
            }
        }