예제 #1
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                Boolset options = (Boolset)(ops1[0x02] & 0xbf);
                int     scope   = this.cbScope.SelectedIndex;
                options[0]  = (scope == 2);
                options[1]  = (scope == 1);
                options[2]  = !this.tfGlobal.Checked;
                options[3]  = !this.tfSemiGlobal.Checked;
                options[4]  = this.tfArgs.Checked;
                options[5]  = this.tfParams.Checked;
                ops1[0x02]  = options;
                ops1[0x02] |= (byte)((doidTree.Value >> 2) & 0x40);

                ops1[0x04] = (byte)(doidTree.Value & 0xff);

                if (this.cbRTBNType.SelectedIndex >= 0)
                {
                    ops1[0x05] = (byte)this.cbRTBNType.SelectedIndex;
                }

                byte[] lohi = { 0, 0 };
                ops1[0x06] = ldocArg1.DataOwner; BhavWiz.FromShort(ref lohi, 0, ldocArg1.Value); ops1[0x07] = lohi[0]; ops2[0x00] = lohi[1];
                ops2[0x01] = ldocArg2.DataOwner; BhavWiz.FromShort(ref ops2, 2, ldocArg2.Value);
                ops2[0x04] = ldocArg3.DataOwner; BhavWiz.FromShort(ref ops2, 5, ldocArg3.Value);
            }
            return(inst);
        }
예제 #2
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                BhavWiz.FromShort(ref ops1, 0, doidAnim.Value);

                ops1[2] = getOptions(lckbOptions1, ops1[2]);

                BhavWiz.FromShort(ref ops1, 4, doidEvent.Value);
                byte[] lohi = { 0, 0 };

                switch (mode)
                {
                case "bwp_Object":
                    ops1[6] = doidObject.DataOwner;
                    BhavWiz.FromShort(ref lohi, 0, doidObject.Value);
                    ops1[7] = lohi[0];
                    ops2[0] = lohi[1];
                    ops2[1] = getScope(ops2[1]);
                    ops2[2] = getOptions(lckbOptions2, ops2[2]);
                    break;

                case "bwp_Sim":
                    ops1[6] = (byte)(doidAnimType.Value & 0xff);
                    ops1[7] = getScope(ops1[7]);
                    ops2[0] = getOptions(lckbOptions2, ops2[0]);
                    ops2[1] = doidIK.DataOwner;
                    BhavWiz.FromShort(ref ops2, 2, doidIK.Value);
                    ops2[4] = getPriority(ops2[4]);
                    break;

                case "bwp_Overlay":
                    ops1[6] = doidObject.DataOwner;
                    BhavWiz.FromShort(ref lohi, 0, doidObject.Value);
                    ops1[7] = lohi[0];
                    ops2[0] = lohi[1];
                    ops2[1] = (byte)(doidAnimType.Value & 0xff);

                    if (inst.NodeVersion != 0)
                    {
                        ops2[3] = getPriority(ops2[3]);
                        Boolset options3 = ops2[4];
                        options3[0] = ckbNotHurryable.Checked;
                        ops2[4]     = options3;
                    }
                    else
                    {
                        ops2[4] = getPriority(ops2[4]);
                    }

                    ops2[6] = getScope(ops2[6]);
                    ops2[7] = getOptions(lckbOptions2, ops2[7]);
                    break;
                }
            }
            return(inst);
        }
예제 #3
0
        private void Unserialize(System.IO.BinaryReader reader)
        {
            setVersion(reader.ReadUInt32());
            simId  = reader.ReadUInt16();
            wantId = reader.ReadUInt32();
            setArgType((ArgTypes)reader.ReadByte());
            switch (argType)
            {
            case ArgTypes.Sim: if (version >= 0x08)
                {
                    setArgUshort(argType, 0x08, reader.ReadUInt16());
                }
                break;

            case ArgTypes.Guid: setArgUint(argType, reader.ReadUInt32()); break;

            case ArgTypes.Category: setArgUint(argType, reader.ReadUInt32()); break;

            case ArgTypes.Skill: setArgUshort(argType, 0, reader.ReadUInt16()); break;

            case ArgTypes.Career: setArgUint(argType, reader.ReadUInt32()); break;

            case ArgTypes.Badge: setArgUint(argType, reader.ReadUInt32()); break;

            default: arg = null; break;
            }
            arg2      = reader.ReadUInt16();
            counter   = reader.ReadUInt32();
            score     = reader.ReadInt32();
            influence = version >= 0x09 ? reader.ReadInt32() : 0;
            flags     = reader.ReadByte();
        }
예제 #4
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1  = inst.Operands;
                wrappedByteArray ops2  = inst.Reserved1;
                Boolset          ops14 = ops1[4];

                ops1[0] = (byte)doid1.Value;
                ops1[1] = (byte)(doid1.Value >> 8);

                if (cbSlotType.SelectedIndex >= 1)
                {
                    ops1[2] = (byte)(cbSlotType.SelectedIndex - 1);
                    ops1[3] = (byte)((cbSlotType.SelectedIndex - 1) >> 8);
                }

                ops14[0] = ckbNFailTrees.Checked;
                ops14[1] = (cbSlotType.SelectedIndex == 0);
                ops14[2] = ckbIgnDstFootprint.Checked;
                ops14[3] = ckbDiffAlts.Checked;
                ops1[4]  = ops14;
            }
            return(inst);
        }
