int setCurrentPlayerFriendship(int nVal)
    {
        if (nVal > byte.MaxValue)
        {
            nVal = byte.MaxValue;
        }
        var mem = loadedVillager.GetMemory(currentSelectedGSaveMemory);

        mem.Friendship = (byte)nVal;
        loadedVillager.SetMemory(mem, currentSelectedGSaveMemory);
        return(nVal);
    }
Beispiel #2
0
        private static VillagerData AdaptVillager(VillagerInfo exist, VillagerData replace, bool prepMoveOut = false)
        {
            var ov = exist.Villager;
            var oh = exist.House;
            var nv = new Villager2(replace.Villager);

            _ = new VillagerHouse1(replace.House)
            {
                NPC1 = oh.NPC1, NPC2 = oh.NPC2, BuildPlayer = oh.BuildPlayer
            };

            // Copy Memories
            var om = nv.GetMemory(0);
            var nm = ov.GetMemory(0);

            nm.PlayerId = om.PlayerId;
            nv.SetMemory(nm, 0);

            if (!prepMoveOut)
            {
                return(replace);
            }

            nv.MovingOut = true;
            return(replace);
        }
    public void VillagerToUI(Villager2 v)
    {
        currentSelectedGSaveMemory = 0;
        var mem = v.GetMemory(currentSelectedGSaveMemory);

        VillagerName.text           = GameInfo.Strings.GetVillager(v.InternalName);
        VillagerPhrase.text         = v.CatchPhrase;
        VillagerFriendship.text     = mem.Friendship.ToString();
        PlayerNameGSave.text        = mem.PlayerName;
        PlayerNameGSave.color       = Color.white;
        MainVillagerTexture.texture = SpriteBehaviour.PullTextureFromParser(villagerSprites, v.InternalName);
        MovingOutToggle.isOn        = v.MovingOut;
        ForceMoveOutToggle.isOn     = v.GetEventFlagsSave()[24] != 0;

        SaveVillagerLabel.text = string.Format("Save villager ({0})", VillagerName.text);

        DataButton.interactable = true;
    }