コード例 #1
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;
            Mode              = input.Mode;
            Flags             = input.Flags;
            UID      = input.UID;
            Callback = (input.Callback == null)?null:new VMActionCallback(input.Callback, context);
        }
コード例 #2
0
ファイル: VMQueuedAction.cs プロジェクト: jwofles/ForkSO
        public void Load(VMQueuedActionMarshal input, VMContext context)
        {
            CodeOwner = FSO.Content.Content.Get().WorldObjects.Get(input.CodeOwnerGUID);

            if (input.RoutineID >= 8192)
            {
                ActionRoutine = (VMRoutine)CodeOwner.Resource.SemiGlobal.GetRoutine(input.RoutineID);
            }
            else if (input.RoutineID >= 4096)
            {
                ActionRoutine = (VMRoutine)CodeOwner.Resource.GetRoutine(input.RoutineID);
            }
            else
            {
                ActionRoutine = (VMRoutine)context.Globals.Resource.GetRoutine(input.RoutineID);
            }

            if (input.CheckRoutineID != 0)
            {
                if (input.CheckRoutineID >= 8192)
                {
                    CheckRoutine = (VMRoutine)CodeOwner.Resource.SemiGlobal.GetRoutine(input.CheckRoutineID);
                }
                else if (input.CheckRoutineID >= 4096)
                {
                    CheckRoutine = (VMRoutine)CodeOwner.Resource.GetRoutine(input.CheckRoutineID);
                }
                else
                {
                    CheckRoutine = (VMRoutine)context.Globals.Resource.GetRoutine(input.CheckRoutineID);
                }
            }

            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;
            Mode              = input.Mode;
            Flags             = input.Flags;
            Flags2            = input.Flags2;
            UID      = input.UID;
            Callback = (input.Callback == null)?null:new VMActionCallback(input.Callback, context);

            InteractionResult  = input.InteractionResult;
            ResultCheckCounter = input.ResultCheckCounter;
        }
コード例 #3
0
        public void Deserialize(BinaryReader reader)
        {
            RoutineID      = reader.ReadUInt16();
            CheckRoutineID = 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();
            NotifyIdle        = reader.ReadBoolean();

            Priority = reader.ReadInt16();
            Mode     = (VMQueueMode)reader.ReadByte();
            Flags    = (TTABFlags)reader.ReadUInt32();
            Flags2   = (TSOFlags)reader.ReadUInt32();

            UID = reader.ReadUInt16();

            if (reader.ReadBoolean())
            {
                Callback = new VMActionCallbackMarshal();
                Callback.Deserialize(reader);
            }

            if (Version > 11)
            {
                InteractionResult  = reader.ReadSByte();
                ResultCheckCounter = reader.ReadUInt16();
            }
        }
コード例 #4
0
        public List <VMPieMenuInteraction> CheckTS1Action(VMQueuedAction action)
        {
            var result = new List <VMPieMenuInteraction>();

            if (Entity is VMAvatar) //just let everyone use the CSR interactions
            {
                var avatar = (VMAvatar)Entity;

                if ((action.Flags & (TTABFlags.TS1AllowCats | TTABFlags.TS1AllowDogs)) > 0)
                {
                    //interaction can only be performed by cats or dogs
                    //if (!avatar.IsPet) return null;
                    //check we're the correct type
                    if (avatar.IsCat && (action.Flags & TTABFlags.TS1AllowCats) == 0)
                    {
                        return(null);
                    }
                    if (avatar.IsDog && (action.Flags & TTABFlags.TS1AllowDogs) == 0)
                    {
                        return(null);
                    }
                }
                else if (avatar.IsPet)
                {
                    return(null);                   //not allowed
                }
                var isVisitor = avatar.GetPersonData(VMPersonDataVariable.PersonType) == 1 && avatar.GetPersonData(VMPersonDataVariable.TS1FamilyNumber) != Context.VM.CurrentFamily?.ChunkID;
                //avatar.ObjectID != Context.VM.GetGlobalValue(3);

                TTABFlags ts1State =
                    ((isVisitor) ? TTABFlags.AllowVisitors : 0)
                    | ((avatar.GetPersonData(VMPersonDataVariable.PersonsAge) < 18) ? TTABFlags.TS1NoChild : 0)
                    | ((avatar.GetPersonData(VMPersonDataVariable.PersonsAge) >= 18 && !avatar.IsPet) ? TTABFlags.TS1NoAdult : 0);

                //DEBUG: enable debug interction for all CSRs.
                if ((action.Flags & TTABFlags.Debug) > 0)
                {
                    if (!isVisitor)
                    {
                        return(result); //do not bother running check
                    }
                    else
                    {
                        return(null); //disable debug for everyone else.
                    }
                }

                //NEGATIVE EFFECTS:
                var pos        = ts1State & (TTABFlags.TS1NoChild | TTABFlags.TS1NoAdult);
                var ts1Compare = action.Flags;
                if ((pos & ts1Compare) > 0)
                {
                    return(null);
                }

                var negMask = (TTABFlags.AllowVisitors);

                var negatedFlags = (~ts1Compare) & negMask;
                if ((negatedFlags & ts1State) > 0)
                {
                    return(null);                               //we are disallowed
                }
            }
            if (action.CheckRoutine != null && EvaluateCheck(Context, Entity, new VMStackFrame()
            {
                Caller = Entity,
                Callee = action.Callee,
                CodeOwner = action.CodeOwner,
                StackObject = action.StackObject,
                Routine = action.CheckRoutine,
                Args = new short[4]
            }, null, result) != VMPrimitiveExitCode.RETURN_TRUE)
            {
                return(null);
            }

            return(result);
        }
コード例 #5
0
        public void Deserialize(BinaryReader reader)
        {
            RoutineID = reader.ReadUInt16();
            CheckRoutineID = 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 = reader.ReadInt16();
            Mode = (VMQueueMode)reader.ReadByte();
            Flags = (TTABFlags)reader.ReadUInt32();
            Flags2 = (TSOFlags)reader.ReadUInt32();

            UID = reader.ReadUInt16();

            if (reader.ReadBoolean())
            {
                Callback = new VMActionCallbackMarshal();
                Callback.Deserialize(reader);
            }
        }
コード例 #6
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);
            ActionRoutine = context.VM.Assemble(bhav);

            if (input.CheckRoutineID != 0)
            {
                if (input.CheckRoutineID >= 8192) bhav = CodeOwner.Resource.SemiGlobal.Get<BHAV>(input.CheckRoutineID);
                else if (input.CheckRoutineID >= 4096) bhav = CodeOwner.Resource.Get<BHAV>(input.CheckRoutineID);
                else bhav = context.Globals.Resource.Get<BHAV>(input.CheckRoutineID);
                CheckRoutine = 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;
            Mode = input.Mode;
            Flags = input.Flags;
            Flags2 = input.Flags2;
            UID = input.UID;
            Callback = (input.Callback == null)?null:new VMActionCallback(input.Callback, context);
        }