예제 #5
0
        void LoadEPFlags()
        {
            Boolset bs = (ushort)0;

            gbValidEPs1.Enabled = gbValidEPs2.Enabled = false;
            foreach (List <RadioButton> lrb in llrbEPs)
            {
                foreach (RadioButton rb in lrb)
                {
                    rb.Checked = false;
                }
            }

            if (wrapper[0x00] > 0x8b)
            {
                gbValidEPs1.Enabled = true;
                bs = (ushort)wrapper[absEPs[0]];
                for (int i = 0; i < llrbEPs[0].Count; i++)
                {
                    llrbEPs[0][i].Checked = bs[i];
                }

                if (wrapper[0x00] > 0x8c)
                {
                    gbValidEPs2.Enabled = true;
                    bs = (ushort)wrapper[absEPs[1]];
                    for (int i = 0; i < llrbEPs[1].Count; i++)
                    {
                        llrbEPs[1][i].Checked = bs[i];
                    }
                }
            }
        }
예제 #6
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                UInt32 val = Convert.ToUInt32(this.tbGUID.Text, 16);
                ops1[0x00] = (byte)(val & 0xff);
                ops1[0x01] = (byte)(val >> 8 & 0xff);
                ops1[0x02] = (byte)(val >> 16 & 0xff);
                ops1[0x03] = (byte)(val >> 24 & 0xff);

                ops1[0x06] = doid1.DataOwner;
                ops1[0x04] = (byte)(doid1.Value & 0xff);
                ops1[0x05] = (byte)(doid1.Value >> 8 & 0xff);

                Boolset ops1_7 = ops1[0x07];
                ops1_7[0]  = this.ckbOrigGUID.Checked;
                ops1_7[1]  = this.ckbNID.Checked;
                ops1_7[2]  = this.ckbTemp01.Checked;
                ops1[0x07] = ops1_7;
            }
            return(inst);
        }
예제 #7
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1  = inst.Operands;
            wrappedByteArray ops2  = inst.Reserved1;
            Boolset          ops14 = ops1[4];

            //internalchg = true;

            doid1 = new DataOwnerControl(inst, null, null, this.tbVal1, this.ckbDecimal, null, null,
                                         0x07, BhavWiz.ToShort(ops1[0x00], ops1[0x01])); // Literal

            int i = 0;

            if (!ops14[1])
            {
                i = BhavWiz.ToShort(ops1[2], ops1[3]);
            }
            if (i < cbSlotType.Items.Count)
            {
                cbSlotType.SelectedIndex = i;
            }

            ckbNFailTrees.Checked      = ops14[0];
            ckbIgnDstFootprint.Checked = ops14[2];
            ckbDiffAlts.Checked        = ops14[3];

            //internalchg = false;
        }
예제 #8
0
 private void btnNone_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < cklbBoolset.Items.Count; i++)
     {
         cklbBoolset.SetSelected(i, false);
     }
     boolset = (ushort)0;
 }
예제 #9
0
 private byte getOptions(List <CheckBox> lckbOptions, Boolset options)
 {
     for (int i = 0; i < lckbOptions.Count; i++)
     {
         if (lckbOptions[i] != null)
         {
             options[i] = lckbOptions[i].Checked;
         }
     }
     return(options);
 }
예제 #10
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1  = inst.Operands;
            wrappedByteArray ops2  = inst.Reserved1;
            Boolset          ops16 = ops1[6];

            //internalchg = true;

            cbLocation.SelectedIndex  = ((byte)(ops1[2] + 2) < cbLocation.Items.Count) ? (byte)(ops1[2] + 2) : -1;
            cbDirection.SelectedIndex = ((byte)(ops1[3] + 2) < cbDirection.Items.Count) ? (byte)(ops1[3] + 2) : -1;

            ckbNoFailureTrees.Checked     = ops16[1];
            ckbDifferentAltitudes.Checked = ops16[2];

            //internalchg = false;
        }
예제 #11
0
        /// <summary>
        /// Unserializes a BinaryStream into the Attributes of this Instance
        /// </summary>
        /// <param name="reader">The Stream that contains the FileData</param>
        protected override void Unserialize(System.IO.BinaryReader reader)
        {
            filename  = reader.ReadBytes(0x40);
            subver    = reader.ReadUInt16();
            sz.Width  = reader.ReadInt32();
            sz.Height = reader.ReadInt32();
            type      = (Ltxt.LotType)reader.ReadByte();

            roads     = reader.ReadByte();
            rotation  = (Ltxt.Rotation)reader.ReadByte();
            unknown_0 = reader.ReadUInt32();

            lotname     = reader.ReadString();
            description = reader.ReadString();

            unknown_1 = new List <UInt32>();
            int len = reader.ReadInt32();

            for (int i = 0; i < len; i++)
            {
                this.unknown_1.Add(reader.ReadUInt32());
            }

            if (subver >= (UInt16)LtxtSubVersion.Voyage)
            {
                unknown_2 = reader.ReadSingle();
            }
            else
            {
                unknown_2 = 0;
            }
            if (subver >= (UInt16)LtxtSubVersion.Freetime)
            {
                unknown_3 = reader.ReadUInt32();
            }
            else
            {
                unknown_3 = 0;
            }
        }
