Esempio n. 1
0
        public R FillSlot(SlotValue value)
        {
            if (this is Slot)
            {
                return(cast <R>((this as Slot).FillIfSelected(value)));
            }

            var rewritten = new List <SyntaxRule>();

            foreach (var term in Terms)
            {
                switch (term)
                {
                case Slot s:
                    rewritten.Add(s.FillIfSelected(value));
                    break;

                default:
                    rewritten.Add(term.FillTypedSlot(value));
                    break;
                }
            }

            return(Define(RuleName, rewritten, Description.ValueOrDefault()));
        }
Esempio n. 2
0
    public void ChangePlayerModel(PedHash hash)
    {
        var model = new Model(hash);

        // only in recent script hook

        /*
         * if (!Game.Player.ChangeModel(model))
         * {
         *  UI.Notify("could not request model");
         * }
         */
        if (!model.IsInCdImage || !model.IsPed || !model.Request(1000))
        {
            UI.Notify("could not request model");
        }
        else
        {
            Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, model.Hash);
            Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
            if (hash == PedHash.FreemodeMale01 || hash == PedHash.FreemodeFemale01)
            {
                // must call SET_PED_HEAD_BLEND_DATA otherwise head overlays don't work
                var slot_key   = new SlotKey(SlotType.Parent, 0);
                var slot_value = new SlotValue(0, 0, 4, 4);
                var ped        = Game.Player.Character;
                SetSlotValue(ped, slot_key, slot_value);
            }
            data.Clear();
        }
        model.MarkAsNoLongerNeeded();
    }
Esempio n. 3
0
 private void EnsureSetter(SlotValue value)
 {
     if (value.Setter == null)
     {
         value.Setter = (object instance, object setvalue) => ((IPythonObject)instance).GetSlots()[_index] = setvalue;
     }
 }
Esempio n. 4
0
 private void MarkEntries(int x, int y, int numEntries, SlotValue value)
 {
     for (int j = y; j < y + numEntries; ++j)
     {
         for (int i = x; i < x + numEntries; ++i)
         {
             m_AtlasSlots[j * m_AtlasResolutionInSlots + i] = value;
         }
     }
 }
 protected override void ReadData(RdmBinaryReader data)
 {
     for (int n = 0; n < Header.ParameterDataLength / 3; n++)
     {
         SlotValue slot = new SlotValue();
         slot.Offset = data.ReadNetwork16();
         slot.Value  = data.ReadByte();
         DefaultValues.Add(slot);
     }
 }
    private static IEnumerator InputCoroutine(string utt, result callback)
    {
        var data = System.Text.Encoding.UTF8.GetBytes(
            Json.Serialize(new Dictionary <string, object>()
        {
            { "projectKey", "OSU" },
            { "appInfo", new Dictionary <string, object>()
              {
                  { "appKey", "TAH_VR" }
              } },
            { "clientVer", "1.0.0" },
            { "language", "ja" },
            { "userUtterance", new Dictionary <string, object>()
              {
                  { "utteranceText", utt }
              } }
        })
            );

        var headers = new Dictionary <string, string>()
        {
            { "Content-Type", "application/x-www-form-urlencoded" }
        };

        var www = new WWW(API_URL, data, headers);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            Debug.LogError("www Error:" + www.error);
            yield break;
        }

        string response     = System.Text.Encoding.UTF8.GetString(www.bytes);
        var    dialogStatus = JsonNode.Parse(response)["dialogStatus"];

        var slots = new Dictionary <string, SlotValue>();

        if (dialogStatus.Get <Dictionary <string, object> >().ContainsKey("slotStatus"))
        {
            foreach (var slot in dialogStatus["slotStatus"])
            {
                var sv = new SlotValue();
                sv.slotValue = slot["slotValue"].Get <string>();
                sv.valueType = slot["valueType"].Get <string>();
                slots.Add(slot["slotName"].Get <string>(), sv);
            }
        }

        callback(utt, dialogStatus["command"]["commandName"].Get <string>(), slots);
    }
