Example #1
0
        public void Deserialize(BinaryReader reader)
        {
            RoutineID = reader.ReadUInt16();
            Callee = reader.ReadInt16();
            StackObject = reader.ReadInt16();
            IconOwner = reader.ReadInt16();

            CodeOwnerGUID = reader.ReadUInt32();
            if (reader.ReadBoolean()) Name = reader.ReadString();

            var argsLen = reader.ReadInt32();
            if (argsLen > -1)
            {
                Args = new short[argsLen];
                for (int i = 0; i < argsLen; i++) Args[i] = reader.ReadInt16();
            }

            InteractionNumber = reader.ReadInt32();
            Cancelled = reader.ReadBoolean();
            Priority = (VMQueuePriority)reader.ReadByte();
            UID = reader.ReadUInt16();

            if (reader.ReadBoolean())
            {
                Callback = new VMActionCallbackMarshal();
                Callback.Deserialize(reader);
            }
        }
Example #2
0
        public void Load(VMQueuedActionMarshal input, VMContext context)
        {
            CodeOwner = FSO.Content.Content.Get().WorldObjects.Get(input.CodeOwnerGUID);

            BHAV bhav = null;
            if (input.RoutineID >= 8192) bhav = CodeOwner.Resource.SemiGlobal.Get<BHAV>(input.RoutineID);
            else if (input.RoutineID >= 4096) bhav = CodeOwner.Resource.Get<BHAV>(input.RoutineID);
            else bhav = context.Globals.Resource.Get<BHAV>(input.RoutineID);
            Routine = context.VM.Assemble(bhav);

            Callee = context.VM.GetObjectById(input.Callee);
            StackObject = context.VM.GetObjectById(input.StackObject);
            IconOwner = context.VM.GetObjectById(input.IconOwner);
            Name = input.Name;
            Args = input.Args;
            InteractionNumber = input.InteractionNumber;
            Cancelled = input.Cancelled;
            Priority = input.Priority;
            UID = input.UID;
            Callback = (input.Callback == null)?null:new VMActionCallback(input.Callback, context);
        }