예제 #12
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1 = inst.Operands;
            wrappedByteArray ops2 = inst.Reserved1;

            internalchg = true;

            setGUID(ops1, 0);

            doid1 = new DataOwnerControl(inst, this.cbDataOwner1, this.cbPicker1, this.tbVal1, this.cbDecimal, this.cbAttrPicker, null,
                                         ops1[0x06], BhavWiz.ToShort(ops1[0x04], ops1[0x05]));

            Boolset ops1_7 = ops1[0x07];

            this.ckbOrigGUID.Checked = ops1_7[0];
            this.ckbNID.Checked      = ops1_7[1];
            this.ckbTemp01.Checked   = ops1_7[2];

            internalchg = false;
        }
예제 #13
0
        public void Execute(Instruction inst)
        {
            this.inst = ldocArg1.Instruction = ldocArg2.Instruction = ldocArg3.Instruction = inst;

            wrappedByteArray ops1 = inst.Operands;
            wrappedByteArray ops2 = inst.Reserved1;

            internalchg = true;

            Boolset options = (byte)(ops1[0x02] & 0x3f);

            this.cbScope.SelectedIndex = 0; // Private
            if (options[0])
            {
                this.cbScope.SelectedIndex = 2;                  // Global
            }
            else if (options[1])
            {
                this.cbScope.SelectedIndex = 1;                  // SemiGlobal
            }
            this.tfSemiGlobal.Checked = !options[3];
            this.tfGlobal.Checked     = !options[2];

            this.cbRTBNType.SelectedIndex = ops1[0x05] < this.cbRTBNType.Items.Count ? ops1[0x05] : -1;

            this.flpArgs.Enabled  = this.tfArgs.Checked = options[4];
            this.tfParams.Checked = options[5];

            doidTree = new DataOwnerControl(null, null, null, this.tbTree, null, null, null, 0x07, BhavWiz.ToShort(ops1[0x04], (byte)((ops1[0x02] >> 6) & 0x01)));
            doidTree.DataOwnerControlChanged += new EventHandler(doidTree_DataOwnerControlChanged);
            doidTree_DataOwnerControlChanged(null, null);

            ldocArg1.Value = BhavWiz.ToShort(ops1[0x07], ops2[0x00]); ldocArg1.DataOwner = ops1[0x06];
            ldocArg2.Value = BhavWiz.ToShort(ops2[0x02], ops2[0x03]); ldocArg2.DataOwner = ops2[0x01];
            ldocArg3.Value = BhavWiz.ToShort(ops2[0x05], ops2[0x06]); ldocArg3.DataOwner = ops2[0x04];

            internalchg = false;
        }
예제 #14
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1  = inst.Operands;
                wrappedByteArray ops2  = inst.Reserved1;
                Boolset          ops16 = ops1[6];

                if (cbLocation.SelectedIndex >= 0)
                {
                    ops1[2] = ((byte)(cbLocation.SelectedIndex - 2));
                }
                if (cbDirection.SelectedIndex >= 0)
                {
                    ops1[3] = ((byte)(cbDirection.SelectedIndex - 2));
                }

                ops16[1] = ckbNoFailureTrees.Checked;
                ops16[2] = ckbDifferentAltitudes.Checked;
                ops1[6]  = ops16;
            }
            return(inst);
        }
예제 #15
0
        public void UpdateGUI(SimPe.Interfaces.Plugin.IFileWrapper wrapper)
        {
            Wrapper.SRel srel = (Wrapper.SRel)wrapper;
            form.wrapper = srel;

            form.tbshortterm.Text = srel.Shortterm.ToString();
            form.tblongterm.Text  = srel.Longterm.ToString();

            List <CheckBox> ltcb = new List <CheckBox>(new CheckBox[] {
                form.cbcrush, form.cblove, form.cbengaged, form.cbmarried,
                form.cbfriend, form.cbbuddie, form.cbsteady, form.cbenemy,
                null, null, null, null,
                null, null, form.cbfamily, form.cbbest,
                null, null, null, null, null, null, null, null,
                /*form.cbBFF*/ null, null, null, null, null, null, null, null,
            });
            Boolset bs1 = srel.RelationState.Value;
            Boolset bs2 = srel.RelationState2.Value;

            for (int i = 0; i < ltcb.Count; i++)
            {
                if (ltcb[i] != null)
                {
                    ltcb[i].Checked = ((Boolset)(i < 16 ? bs1 : bs2))[i & 0x0f];
                }
            }

            form.cbfamtype.SelectedIndex = 0;
            for (int i = 1; i < form.cbfamtype.Items.Count; i++)
            {
                if (form.cbfamtype.Items[i] == new Data.LocalizedRelationshipTypes(srel.FamilyRelation))
                {
                    form.cbfamtype.SelectedIndex = i;
                    break;
                }
            }
        }