Esempio n. 7
0
        /**************/
        /* AssignData */
        /**************/
        private void AssignData(
            List <Module> theModules,
            List <FactInstance> theEntityList,
            Dictionary <ulong, BitArray> theScopes)
        {
            modules    = theModules;
            entityList = theEntityList;
            scopes     = theScopes;

            moduleDataGridView.ItemsSource = theModules;

            CreateEntitySource();

            if (theModules.Count == 0)
            {
                moduleDataGridView.SelectedItem = null;
            }
            else
            {
                moduleDataGridView.SelectedItem = theModules.First();
            }

            if (entityDataGridView.Items.Count != 0)
            {
                FactInstance theEntity = entityDataGridView.Items[0] as FactInstance;

                entityDataGridView.SelectedItem = theEntity;

                CreateSlotListSource(theEntity);

                if (slotDataGridView.Items.Count != 0)
                {
                    SlotValue theSlotValue = slotDataGridView.Items[0] as SlotValue;
                    slotDataGridView.SelectedItem = theSlotValue;
                }
            }
            else
            {
                slotDataGridView.ItemsSource = null;
                slotSourceList   = null;
                entitySourceList = null;
                entityCollection = null;
                slotCollection   = null;
            }
        }
Esempio n. 8
0
    public void FreemodeUndressSlot(Ped ped, SlotKey slot_key)
    {
        var slot_value = new SlotValue(0, 0, 0, 0);

        if (slot_key.typ == SlotType.CompVar)
        {
            var hash = (PedHash)ped.Model.Hash;
            if (hash == PedHash.FreemodeMale01)
            {
                slot_value.index1 = mp_male_undress_drawable[slot_key.id];
            }
            else if (hash == PedHash.FreemodeFemale01)
            {
                slot_value.index1 = mp_female_undress_drawable[slot_key.id];
            }
        }
        SetSlotValue(ped, slot_key, slot_value);
    }
        public override int SetValueAsString(string pszValue, uint dwRadix, uint dwTimeout)
        {
            var stackFrameVal = Value as DalvikStackFrameValue;

            if (stackFrameVal == null || !Value.IsPrimitive)
            {
                return(VSConstants.E_FAIL);
            }

            object val = ParsePrimitive(pszValue, Value.Tag, (int)dwRadix);

            // is there as simpler way to grab the debugger?
            var debugger = _stackFrame.Thread.Program.Process.Debugger;

            var slotValue = new SlotValue(stackFrameVal.Variable.Slot, Value.Tag, val);

            debugger.StackFrame.SetValuesAsync(_stackFrame.Thread.Id, _stackFrame.Id, slotValue)
            .Await((int)dwTimeout);
            _stackFrame.InvalidateVariablesValueCache();
            return(VSConstants.S_OK);
        }
Esempio n. 10
0
    public void LoadActor(UIMenuItem item, int slot)
    {
        var path = GetActorFilename(slot);

        UI.Notify(String.Format("Loading actor from {0}", path));
        var reader = new XmlTextReader(path);

        while (reader.Read())
        {
            if (reader.Name == "SetPlayerModel")
            {
                ped_data.ChangePlayerModel(_pedhash[reader.GetAttribute("name")]);
            }
            else if (reader.Name == "SetSlotValue")
            {
                var key = new SlotKey(reader);
                var val = new SlotValue(reader);
                ped_data.SetSlotValue(Game.Player.Character, key, val);
            }
        }
    }
Esempio n. 11
0
        /**************/
        /* SlotFilter */
        /**************/
        private void SlotFilter(object sender, FilterEventArgs e)
        {
            SlotValue slot = e.Item as SlotValue;

            if (slot == null)
            {
                return;
            }

            if (!slot.IsDefault)
            {
                e.Accepted = true;
            }
            else if (displayDefaultsCheckBox.IsChecked == true)
            {
                e.Accepted = true;
            }
            else
            {
                e.Accepted = false;
            }
        }
