Exemplo n.º 1
0
            static void Postfix(NpcAppearDBData npcAppearDBData, NpcAppearData appearData, Actor actor)
            {
                if (!enabled)
                {
                    return;
                }

                for (int i = 0; i < clothesChangers.Count; i++)
                {
                    //Dbgl($"changing for {i} {clothesChangers[i].name}");
                    if (clothesChangers[i].id == actor.InstanceId)
                    {
                        Dbgl($"actor: {actor.ActorName}");
                        Dictionary <int, AppearDBData> appearDbDatas = AccessTools.FieldRefAccess <NpcAppearModule, Dictionary <int, AppearDBData> >(Module <NpcAppearModule> .Self, "m_AppearDBDataDic");
                        NpcAppear component = actor.GetComponent <NpcAppear>();
                        if (component == null)
                        {
                            Dbgl("actor does not have npcappear");
                            return;
                        }
                        Dbgl($"i {i} hair setting {settings.hairs[i]} actor hair: {hairs[settings.hairs[i]]}");
                        //if(settings.hairs[i] != 0)
                        component.SetPart(appearDbDatas[hairs[settings.hairs[i]]]);
                        Dbgl($"actor clothes: {clothes[settings.clothes[i]]}");
                        //if (settings.clothes[i] != 0)
                        component.SetPart(appearDbDatas[clothes[settings.clothes[i]]]);
                    }
                }
            }
Exemplo n.º 2
0
        private static void ChangeClothes(Actor actor, int hairId, int clothesId)
        {
            if (!enabled)
            {
                return;
            }

            Dictionary <int, AppearDBData> appearDbDatas = AccessTools.FieldRefAccess <NpcAppearModule, Dictionary <int, AppearDBData> >(NpcAppearModule.Self, "m_AppearDBDataDic");

            Dbgl($"changing clothes for {actor.ActorName}");


            NpcAppear component = actor.GetComponent <NpcAppear>();

            if (component == null || !appearDbDatas.ContainsKey(hairId) || !appearDbDatas.ContainsKey(clothesId))
            {
                Dbgl($"no npcappear for {actor.ActorName}");
                return;
            }
            if (hairId > -1)
            {
                component.SetPart(appearDbDatas[hairId]);
            }
            if (clothesId > -1)
            {
                component.SetPart(appearDbDatas[clothesId]);
            }
        }