예제 #16
0
        private void ChangedState(object sender, System.EventArgs e)
        {
            if (intern)
            {
                return;
            }

            int i = ltcb.IndexOf((TransparentCheckBox)sender);

            if (i >= 0)
            {
                Boolset val = (i < 16) ? Srel.RelationState.Value : Srel.RelationState2.Value;
                val[i & 0x0f] = ((TransparentCheckBox)sender).Checked;
                if (i < 16)
                {
                    Srel.RelationState.Value = val;
                }
                else
                {
                    Srel.RelationState2.Value = val;
                }
                Srel.Changed = true;
            }
        }
예제 #17
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                Boolset option1 = ops1[0];
                if (inst.NodeVersion < 1)
                {
                    if (cbTargetInv.SelectedIndex >= 0)
                    {
                        option1 = (byte)((option1 & 0xfc) | (cbTargetInv.SelectedIndex & 0x03));
                    }

                    option1[2] = rb1Counted.Checked;
                    option1[3] = !ckbTTInvVisible.Checked;
                    option1[4] = !ckbTTInvMemory.Checked;
                }
                else
                {
                    if (cbTargetInv.SelectedIndex >= 0)
                    {
                        option1 = (byte)((option1 & 0xf8) | (cbTargetInv.SelectedIndex & 0x07));
                    }

                    option1[3] = rb1Counted.Checked;
                    option1[4] = !ckbTTInvVisible.Checked;
                    option1[5] = !ckbTTInvMemory.Checked;
                }
                option1[7] = ckbReversed.Checked;
                ops1[0]    = option1;

                ops1[1] = doid0.DataOwner;
                BhavWiz.FromShort(ref ops1, 2, doid0.Value);

                ops1[4] = operation;

                ops1[5] = o5678[0];
                ops1[6] = o5678[1];
                ops1[7] = o5678[2];
                ops2[0] = o5678[3];

                if (inst.NodeVersion >= 2)
                {
                    Boolset option2 = ops2[1];
                    option2[0] = !ckbTTInvShopping.Checked;
                    option2[2] = ckbTTVisible.Checked;
                    option2[3] = ckbTTMemory.Checked;
                    option2[5] = ckbTTShopping.Checked;
                    ops2[1]    = option2;
                }

                ops2[2] = doid2.DataOwner;
                BhavWiz.FromShort(ref ops2, 3, doid2.Value);

                ops2[5] = doid3.DataOwner;
                BhavWiz.FromShort(ref ops2, 6, doid3.Value);
            }
            return(inst);
        }
예제 #18
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1     = inst.Operands;
            wrappedByteArray ops2     = inst.Reserved1;
            Boolset          options1 = null;
            Boolset          options2 = null;
            int scope    = 0;
            int priority = -1;

            internalchg = true;

            foreach (CheckBox c in lckb)
            {
                c.Visible = false;
            }

            doidAnim = new DataOwnerControl(inst, null, null, tbValAnim,
                                            ckbDecimal, ckbAttrPicker, null, 0x07, BhavWiz.ToShort(ops1[0], ops1[1]));
            doidAnim.DataOwnerControlChanged += new EventHandler(doidAnim_DataOwnerControlChanged);

            options1 = ops1[2];

            doidEvent = new DataOwnerControl(inst, null, null, tbValEventTree,
                                             ckbDecimal, ckbAttrPicker, null, 0x07, BhavWiz.ToShort(ops1[4], ops1[5]));
            doidEvent.DataOwnerControlChanged += new EventHandler(doidEvent_DataOwnerControlChanged);

            switch (mode)
            {
            case "bwp_Object":
                doidObject = new DataOwnerControl(inst, cbdoObject, cbPickerObject, tbValObject,
                                                  ckbDecimal, ckbAttrPicker, null, ops1[6], BhavWiz.ToShort(ops1[7], ops2[0]));
                scope    = ops2[1];
                options2 = ops2[2];
                break;

            case "bwp_Sim":
                doidAnimType = new DataOwnerControl(inst, null, null, tbValAnimType,
                                                    ckbDecimal, ckbAttrPicker, null, 0x07, (byte)ops1[6]);
                doidAnimType.DataOwnerControlChanged += new EventHandler(doidAnimType_DataOwnerControlChanged);
                scope    = ops1[7];
                options2 = ops2[0];
                doidIK   = new DataOwnerControl(inst, cbdoIK, cbPickerIK, tbValIK,
                                                ckbDecimal, ckbAttrPicker, null, ops2[1], BhavWiz.ToShort(ops2[2], ops2[3]));
                priority = ops2[4];
                break;

            case "bwp_Overlay":
                doidObject = new DataOwnerControl(inst, cbdoObject, cbPickerObject, tbValObject,
                                                  ckbDecimal, ckbAttrPicker, null, ops1[6], BhavWiz.ToShort(ops1[7], ops2[0]));
                doidAnimType = new DataOwnerControl(inst, null, null, tbValAnimType,
                                                    ckbDecimal, ckbAttrPicker, null, 0x07, (byte)ops2[1]);
                doidAnimType.DataOwnerControlChanged += new EventHandler(doidAnimType_DataOwnerControlChanged);
                if (inst.NodeVersion != 0)
                {
                    priority = ops2[3];
                    ckbNotHurryable.Checked = (ops2[4] & 0x01) != 0;
                    ckbNotHurryable.Visible = true;
                }
                else
                {
                    priority = ops2[4];
                }
                scope    = ops2[6];
                options2 = ops2[7];
                break;
            }

            for (int i = 0; i < lckbOptions1.Count; i++)
            {
                if (lckbOptions1[i] != null)
                {
                    lckbOptions1[i].Visible = true;
                    lckbOptions1[i].Checked = options1[i];
                }
            }

            for (int i = 0; i < lckbOptions2.Count; i++)
            {
                if (lckbOptions2[i] != null)
                {
                    lckbOptions2[i].Visible = true;
                    lckbOptions2[i].Checked = options2[i];
                }
            }

            switch (scope)
            {
            case 0: cbEventScope.SelectedIndex = 0; break;

            case 1: cbEventScope.SelectedIndex = 1; break;

            default: cbEventScope.SelectedIndex = 2; break;
            }

            internalchg = false;

            if (!mode.Equals("bwp_Object"))
            {
                doidAnimType_DataOwnerControlChanged(null, null);
            }
            else
            {
                doidAnim_DataOwnerControlChanged(null, null);
            }
            doidEvent_DataOwnerControlChanged(null, null);
            ckbParam_CheckedChanged(null, null);
            ckbFlipTemp3_CheckedChanged(null, null);
            if (priority < cbPriority.Items.Count)
            {
                cbPriority.SelectedIndex = priority;
            }
        }