Esempio n. 12
0
        /*****************/
        /* EntityChanged */
        /*****************/
        private void EntityChanged(object sender, SelectionChangedEventArgs e)
        {
            FactInstance theEntity;

            if (e.RemovedItems.Count != 1)
            {
                return;
            }
            if (e.AddedItems.Count != 1)
            {
                return;
            }

            theEntity = (FactInstance)e.AddedItems[0];

            CreateSlotListSource(theEntity);

            if (slotDataGridView.Items.Count != 0)
            {
                SlotValue theSV = slotDataGridView.Items[0] as SlotValue;
                slotDataGridView.SelectedItem = theSV;
            }
        }
Esempio n. 13
0
        /**************************/
        /* ReselectEntityAndSlots */
        /**************************/
        private void ReselectEntityAndSlots()
        {
            if (entityDataGridView.Items.Count != 0)
            {
                FactInstance theEntity;

                theEntity = entityDataGridView.Items[0] as FactInstance;

                entityDataGridView.SelectedItem = theEntity;

                CreateSlotListSource(theEntity);
                if (slotDataGridView.Items.Count != 0)
                {
                    SlotValue theSV = slotDataGridView.Items[0] as SlotValue;
                    slotDataGridView.SelectedItem = theSV;
                }
            }
            else
            {
                slotDataGridView.ItemsSource = null;
                slotSourceList = null;
                slotCollection = null;
            }
        }
Esempio n. 14
0
 public void SetSlotValue(Ped ped, SlotKey slot_key, SlotValue slot_value)
 {
     // store it
     if (slot_value.index1 == 0 && slot_value.index2 == 0 && slot_value.index3 == 0 && slot_value.index4 == 0)
         data.Remove(slot_key);
     else
         data[slot_key] = slot_value;
     // change game state accordingly
     switch (slot_key.typ)
     {
         case SlotType.CompVar:
             Function.Call(
                 Hash.SET_PED_COMPONENT_VARIATION,
                 ped.Handle,
                 slot_key.id, slot_value.index1, slot_value.index2, 0);
             if (slot_key.id == 2) // hair: use index3 and index4
                 Function.Call(Hash._SET_PED_HAIR_COLOR, ped.Handle, slot_value.index3, slot_value.index4);
             break;
         case SlotType.Prop:
             if (slot_value.index1 == 0)
                 Function.Call(Hash.CLEAR_PED_PROP, ped.Handle, slot_key.id);
             else
                 Function.Call(Hash.SET_PED_PROP_INDEX, ped.Handle, slot_key.id, slot_value.index1 - 1, slot_value.index2, true);
             break;
         case SlotType.HeadOverlay:
             if (slot_value.index1 == 0)
                 Function.Call(Hash.SET_PED_HEAD_OVERLAY, ped.Handle, slot_key.id, 0, 0.0f);
             else
             {
                 // index2 is opacity
                 Function.Call(Hash.SET_PED_HEAD_OVERLAY, ped.Handle, slot_key.id, slot_value.index1 - 1, (8 - slot_value.index2) / 8.0f);
                 // takes color (index3) and highlight color (index4), but the latter is ignored
                 // so use index3 for both colors just in case
                 var color_type = mp_head_overlay_color_type[slot_key.id];
                 switch (color_type)
                 {
                     case ColorType.Hair:
                         Function.Call(Hash._SET_PED_HEAD_OVERLAY_COLOR, ped.Handle, slot_key.id, 1, slot_value.index3, slot_value.index3);
                         break;
                     case ColorType.Makeup:
                         Function.Call(Hash._SET_PED_HEAD_OVERLAY_COLOR, ped.Handle, slot_key.id, 2, slot_value.index3, slot_value.index3);
                         break;
                 }
             }
             break;
         case SlotType.Eye:
             Function.Call(Hash._SET_PED_EYE_COLOR, ped.Handle, slot_value.index1);
             break;
         case SlotType.Parent:
             // get current parent info
             var par = GetSlotValue(new SlotKey(SlotType.Parent, 0));
             var shape1 = par.index1;
             var shape2 = par.index2;
             var skin1 = par.index1;
             var skin2 = par.index2;
             float shapemix = par.index3 / 8.0f;
             float skinmix = par.index4 / 8.0f;
             Function.Call(
                 Hash.SET_PED_HEAD_BLEND_DATA, ped.Handle,
                 shape1, shape2, 0, skin1, skin2, 0, shapemix, skinmix, 0.0f);
             break;
     }
 }