예제 #19
0
 /// <summary>
 /// Displays a message box in front of the specified object and with specified text, caption, and buttons.
 /// </summary>
 /// <param name="owner">An implementation of System.Windows.Forms.IWin32Window that will own the modal dialog box.</param>
 /// <param name="text">The text to display in the message box.</param>
 /// <param name="caption">The text to display in the title bar of the message box.</param>
 /// <param name="buttonsVisible">A Boolset of flags specifying which buttons should be visible.</param>
 /// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
 /// <exception cref="System.ArgumentException">buttonsVisible must contain at least three flags</exception>
 public static DialogResult Show(IWin32Window owner, string text, string caption, Boolset buttonsVisible)
 {
     return((new pjseMsgBox(text, caption, buttonsVisible, null, null, null)).ShowDialog(owner));
 }
예제 #20
0
 /// <summary>
 /// Displays a message box with specified text, caption, and buttons.
 /// </summary>
 /// <param name="text">The text to display in the message box.</param>
 /// <param name="caption">The text to display in the title bar of the message box.</param>
 /// <param name="buttonsVisible">A Boolset of flags specifying which buttons should be visible.</param>
 /// <param name="buttonsOverride">A Boolset of flags specifying which buttons should be overriden from buttons.</param>
 /// <param name="buttons">Text for button faces</param>
 /// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
 /// <exception cref="System.ArgumentException">buttonsVisible must contain at least three flags</exception>
 public static DialogResult Show(string text, string caption, Boolset buttonsVisible, Boolset buttonsOverride, string[] buttons)
 {
     return((new pjseMsgBox(text, caption, buttonsVisible, buttonsOverride, buttons, null)).ShowDialog());
 }
예제 #21
0
        public void UpdateScreen()
        {
            ClearScreen();
            if (objd == null)
            {
                return;
            }

            string[] mn = GetModelnames();
            if (mn.Length > 0)
            {
                uint grp = objd.FileDescriptor.Group;
                pb.Image = GenerateImage(pb.Size, GetThumbnail(objd.FileDescriptor.Group, mn[0]), true);
            }
            else
            {
                pb.Image = null;
            }

            if (pb.Image == null)
            {
                pb.Image = defimg;
            }

            SetupCategories(SimPe.Cache.ObjectCacheItem.GetCategory(SimPe.Cache.ObjectCacheItemVersions.DockableOW, objd.FunctionSubSort, objd.Type, SimPe.Cache.ObjectClass.Object));

            SimPe.PackedFiles.Wrapper.StrItemList strs = GetCtssItems();
            if (strs != null)
            {
                if (strs.Count > 0)
                {
                    this.lbName.Text = strs[0].Title;
                }
                if (strs.Count > 1)
                {
                    this.lbAbout.Text = strs[1].Title;
                }
            }
            else
            {
                this.lbName.Text = objd.FileName;
            }

            this.lbPrice.Text = objd.Price.ToString() + " $";

            Boolset       bs      = (ushort)objd.Data[0x40]; // EPFlags1
            List <string> epNames = pjse.BhavWiz.readStr(pjse.GS.BhavStr.GameEditionFlags);

            this.lbEPList.Text = "";
            for (int i = 0; i < bs.Length; i++)
            {
                if (bs[i])
                {
                    this.lbEPList.Text += (this.lbEPList.Text.Length == 0 ? "" : "; ") + epNames[i];
                }
            }

            bs      = (ushort)objd.Data[0x41]; // EPFlags2
            epNames = pjse.BhavWiz.readStr(pjse.GS.BhavStr.UnknownFlags);
            for (int i = 0; i < bs.Length; i++)
            {
                if (bs[i])
                {
                    this.lbEPList.Text += (this.lbEPList.Text.Length == 0 ? "" : "; ") + epNames[i];
                }
            }
        }
예제 #22
0
        /// <summary>
        /// Unserializes a BinaryStream into the Attributes of this Instance
        /// </summary>
        /// <param name="reader">The Stream that contains the FileData</param>
        protected override void Unserialize(System.IO.BinaryReader reader)
        {
            ver       = reader.ReadUInt16();
            subver    = reader.ReadUInt16();
            sz.Width  = reader.ReadInt32();
            sz.Height = reader.ReadInt32();
            type      = (LotType)reader.ReadByte();

            roads     = reader.ReadByte();
            rotation  = (Rotation)reader.ReadByte();
            unknown_0 = reader.ReadUInt32();

            lotname     = StreamHelper.ReadString(reader);
            description = StreamHelper.ReadString(reader);

            unknown_1 = new List <float>();
            int len = reader.ReadInt32();

            for (int i = 0; i < len; i++)
            {
                this.unknown_1.Add(reader.ReadSingle());
            }

            if (subver >= (UInt16)LtxtSubVersion.Voyage)
            {
                unknown_3 = reader.ReadSingle();
            }
            else
            {
                unknown_3 = 0;
            }
            if (subver >= (UInt16)LtxtSubVersion.Freetime)
            {
                unknown_4 = reader.ReadUInt32();
            }
            else
            {
                unknown_4 = 0;
            }

            if (ver >= (UInt16)LtxtVersion.Apartment || subver >= (UInt16)LtxtSubVersion.Apartment)
            {
                unknown_5 = reader.ReadBytes(14);
            }
            else
            {
                unknown_5 = new byte[0];
            }

            int y = reader.ReadInt32();
            int x = reader.ReadInt32();

            loc = new Point(x, y);

            elevation   = reader.ReadSingle();
            lotInstance = reader.ReadUInt32();
            orient      = (LotOrientation)reader.ReadByte();

            texture = StreamHelper.ReadString(reader);

            unknown_2 = reader.ReadByte();

            if (ver >= (int)LtxtVersion.Business)
            {
                owner = reader.ReadUInt32();
            }
            else
            {
                owner = 0;
            }

            if (ver >= (UInt16)LtxtVersion.Apartment || subver >= (UInt16)LtxtSubVersion.Apartment)
            {
                int count;

                apartmentBase = reader.ReadUInt32();
                unknown_6     = reader.ReadBytes(9);

                subLots = new List <SubLot>();
                count   = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    subLots.Add(new SubLot(reader));
                }

                unknown_7 = new List <uint>();
                count     = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    unknown_7.Add(reader.ReadUInt32());
                }
            }
            else
            {
                apartmentBase = 0;
                unknown_6     = new byte[0];
                subLots       = new List <SubLot>();
                unknown_7     = new List <uint>();
            }

            followup = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
        }
예제 #23
0
 /// <summary>
 /// Displays a message box in front of the specified object and with specified text, caption, and buttons.
 /// </summary>
 /// <param name="owner">An implementation of System.Windows.Forms.IWin32Window that will own the modal dialog box.</param>
 /// <param name="text">The text to display in the message box.</param>
 /// <param name="caption">The text to display in the title bar of the message box.</param>
 /// <param name="buttonsVisible">A Boolset of flags specifying which buttons should be visible.</param>
 /// <param name="buttonsOverride">A Boolset of flags specifying which buttons should be overriden from buttons.</param>
 /// <param name="buttons">Text for button faces</param>
 /// <param name="resultSet">DialogResult values for buttons</param>
 /// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
 /// <exception cref="System.ArgumentException">buttonsVisible must contain at least three flags</exception>
 public static DialogResult Show(IWin32Window owner, string text, string caption, Boolset buttonsVisible, Boolset buttonsOverride, string[] buttons, DialogResult[] resultSet)
 {
     return((new pjseMsgBox(text, caption, buttonsVisible, buttonsOverride, buttons, resultSet)).ShowDialog(owner));
 }