Esempio n. 15
0
 public void FreemodeUndressSlot(Ped ped, SlotKey slot_key)
 {
     var slot_value = new SlotValue(0, 0, 0, 0);
     if (slot_key.typ == SlotType.CompVar)
     {
         var hash = (PedHash)ped.Model.Hash;
         if (hash == PedHash.FreemodeMale01)
             slot_value.index1 = mp_male_undress_drawable[slot_key.id];
         else if (hash == PedHash.FreemodeFemale01)
             slot_value.index1 = mp_female_undress_drawable[slot_key.id];
     }
     SetSlotValue(ped, slot_key, slot_value);
 }
Esempio n. 16
0
 public void ChangePlayerModel(PedHash hash)
 {
     var model = new Model(hash);
     // only in recent script hook
     /*
     if (!Game.Player.ChangeModel(model))
     {
         UI.Notify("could not request model");
     }
     */
     if (!model.IsInCdImage || !model.IsPed || !model.Request(1000))
     {
         UI.Notify("could not request model");
     }
     else
     {
         Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, model.Hash);
         Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
         if (hash == PedHash.FreemodeMale01 || hash == PedHash.FreemodeFemale01)
         {
             // must call SET_PED_HEAD_BLEND_DATA otherwise head overlays don't work
             var slot_key = new SlotKey(SlotType.Parent, 0);
             var slot_value = new SlotValue(0, 0, 4, 4);
             var ped = Game.Player.Character;
             SetSlotValue(ped, slot_key, slot_value);
         }
         data.Clear();
     }
     model.MarkAsNoLongerNeeded();
 }
Esempio n. 17
0
 public void LoadActor(UIMenuItem item, int slot)
 {
     var path = GetActorFilename(slot);
     UI.Notify(String.Format("Loading actor from {0}", path));
     var reader = new XmlTextReader(path);
     while (reader.Read())
     {
         if (reader.Name == "SetPlayerModel")
         {
             ped_data.ChangePlayerModel(_pedhash[reader.GetAttribute("name")]);
         }
         else if (reader.Name == "SetSlotValue")
         {
             var key = new SlotKey(reader);
             var val = new SlotValue(reader);
             ped_data.SetSlotValue(Game.Player.Character, key, val);
         }
     }
 }
Esempio n. 18
0
 private void EnsureSetter(SlotValue value) {
     if (value.Setter == null) {
         value.Setter = (object instance, object setvalue) => ((IObjectWithSlots)instance).GetSlots()[_index] = setvalue;
     }
 }
Esempio n. 19
0
        /// <summary>
        ///
        /// </summary>
        public int SetNextStatement(IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext)
        {
            // TODO: move this code to DalvikThread, or to a SetNextInstructionManager
            DLog.Debug(DContext.VSDebuggerComCall, "IDebugThread2.SetNextStatement");

            var stack = (DebugStackFrame)pStackFrame;
            var ctx   = (DebugCodeContext)pCodeContext;

            // nothing to do.
            if (ctx.Location.Equals(stack.Location))
            {
                return(VSConstants.S_OK);
            }

            if (!ctx.Location.IsSameMethod(stack.Location))
            {
                return(HResults.E_CANNOT_SETIP_TO_DIFFERENT_FUNCTION);
            }

            var loc = stack.GetDocumentLocationAsync().Await(DalvikProcess.VmTimeout);

            if (loc.MethodEntry == null)
            {
                DLog.Info(DContext.VSStatusBar, "Can not set next instruction: Debug info not available.");
                return(HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL);
            }

            var nextInstrVar = loc.MethodEntry.Variables.FirstOrDefault(v => v.Name == DebuggerConstants.SetNextInstructionVariableName);

            if (nextInstrVar == null)
            {
                DLog.Info(DContext.VSStatusBar, "Can not set next instruction: missing compiler setting or method optimized.");
                return(HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL);
            }

            // make sure there are no branch instructions
            // between the current instruction and our branch instruction.
            // note that for convinence, we *do* allow assignments to
            // fields of objects, even though these are visible to the
            // program.
            var disassembly = Program.DisassemblyProvider.GetFromLocation(loc);

            if (disassembly == null)
            {
                return(HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL);
            }

            var body = disassembly.Method.Body;
            int idx  = body.Instructions.FindIndex(i => (ulong)i.Offset == loc.Location.Index);

            if (idx == -1)
            {
                return(HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL);
            }

            bool foundSetNextInstruction = false;

            for (; idx < body.Instructions.Count; ++idx)
            {
                var ins = body.Instructions[idx];
                foundSetNextInstruction = ins.OpCode == OpCodes.If_nez && ins.Registers.Count == 1 &&
                                          ins.Registers[0].Index == nextInstrVar.Register;

                if (foundSetNextInstruction)
                {
                    break;
                }

                if (ins.OpCode.IsJump())
                {
                    break;
                }
            }

            if (!foundSetNextInstruction)
            {
                DLog.Info(DContext.VSStatusBar, "Can not set next instruction from current position. Try again at a later position if any.");
                return(HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL);
            }

            DLog.Info(DContext.VSStatusBar, "Setting next instruction to beginning of block.");

            // find target instruction.
            var targetIns = (Instruction)body.Instructions[idx].Operand;

            idx       = body.Instructions.FindIndex(p => p.Offset == targetIns.Offset);
            idx       = FindNextLocationWithSource(disassembly, idx) ?? idx;
            targetIns = body.Instructions[idx];
            var targetLoc = loc.Location.GetAtIndex(targetIns.Offset);

            // set a temporary breakpoint. The reset logic could get into a "DalvikTemporaryBreakpoint" class.
            var bp        = new DalvikAwaitableBreakpoint(targetLoc);
            var waitBp    = bp.WaitUntilHit();
            var waitBound = Debugger.Process.BreakpointManager.SetBreakpoint(bp);

            try
            {
                if (!waitBound.Await(DalvikProcess.VmTimeout))
                {
                    return(HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL);
                }

                // set the special variable.
                var newSlotVal = new SlotValue(nextInstrVar.Register, Jdwp.Tag.Int, 1);
                Debugger.StackFrame.SetValuesAsync(stack.Thread.Id, stack.Id, newSlotVal)
                .Await(DalvikProcess.VmTimeout);

                // resume the process.
                Debugger.Process.ResumeAsync();

                // wait for breakpoint to be hit.
                try
                {
                    waitBp.Await(1000);
                }
                catch (Exception)
                {
                    // ups. something went wrong. suspend again.
                    if (!Debugger.Process.IsSuspended)
                    {
                        Debugger.Process.SuspendAsync();
                    }
                    return(VSConstants.E_FAIL);
                }

                return(VSConstants.S_OK);
            }
            finally
            {
                // clear the breakpoint again.
                Debugger.Process.BreakpointManager.ResetAsync(bp)
                .Await(DalvikProcess.VmTimeout);
                // reset the special variable, in case this was not performed automatically.
                // (should not happen, but maybe the set value code got optimized away per
                //  accident)
                var newSlotVal = new SlotValue(nextInstrVar.Register, Jdwp.Tag.Int, 0);
                Debugger.StackFrame.SetValuesAsync(stack.Thread.Id, stack.Id, newSlotVal)
                .Await(DalvikProcess.VmTimeout);
            }
        }