예제 #24
0
        /// <summary>
        /// List available resources of a given type, allowing the user to select one.
        /// </summary>
        /// <param name="resourceType">Type of resource to list</param>
        /// <param name="group">Group number of "this" group</param>
        /// <param name="form">Parent form</param>
        /// <param name="skip_pages">A flag per page (this package, private, semi, global, prim) to suppress pages</param>
        /// <param name="canDoEA">Whether to differentiate overriding resources</param>
        /// <returns>The chosen resource entry</returns>
        public pjse.FileTable.Entry Execute(uint resourceType, uint group, Control form, bool canDoEA, Boolset skip_pages)
        {
            CanDoEA = canDoEA;

            form.Cursor = Cursors.WaitCursor;
            this.Cursor = Cursors.WaitCursor;

            List <TabPage> ltp = new List <TabPage>(new TabPage[] { tpPackage, tpGroup, tpSemiGroup, tpGlobalGroup, tpBuiltIn });

            btnViewBHAV.Visible = resourceType == SimPe.Data.MetaData.BHAV_FILE;

            this.tcResources.TabPages.Clear();

            // There doesn't appear to be a way to compare two paths and have the OS decide if they refer to the same object
            if (!skip_pages[0] &&
                pjse.FileTable.GFT.CurrentPackage != null &&
                pjse.FileTable.GFT.CurrentPackage.FileName != null &&
                !pjse.FileTable.GFT.CurrentPackage.FileName.ToLower().EndsWith("objects.package"))
            {
                FillPackage(resourceType, this.lvPackage, this.tpPackage);
            }

            if (!skip_pages[1])
            {
                FillGroup(resourceType, group, this.lvGroup, this.tpGroup);
            }

            if (!skip_pages[2])
            {
                Glob g = pjse.BhavWiz.GlobByGroup(group);
                if (g != null)
                {
                    FillGroup(resourceType, g.SemiGlobalGroup, this.lvSemi, this.tpSemiGroup);
                    this.tpSemiGroup.Text = g.SemiGlobalName;
                }
            }

            if (!skip_pages[3] && group != (uint)Group.Global)
            {
                FillGroup(resourceType, (uint)Group.Global, this.lvGlobal, this.tpGlobalGroup);
            }

            if (!skip_pages[4] && resourceType == SimPe.Data.MetaData.BHAV_FILE)
            {
                FillBuiltIn(resourceType, this.lvPrim, this.tpBuiltIn);
            }

            if (this.tcResources.TabCount > 0)
            {
                if (tcResources.Contains(ltp[PersistentTab]))
                {
                    tcResources.SelectTab(ltp[PersistentTab]);
                }
                else
                {
                    this.tcResources.SelectedIndex = 0;
                }
            }

            form.Cursor = Cursors.Default;
            this.Cursor = Cursors.Default;
            this.Size   = ChooserSize;

            DialogResult dr = ShowDialog();

            while (dr == DialogResult.Retry)
            {
                dr = ShowDialog();
            }

            ChooserSize   = this.Size;
            PersistentTab = ltp.IndexOf(this.tcResources.SelectedTab);
            Close();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                ListView lv = getListView();

                if (lv != null)
                {
                    if (lv != lvPrim)
                    {
                        return((pjse.FileTable.Entry)lv.SelectedItems[0].Tag);
                    }
                    else
                    {
                        IPackedFileDescriptor pfd = new SimPe.Packages.PackedFileDescriptor();
                        pfd.Instance = (uint)lvPrim.SelectedItems[0].Tag;
                        return(new pjse.FileTable.Entry(null, pfd, true, true));
                    }
                }
            }
            return(null);
        }
예제 #25
0
        protected void UpdateContent()
        {
            this.Enabled = (Srel != null);
            if (Srel == null)
            {
                return;
            }
            intern            = true;
            this.pbDay.Value  = Srel.Shortterm;
            this.pbLife.Value = Srel.Longterm;

            Boolset bs = Srel.RelationState.Value;

            for (int i = 0; i < bs.Length; i++)
            {
                if (ltcb[i] != null)
                {
                    ltcb[i].Checked = bs[i];
                }
            }
            if (Srel.RelationState2 != null)
            {
                bs = Srel.RelationState2.Value;
                for (int i = 0; i < bs.Length; i++)
                {
                    if (ltcb[i + 16] != null)
                    {
                        ltcb[i + 16].Enabled = true;
                        ltcb[i + 16].Checked = bs[i];
                    }
                }
            }
            else
            {
                for (int i = 0; i < bs.Length; i++)
                {
                    if (ltcb[i + 16] != null)
                    {
                        ltcb[i + 16].Enabled = false;
                    }
                }
            }

            this.cbfamtype.SelectedIndex = 0;
            for (int i = 1; i < this.cbfamtype.Items.Count; i++)
            {
                if (this.cbfamtype.Items[i] == new Data.LocalizedRelationshipTypes(srel.FamilyRelation))
                {
                    this.cbfamtype.SelectedIndex = i;
                    break;
                }
            }

            this.tbRel.Text = "0x" + Helper.HexString((uint)srel.FamilyRelation);
            intern          = false;

            if (ChangedContent != null)
            {
                ChangedContent(this, new EventArgs());
            }
        }
예제 #26
0
        // public pjseMsgBox() : this("", "", "001", null, null, null) { }

        private pjseMsgBox(string text, string caption,
                           Boolset buttonsVisible, Boolset bsBtns, string[] sBtns, DialogResult[] adr)
        {
            InitializeComponent();

            this.tbMessage.Text = text;
            this.Text           = caption;

            if (buttonsVisible.Length < 3)
            {
                throw new ArgumentException("need three (or more) flags", "buttonsVisible");
            }

            //button1.Visible = buttonsVisible[0];
            //button2.Visible = buttonsVisible[1];
            //button3.Visible = buttonsVisible[2];
            if (!buttonsVisible[0])
            {
                tlpButtons.Controls.Remove(button1);
            }
            if (!buttonsVisible[1])
            {
                tlpButtons.Controls.Remove(button2);
            }
            if (!buttonsVisible[2])
            {
                tlpButtons.Controls.Remove(button3);
            }

            if (bsBtns != null && sBtns != null)
            {
                if (bsBtns.Length >= 1 && sBtns.Length >= 1 && bsBtns[0])
                {
                    button1.Text = sBtns[0];
                }
                if (bsBtns.Length >= 2 && sBtns.Length >= 2 && bsBtns[1])
                {
                    button2.Text = sBtns[1];
                }
                if (bsBtns.Length >= 3 && sBtns.Length >= 3 && bsBtns[2])
                {
                    button3.Text = sBtns[2];
                }
            }
            if (adr != null)
            {
                if (bsBtns.Length >= 1 && adr.Length >= 1 && bsBtns[0])
                {
                    button1.DialogResult = adr[0];
                }
                if (bsBtns.Length >= 2 && adr.Length >= 2 && bsBtns[1])
                {
                    button2.DialogResult = adr[1];
                }
                if (bsBtns.Length >= 3 && adr.Length >= 3 && bsBtns[2])
                {
                    button3.DialogResult = adr[2];
                }
            }
            else
            {
                button1.DialogResult = DialogResult.OK;
                button2.DialogResult = DialogResult.Cancel;
                button3.DialogResult = DialogResult.None;
            }

            int x = Convert.ToInt32((this.Width - tlpButtons.Width) / 2);

            tlpButtons.Left = x;

            this.AcceptButton = this.CancelButton = null;
            foreach (Button b in new Button[] { button1, button2, button3 })
            {
                if (b.DialogResult == DialogResult.OK)
                {
                    this.AcceptButton = b;
                }
                if (b.DialogResult == DialogResult.Cancel)
                {
                    this.CancelButton = b;
                }
            }
        }