Esempio n. 20
0
 private void EnsureGetter(SlotValue value) {
     if (value.Getter == null) {
         value.Getter = (object instance) => ((IPythonObject)instance).GetSlots()[_index];
     }
 }
Esempio n. 21
0
        /********************/
        /* RestoreSelection */
        /********************/
        private void RestoreSelection()
        {
            int          i, count;
            bool         found;
            Module       theModule;
            FactInstance theEntity;

            moduleDataGridView.SelectedItem = null;
            entityDataGridView.SelectedItem = null;

            if (lastModuleRow == -1)
            {
                if (moduleDataGridView.Items.Count > 0)
                {
                    theModule = moduleDataGridView.Items[0] as Module;
                    moduleDataGridView.SelectedItem = theModule;
                }
            }
            else
            {
                count = moduleDataGridView.Items.Count;
                found = false;

                if (lastModuleRow < count)
                {
                    theModule = moduleDataGridView.Items[lastModuleRow] as Module;

                    if (theModule.ModuleName.Equals(lastModule))
                    {
                        moduleDataGridView.SelectedItem = theModule;
                        found = true;
                    }
                }

                if (!found)
                {
                    for (i = 0; i < count; i++)
                    {
                        theModule = moduleDataGridView.Items[i] as Module;

                        if (theModule.ModuleName.Equals(lastModule))
                        {
                            found = true;
                            moduleDataGridView.SelectedItem = theModule;
                            break;
                        }
                    }
                }

                if (!found)
                {
                    lastEntityRow = -1;
                    lastEntity    = null;
                    if (count > 0)
                    {
                        if (lastModuleRow < count)
                        {
                            theModule = moduleDataGridView.Items[lastModuleRow] as Module;
                            moduleDataGridView.SelectedItem = theModule;
                        }
                        else
                        {
                            theModule = moduleDataGridView.Items[count - 1] as Module;
                            moduleDataGridView.SelectedItem = theModule;
                        }
                    }
                }
            }

            if (lastEntityRow == -1)
            {
                if (entityDataGridView.Items.Count > 0)
                {
                    theEntity = entityDataGridView.Items[0] as FactInstance;
                    entityDataGridView.SelectedItem = theEntity;
                }
            }
            else
            {
                count = entityDataGridView.Items.Count;
                found = false;

                if (lastEntityRow < count)
                {
                    theEntity = entityDataGridView.Items[lastEntityRow] as FactInstance;

                    if (theEntity.Name.Equals(lastEntity))
                    {
                        entityDataGridView.SelectedItem = theEntity;
                        found = true;
                    }
                }

                if (!found)
                {
                    for (i = 0; i < count; i++)
                    {
                        theEntity = entityDataGridView.Items[i] as FactInstance;

                        if (theEntity.Name.Equals(lastEntity))
                        {
                            found = true;
                            entityDataGridView.SelectedItem = theEntity;
                            break;
                        }
                    }
                }

                if (!found)
                {
                    if (count > 0)
                    {
                        if (lastEntityRow < count)
                        {
                            theEntity = entityDataGridView.Items[lastEntityRow] as FactInstance;
                            entityDataGridView.SelectedItem = theEntity;
                        }
                        else
                        {
                            theEntity = entityDataGridView.Items[count - 1] as FactInstance;
                            entityDataGridView.SelectedItem = theEntity;
                        }
                    }
                }
            }

            if (entityDataGridView.SelectedItem != null)
            {
                theEntity = entityDataGridView.SelectedItem as FactInstance;

                CreateSlotListSource(theEntity);

                if (slotDataGridView.Items.Count != 0)
                {
                    SlotValue theSlotValue = slotDataGridView.Items[0] as SlotValue;
                    slotDataGridView.SelectedItem = theSlotValue;
                }
            }
            else
            {
                slotDataGridView.ItemsSource = null;
                slotSourceList   = null;
                entitySourceList = null;
                entityCollection = null;
                slotCollection   = null;
            }

            lastModuleRow = -1;
            lastModule    = null;
            lastEntity    = null;
            lastEntityRow = -1;
        }