예제 #27
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1 = inst.Operands;
            wrappedByteArray ops2 = inst.Reserved1;

            o5678[0] = ops1[5];
            o5678[1] = ops1[6];
            o5678[2] = ops1[7];
            o5678[3] = ops2[0];

            internalchg = true;

            Boolset option1 = ops1[0];

            if (inst.NodeVersion < 1)
            {
                // In the parser we have something like this...
                //option1 = (inst.NodeVersion >= 1) ? ops1[0] : (byte)(((ops1[0] & 0x3C) << 1) | (ops1[0] & 0x83));
                // 8765 4321
                // 0065 4300 <<1 =
                // 0654 3000 |
                // 8000 0021 =
                // 8654 3021

                List <String> aS = new List <string>(aInventoryType.ToArray());
                aS.RemoveRange(4, aS.Count - 4);
                cbTargetInv.Items.Clear();
                cbTargetInv.Items.AddRange(aS.ToArray());
                cbInventory.Items.Clear();
                cbInventory.Items.AddRange(aS.ToArray());
                cbTargetInv.SelectedIndex = ((option1 & 0x03) < cbTargetInv.Items.Count) ? option1 & 0x03 : -1;

                rb1Counted.Checked      = option1[2];
                ckbTTInvVisible.Checked = !option1[3];
                ckbTTInvMemory.Checked  = !option1[4];
            }
            else
            {
                cbTargetInv.Items.Clear();
                cbTargetInv.Items.AddRange(aInventoryType.ToArray());
                cbInventory.Items.Clear();
                cbInventory.Items.AddRange(aInventoryType.ToArray());
                cbTargetInv.SelectedIndex = ((option1 & 0x07) < cbTargetInv.Items.Count) ? option1 & 0x07 : -1;

                rb1Counted.Checked      = option1[3];
                ckbTTInvVisible.Checked = !option1[4];
                ckbTTInvMemory.Checked  = !option1[5];
            }
            ckbReversed.Checked = option1[7];

            pnDoid0.Enabled     = (cbTargetInv.SelectedIndex >= 1 && cbTargetInv.SelectedIndex <= 3);
            lbDoid0.Text        = pnDoid0.Enabled ? cbTargetInv.SelectedItem.ToString() : "";
            rb1Singular.Checked = !rb1Counted.Checked;

            doid0 = new DataOwnerControl(inst, cbDataOwner0, cbPicker0, tbVal0,
                                         ckbDecimal, ckbAttrPicker, null, ops1[1], BhavWiz.ToShort(ops1[2], ops1[3]));

            operation = ops1[4];

            doid1 = new DataOwnerControl(inst, cbDataOwner1, cbPicker1, tbVal1,
                                         ckbDecimal, ckbAttrPicker, null, o5678[1], BhavWiz.ToShort(o5678[2], o5678[3]));
            doid1.DataOwnerControlChanged += new EventHandler(doid1_DataOwnerControlChanged);

            ckbTTVisible.Enabled = ckbTTMemory.Enabled = ckbTTShopping.Enabled = (inst.NodeVersion >= 2);
            if (inst.NodeVersion >= 2)
            {
                Boolset option2 = ops2[1];
                ckbTTInvShopping.Checked = !option2[0];
                ckbTTVisible.Checked     = option2[2];
                ckbTTMemory.Checked      = option2[3];
                ckbTTShopping.Checked    = option2[5];
            }

            doid2 = new DataOwnerControl(inst, cbDataOwner2, cbPicker2, tbVal2,
                                         ckbDecimal, ckbAttrPicker, null, ops2[2], BhavWiz.ToShort(ops2[3], ops2[4]));

            doid3 = new DataOwnerControl(inst, cbDataOwner3, cbPicker3, tbVal3,
                                         ckbDecimal, ckbAttrPicker, null, ops2[5], BhavWiz.ToShort(ops2[6], ops2[7]));


            if (rb1Counted.Checked)
            {
                doCounted();
            }
            else
            {
                doSingular();
            }

            cbOperation.SelectedIndex = (operation < cbOperation.Items.Count) ? operation : -1;

            internalchg = false;
        }