Esempio n. 22
0
    public void SetSlotValue(Ped ped, SlotKey slot_key, SlotValue slot_value)
    {
        // store it
        if (slot_value.index1 == 0 && slot_value.index2 == 0 && slot_value.index3 == 0 && slot_value.index4 == 0)
        {
            data.Remove(slot_key);
        }
        else
        {
            data[slot_key] = slot_value;
        }
        // change game state accordingly
        switch (slot_key.typ)
        {
        case SlotType.CompVar:
            Function.Call(
                Hash.SET_PED_COMPONENT_VARIATION,
                ped.Handle,
                slot_key.id, slot_value.index1, slot_value.index2, 0);
            if (slot_key.id == 2)     // hair: use index3 and index4
            {
                Function.Call(Hash._SET_PED_HAIR_COLOR, ped.Handle, slot_value.index3, slot_value.index4);
            }
            break;

        case SlotType.Prop:
            if (slot_value.index1 == 0)
            {
                Function.Call(Hash.CLEAR_PED_PROP, ped.Handle, slot_key.id);
            }
            else
            {
                Function.Call(Hash.SET_PED_PROP_INDEX, ped.Handle, slot_key.id, slot_value.index1 - 1, slot_value.index2, true);
            }
            break;

        case SlotType.HeadOverlay:
            if (slot_value.index1 == 0)
            {
                Function.Call(Hash.SET_PED_HEAD_OVERLAY, ped.Handle, slot_key.id, 0, 0.0f);
            }
            else
            {
                // index2 is opacity
                Function.Call(Hash.SET_PED_HEAD_OVERLAY, ped.Handle, slot_key.id, slot_value.index1 - 1, (8 - slot_value.index2) / 8.0f);
                // takes color (index3) and highlight color (index4), but the latter is ignored
                // so use index3 for both colors just in case
                var color_type = mp_head_overlay_color_type[slot_key.id];
                switch (color_type)
                {
                case ColorType.Hair:
                    Function.Call(Hash._SET_PED_HEAD_OVERLAY_COLOR, ped.Handle, slot_key.id, 1, slot_value.index3, slot_value.index3);
                    break;

                case ColorType.Makeup:
                    Function.Call(Hash._SET_PED_HEAD_OVERLAY_COLOR, ped.Handle, slot_key.id, 2, slot_value.index3, slot_value.index3);
                    break;
                }
            }
            break;

        case SlotType.Eye:
            Function.Call(Hash._SET_PED_EYE_COLOR, ped.Handle, slot_value.index1);
            break;

        case SlotType.Parent:
            // get current parent info
            var   par      = GetSlotValue(new SlotKey(SlotType.Parent, 0));
            var   shape1   = par.index1;
            var   shape2   = par.index2;
            var   skin1    = par.index1;
            var   skin2    = par.index2;
            float shapemix = par.index3 / 8.0f;
            float skinmix  = par.index4 / 8.0f;
            Function.Call(
                Hash.SET_PED_HEAD_BLEND_DATA, ped.Handle,
                shape1, shape2, 0, skin1, skin2, 0, shapemix, skinmix, 0.0f);
            break;
        }
    }
Esempio n. 23
0
 public override SyntaxRule FillTypedSlot(SlotValue Value)
 => FillSlot(Value);